From 22f5cee4b4f9a717df573456f3b149be697b17d1 Mon Sep 17 00:00:00 2001 From: zhoushihao <zsh19950802@163.com> Date: 星期三, 03 七月 2024 08:36:10 +0800 Subject: [PATCH] 下片优化出片逻辑 大理片出片:出片线路调整 --- hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java | 107 ++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 73 insertions(+), 34 deletions(-) diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java index 28c7f1f..8a96f63 100644 --- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java +++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java @@ -72,25 +72,28 @@ @Value("${mes.slotWidth}") private Integer slotWidth; - @Value("${mes.carMaxSize}") - private Integer carMaxSize; + @Value("${mes.inCarMaxSize}") + private Integer inCarMaxSize; + + @Value("${mes.outCarMaxSize}") + private Integer outCarMaxSize; @Value("${mes.galssGap}") private Integer galssGap; - // @Scheduled(fixedDelay = 5000) + @Scheduled(fixedDelay = 5000) public void plcToHomeEdgScan() { PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; String d01Id = plcParameterObject.getPlcParameter("D01ID").getValue(); - String d02Id = plcParameterObject.getPlcParameter("D02ID").getValue(); + String d04Id = plcParameterObject.getPlcParameter("D04ID").getValue(); String d03State = plcParameterObject.getPlcParameter("D03State").getValue(); String d05State = plcParameterObject.getPlcParameter("D05State").getValue(); String mesD03Address = plcParameterObject.getPlcParameter("MESToD03").getAddress(); String mesD05Address = plcParameterObject.getPlcParameter("MESToD05").getAddress(); - log.info("1銆佽幏鍙杁01Id鎵弿ID涓猴細{};鑾峰彇d02Id鎵弿ID涓猴細{};", d01Id, d02Id); - if (StringUtils.isBlank(d01Id) && StringUtils.isBlank(d02Id)) { + log.info("1銆佽幏鍙杁01Id鎵弿ID涓猴細{};鑾峰彇d04Id鎵弿ID涓猴細{};", d01Id, d04Id); + if (StringUtils.isBlank(d01Id) && StringUtils.isBlank(d04Id)) { log.info("涓ゆ潯绾挎湭鏀跺埌杩涚墖浠诲姟锛岀粨鏉熸湰娆℃壂鎻忚繘鍗ц浆绔嬩换鍔�"); return; } @@ -104,8 +107,8 @@ if (StringUtils.isNotBlank(d01Id) && !REQUEST_WORD.equals(d03State)) { judgeGlassTypeStatus(d01Id, Const.A09_OUT_TARGET_POSITION, mesD03Address); } - if (StringUtils.isNotBlank(d02Id) && !REQUEST_WORD.equals(d05State)) { - judgeGlassTypeStatus(d02Id, Const.A10_OUT_TARGET_POSITION, mesD05Address); + if (StringUtils.isNotBlank(d04Id) && !REQUEST_WORD.equals(d05State)) { + judgeGlassTypeStatus(d04Id, Const.A10_OUT_TARGET_POSITION, mesD05Address); } log.info("缁撴潫鎵爜浠诲姟"); // if (flag01 && flag04) { @@ -146,13 +149,13 @@ } } String d01Id = plcParameterObject.getPlcParameter("D01ID").getValue(); - String d02Id = plcParameterObject.getPlcParameter("D02ID").getValue(); - log.info("1銆佽幏鍙杁01Id鎵弿ID涓猴細{};鑾峰彇d02Id鎵弿ID涓猴細{};", d01Id, d02Id); + String d04Id = plcParameterObject.getPlcParameter("D04ID").getValue(); + log.info("1銆佽幏鍙杁01Id鎵弿ID涓猴細{};鑾峰彇d04Id鎵弿ID涓猴細{};", d01Id, d04Id); //涓ゆ潯绾块兘鏈夎繘鍗ц浆绔嬩换鍔★紝鐩存帴缁撴潫 - if (StringUtils.isNotBlank(d01Id) && StringUtils.isNotBlank(d02Id)) { - log.info("涓ゆ潯绾块兘瀛樺湪杩涚墖浠诲姟锛岀粨鏉熶换鍔�"); - return; - } +// if (StringUtils.isNotBlank(d01Id) && StringUtils.isNotBlank(d04Id)) { +// log.info("涓ゆ潯绾块兘瀛樺湪杩涚墖浠诲姟锛岀粨鏉熶换鍔�"); +// return; +// } //鑾峰彇涓ゆ潯绾垮崸杞珛鏄惁鏈夌幓鐠冿紝涓斾换鍔$姸鎬侀兘涓�2 List<Integer> lineList = bigStorageCageFeedTaskService.querySitToUpGlass(); if (CollectionUtils.isEmpty(lineList)) { @@ -160,27 +163,50 @@ return; } Integer lineFirst = lineList.get(0); - String lineGlassId = lineFirst.equals(Const.A09_OUT_TARGET_POSITION) ? d01Id : d02Id; + String lineGlassId = lineFirst.equals(Const.A09_OUT_TARGET_POSITION) ? d01Id : d04Id; //浠呮湁涓�鏉″厛绗﹀悎鍚姩鍚姩鏉′欢 if (lineList.size() == 1) { //濡傛灉杩涚墖璇锋眰浣嗙幓鐠冧负绌猴紝璁$畻浠诲姟琛ㄨ繘鐗囨牸瀛� 鍙戦�佽繘鐗囦换鍔� if (StringUtils.isEmpty(lineGlassId)) { computeTargetByLine(lineFirst); + } else { + //todo:璁$畻鎵弿鍒扮殑鐜荤拑鏄惁鍙互瀛樿繘鍗ц浆绔� + //鑾峰彇鍗ц浆绔嬪墿浣欏搴� + if (computeIsRun(lineFirst, lineGlassId)) { + computeTargetByLine(lineFirst); + } } return; } //涓ゆ潯鍏堝潎鍙墽琛岃繘鐗囦换鍔★紝鍒ゆ柇涓ゆ潯绾挎槸鍚﹁繘鐗囪姹傛槸鍚﹂兘涓虹┖ - if (StringUtils.isBlank(d01Id) && StringUtils.isBlank(d02Id)) { + if (StringUtils.isBlank(d01Id) && StringUtils.isBlank(d04Id)) { //姣旇緝鏈�鏃╀竴鐗囦换鍔$殑鐗堝浘id鍙婄増搴� 姹傚嚭鍗ц浆绔嬬殑绾胯矾 Integer line = getStartLine(); //璁$畻浠诲姟琛ㄨ繘鐗囨牸瀛� 鍙戦�佽繘鐗囦换鍔� computeTargetByLine(line); return; + } else if (StringUtils.isNotBlank(d01Id) && StringUtils.isNotBlank(d04Id)) { +// todo:涓や釜閮芥湁杩涚墖鐜荤拑 + if (computeIsRun(Const.A09_OUT_TARGET_POSITION, d01Id) && computeIsRun(Const.A10_OUT_TARGET_POSITION, d04Id)) { + //姣旇緝鏈�鏃╀竴鐗囦换鍔$殑鐗堝浘id鍙婄増搴� 姹傚嚭鍗ц浆绔嬬殑绾胯矾 + Integer line = getStartLine(); + //璁$畻浠诲姟琛ㄨ繘鐗囨牸瀛� 鍙戦�佽繘鐗囦换鍔� + computeTargetByLine(line); + } else if (computeIsRun(Const.A09_OUT_TARGET_POSITION, d01Id)) { + computeTargetByLine(Const.A09_OUT_TARGET_POSITION); + } else if (computeIsRun(Const.A10_OUT_TARGET_POSITION, d04Id)) { + computeTargetByLine(Const.A10_OUT_TARGET_POSITION); + } else { + return; + } + } else { + //锛屾垨鑰呬粎鏈変竴鏉℃湁鐜荤拑 + //涓�鏉$嚎涓虹┖锛屼竴鏉$嚎鏈夎繘鐗囪姹傛湁鐜荤拑 + int outLine = StringUtils.isBlank(d01Id) ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; + //鑾峰彇杩涚墖璇锋眰鐜荤拑涓虹┖鐨勶紝璁$畻浠诲姟琛ㄨ繘鐗囨牸瀛� 鍙戦�佽繘鐗囦换鍔� + computeTargetByLine(outLine); } - //涓�鏉$嚎涓虹┖锛屼竴鏉$嚎鏈夎繘鐗囪姹傛湁鐜荤拑 - int outLine = StringUtils.isBlank(d01Id) ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; - //鑾峰彇杩涚墖璇锋眰鐜荤拑涓虹┖鐨勶紝璁$畻浠诲姟琛ㄨ繘鐗囨牸瀛� 鍙戦�佽繘鐗囦换鍔� - computeTargetByLine(outLine); + } // @Scheduled(fixedDelay = 5000) @@ -198,14 +224,14 @@ .orderBy(Boolean.TRUE, sequenceOrder, TemperingGlassInfo::getTemperingFeedSequence)); if (CollectionUtils.isNotEmpty(temperingGlassInfoList)) { log.info("鏈夋鍦ㄥ嚭鐗囩殑閽㈠寲浠诲姟"); - computeOutGlassInfo(temperingGlassInfoList); + computeOutGlassInfo(temperingGlassInfoList, Boolean.TRUE); return; } //鏄惁鏈変汉宸ヤ笅鐗囦换鍔� 鏈夌洿鎺ュ嚭 List<BigStorageCageDetails> artificialList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>() .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_ARTIFICIAL).orderByDesc(BigStorageCageDetails::getWidth)); if (CollectionUtils.isNotEmpty(artificialList)) { - computeOutGlassInfo(temperingGlassInfoList); + computeOutGlassInfo(temperingGlassInfoList, Boolean.FALSE); return; } //閽㈠寲浼樺厛锛氳幏鍙栫悊鐗囩 鐜荤拑灏忕墖 鐮存崯琛� 鏁伴噺 鍒ゆ柇绗煎唴鐗堝浘鏄惁鍒伴綈 @@ -222,7 +248,7 @@ .eq(GlassInfo::getTemperingLayoutId, temperingLayoutDTO.getTemperingLayoutId()) .eq(GlassInfo::getEngineerId, temperingLayoutDTO.getEngineerId())); temperingGlassInfoService.saveBatch(temperingGlassInfos); - computeOutGlassInfo(temperingGlassInfoList); + computeOutGlassInfo(temperingGlassInfoList, Boolean.TRUE); return; } //鏈埌榻� 鎵ц鍐呴儴璋冨害浠诲姟 @@ -286,7 +312,7 @@ Integer widthSecond = edgGlassTaskInfoList.get(1).getWidth(); if (remainWidth >= widthFirst) { if (remainWidth - widthFirst - galssGap >= widthSecond) { - if (glassCount <= carMaxSize - 1) { + if (glassCount <= inCarMaxSize - 1) { addFeedTask(glassId, line, Const.BIG_STORAGE_IN_WAIT, widthFirst); } else { addFeedTask(glassId, line, Const.BIG_STORAGE_IN_RUN, widthFirst); @@ -375,11 +401,11 @@ //2銆佽幏鍙栫洰鏍囨牸瀛愪俊鎭� BigStorageDTO bigStorageDTO = bigStorageCageDetailsService.queryTargetSlotByTempering(info); //3銆佹洿鏂板ぇ鐞嗙墖绗艰〃鍓╀綑瀹藉害 - bigStorageCageService.update(new LambdaUpdateWrapper<BigStorageCage>().set(BigStorageCage::getRemainWidth, bigStorageDTO.getWidth()) + bigStorageCageService.update(new LambdaUpdateWrapper<BigStorageCage>().set(BigStorageCage::getRemainWidth, bigStorageDTO.getWidth() - info.getWidth()) .eq(BigStorageCage::getSlot, bigStorageDTO.getSlot())); //4銆佹洿鏂拌繘鐗囦换鍔¤〃锛岀洰鏍囨牸瀛愬強鐘舵�侊紙鐘舵�佹敼涓�2 鐢垫皵鎵埌鑷澶勭悊锛� 閬囧埌闂锛氭棤娉曟壒閲忔洿鏂帮紝鎵归噺鏇存柊鏃犳硶璧版寚瀹氫粠搴� e.setTargetSlot(bigStorageDTO.getSlot()); - e.setTaskType(Const.BIG_STORAGE_IN_RUN); +// e.setTaskType(Const.BIG_STORAGE_IN_RUN); bigStorageCageFeedTaskService.updateById(e); //5銆佸皢杩涚墖淇℃伅瀛樺叆澶х悊鐗囩璇︽儏琛� @@ -398,24 +424,30 @@ String mesD05Address = plcMesObject.getPlcParameter("MESToD05").getAddress(); String outLine = line.equals(Const.A09_OUT_TARGET_POSITION) ? mesD03Address : mesD05Address; for (int i = 1; i <= taskList.size(); i++) { - s7control.writeWord(plcMesObject.getPlcParameter("StartAddToImport" + i).getAddress(), (short) taskList.get(i).getLine()); - s7control.writeWord(plcMesObject.getPlcParameter("TargetAddToImport1" + i).getAddress(), (short) taskList.get(i).getTargetSlot()); + s7control.writeWord(plcMesObject.getPlcParameter("StartAddToImport" + i).getAddress(), (short) taskList.get(i - 1).getLine()); + s7control.writeWord(plcMesObject.getPlcParameter("TargetAddToImport" + i).getAddress(), (short) taskList.get(i - 1).getTargetSlot()); } s7control.writeWord(outLine, (short) 1); } - private <T extends BigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list) { + private <T extends BigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, Boolean isTempering) { //浠诲姟鏁版嵁 鑾峰彇杞﹀瓙瀛樻斁鐜荤拑鏈�澶ф暟閲� 鐜荤拑闂撮殧 List<BigStorageCageOutTask> bigStorageCageOutTaskList = new ArrayList<>(); //鎵撹溅鍓╀綑灏哄 Integer remainWidth = carWidth; for (T e : list) { - if (bigStorageCageOutTaskList.size() > carMaxSize || e.getWidth() > remainWidth) { + if (bigStorageCageOutTaskList.size() > outCarMaxSize || e.getWidth() > remainWidth) { break; } remainWidth = remainWidth - (int) e.getWidth() - galssGap; - bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.A09_OUT_TARGET_POSITION, - (int) e.getWidth(), 0, 0, 1)); + if (isTempering) { + bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.TEMPERING_OUT_TARGET_POSITION, + (int) e.getWidth() * 10, 0, 0, 1)); + } else { + bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.ARTIFICIAL_OUT_TARGET_POSITION, + (int) e.getWidth() * 10, 0, 0, 1)); + } + } Assert.isFalse(CollectionUtils.isEmpty(bigStorageCageOutTaskList), "鏈幏鍙栧嚭鐗囨暟鎹紝缁撴潫鍑虹墖浠诲姟"); log.info("鑾峰彇鍑虹墖浠诲姟鏁版嵁{}鏉★紝鎵ц淇濆瓨", bigStorageCageOutTaskList.size()); @@ -456,7 +488,14 @@ bigStorageCageService.update(new LambdaUpdateWrapper<BigStorageCage>().set(BigStorageCage::getRemainWidth, slotWidth) .in(BigStorageCage::getSlot, slotList)); } - - } + + public Boolean computeIsRun(int line, String glassId) { + //鑾峰彇鍗ц浆绔嬪墿浣欏搴� + BigStorageDTO sitToUpRemainWidth = bigStorageCageFeedTaskService.querySitToUpRemainWidth(line); + //鑾峰彇鐜荤拑淇℃伅 + GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId)); + return sitToUpRemainWidth.getWidth() < glassInfo.getWidth(); + } + } \ No newline at end of file -- Gitblit v1.8.0