| | |
| | | List<DevopsMessage> devopsMessages = new ArrayList<>(); |
| | | DevopsMessage devopsMessage; |
| | | for (CrnSlave crnSlave : slaveProperties.getCrn()) { |
| | | List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("crn_no", crnSlave.getId()).in("io_type", 101, 103, 107).orderBy("wrk_sts", false)); |
| | | List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("crn_no", crnSlave.getId()).orderBy("wrk_sts", false)); |
| | | //先查询堆垛机是否在工作 |
| | | WrkMast working = wrkMastMapper.selectWorking(crnSlave.getId()); |
| | | for (WrkMast wrkMast : wrkMasts) { |
| | |
| | | } |
| | | continue; |
| | | } |
| | | List<ErrorType> staError = isStaError(wrkMast); |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | StaProtocol staProtocol = devpThread.getStation().get(wrkMast.getStaNo()); |
| | | List<ErrorType> staError = isStaError(staProtocol, wrkMast); |
| | | for (ErrorType type : staError) { |
| | | if (!Cools.isEmpty(devopsMessage.getError())) { |
| | | devopsMessage.setError(devopsMessage.getError() + ";" + type.getDesc()); |
| | |
| | | devopsMessage.setMethod(type.getMethod()); |
| | | } |
| | | } |
| | | List<ErrorType> crnError = isCrnError(wrkMast); |
| | | CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, wrkMast.getCrnNo()); |
| | | CrnProtocol crnProtocol = crnThread.getCrnProtocol(); |
| | | List<ErrorType> crnError = isCrnError(crnProtocol, wrkMast); |
| | | for (ErrorType type : crnError) { |
| | | if (!Cools.isEmpty(devopsMessage.getError())) { |
| | | devopsMessage.setError(devopsMessage.getError() + ";" + type.getDesc()); |
| | |
| | | return R.ok(devopsMessages); |
| | | } |
| | | |
| | | private List<ErrorType> isStaError(WrkMast staNo) { |
| | | private List<ErrorType> isStaError(StaProtocol staProtocol, WrkMast wrkMast) { |
| | | List<ErrorType> types = new ArrayList<>(); |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | StaProtocol staProtocol = devpThread.getStation().get(staNo); |
| | | if (staProtocol == null) { |
| | | types.add(ErrorType.ERROR); |
| | | return types; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | // 自动 |
| | | if (staProtocol.isAutoing()) { |
| | | types.add(ErrorType.FEIZIDONG); |
| | | } |
| | | if (staProtocol.isLoading()) { |
| | | types.add(ErrorType.YOUWU); |
| | | } |
| | | if (staProtocol.getWorkNo() == 0) { |
| | | types.add(ErrorType.GONGZUOHAO); |
| | | } |
| | | if (staProtocol.getStaNo() == null) { |
| | | types.add(ErrorType.STANO); |
| | | if (wrkMast.getIoType() > 100) { |
| | | // 出库校验 |
| | | // 有物 |
| | | if (staProtocol.isLoading()) { |
| | | types.add(ErrorType.YOUWU); |
| | | } // 工作号是否为0 |
| | | if (staProtocol.getWorkNo() == 0) { |
| | | types.add(ErrorType.GONGZUOHAO); |
| | | } |
| | | // 目标站点 |
| | | if (staProtocol.getStaNo() == null) { |
| | | types.add(ErrorType.STANO); |
| | | } |
| | | } else { |
| | | // 入库校验 |
| | | |
| | | } |
| | | return types; |
| | | } |
| | | |
| | | |
| | | private List<ErrorType> isCrnError(WrkMast wrkMast) { |
| | | private List<ErrorType> isCrnError(CrnProtocol crnProtocol, WrkMast wrkMast) { |
| | | List<ErrorType> types = new ArrayList<>(); |
| | | CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, wrkMast.getCrnNo()); |
| | | CrnProtocol crnProtocol = crnThread.getCrnProtocol(); |
| | | |
| | | // 堆垛机是否空闲 |
| | | if (crnProtocol.getStatusType() == CrnStatusType.IDLE) { |
| | | types.add(ErrorType.CRN_NO_IDLE); |
| | | } |
| | | //任务号是否为0 |
| | | if (crnProtocol.getTaskNo() == 0) { |
| | | types.add(ErrorType.WORKING); |
| | | } |
| | | // 堆垛机是否自动 |
| | | if (crnProtocol.getModeType() == CrnModeType.AUTO) { |
| | | types.add(ErrorType.CRN_FEIZIDONG); |
| | | } |
| | | // 载货台有物 |
| | | if (crnProtocol.getLoaded() == 0) { |
| | | types.add(ErrorType.LOAD); |
| | | } |
| | | // 堆垛机取货中 |
| | | if (crnProtocol.statusType == CrnStatusType.FETCHING) { |
| | | types.add(ErrorType.WORKING); |
| | | } |
| | | // 放货中 |
| | | if (crnProtocol.statusType == CrnStatusType.PUTTING) { |
| | | types.add(ErrorType.WORKING); |
| | | } |
| | | // 堆垛机等待确认状态 |
| | | if (crnProtocol.statusType == CrnStatusType.WAITING) { |
| | | types.add(ErrorType.WORKING); |
| | | } |
| | | // 货叉是否会回中 |
| | | if (crnProtocol.forkPosType == CrnForkPosType.HOME) { |
| | | types.add(ErrorType.HOME); |
| | | } |
| | | if (crnProtocol.modeType == CrnModeType.AUTO) { |
| | | types.add(ErrorType.FEIZIDONG); |
| | | } |
| | | |
| | | return types; |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/site/list") |
| | | @ManagerAuth(memo = "站点信息表") |
| | | public R siteTable(){ |
| | | public R siteTable() { |
| | | List<SiteTableVo> list = new ArrayList<>(); |
| | | // 内存数据 |
| | | Map<Integer, StaProtocol> station = new HashMap<>(); |
| | |
| | | List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<BasDevp>().orderBy("dev_no")); |
| | | for (BasDevp devp : basDevps) { |
| | | StaProtocol staProtocol = station.get(devp.getDevNo()); |
| | | if (null == staProtocol) { continue; } |
| | | if (null == staProtocol) { |
| | | continue; |
| | | } |
| | | SiteTableVo vo = new SiteTableVo(); |
| | | vo.setDevNo(devp.getDevNo()); // 站点编号 |
| | | vo.setWorkNo(staProtocol.getWorkNo()); // 工作号 |
| | | vo.setAutoing(staProtocol.isAutoing()?"Y":"N"); // 自动 |
| | | vo.setLoading(staProtocol.isLoading()?"Y":"N"); // 有物 |
| | | vo.setInEnable(staProtocol.isInEnable()?"Y":"N"); // 可入 |
| | | vo.setOutEnable(staProtocol.isOutEnable()?"Y":"N"); // 可出 |
| | | vo.setAutoing(staProtocol.isAutoing() ? "Y" : "N"); // 自动 |
| | | vo.setLoading(staProtocol.isLoading() ? "Y" : "N"); // 有物 |
| | | vo.setInEnable(staProtocol.isInEnable() ? "Y" : "N"); // 可入 |
| | | vo.setOutEnable(staProtocol.isOutEnable() ? "Y" : "N"); // 可出 |
| | | vo.setPakMk(staProtocol.isPakMk()?"Y":"N"); // 入库标记 |
| | | vo.setStaNo(staProtocol.getStaNo()); // 目标站 |
| | | vo.setEmptyMk(staProtocol.isEmptyMk()?"Y":"N"); // 空板信号 |
| | | list.add(vo); |
| | | } |
| | | return R.ok().add(list); |
| | |
| | | */ |
| | | public enum ErrorType { |
| | | ERROR(10000, "站点对象为空","联系技术人员"), |
| | | WUWU(10001, "无物", "1"), |
| | | YOUWU(10002, "有物", "1"), |
| | | STANO(10003, "目标站点存在站点号", "1"), |
| | | FEIZIDONG(10004, "目标站点非自动", "1"), |
| | | GONGZUOHAO(10005, "目标站点存在工作号", "1"), |
| | | WUWU(10001, "站点无物", "请检查托盘是否走到位"), |
| | | YOUWU(10002, "站点有物", "请检查光电是否落灰"), |
| | | STANO(10003, "目标站点存在站点号", "缺少目标站点"), |
| | | FEIZIDONG(10004, "目标站点非自动", "站点非自动状态,请切换"), |
| | | GONGZUOHAO(10005, "目标站点存在工作号", "目标站点存在工作号,请检查"), |
| | | |
| | | |
| | | WORKING(11001, "堆垛机在工作中", "1"), |
| | | HOME(11002, "货叉不在原位", "1"), |
| | | CRNGONGZUOHAO(11003, "堆垛机在工作中", "1"), |
| | | LOAD(11004, "堆垛机的载物台有物", "1"), |
| | | CRN_FEIZIDONG(11004, "堆垛机非自动", "1"), |
| | | CRN_NO_IDLE(11004, "堆垛机非空闲", "1"), |
| | | WORKING(11001, "堆垛机工作中", "堆垛机工作中"), |
| | | HOME(11002, "货叉不在原位", "请将货叉回中"), |
| | | CRNGONGZUOHAO(11003, "堆垛机存在工作号", "堆垛机存在工作号,请检查该任务是否已经完成"), |
| | | LOAD(11004, "堆垛机的载物台有物", "堆垛机的载物台有物,请检查光电"), |
| | | CRN_FEIZIDONG(11004, "堆垛机非自动", "请将堆垛机切自动"), |
| | | CRN_NO_IDLE(11004, "堆垛机非空闲", "请将堆垛机切自动"), |
| | | |
| | | |
| | | ; |
| | |
| | | <th>可入</th> |
| | | <th>可出</th> |
| | | <th>入库标记</th> |
| | | <th>空板信号</th> |
| | | <th>目标站</th> |
| | | <th>信息</th> |
| | | <th>高低库位</th> |
| | | </tr> |
| | | </thead> |
| | |
| | | var siteTableFullRows = 0; |
| | | var outputDom = document.getElementById("output"); |
| | | $(document).ready(function () { |
| | | getIoModeInfo(); |
| | | initPlcErrorTable(); |
| | | getPlcError(); |
| | | initSiteTable(); |
| | |
| | | setInterval(function () { |
| | | getPlcError(); |
| | | starGetSite(); |
| | | getIoModeInfo(); |
| | | }, 1000); |
| | | setInterval(function () { |
| | | getSiteOutput(); |
| | |
| | | } |
| | | } |
| | | |
| | | var ioModeData; |
| | | |
| | | function getIoModeInfo() { |
| | | $.ajax({ |
| | | url: baseUrl + "/site/io/mode/info/site", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'GET', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | ioModeData = res.data; |
| | | ioModeData.forEach(function (e) { |
| | | $("#io-mode-" + e.floor).html(e.modeDesc); |
| | | }) |
| | | } else if (res.code === 403) { |
| | | window.location.href = baseUrl + "/login"; |
| | | } else { |
| | | console.log(res.msg); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 强制切换入出库模式 |
| | | */ |
| | | function ioModeSwitch(el) { |
| | | var floor = el.split("-")[2]; |
| | | if (ioModeData != null && ioModeData.length > 1) { |
| | | ioModeData.forEach(function (e) { |
| | | if (e.floor === Number(floor)) { |
| | | if (e.modeVal === 3 || e.modeVal === 4) { |
| | | layer.confirm('确定切换为入库模式吗?', function () { |
| | | $.ajax({ |
| | | url: baseUrl + "/site/io/mode/action/site", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {floor: e.floor}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | layer.msg("暂时不能切换!", {icon: 1}) |
| | | } else if (res.code === 403) { |
| | | window.location.href = baseUrl + "/login"; |
| | | } else { |
| | | console.log(res.msg); |
| | | } |
| | | } |
| | | }); |
| | | layer.closeAll(); |
| | | }) |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | // plc异常信息表获取 |
| | | function getPlcError() { |
| | | var tableEl = $('#plc-error-table'); |
| | | tableEl.children("tr").children("td").html(""); |
| | | $.ajax({ |
| | | url: baseUrl + "/site/table/plc/errors", |
| | | url: baseUrl + "/devops/wrkMast/list", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | |
| | | function getSite() { |
| | | var tableEl = $('#site-table'); |
| | | $.ajax({ |
| | | url: baseUrl + "/site/table/site", |
| | | url: baseUrl + "/devops/site/list", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | |
| | | setVal(tr.children("td").eq(4), table[i - 1].inEnable); |
| | | setVal(tr.children("td").eq(5), table[i - 1].outEnable); |
| | | setVal(tr.children("td").eq(6), table[i - 1].pakMk); |
| | | setVal(tr.children("td").eq(7), table[i - 1].emptyMk); |
| | | setVal(tr.children("td").eq(8), table[i - 1].staNo); |
| | | setVal(tr.children("td").eq(7), table[i - 1].staNo); |
| | | setVal(tr.children("td").eq(8), table[i - 1].emptyMk); |
| | | setVal(tr.children("td").eq(9), table[i - 1].locType1); |
| | | } |
| | | } else if (res.code === 403) { |
| | |
| | | }); |
| | | |
| | | $(document).on('click ', '#save', function () { |
| | | http.post(baseUrl + "/site//detl/update", { |
| | | http.post(baseUrl + "/site/detl/update", { |
| | | siteId: $('#siteId').val(), |
| | | workNo: $('#workNo').val(), |
| | | staNo: $('#staNo').val(), |
| | |
| | | <li><a id="console" onclick="nav(this.id)" class="nav-select" href="#">主控图</a></li> |
| | | <li><a id="pipeline" onclick="nav(this.id)" class="nav-unselect" href="#">输送设备</a></li> |
| | | <li><a id="crn" onclick="nav(this.id)" class="nav-unselect" href="#">堆垛机</a></li> |
| | | <li><a id="devops" onclick="nav(this.id)" class="nav-unselect" href="#">运维平台</a></li> |
| | | <li><a id="devops" onclick="nav(this.id)" class="nav-unselect" href="#">监控</a></li> |
| | | </ul> |
| | | </div> |
| | | </div> |