From 8f1d32397b1b30f51d641513898d3f36cb0e515d Mon Sep 17 00:00:00 2001 From: gtsxc <3272660260@qq.com> Date: 星期一, 18 十一月 2024 13:53:47 +0800 Subject: [PATCH] # --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java | 95 +++++++++++++++++++++++++++++++++-------------- 1 files changed, 66 insertions(+), 29 deletions(-) diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java index 1c69d07..e941845 100644 --- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java +++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java @@ -8,15 +8,18 @@ import com.zy.asrs.common.domain.param.SearchLocParam; import com.zy.asrs.common.utils.HttpHandler; import com.zy.asrs.framework.common.Cools; +import com.zy.asrs.framework.common.R; import com.zy.asrs.framework.common.SnowflakeIdWorker; import com.zy.asrs.wcs.core.domain.dto.MatDto; import com.zy.asrs.wcs.core.domain.dto.RedisMapDto; import com.zy.asrs.wcs.core.domain.dto.StaDto; +import com.zy.asrs.wcs.core.domain.param.CreateInTaskParam; import com.zy.asrs.wcs.core.entity.*; import com.zy.asrs.wcs.core.kernel.AnalyzeService; import com.zy.asrs.wcs.core.model.MapNode; import com.zy.asrs.wcs.core.model.enums.*; import com.zy.asrs.wcs.core.service.*; +import com.zy.asrs.wcs.core.utils.OpenUtils; import com.zy.asrs.wcs.core.utils.RedisUtil; import com.zy.asrs.wcs.core.utils.ShuttleDispatcher; import com.zy.asrs.wcs.core.utils.Utils; @@ -86,6 +89,8 @@ private DeviceBarcodeService deviceBarcodeService; @Autowired private ShuttleChargeStaService shuttleChargeStaService; + @Autowired + private OpenUtils openUtils; /** * 缁勬墭 @@ -160,6 +165,7 @@ if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && !staProtocol.isEmptyMk() && (workNo == 0 || (workNo >= 9990 && workNo <= 9999)) + && staProtocol.isPakMk() ) { // 鑾峰彇鏉$爜鎵弿浠俊鎭� @@ -191,19 +197,18 @@ } } - //鑾峰彇鍏ュ簱浠诲姟绫诲瀷 - TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>() - .eq(TaskCtg::getFlag, String.valueOf(TaskCtgType.IN)) - .eq(TaskCtg::getStatus, 1)); - // 鍒ゆ柇閲嶅宸ヤ綔妗� Task task1 = taskService.getOne(new LambdaQueryWrapper<Task>() .eq(Task::getOriginSite, inSta.getStaNo()) - .eq(Task::getTaskCtg, taskCtg.getId()) - .in(Task::getTaskSts, 1, 2, 3) + .in(Task::getTaskSts, TaskStsType.NEW_INBOUND.sts, TaskStsType.ANALYZE_INBOUND.sts, TaskStsType.EXECUTE_INBOUND.sts) .eq(Task::getZpallet, barcode)); if (task1 != null) { News.error("宸ヤ綔妗e凡瀛樺湪,宸ヤ綔鍙�={}", task1.getTaskNo()); + if (staProtocol.getWorkNo().intValue() != Integer.parseInt(task1.getTaskNo())) { + devpThread.writeWorkSta(staProtocol.getSiteId(), Short.parseShort(task1.getTaskNo()), Short.parseShort(task1.getDestSite())); + devpThread.setPakMk(staProtocol.getSiteId(), false); + News.info("杈撻�佺嚎鍏ュ簱鍛戒护涓嬪彂锛屼换鍔℃暟鎹�={}", JSON.toJSON(task1)); + } continue; } @@ -220,7 +225,7 @@ param.setBarcode(barcode); param.setIoType(1); param.setSourceStaNo(inSta.getStaNo()); - param.setLocType1((short)1); + param.setLocType1(staProtocol.getLocType1().shortValue()); String response = new HttpHandler.Builder() .setUri(wmsUrl) .setPath("/rpc/pakin/loc/v1") @@ -233,30 +238,53 @@ if (code.equals(200)) { StartupDto dto = jsonObject.getObject("data", StartupDto.class); - //鑾峰彇杈撻�佽矾寰� - BasConveyorPath conveyorPath = basConveyorPathService.getOne(new LambdaQueryWrapper<BasConveyorPath>() - .eq(BasConveyorPath::getTypeNo, TaskCtgType.IN.val()) - .eq(BasConveyorPath::getDeviceId, devp.getId()) - .eq(BasConveyorPath::getStnNo, staProtocol.getSiteId())); - if (conveyorPath == null) { - News.error("杈撻�佽矾寰勪笉瀛樺湪"); - }else { - devpThread.writeWorkSta(staProtocol.getSiteId(), dto.getWorkNo().shortValue(), conveyorPath.getDeviceStn().shortValue()); - devpThread.setPakMk(staProtocol.getSiteId(), false); + String wmsLocNo = dto.getLocNo(); + int row = Integer.parseInt(wmsLocNo.substring(0, 2)); + int bay = Integer.parseInt(wmsLocNo.substring(2, 5)); + int lev = Integer.parseInt(wmsLocNo.substring(5, 7)); + row -= 16; + String wcsLocNo = Utils.getLocNo(row, bay, lev); + + CreateInTaskParam createInTaskParam = new CreateInTaskParam(); + createInTaskParam.setTaskNo(String.valueOf(dto.getWorkNo())); + createInTaskParam.setDestLoc(wcsLocNo); + createInTaskParam.setOriginSite("31002"); + createInTaskParam.setDestSite("31004"); + createInTaskParam.setPriority(11); + createInTaskParam.setBarcode(barcode); + + R result = openUtils.createInTask(createInTaskParam); + News.info("鍒涘缓鍏ュ簱浠诲姟锛屼换鍔℃暟鎹�={}锛學MS鍝嶅簲={}锛岃姹傚搷搴�={}", JSON.toJSON(param), JSON.toJSON(jsonObject), JSON.toJSON(result)); + try{ + String msg = ""; + HashMap<String, String> hashMap = new HashMap<>(); + hashMap.put("msg", msg); + hashMap.put("sta", "31001"); + new HttpHandler.Builder() + .setUri(wmsUrl) + .setPath("/rpc/led/getError") + .setJson(JSON.toJSONString(hashMap)) + .build() + .doPost(); + }catch (Exception e){ + } + }else { - if (ledThread != null) { - String errorMsg = jsonObject.getString("msg"); - if (!Cools.isEmpty(errorMsg)) { - ledThread.error(errorMsg); - ledThread.setLedMk(false); - } - } - News.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v2", JSON.toJSONString(param), response); + String msg = jsonObject.getString("msg"); + HashMap<String, String> hashMap = new HashMap<>(); + hashMap.put("msg", msg); + hashMap.put("sta", "31001"); + new HttpHandler.Builder() + .setUri(wmsUrl) + .setPath("/rpc/led/getError") + .setJson(JSON.toJSONString(hashMap)) + .build() + .doPost(); + News.error("鍏ュ簱鐢宠澶辫触锛屼换鍔℃暟鎹�={}锛岃姹傚搷搴�={}", JSON.toJSON(param), JSON.toJSON(jsonObject)); } } catch (Exception e) { e.printStackTrace(); - TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); } } } @@ -465,7 +493,7 @@ if (Cools.isEmpty(basConveyorSta.getTaskNo())){ continue; } - if (!basConveyorSta.getTaskNo().toString().equals(task.getWmsTaskNo())){ + if (!basConveyorSta.getTaskNo().toString().equals(task.getTaskNo())){ continue; } DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Conveyor, basConveyor.getDeviceId().intValue()); @@ -482,6 +510,14 @@ continue; } + //瑙f瀽鍓嶅垽鏂唴閮ㄧ洰鏍囧�兼槸鍚︽湁鐗� 鏈夊伐浣滃彿 + StaProtocol staProtocolInside = devpThread.getStation().get(Utils.getStaByLev(Utils.getLev(task.getDestLoc()))); + if (staProtocolInside == null) { + continue; + } + if (staProtocolInside.isLoading() || staProtocolInside.getWorkNo() !=0) { + continue; + } if (Cools.isEmpty(task.getShuttleNo())) { //鍒嗛厤灏忚溅 @@ -894,7 +930,8 @@ .eq(BasLed::getDeviceId, ledDevice.getId())); List<Integer> staArr = JSON.parseArray(led.getSta(), Integer.class); - BasConveyor basConveyor = basConveyorService.getById(led.getConveyorId().intValue()); + BasConveyor basConveyor = basConveyorService.getById(new LambdaQueryWrapper<BasConveyor>() + .eq(BasConveyor::getDeviceId, led.getConveyorId().intValue())); if (basConveyor == null) { continue; } -- Gitblit v1.9.1