| | |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-webflux</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-actuator</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | vo.setOutEnable(stationProtocol.isOutEnable()); // æ¯å¦å¯åº |
| | | vo.setEmptyMk(stationProtocol.isEmptyMk()); // æ¯å¦ç©ºæ¿ |
| | | vo.setFullPlt(stationProtocol.isFullPlt()); // æ¯å¦æ»¡æ¿ |
| | | vo.setRunBlock(stationProtocol.isRunBlock());// è¿è¡å µå¡ |
| | | vo.setPalletHeight(stationProtocol.getPalletHeight()); // æçé«åº¦ |
| | | vo.setError(stationProtocol.getError()); // é误ç |
| | | vo.setBarcode(stationProtocol.getBarcode()); // æ¡ç |
| | | String stationStatus = StationStatusType.process(stationProtocol).toString().toLowerCase().replaceAll("_", "-"); |
| | | if (stationProtocol.isAutoing() && stationProtocol.isLoading() && stationProtocol.getTaskNo() > 0) { |
| | | if (stationProtocol.isAutoing() && stationProtocol.isLoading() && stationProtocol.getTaskNo() > 0 && !stationProtocol.isRunBlock()) { |
| | | String taskClass = getStationTaskClass(stationProtocol.getTaskNo(), inTaskRange, outTaskRange); |
| | | if (taskClass != null) { |
| | | stationStatus = taskClass; |
| | |
| | | SITE_AUTO_ID, |
| | | // æ
é |
| | | SITE_ERROR, |
| | | // è¿è¡é»å¡ |
| | | SITE_RUN_BLOCK, |
| | | ; |
| | | |
| | | public static StationStatusType process(StationProtocol stationProtocol){ |
| | | if (stationProtocol == null) { |
| | | return null; |
| | | } |
| | | if(stationProtocol.isAutoing() && stationProtocol.isLoading() && stationProtocol.getTaskNo() > 0 && stationProtocol.isRunBlock()){ |
| | | return SITE_RUN_BLOCK; |
| | | } |
| | | if (stationProtocol.isAutoing() && stationProtocol.isLoading() && stationProtocol.getTaskNo() > 0) { |
| | | return SITE_AUTO_RUN_ID; |
| | | } |
| | |
| | | // 满æç |
| | | private boolean fullPlt; |
| | | |
| | | // è¿è¡é»å¡ |
| | | private boolean runBlock; |
| | | |
| | | // æçé«åº¦ |
| | | private Integer palletHeight; |
| | | |
| | |
| | | @TableField("out_station_list") |
| | | private String outStationList; |
| | | |
| | | /** |
| | | * è¿è¡å µå¡éæ°åé
åºä½ç«ç¹æ°æ® |
| | | */ |
| | | @ApiModelProperty(value= "è¿è¡å µå¡éæ°åé
åºä½ç«ç¹æ°æ®") |
| | | @TableField("run_block_reassign_loc_station_list") |
| | | private String runBlockReassignLocStationList; |
| | | |
| | | /** |
| | | * é¡¶åç§»æ ½ç«ç¹æ°æ® |
| | | */ |
| | | @ApiModelProperty(value= "é¡¶åç§»æ ½ç«ç¹æ°æ®") |
| | | @TableField("lift_transfer_station_list") |
| | | private String liftTransferStationList; |
| | | |
| | | public BasDevp() {} |
| | | |
| | | public BasDevp(Integer devpNo,Integer status,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo,String stationList,String barcodeStationList,String inStationList,String outStationList) { |
| | |
| | | return list; |
| | | } |
| | | |
| | | public List<StationObjModel> getRunBlockReassignLocStationList$(){ |
| | | List<StationObjModel> list = new ArrayList<>(); |
| | | if (Cools.isEmpty(this.runBlockReassignLocStationList)){ |
| | | return list; |
| | | } |
| | | |
| | | List<StationObjModel> jsonList = JSON.parseArray(this.runBlockReassignLocStationList, StationObjModel.class); |
| | | for (StationObjModel json : jsonList){ |
| | | list.add(json); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | LocMast queryByLoc(String locNo); |
| | | |
| | | LocMast queryByQrCode(String qrCodeValue); |
| | | |
| | | List<LocMast> selectLocByLev(Integer lev); |
| | | |
| | | List<LocMast> selectEmptyLocNos(@Param("locNos") List<String> locNos); |
| | | |
| | | List<LocMast> selectNotEmptyLocNos(@Param("locNos") List<String> locNos); |
| | | |
| | | //æ¥è¯¢æææ¥¼å± |
| | | List<Integer> getLevList(); |
| | |
| | | |
| | | LocMast queryByLoc(String locNo); |
| | | |
| | | LocMast queryByQrCode(String qrCodeValue); |
| | | |
| | | //æ¥è¯¢æå®æ¥¼å±çåºä½æ°æ® |
| | | List<LocMast> selectLocByLev(Integer lev); |
| | | |
| | | List<LocMast> selectEmptyLocNos(List<String> locNos); |
| | | |
| | | List<LocMast> selectNotEmptyLocNos(List<String> locNos); |
| | | |
| | | //æ¥è¯¢æææ¥¼å± |
| | | List<Integer> getLevList(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public LocMast queryByQrCode(String qrCodeValue) { |
| | | return this.baseMapper.queryByQrCode(qrCodeValue); |
| | | } |
| | | |
| | | @Override |
| | | public List<LocMast> selectLocByLev(Integer lev) { |
| | | return this.baseMapper.selectLocByLev(lev); |
| | | } |
| | | |
| | | @Override |
| | | public List<LocMast> selectEmptyLocNos(List<String> locNos) { |
| | | return this.baseMapper.selectEmptyLocNos(locNos); |
| | | } |
| | | |
| | | @Override |
| | | public List<LocMast> selectNotEmptyLocNos(List<String> locNos) { |
| | | if (locNos.isEmpty()) { |
| | | return new ArrayList<LocMast>(); |
| | | } |
| | | return this.baseMapper.selectNotEmptyLocNos(locNos); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | //è·åå
¥åºä»»å¡å¯ç¨æ |
| | | public static List<Integer> getInTaskEnableRow() { |
| | | return getInTaskEnableRow(new ArrayList<>()); |
| | | } |
| | | |
| | | //è·åå
¥åºä»»å¡å¯ç¨æ |
| | | public static List<Integer> getInTaskEnableRow(List<Integer> excludeCrnList) { |
| | | List<Integer> list = new ArrayList<>(); |
| | | try { |
| | | RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); |
| | |
| | | News.info("å åæº:{} 已达æå¤§å
¥åºä»»å¡æ°ï¼å½å任塿°:{}", basCrnp.getCrnNo(), inWrkMasts.size()); |
| | | continue; |
| | | } |
| | | if (excludeCrnList.contains(basCrnp.getCrnNo())) { |
| | | continue; |
| | | } |
| | | enabledCrnps.add(basCrnp); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | Request request = headerBuilder.url(url).build(); |
| | | Response response = getClient(timeout, timeUnit).newCall(request).execute(); |
| | | OkHttpClient client = getClient(timeout, timeUnit); |
| | | Response response = client.newCall(request).execute(); |
| | | String result = response.isSuccessful() ? response.body().string() : null; |
| | | response.close(); |
| | | try { client.dispatcher().executorService().shutdown(); } catch (Exception ignore) {} |
| | | try { client.connectionPool().evictAll(); } catch (Exception ignore) {} |
| | | return result; |
| | | } |
| | | |
| | |
| | | request = builder.post(body).build(); |
| | | |
| | | } |
| | | Call call = getClient(timeout, timeUnit).newCall(request); |
| | | OkHttpClient client = getClient(timeout, timeUnit); |
| | | Call call = client.newCall(request); |
| | | Response response = call.execute(); |
| | | String result = response.body().string(); |
| | | response.close(); |
| | | try { client.dispatcher().executorService().shutdown(); } catch (Exception ignore) {} |
| | | try { client.connectionPool().evictAll(); } catch (Exception ignore) {} |
| | | return result; |
| | | } |
| | | |
| | |
| | | CRN_IO_EXECUTE_FINISH_LIMIT("crn_io_execute_finish_limit_"), |
| | | STATION_IN_EXECUTE_LIMIT("station_in_execute_limit_"), |
| | | STATION_OUT_EXECUTE_LIMIT("station_out_execute_limit_"), |
| | | CHECK_STATION_RUN_BLOCK_LIMIT_("check_station_run_block_limit_"), |
| | | |
| | | CURRENT_CIRCLE_TASK_CRN_NO("current_circle_task_crn_no_"), |
| | | AI_CHAT_HISTORY("ai_chat_history_"), |
| | |
| | | // 满æç |
| | | private boolean fullPlt; |
| | | |
| | | // è¿è¡é»å¡ |
| | | private boolean runBlock; |
| | | |
| | | // æçé«åº¦ |
| | | private Integer palletHeight; |
| | | |
| | |
| | | //æ¡ç |
| | | private String barcode; |
| | | |
| | | //è¿è¡å µå¡ |
| | | private boolean runBlock = false; |
| | | |
| | | @Override |
| | | public ZyStationStatusEntity clone() { |
| | | try { |
| | |
| | | |
| | | @Override |
| | | public boolean disconnect() { |
| | | try { executor.shutdownNow(); } catch (Exception ignore) {} |
| | | return true; |
| | | } |
| | | |
| | |
| | | moveZ(this.crnStatus.getLevel(), sourcePosZ); |
| | | this.crnStatus.setStatus(CrnStatusType.FETCHING.id); |
| | | sleep(2000); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | | |
| | | this.crnStatus.setLoaded(1); |
| | | this.crnStatus.setStatus(CrnStatusType.PUT_MOVING.id); |
| | |
| | | moveZ(this.crnStatus.getLevel(), destinationPosZ); |
| | | this.crnStatus.setStatus(CrnStatusType.PUTTING.id); |
| | | sleep(2000); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | | this.crnStatus.setLoaded(0); |
| | | this.crnStatus.setStatus(CrnStatusType.WAITING.id); |
| | | } |
| | |
| | | initSourcePosZ++; |
| | | this.crnStatus.setLevel(initSourcePosZ); |
| | | sleep(1000); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | | } |
| | | }else { |
| | | int moveLength = sourcePosZ - destinationPosZ; |
| | |
| | | initSourcePosZ--; |
| | | this.crnStatus.setLevel(initSourcePosZ); |
| | | sleep(1000); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | initSourcePosY++; |
| | | this.crnStatus.setBay(initSourcePosY); |
| | | sleep(1000); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | | } |
| | | }else { |
| | | int moveLength = sourcePosY - destinationPosY; |
| | |
| | | initSourcePosY--; |
| | | this.crnStatus.setBay(initSourcePosY); |
| | | sleep(1000); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | try { |
| | | Thread.sleep(ms); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | Thread.currentThread().interrupt(); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | @Override |
| | | public boolean disconnect() { |
| | | try { executor.shutdownNow(); } catch (Exception ignore) {} |
| | | return true; |
| | | } |
| | | |
| | |
| | | |
| | | status.setRgvPos(currentTrackSiteNo); |
| | | sleep(1000); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | | } |
| | | |
| | | status.setStatus(RgvStatusType.PUTTING.id); |
| | | status.setLoaded(1); |
| | | sleep(1000); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | | |
| | | for (int i = 0; i < targetNavigateNodes.size(); i++) { |
| | | NavigateNode navigateNode = targetNavigateNodes.get(i); |
| | |
| | | |
| | | status.setRgvPos(currentTrackSiteNo); |
| | | sleep(1000); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | | } |
| | | |
| | | sleep(1000); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | | status.setStatus(RgvStatusType.WAITING.id); |
| | | } |
| | | |
| | |
| | | |
| | | status.setRgvPos(currentTrackSiteNo); |
| | | sleep(1000); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return; |
| | | } |
| | | } |
| | | status.setStatus(RgvStatusType.WAITING.id); |
| | | } |
| | |
| | | try { |
| | | Thread.sleep(ms); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | Thread.currentThread().interrupt(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.zy.core.network.api.ZyStationConnectApi; |
| | | import com.zy.core.network.entity.ZyStationStatusEntity; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | import java.util.concurrent.CopyOnWriteArrayList; |
| | |
| | | status.setOutEnable(true);// 模æå¯åº |
| | | status.setEmptyMk(false);// 模æç©ºæ¿ä¿¡å· |
| | | status.setFullPlt(false);// æ¨¡ææ»¡æç |
| | | status.setRunBlock(false);// è¿è¡æ å µå¡ |
| | | status.setPalletHeight(0);// 模ææçé«åº¦ä¸º0 |
| | | status.setError(0);// æ¨¡ææ æ¥è¦ |
| | | status.setBarcode("");// æ¨¡ææ æ¡ç |
| | |
| | | return; |
| | | } |
| | | |
| | | stationMove(navigateNodes, taskNo, stationId, true, generateBarcode); |
| | | stationMove(targetNavigateNodes, taskNo, targetStationId, false, generateBarcode); |
| | | boolean result = stationMove(navigateNodes, taskNo, stationId, true, generateBarcode); |
| | | if(result) { |
| | | stationMove(targetNavigateNodes, taskNo, targetStationId, false, generateBarcode); |
| | | } |
| | | } |
| | | |
| | | private void stationMove(List<NavigateNode> navigateNodes, Integer taskNo, Integer targetStationId, boolean clearData, boolean generateBarcode) { |
| | | private boolean stationMove(List<NavigateNode> navigateNodes, Integer taskNo, Integer targetStationId, boolean clearData, boolean generateBarcode) { |
| | | Integer lastStationId = null; |
| | | |
| | | long executeTime = System.currentTimeMillis(); |
| | | int i = 0; |
| | | while (i < navigateNodes.size()) { |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return false; |
| | | } |
| | | NavigateNode navigateNode = navigateNodes.get(i); |
| | | JSONObject valueObject = JSON.parseObject(navigateNode.getNodeValue()); |
| | | Integer currentStationId = valueObject.getInteger("stationId"); |
| | |
| | | |
| | | } |
| | | |
| | | if (nextStationId != null) { |
| | | if (!checkTaskNoInArea(taskNo)) { |
| | | boolean fakeAllowCheckBlock = true; |
| | | Object systemConfigMapObj = redisUtil.get(RedisKeyType.SYSTEM_CONFIG_MAP.key); |
| | | if (systemConfigMapObj != null) { |
| | | HashMap<String, String> systemConfigMap = (HashMap<String, String>) systemConfigMapObj; |
| | | if (!systemConfigMap.get("fakeAllowCheckBlock").equals("Y")) { |
| | | fakeAllowCheckBlock = false; |
| | | } |
| | | } |
| | | |
| | | if (fakeAllowCheckBlock && System.currentTimeMillis() - executeTime > 1000 * 10) { |
| | | //认å®å µå¡ |
| | | boolean result = runBlockStation(taskNo, currentStationId, taskNo, currentStationId); |
| | | if(!result) { |
| | | continue; |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | if (i == 0) { |
| | |
| | | continue; |
| | | } |
| | | sleep(1000); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | if(nextStationId != null) { |
| | |
| | | } |
| | | |
| | | i++; |
| | | executeTime = System.currentTimeMillis(); |
| | | sleep(1000); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | if (generateBarcode) { |
| | | if (lastStationId != null) { |
| | | while (true) { |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | break; |
| | | } |
| | | boolean result = generateStationBarcode(taskNo, targetStationId); |
| | | sleep(1000); |
| | | if (!result) { |
| | |
| | | |
| | | if (clearData) { |
| | | sleep(10000); |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | return true; |
| | | } |
| | | if (lastStationId != null) { |
| | | while (true) { |
| | | if (Thread.currentThread().isInterrupted()) { |
| | | break; |
| | | } |
| | | boolean result = clearStation(taskNo, targetStationId); |
| | | sleep(1000); |
| | | if (!result) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | private void sleep(long ms) { |
| | | try { |
| | | Thread.sleep(ms); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | Thread.currentThread().interrupt(); |
| | | } |
| | | } |
| | | |
| | |
| | | return true; |
| | | } |
| | | |
| | | public synchronized boolean updateStationData(Integer lockTaskNo, Integer stationId, Integer taskNo, Integer targetStaNo, Boolean isLoading, String barcode) { |
| | | public synchronized boolean updateStationData(Integer lockTaskNo, Integer stationId, Integer taskNo, Integer targetStaNo, Boolean isLoading, String barcode, Boolean runBlock) { |
| | | if (LOCK_STATION != lockTaskNo) { |
| | | return false; |
| | | } |
| | |
| | | if (barcode != null) { |
| | | currentStatus.setBarcode(barcode); |
| | | } |
| | | |
| | | if(runBlock != null) { |
| | | currentStatus.setRunBlock(runBlock); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | if(currentStatus.getTaskNo().equals(taskNo)) { |
| | | return true; |
| | | if (currentStatus.getTaskNo() > 0) { |
| | | if (!currentStatus.getTaskNo().equals(taskNo) && currentStatus.isLoading()) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | if (currentStatus.getTaskNo() > 0 || currentStatus.isLoading()) { |
| | | return false; |
| | | } |
| | | |
| | | boolean result = updateStationData(taskNo, currentStationId, taskNo, targetStationId, isLoading, barcode); |
| | | boolean result = updateStationData(taskNo, currentStationId, taskNo, targetStationId, isLoading, barcode, false); |
| | | if (!result) { |
| | | return false; |
| | | } |
| | |
| | | return false; |
| | | } |
| | | |
| | | boolean result = updateStationData(lockTaskNo, nextStationId, taskNo, targetStaNo, true, null); |
| | | boolean result = updateStationData(lockTaskNo, nextStationId, taskNo, targetStaNo, true, null, false); |
| | | if (!result) { |
| | | return false; |
| | | } |
| | | |
| | | boolean result2 = updateStationData(lockTaskNo, currentStationId, 0, 0, false, null); |
| | | boolean result2 = updateStationData(lockTaskNo, currentStationId, 0, 0, false, "", false); |
| | | if (!result2) { |
| | | return false; |
| | | } |
| | |
| | | String barcodeTime = String.valueOf(System.currentTimeMillis()); |
| | | String barcode = barcodeTime.substring(5); |
| | | |
| | | boolean result = updateStationData(lockTaskNo, currentStationId, null, null, null, barcode); |
| | | boolean result = updateStationData(lockTaskNo, currentStationId, null, null, null, barcode, null); |
| | | if (!result) { |
| | | return false; |
| | | } |
| | |
| | | return false; |
| | | } |
| | | |
| | | boolean result = updateStationData(lockTaskNo, currentStationId, 0, 0, false, ""); |
| | | boolean result = updateStationData(lockTaskNo, currentStationId, 0, 0, false, "", false); |
| | | if (!result) { |
| | | return false; |
| | | } |
| | | return true; |
| | | }); |
| | | |
| | | return executeResult; |
| | | } |
| | | |
| | | public synchronized boolean runBlockStation(Integer lockTaskNo, Integer currentStationId, Integer taskNo, Integer blockStationId) { |
| | | boolean executeResult = lockExecute(lockTaskNo, () -> { |
| | | ZyStationStatusEntity currentStatus = statusList.stream() |
| | | .filter(item -> item.getStationId().equals(currentStationId)).findFirst().orElse(null); |
| | | |
| | | if (currentStatus == null) { |
| | | return false; |
| | | } |
| | | |
| | | boolean result = updateStationData(lockTaskNo, currentStationId, taskNo, blockStationId, true, "", true); |
| | | if (!result) { |
| | | return false; |
| | | } |
| | |
| | | stationOperateProcessUtils.stationOutExecute(); |
| | | //æ£æµè¾éç«ç¹åºåºä»»å¡æ§è¡å®æ |
| | | stationOperateProcessUtils.stationOutExecuteFinish(); |
| | | //æ£æµè¾éç«ç¹æ¯å¦è¿è¡å µå¡ |
| | | stationOperateProcessUtils.checkStationRunBlock(); |
| | | } |
| | | |
| | | //æ£æµå
¥åºç«æ¯å¦æä»»å¡çæï¼å¹¶ä»¿ççææ¨¡æå
¥åºç«ç¹æ°æ® |
| | |
| | | stationProtocol.setPalletHeight(statusEntity.getPalletHeight()); |
| | | stationProtocol.setError(statusEntity.getError()); |
| | | stationProtocol.setBarcode(statusEntity.getBarcode()); |
| | | stationProtocol.setRunBlock(statusEntity.isRunBlock()); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.BasCrnp; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.BasCrnpService; |
| | | import com.zy.asrs.service.BasDevpService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.domain.param.CreateInTaskParam; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.core.News; |
| | | import com.zy.core.cache.MessageQueue; |
| | |
| | | import com.zy.core.model.command.StationCommand; |
| | | import com.zy.core.model.protocol.StationProtocol; |
| | | import com.zy.core.thread.StationThread; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.service.ConfigService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | @Component |
| | | public class StationOperateProcessUtils { |
| | |
| | | private BasCrnpService basCrnpService; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | @Autowired |
| | | private ConfigService configService; |
| | | @Autowired |
| | | private HttpRequestLogService httpRequestLogService; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | |
| | | //æ§è¡è¾éç«ç¹å
¥åºä»»å¡ |
| | | public synchronized void stationInExecute() { |
| | |
| | | } |
| | | } |
| | | |
| | | //æ£æµè¾éç«ç¹æ¯å¦è¿è¡å µå¡ |
| | | public synchronized void checkStationRunBlock() { |
| | | String wmsUrl = null; |
| | | Config wmsSystemUriConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "wmsSystemUri")); |
| | | if (wmsSystemUriConfig != null) { |
| | | wmsUrl = wmsSystemUriConfig.getValue(); |
| | | } |
| | | |
| | | if(wmsUrl == null){ |
| | | News.error("æªé
ç½®WMSç³»ç»URIï¼é
ç½®æä»¶Codeç¼ç ï¼wmsSystemUri"); |
| | | return; |
| | | } |
| | | |
| | | String wmsSystemReassignInTaskUrl = null; |
| | | Config wmsSystemReassignInTaskUrlConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "wmsSystemReassignInTaskUrl")); |
| | | if (wmsSystemReassignInTaskUrlConfig != null) { |
| | | wmsSystemReassignInTaskUrl = wmsSystemReassignInTaskUrlConfig.getValue(); |
| | | } |
| | | |
| | | if(wmsSystemReassignInTaskUrl == null){ |
| | | News.error("æªé
ç½®WMSä»»å¡éæ°åé
å
¥åºåºä½æ¥å£å°åï¼é
ç½®æä»¶Codeç¼ç ï¼wmsSystemReassignInTaskUrl"); |
| | | return; |
| | | } |
| | | |
| | | List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<>()); |
| | | for (BasDevp basDevp : basDevps) { |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basDevp.getDevpNo()); |
| | | if(stationThread == null){ |
| | | continue; |
| | | } |
| | | |
| | | List<Integer> runBlockReassignLocStationList = new ArrayList<>(); |
| | | for (StationObjModel stationObjModel : basDevp.getRunBlockReassignLocStationList$()) { |
| | | runBlockReassignLocStationList.add(stationObjModel.getStationId()); |
| | | } |
| | | |
| | | List<StationProtocol> list = stationThread.getStatus(); |
| | | for (StationProtocol stationProtocol : list) { |
| | | if(stationProtocol.isAutoing() |
| | | && stationProtocol.isLoading() |
| | | && stationProtocol.getTaskNo() > 0 |
| | | && stationProtocol.isRunBlock() |
| | | ) { |
| | | WrkMast wrkMast = wrkMastService.selectByWorkNo(stationProtocol.getTaskNo()); |
| | | if (wrkMast == null) { |
| | | News.info("è¾éç«ç¹å·={} è¿è¡é»å¡ï¼ä½æ æ³æ¾å°å¯¹åºä»»å¡ï¼å·¥ä½å·={}", stationProtocol.getStationId(), stationProtocol.getTaskNo()); |
| | | continue; |
| | | } |
| | | |
| | | Object lock = redisUtil.get(RedisKeyType.CHECK_STATION_RUN_BLOCK_LIMIT_.key + stationProtocol.getTaskNo()); |
| | | if (lock != null) { |
| | | continue; |
| | | } |
| | | redisUtil.set(RedisKeyType.CHECK_STATION_RUN_BLOCK_LIMIT_.key + stationProtocol.getTaskNo(), "lock", 15); |
| | | |
| | | if (runBlockReassignLocStationList.contains(stationProtocol.getStationId())) { |
| | | //ç«ç¹å¤äºéæ°åé
åºä½åºå |
| | | //è¿è¡å µå¡ï¼éæ°ç³è¯·ä»»å¡ |
| | | |
| | | HashMap<String, Object> requestParam = new HashMap<>(); |
| | | String response = null; |
| | | try { |
| | | requestParam.put("taskNo", wrkMast.getWmsWrkNo()); |
| | | requestParam.put("row", Utils.getInTaskEnableRow(new ArrayList<>(basDevp.getDevpNo()))); |
| | | |
| | | response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath(wmsSystemReassignInTaskUrl) |
| | | .setJson(JSON.toJSONString(requestParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | | |
| | | String sourceLocNo = wrkMast.getLocNo(); |
| | | String locNo = dto.getLocNo(); |
| | | |
| | | LocMast sourceLocMast = locMastService.queryByLoc(sourceLocNo); |
| | | if (sourceLocMast == null) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "åºä½å·:{} æºåºä½ä¿¡æ¯ä¸åå¨", sourceLocNo); |
| | | continue; |
| | | } |
| | | |
| | | if (!sourceLocMast.getLocSts().equals("S")) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "åºä½å·:{} æºåºä½ç¶æä¸å¤äºå
¥åºé¢çº¦", sourceLocNo); |
| | | continue; |
| | | } |
| | | |
| | | LocMast locMast = locMastService.queryByLoc(locNo); |
| | | if (locMast == null) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "åºä½å·:{} ç®æ åºä½ä¿¡æ¯ä¸åå¨", locNo); |
| | | continue; |
| | | } |
| | | |
| | | if (!locMast.getLocSts().equals("O")) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "åºä½å·:{} ç®æ åºä½ç¶æä¸å¤äºç©ºåºä½", locNo); |
| | | continue; |
| | | } |
| | | |
| | | Integer crnNo = commonService.findCrnNoByLocNo(locNo); |
| | | if (crnNo == null) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "æªå¹é
å°å åæº"); |
| | | continue; |
| | | } |
| | | |
| | | Integer targetStationId = commonService.findInStationId(crnNo, stationProtocol.getStationId()); |
| | | if (targetStationId == null) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "æç´¢å
¥åºç«ç¹å¤±è´¥"); |
| | | continue; |
| | | } |
| | | |
| | | StationCommand command = stationThread.getMoveCommand(wrkMast.getWrkNo(), stationProtocol.getStationId(), targetStationId, 0); |
| | | if(command == null){ |
| | | News.taskInfo(wrkMast.getWrkNo(), "è·åè¾é线å½ä»¤å¤±è´¥"); |
| | | continue; |
| | | } |
| | | |
| | | //æ´æ°æºåºä½ |
| | | sourceLocMast.setLocSts("O"); |
| | | sourceLocMast.setModiTime(new Date()); |
| | | locMastService.updateById(sourceLocMast); |
| | | |
| | | //æ´æ°ç®æ åºä½ |
| | | locMast.setLocSts("S"); |
| | | locMast.setModiTime(new Date()); |
| | | locMastService.updateById(locMast); |
| | | |
| | | //æ´æ°å·¥ä½æ¡£æ°æ® |
| | | wrkMast.setLocNo(locNo); |
| | | wrkMast.setCrnNo(crnNo); |
| | | wrkMast.setStaNo(targetStationId); |
| | | if (wrkMastService.updateById(wrkMast)) { |
| | | MessageQueue.offer(SlaveType.Devp, basDevp.getDevpNo(), new Task(2, command)); |
| | | } |
| | | News.info("请æ±WMSæ¥å£æåï¼ï¼ï¼urlï¼{}ï¼requestï¼{}ï¼responseï¼{}", wmsUrl + wmsSystemReassignInTaskUrl, JSON.toJSONString(requestParam), response); |
| | | } else { |
| | | News.error("请æ±WMSæ¥å£å¤±è´¥ï¼ï¼ï¼urlï¼{}ï¼requestï¼{}ï¼responseï¼{}", wmsUrl + wmsSystemReassignInTaskUrl, JSON.toJSONString(requestParam), response); |
| | | } |
| | | } catch (Exception e) { |
| | | News.error("请æ±WMSæ¥å£å¼å¸¸ï¼ï¼ï¼urlï¼{}ï¼requestï¼{}ï¼ responseï¼{}", wmsUrl + wmsSystemReassignInTaskUrl, JSON.toJSONString(requestParam), response, e); |
| | | } finally { |
| | | HttpRequestLog httpRequestLog = new HttpRequestLog(); |
| | | httpRequestLog.setName(wmsUrl + wmsSystemReassignInTaskUrl); |
| | | httpRequestLog.setRequest(JSON.toJSONString(requestParam)); |
| | | httpRequestLog.setResponse(response); |
| | | httpRequestLog.setCreateTime(new Date()); |
| | | httpRequestLogService.insert(httpRequestLog); |
| | | } |
| | | }else { |
| | | //è¿è¡å µå¡ï¼éæ°è®¡ç®è·¯çº¿ |
| | | StationCommand command = stationThread.getMoveCommand(wrkMast.getWrkNo(), stationProtocol.getStationId(), wrkMast.getStaNo(), 0); |
| | | if(command == null){ |
| | | News.taskInfo(wrkMast.getWrkNo(), "è·åè¾é线å½ä»¤å¤±è´¥"); |
| | | continue; |
| | | } |
| | | |
| | | MessageQueue.offer(SlaveType.Devp, basDevp.getDevpNo(), new Task(2, command)); |
| | | News.info("è¾éç«ç¹å µå¡åéæ°è®¡ç®è·¯å¾å½ä»¤ä¸åæåï¼ç«ç¹å·={}ï¼å·¥ä½å·={}ï¼å½ä»¤æ°æ®={}", stationProtocol.getStationId(), wrkMast.getWrkNo(), JSON.toJSONString(command)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | logging: |
| | | file: |
| | | path: ./stock/out/@pom.build.finalName@/logs |
| | | path: /stock/out/@pom.build.finalName@/logs |
| | | |
| | | super: |
| | | pwd: xltys1995 |
| | |
| | | # è®¾å¤æ¥å¿å卿¹å¼ mysql file |
| | | type: file |
| | | # fileç±»ååå¨å°å |
| | | loggingPath: ./stock/out/@pom.build.finalName@/deviceLogs |
| | | loggingPath: /stock/out/@pom.build.finalName@/deviceLogs |
| | | # æ¥å¿è¿ææ¶é´ åä½å¤© |
| | | expireDays: 7 |
| | | |
| | |
| | | <result column="barcode_station_list" property="barcodeStationList" /> |
| | | <result column="in_station_list" property="inStationList" /> |
| | | <result column="out_station_list" property="outStationList" /> |
| | | <result column="run_block_reassign_loc_station_list" property="runBlockReassignLocStationList" /> |
| | | <result column="lift_transfer_station_list" property="liftTransferStationList" /> |
| | | |
| | | </resultMap> |
| | | |
| | |
| | | select * from asr_loc_mast where loc_no = #{locNo} limit 0,1 |
| | | </select> |
| | | |
| | | <select id="queryByQrCode" resultMap="BaseResultMap"> |
| | | select * from asr_loc_mast where qr_code_value = #{qrCodeValue} limit 0,1 |
| | | </select> |
| | | |
| | | <select id="selectLocByLev" resultMap="BaseResultMap"> |
| | | SELECT * FROM asr_loc_mast WHERE lev1 = #{lev} |
| | | </select> |
| | | |
| | | <select id="selectEmptyLocNos" resultMap="BaseResultMap"> |
| | | select * from asr_loc_mast |
| | | where loc_no in |
| | | <foreach item="loc" collection="locNos" index="index" separator="," open="(" close=")"> |
| | | #{loc} |
| | | </foreach> |
| | | and loc_sts = 'O' |
| | | order by row1 |
| | | </select> |
| | | |
| | | <select id="selectNotEmptyLocNos" resultMap="BaseResultMap"> |
| | | select * from asr_loc_mast |
| | | where loc_no in |
| | | <foreach item="loc" collection="locNos" index="index" separator="," open="(" close=")"> |
| | | #{loc} |
| | | </foreach> |
| | | and loc_sts not in ('O') |
| | | order by row1 |
| | | </select> |
| | | |
| | | <select id="getLevList" resultType="java.lang.Integer"> |
| | |
| | | <el-descriptions-item label="å¯åº">{{ item.outEnable ? 'Y' : 'N' }}</el-descriptions-item> |
| | | <el-descriptions-item label="空æ¿ä¿¡å·">{{ item.emptyMk ? 'Y' : 'N' }}</el-descriptions-item> |
| | | <el-descriptions-item label="满æ¿ä¿¡å·">{{ item.fullPlt ? 'Y' : 'N' }}</el-descriptions-item> |
| | | <el-descriptions-item label="è¿è¡é»å¡">{{ item.runBlock ? 'Y' : 'N' }}</el-descriptions-item> |
| | | <el-descriptions-item label="æçé«åº¦">{{ item.palletHeight }}</el-descriptions-item> |
| | | <el-descriptions-item label="æ¡ç ">{{ item.barcode }}</el-descriptions-item> |
| | | <el-descriptions-item label="æ
é代ç ">{{ item.error }}</el-descriptions-item> |
| | |
| | | this.updateColor(sta, 0x30bffc); |
| | | } else if (status === "machine-pakout") { |
| | | this.updateColor(sta, 0x97b400); |
| | | } else if (status === "site-run-block") { |
| | | this.updateColor(sta, 0xe69138); |
| | | } else { |
| | | this.updateColor(sta, 0xb8b8b8); |
| | | } |
| | |
| | | { field: "id", align: "center", title: "ç¼å·" }, |
| | | { field: "devpNo", align: "center", title: "设å¤ç¼å·" }, |
| | | { field: "status$", align: "center", title: "ç¶æ" }, |
| | | { field: "createBy", align: "center", title: "å建人å" }, |
| | | { field: "createTime$", align: "center", title: "å建æ¶é´" }, |
| | | { field: "updateBy", align: "center", title: "ä¿®æ¹äººå" }, |
| | | { field: "updateTime$", align: "center", title: "ä¿®æ¹æ¶é´" }, |
| | | // { field: "createBy", align: "center", title: "å建人å" }, |
| | | // { field: "createTime$", align: "center", title: "å建æ¶é´" }, |
| | | // { field: "updateBy", align: "center", title: "ä¿®æ¹äººå" }, |
| | | // { field: "updateTime$", align: "center", title: "ä¿®æ¹æ¶é´" }, |
| | | { field: "memo", align: "center", title: "夿³¨" }, |
| | | { field: "stationList", align: "center", title: "ç«ç¹æ°æ®" }, |
| | | { field: "barcodeStationList", align: "center", title: "æ¡ç ç«ç¹æ°æ®" }, |
| | | { field: "inStationList", align: "center", title: "å
¥åºç«ç¹æ°æ®" }, |
| | | { field: "outStationList", align: "center", title: "åºåºç«ç¹æ°æ®" }, |
| | | { field: "runBlockReassignLocStationList", align: "center", title: "è¿è¡å µå¡éæ°åé
åºä½ç«ç¹æ°æ®" }, |
| | | { field: "liftTransferStationList", align: "center", title: "é¡¶åç§»æ ½ç«ç¹æ°æ®" }, |
| | | |
| | | { |
| | | fixed: "right", |
| | |
| | | <input class="layui-input" name="outStationList" placeholder="请è¾å
¥åºåºç«ç¹æ°æ®"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">è¿è¡å µå¡éæ°åé
åºä½ç«ç¹æ°æ®: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="runBlockReassignLocStationList" placeholder="请è¾å
¥è¿è¡å µå¡éæ°åé
åºä½ç«ç¹æ°æ®"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">é¡¶åç§»æ ½ç«ç¹æ°æ®: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="liftTransferStationList" placeholder="请è¾å
¥é¡¶åç§»æ ½ç«ç¹æ°æ®"> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |