| | |
| | | } |
| | | vo.setSpeed(steProtocol.getSpeed()); // 速度 |
| | | vo.setCloser(steProtocol.getCloser()); // 近点距离 |
| | | vo.setPakMk(steProtocol.getPakMk()); // 作业标记 |
| | | } |
| | | return R.ok().add(list); |
| | | } |
| | |
| | | vo.setLev(basSte.getLev()); |
| | | vo.setCrnNo(basSte.getCrnNo()); |
| | | vo.setWorkNo(basSte.getWrkNo()); |
| | | vo.setPakMk(basSte.getPakMk()); |
| | | } |
| | | break; |
| | | } |
| | |
| | | if (basSte == null) { |
| | | return R.error(); |
| | | } |
| | | |
| | | // 获取穿梭车信息 |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, vo.getSteNo()); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol != null) { |
| | | throw new CoolException(vo.getSteNo() + "号穿梭车不在线,无法保存"); |
| | | } |
| | | if (!Cools.isEmpty(vo.getRow(), vo.getBay(), vo.getLev())) { |
| | | if (!steThread.modifyPosHandle(vo.getRow(), vo.getBay(), vo.getLev())) { |
| | | throw new CoolException("服务器错误"); |
| | | } |
| | | } |
| | | basSte.setPakMk(vo.getPakMk()); |
| | | basSte.setWrkNo(vo.getWorkNo()); |
| | | basSte.setCrnNo(vo.getCrnNo()); |
| | | basSte.setUpdateTime(new Date()); |
| | |
| | | |
| | | private Integer crnNo; |
| | | |
| | | private String pakMk; |
| | | |
| | | } |
| | |
| | | // 近点距离 |
| | | public Double closer = 0.0D; |
| | | |
| | | // 作业标记 |
| | | private String pakMk = "-"; |
| | | |
| | | } |
| | |
| | | @Repository |
| | | public interface BasSteMapper extends BaseMapper<BasSte> { |
| | | |
| | | int updatePos(@Param("row")Integer row, @Param("bay")Integer bay, @Param("lev")Integer lev); |
| | | int updatePos(@Param("steNo")Integer steNo, @Param("row")Integer row, @Param("bay")Integer bay, @Param("lev")Integer lev); |
| | | |
| | | int updatePakMk(@Param("steNo")Integer steNo, @Param("pakMk")String pakMk); |
| | | |
| | | } |
| | |
| | | |
| | | BasSte findByCrnNo(Integer crnNo); |
| | | |
| | | int updatePos(Integer row, Integer bay, Integer lev); |
| | | Boolean updatePos(Integer steNo, Integer row, Integer bay, Integer lev); |
| | | |
| | | Boolean updatePakMk(Integer steNo, String pakMk); |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public int updatePos(Integer row, Integer bay, Integer lev) { |
| | | return this.baseMapper.updatePos(row, bay, lev); |
| | | public Boolean updatePos(Integer steNo, Integer row, Integer bay, Integer lev) { |
| | | return this.baseMapper.updatePos(steNo, row, bay, lev) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean updatePakMk(Integer steNo, String pakMk) { |
| | | return this.baseMapper.updatePakMk(steNo, pakMk) > 0; |
| | | } |
| | | |
| | | } |
| | |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { continue; } |
| | | if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) { |
| | | if (steProtocol.isIdle()) { |
| | | |
| | | // 已经存在吊车执行任务时,则过滤 |
| | | if (wrkMastMapper.selectWorking(slave.getId()) != null) { |
| | |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { continue; } |
| | | if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) { |
| | | if (steProtocol.isIdle()) { |
| | | |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | SteCommand steCommand = new SteCommand(); |
| | |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, ste.getId()); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { continue; } |
| | | if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) { |
| | | if (steProtocol.isIdle()) { |
| | | if (Utils.getGroupRow(locNo).equals(Utils.getGroupRow(steProtocol.getRow().intValue())) && steProtocol.getBay() == Utils.getBay(locNo) && steProtocol.getLev() == Utils.getLev(locNo)) { |
| | | return steProtocol.getSteNo().intValue(); |
| | | } |
| | |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, basSte.getSteNo()); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol != null) { |
| | | if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) { |
| | | if (steProtocol.isIdle()) { |
| | | return steThread; |
| | | } |
| | | } |
| | |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { return; } |
| | | if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) { |
| | | if (steProtocol.isIdle()) { |
| | | |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | SteCommand steCommand = new SteCommand(); |
| | |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { return; } |
| | | if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) { |
| | | if (steProtocol.isIdle()) { |
| | | // 堆垛机空闲 |
| | | if (crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() == 0) { |
| | | LocMast locMast; |
| | |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { return; } |
| | | // 穿梭车空闲 |
| | | if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) { |
| | | if (steProtocol.isIdle()) { |
| | | // 堆垛机空闲 |
| | | if (crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() == 0) { |
| | | |
| | |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { continue; } |
| | | if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) { |
| | | if (steProtocol.isIdle()) { |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | SteCommand steCommand = new SteCommand(); |
| | | steCommand.setSteNo(steNo); // 穿梭车编号 |
| | |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { continue; } |
| | | if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) { |
| | | if (steProtocol.isIdle()) { |
| | | // 穿梭车重新定位排列层 |
| | | if (!steThread.confirmPos()) { |
| | | log.error("{}号穿梭车重新定位失败!作业工作档任务号:{}", wrkMast.getSteNo(), wrkMast.getWrkNo()); |
| | |
| | | */ |
| | | private String lastIo = "I"; |
| | | |
| | | private String pakMk = "-"; |
| | | |
| | | public BasSte toSqlModel(BasSte basSte){ |
| | | if (alarm!=null) { |
| | |
| | | basSte.setWrkNo(taskNo); |
| | | return basSte; |
| | | } |
| | | |
| | | // 是否处于空闲待命状态 |
| | | public Boolean isIdle() { |
| | | return getStatusType().equals(SteStatusType.IDLE) && pakMk.equals("N"); |
| | | } |
| | | |
| | | } |
| | |
| | | private short heartBeatVal = 1; |
| | | private boolean resetFlag = false; |
| | | |
| | | private Integer lastRow; |
| | | private Integer lastBay; |
| | | private Integer lastLev; |
| | | |
| | | public SteThread(SteSlave slave) { |
| | | this.slave = slave; |
| | | } |
| | |
| | | // 根据实时信息更新数据库 |
| | | BasSteService service = SpringUtils.getBean(BasSteService.class); |
| | | if (null != service) { |
| | | // 同步pakMk |
| | | BasSte one = service.selectById(slave.getId()); |
| | | if (one != null) { |
| | | steProtocol.setPakMk(one.getPakMk()); |
| | | } |
| | | |
| | | BasSte basSte = new BasSte(); |
| | | basSte.setSteNo(slave.getId()); |
| | | if (!service.updateById(steProtocol.toSqlModel(basSte))){ |
| | |
| | | } |
| | | |
| | | public void modifyPos(Integer row, Integer bay, Integer lev) { |
| | | this.lastRow = row; |
| | | this.lastBay = bay; |
| | | this.lastLev = lev; |
| | | BasSteService service = SpringUtils.getBean(BasSteService.class); |
| | | if (!service.updatePos(this.slave.getId(), row, bay, lev)) { |
| | | log.error("更新{}号穿梭车定位失败 ===>> 排:【{}】, 列:【{}】,层:【{}】", this.slave.getId(), row, bay, lev); |
| | | } |
| | | } |
| | | |
| | | public boolean confirmPos() { |
| | | if (this.lastRow != null && this.lastRow != 0) { |
| | | if (this.lastBay != null && this.lastBay != 0) { |
| | | if (this.lastLev != null && this.lastLev != 0) { |
| | | BasSteService service = SpringUtils.getBean(BasSteService.class); |
| | | BasSte basSte = service.selectById(slave.getId()); |
| | | if (basSte != null) { |
| | | // 更新plc数据块 |
| | | short[] arr = new short[] {this.lastRow.shortValue(), this.lastBay.shortValue(), this.lastLev.shortValue()}; |
| | | OperateResult result = siemensS7Net.Write("V1002", arr); |
| | | if (result.IsSuccess) { |
| | | // 更新数据库 |
| | | if (service.updatePos(this.lastRow, this.lastBay, this.lastLev) > 0) { |
| | | this.lastRow = null; |
| | | this.lastBay = null; |
| | | this.lastLev = null; |
| | | return true; |
| | | } else { |
| | | log.error("{}号穿梭车修改数据库定位失败!!!", slave.getId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | BasSteService service = SpringUtils.getBean(BasSteService.class); |
| | | BasSte basSte = service.selectById(slave.getId()); |
| | | if (basSte != null) { |
| | | // 更新plc数据块 |
| | | short[] arr = new short[] {basSte.getRow().shortValue(), basSte.getBay().shortValue(), basSte.getLev().shortValue()}; |
| | | OperateResult result = siemensS7Net.Write("V1002", arr); |
| | | if (result.IsSuccess) { |
| | | // 更新数据库 |
| | | if (service.updatePakMk(this.slave.getId(), "N")) { |
| | | return true; |
| | | } else { |
| | | log.error("{}号穿梭车修改数据库定位失败!!!", slave.getId()); |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | public boolean modifyPosHandle(Integer row, Integer bay, Integer lev) { |
| | | short[] arr = new short[] {row.shortValue(), bay.shortValue(), lev.shortValue()}; |
| | | OperateResult result = siemensS7Net.Write("V1002", arr); |
| | | if (!result.IsSuccess) { |
| | | return false; |
| | | } |
| | | BasSteService service = SpringUtils.getBean(BasSteService.class); |
| | | if (!service.updatePos(this.slave.getId(), row, bay, lev)) { |
| | | log.error("更新{}号穿梭车定位失败 ===>> 排:【{}】, 列:【{}】,层:【{}】", this.slave.getId(), row, bay, lev); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public void close() { |
| | | siemensS7Net.ConnectClose(); |
| | |
| | | <update id="updatePos"> |
| | | update asr_bas_ste |
| | | set his_row = row, his_bay = bay,his_lev = lev, |
| | | row = #{row}, bay = #{bay}, lev = #{lev} |
| | | row = #{row}, bay = #{bay}, lev = #{lev}, |
| | | pak_mk = 'Y' |
| | | where 1=1 |
| | | and ste_no = #{steNo} |
| | | </update> |
| | | |
| | | <update id="updatePakMk"> |
| | | update asr_bas_ste |
| | | set pak_mk = #{pakMk} |
| | | where 1=1 |
| | | and ste_no = #{steNo} |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | </footer> |
| | | |
| | | <div id="site-detl" style="display: none"> |
| | | <form> |
| | | <div> |
| | | <div class="form-item"> |
| | | <label class="form-label">站号:</label> |
| | | <div class="form-input"> |
| | |
| | | <button class="form-button" id="save">保存</button> |
| | | <button class="form-button" id="cancel" style="background-color: #D0D0D0">取消</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | staNo: $('#staNo').val(), |
| | | pakMk: $('#pakMk').val() |
| | | }, function (res) { |
| | | layer.close(layerDetl); |
| | | layer.msg("修改成功",{icon: 1,}); |
| | | }) |
| | | }) |
| | |
| | | }) |
| | | |
| | | </script> |
| | | </html> |
| | | </html> |
| | |
| | | <th>目标库位</th> |
| | | <th>速度</th> |
| | | <th>近点距离</th> |
| | | <th>作业标记</th> |
| | | </tr> |
| | | </thead> |
| | | <tbody> |
| | |
| | | </div> |
| | | |
| | | <div id="ste-detl" style="display: none"> |
| | | <form> |
| | | <div> |
| | | <div class="form-item"> |
| | | <label class="form-label">穿梭车号:</label> |
| | | <div class="form-input"> |
| | |
| | | <div class="form-item"> |
| | | <label class="form-label">列:</label> |
| | | <div class="form-input"> |
| | | <input id="bay" name="bay" type="text" class="layui-input" autocomplete="off"> |
| | | <input id="bay" name="bay" type="number" class="layui-input" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="form-item"> |
| | | <label class="form-label">层:</label> |
| | | <div class="form-input"> |
| | | <input id="lev" name="lev" type="text" class="layui-input" autocomplete="off"> |
| | | <input id="lev" name="lev" type="number" class="layui-input" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="form-item"> |
| | | <label class="form-label">堆垛机:</label> |
| | | <div class="form-input"> |
| | | <input id="crnNo" name="crnNo" type="text" class="layui-input" autocomplete="off"> |
| | | <input id="crnNo" name="crnNo" type="number" class="layui-input" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="form-item"> |
| | | <label class="form-label">作业标记:</label> |
| | | <div class="form-input"> |
| | | <input id="pakMk" name="pakMk" type="text" class="layui-input" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="form-item form-button-container"> |
| | | <button class="form-button" id="save">保存</button> |
| | | <button class="form-button" id="cancel" style="background-color: #D0D0D0">取消</button> |
| | | </div> |
| | | </form> |
| | | </di> |
| | | </div> |
| | | </body> |
| | | </html> |
| | |
| | | } |
| | | } |
| | | |
| | | var layerIdx; |
| | | $(document).on('click ','.pos-btn', function () { |
| | | let steNo = Number($(this).parent().attr("data-steNo")); |
| | | layerDetl = layer.open({ |
| | | layerIdx = layer.open({ |
| | | type: 1, |
| | | title: false, |
| | | shadeClose: true, |
| | | offset: [$(this).offset().top + 30 + 'px', $(this).offset().left + 'px'], |
| | | anim: 5, |
| | | shade: [0], |
| | | area: ['310px', '340px'], |
| | | area: ['310px', '370px'], |
| | | closeBtn: 0, |
| | | content: $("#ste-detl"), |
| | | success: function(layero, index){ |
| | |
| | | $('#bay').val(res.data.bay); |
| | | $('#lev').val(res.data.lev); |
| | | $('#crnNo').val(res.data.crnNo); |
| | | $('#pakMk').val(res.data.pakMk); |
| | | }) |
| | | }, |
| | | end: function () { |
| | |
| | | $('#bay').val(""); |
| | | $('#lev').val(""); |
| | | $('#crnNo').val(""); |
| | | $('#pakMk').val(""); |
| | | } |
| | | }) |
| | | }) |
| | |
| | | bay: $('#bay').val(), |
| | | lev: $('#lev').val(), |
| | | crnNo: $('#crnNo').val(), |
| | | pakMk: $('#pakMk').val(), |
| | | }, function (res) { |
| | | layer.msg("修改成功",{icon: 1,}); |
| | | layer.msg("修改成功", {icon: 1,}); |
| | | layer.close(layerIdx); |
| | | }) |
| | | }) |
| | | |
| | | $(document).on('click ','#cancel', function () { |
| | | layer.close(layerIdx); |
| | | }) |
| | | |
| | | // 穿梭车信息表获取 ---- 表一 |
| | |
| | | setVal(tr.children("td").eq(6), table[i-1].locNo); |
| | | setVal(tr.children("td").eq(7), table[i-1].speed); |
| | | setVal(tr.children("td").eq(8), table[i-1].closer); |
| | | setVal(tr.children("td").eq(9), table[i-1].pakMk); |
| | | } |
| | | } else if (res.code === 403){ |
| | | window.location.href = baseUrl+"/login"; |