From cce8b8793ca1466ca1330f3bd62e11ae6551261e Mon Sep 17 00:00:00 2001 From: cpT <1@123> Date: 星期二, 01 七月 2025 13:51:58 +0800 Subject: [PATCH] #改造 --- src/main/java/com/zy/asrs/service/impl/TaskWrkServiceImpl.java | 25 +++++++++++++++---------- 1 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/TaskWrkServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/TaskWrkServiceImpl.java index 65408e9..106bbaf 100644 --- a/src/main/java/com/zy/asrs/service/impl/TaskWrkServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/TaskWrkServiceImpl.java @@ -19,6 +19,7 @@ import com.zy.common.service.CommonService; import com.zy.common.utils.HttpHandler; import com.zy.core.DevpThread; +import com.zy.core.cache.MessageQueue; import com.zy.core.cache.SlaveConnection; import com.zy.core.enums.CrnTaskModeType; import com.zy.core.enums.SlaveType; @@ -33,6 +34,7 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDateTime; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -134,17 +136,20 @@ crnCommand.setDestinationPosX(Utils.getRowShort(taskWrk.getTargetPoint())); // 鐩爣搴撲綅鍒� crnCommand.setDestinationPosY(Utils.getBayShort(taskWrk.getTargetPoint())); // 鐩爣搴撲綅灞� crnCommand.setDestinationPosZ(Utils.getLevShort(taskWrk.getTargetPoint())); // 鐩爣搴撲綅鎺� - crnCommand.setCommand((short)1); - if (!CommandUtils.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(5, crnCommand),false)) { +// crnCommand.setCommand((short)1); + if (!MessageQueue.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(5, crnCommand))) { log.error("鍫嗗灈鏈哄懡浠ょ敓鎴愬け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand)); throw new CoolException("鍫嗗灈鏈哄懡浠ょ敓鎴愬け璐�"); }else{ try{ HashMap<String, Object> headParam = new HashMap<>(); headParam.put("taskNo",taskWrk.getTaskNo()); - headParam.put("status",taskWrk.getStatus()); - headParam.put("ioType",taskWrk.getIoType()); - headParam.put("barcode",taskWrk.getBarcode()); + headParam.put("taskStatus",taskWrk.getStatusWms()); + headParam.put("ioType",taskWrk.getIoTypeWms()); + headParam.put("barCode",taskWrk.getBarcode()); + headParam.put("reportTime", LocalDateTime.now()); + headParam.put("weight",taskWrk.getScWeight().doubleValue()); + // headParam.put("reportTime",new Date()); String response; response = new HttpHandler.Builder() @@ -205,8 +210,8 @@ crnCommand.setDestinationPosX(crnStn.getBay().shortValue()); // 鐩爣搴撲綅鎺� crnCommand.setDestinationPosY(crnStn.getLev().shortValue()); // 鐩爣搴撲綅鍒� crnCommand.setDestinationPosZ(crnStn.getRow().shortValue()); // 鐩爣搴撲綅灞� - crnCommand.setCommand((short)1); - if (!CommandUtils.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(5, crnCommand))) { +// crnCommand.setCommand((short)1); + if (!MessageQueue.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(5, crnCommand))) { log.error("鍫嗗灈鏈哄懡浠ょ敓鎴愬け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand)); throw new CoolException("鍫嗗灈鏈哄懡浠ょ敓鎴愬け璐�"); } @@ -216,7 +221,7 @@ StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo()).clone(); staProtocol.setWorkNo(taskWrk.getWrkNo()); staProtocol.setStaNo(Integer.parseInt(taskWrk.getTargetPoint())); - if (!CommandUtils.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(3, staProtocol))) { + if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(3, staProtocol))) { log.error("杈撻�佺嚎鍛戒护鐢熸垚澶辫触锛屽爢鍨涙満鍙�={}锛屼换鍔℃暟鎹�={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand)); throw new CoolException("杈撻�佺嚎鍛戒护鐢熸垚澶辫触"); } @@ -252,12 +257,12 @@ @Override - public List<TaskWrk> selectTaskWrkList(Integer wrkNo,Integer taskNo,Integer status,Date modiTimeStart,Date modiTimeEnd, Integer curr, Integer limit) { + public List<TaskWrk> selectTaskWrkList(Integer wrkNo,String taskNo,Integer status,Date modiTimeStart,Date modiTimeEnd, Integer curr, Integer limit) { return this.baseMapper.selectTaskWrkList(wrkNo,taskNo, status,modiTimeStart,modiTimeEnd,curr,limit); } @Override - public Long selectTaskWrkListTotal(Integer wrkNo,Integer taskNo,Integer status,Date modiTimeStart,Date modiTimeEnd) { + public Long selectTaskWrkListTotal(Integer wrkNo,String taskNo,Integer status,Date modiTimeStart,Date modiTimeEnd) { return this.baseMapper.selectTaskWrkListTotal(wrkNo,taskNo, status,modiTimeStart,modiTimeEnd); } -- Gitblit v1.9.1