#
1
2025-05-13 7c315b53808a66a2f1faf90930ecffdc85ba455f
#
6个文件已修改
181 ■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/TaskWrkController.java 125 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/TaskWrk.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/TaskLogScheduler.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/RgvThread.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/TaskWrkMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/TaskWrkController.java
@@ -261,43 +261,44 @@
        }
        String response="";
        try{
            HashMap<String, Object> headParam = new HashMap<>();
            headParam.put("taskNo",taskWrk.getTaskNo());
            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());
            log.info("wcs手动完成任务上报wms={}", taskWrk);
            response = new HttpHandler.Builder()
                    // .setHeaders(headParam)
                    .setUri(wmsUrl)
                    .setPath(taskStatusFeedbackPath)
                    .setJson(JSON.toJSONString(headParam))
                    .build()
                    .doPost();
            JSONObject jsonObject = JSON.parseObject(response);
            apiLogService.save("wcs手动完成任务上报wms"
                    ,wmsUrl+taskStatusFeedbackPath
                    ,null
                    ,"127.0.0.1"
                    ,JSON.toJSONString(headParam)
                    ,response
                    ,true
            );
        }catch (Exception e){
            log.error("wcs手动完成任务上报wms失{},返回值={}", taskWrk,response);
//            throw new CoolException(e);
        }
        Date now = new Date();
        locMast.setModiTime(now);
        locMastService.updateById(locMast);
        taskWrk.setStatus(7);//手动完成任务
        taskWrk.setModiTime(now);
        taskWrk.setCompleteTime(now);
//        try{
//            HashMap<String, Object> headParam = new HashMap<>();
//            headParam.put("taskNo",taskWrk.getTaskNo());
//            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());
//
//            log.info("wcs手动完成任务上报wms={}", taskWrk);
//            response = new HttpHandler.Builder()
//                    // .setHeaders(headParam)
//                    .setUri(wmsUrl)
//                    .setPath(taskStatusFeedbackPath)
//                    .setJson(JSON.toJSONString(headParam))
//                    .build()
//                    .doPost();
//
//            JSONObject jsonObject = JSON.parseObject(response);
//            apiLogService.save("wcs手动完成任务上报wms"
//                    ,wmsUrl+taskStatusFeedbackPath
//                    ,null
//                    ,"127.0.0.1"
//                    ,JSON.toJSONString(headParam)
//                    ,response
//                    ,true
//            );
//        }catch (Exception e){
//            log.error("wcs手动完成任务上报wms失{},返回值={}", taskWrk,response);
////            throw new CoolException(e);
//        }
        locMastService.updateById(locMast);
        taskWrkService.updateById(taskWrk);
        return R.ok();
    }
@@ -322,37 +323,37 @@
            taskWrk.setModiUser(1111L);//操作员
        }
        String response="";
        try{
            HashMap<String, Object> headParam = new HashMap<>();
            headParam.put("taskNo",taskWrk.getTaskNo());
            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());
            log.info("wcs手动取消任务上报wm={}", taskWrk);
            response = new HttpHandler.Builder()
                    // .setHeaders(headParam)
                    .setUri(wmsUrl)
                    .setPath(taskStatusFeedbackPath)
                    .setJson(JSON.toJSONString(headParam))
                    .build()
                    .doPost();
            JSONObject jsonObject = JSON.parseObject(response);
            apiLogService.save("wcs手动取消任务上报wms"
                    ,wmsUrl+taskStatusFeedbackPath
                    ,null
                    ,"127.0.0.1"
                    ,JSON.toJSONString(headParam)
                    ,response
                    ,true
            );
        }catch (Exception e){
            log.error("wcs手动取消任务上报wms失败={},返回值={}", taskWrk,response);
//            throw new CoolException(e);
        }
//        try{
//            HashMap<String, Object> headParam = new HashMap<>();
//            headParam.put("taskNo",taskWrk.getTaskNo());
//            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());
//
//
//            log.info("wcs手动取消任务上报wm={}", taskWrk);
//            response = new HttpHandler.Builder()
//                    // .setHeaders(headParam)
//                    .setUri(wmsUrl)
//                    .setPath(taskStatusFeedbackPath)
//                    .setJson(JSON.toJSONString(headParam))
//                    .build()
//                    .doPost();
//            JSONObject jsonObject = JSON.parseObject(response);
//            apiLogService.save("wcs手动取消任务上报wms"
//                    ,wmsUrl+taskStatusFeedbackPath
//                    ,null
//                    ,"127.0.0.1"
//                    ,JSON.toJSONString(headParam)
//                    ,response
//                    ,true
//            );
//        }catch (Exception e){
//            log.error("wcs手动取消任务上报wms失败={},返回值={}", taskWrk,response);
////            throw new CoolException(e);
//        }
        taskWrk.setCompleteTime(now);//完结时间
        taskWrkService.updateById(taskWrk);
        return R.ok();
src/main/java/com/zy/asrs/entity/TaskWrk.java
@@ -377,14 +377,7 @@
    }
    public Integer getStatusWms(){
        switch (status){
            case 5:
                return 1;
            case 4:
                return 0;
            default:
                return 0;
        }
        return status;
    }
    public String getPut(String point){
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1400,22 +1400,13 @@
                || (!rgvProtocol.getStatusType().equals(RgvStatusType.IDLE) && !rgvProtocol.getStatusType().equals(RgvStatusType.ROAM))) {
            return false;
        }
        RgvProtocol rgvProtocolOther = RgvStatusCache.getRgvStatus(slave.getId());
        RgvTaskProtocol rgvTaskProtocolOther = RgvTaskCache.getRgvStatus(slave.getId());
        if (rgvProtocolOther == null) {
            return true;
        }
        if (rgvProtocolOther.statusEnable) {
            if (rgvProtocolOther.getModeType().equals(RgvModeType.AUTO)
                    && rgvProtocolOther.getStatusType().equals(RgvStatusType.IDLE)
                    && rgvProtocolOther.getLoaded()==0) {
                return false;
            }
        if (rgvProtocol.getLoaded()!=0) {
            return false;
        }
        return true;
    }
    public boolean rgvOtherIDLE(RgvSlave slave) {
    public boolean rgvOtherIDLE(RgvSlave slave,Integer staNo) {
        RgvProtocol rgvProtocol = RgvStatusCache.getRgvStatus(slave.getId());
        RgvTaskProtocol rgvTaskProtocol = RgvTaskCache.getRgvStatus(slave.getId());
@@ -1427,15 +1418,15 @@
            return false;
        }
        RgvProtocol rgvProtocolOther = RgvStatusCache.getRgvStatus(slave.getOtherId());
        RgvTaskProtocol rgvTaskProtocolOther = RgvTaskCache.getRgvStatus(slave.getOtherId());
        if (rgvProtocolOther == null) {
            return true;
        }
        if (rgvProtocolOther.statusEnable) {
            if (rgvProtocolOther.getModeType().equals(RgvModeType.AUTO)
                    && rgvProtocolOther.getStatusType().equals(RgvStatusType.IDLE)
                    && rgvProtocolOther.getLoaded()==0) {
            BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", staNo));
            if (Math.abs(basDevpPosition.getPlcPosition()-rgvProtocol.getRgvPos())
                    >=
                    Math.abs(basDevpPosition.getPlcPosition()-rgvProtocolOther.getRgvPos())){
                return false;
            }
        }
@@ -1491,7 +1482,7 @@
                    for (RgvSlave.RgvStn inSta : rgvSlave.getRgvInSta()) {
                        TaskWrk taskWrk = deviceDetection(inSta);
                        if (taskWrk != null) {
                            if (taskWrk.getTaskNo().equals(taskNoNow)) continue;
                            if (taskWrk.getWrkNo().toString().equals(taskNoNow)) continue;
                            taskWrkList.add(taskWrk);
                            staList.add(inSta.getStaNo());
                        }
@@ -1550,10 +1541,9 @@
                                }
                            }
                        }
                        if (!sign){
                        if (!sign && belongToRange.size()==1){
                            if (rgvOtherIDLEOther(rgvSlave)){
                                if (!rgvOtherIDLE(rgvSlave)){
                                if (!rgvOtherIDLE(rgvSlave,belongToRange.get(0))){
                                    sign=true;
                                }
                            }
@@ -1693,7 +1683,7 @@
                BasDevpPosition basDevpPositionSou = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStn.getStaNo()));
                BasDevpPosition basDevpPositionEnd = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", targetPointConvert));
                //执行
                issuedTake.setTaskNo(Long.valueOf(taskWrk.getTaskNo()));
                issuedTake.setTaskNo(Long.valueOf(taskWrk.getWrkNo()));
                issuedTake.setTaskStatus(2);
                issuedTake.setTaskNoDirection(issuedTake.gettaskNoDirection$(issuedTake.getTaskNo(), issuedTake.getTaskStatus()));
                issuedTake.setTargetPosition(basDevpPositionSou.getPlcPosition());
@@ -1701,7 +1691,7 @@
                issuedTake.setDirection(basDevpPositionSou.getRgvSign()==1);
                issuedPut.setTaskNo(Long.valueOf(taskWrk.getTaskNo()));
                issuedPut.setTaskNo(Long.valueOf(taskWrk.getWrkNo()));
                issuedPut.setTaskStatus(3);
                issuedPut.setTaskNoDirection(issuedPut.gettaskNoDirection$(issuedPut.getTaskNo(), issuedPut.getTaskStatus()));
                issuedPut.setTargetPosition(basDevpPositionEnd.getPlcPosition());
src/main/java/com/zy/asrs/task/TaskLogScheduler.java
@@ -57,6 +57,10 @@
    public void execute() throws IOException {
        List<TaskWrk> taskWrkList = taskWrkService.selectToBeHistoryData();
        for (TaskWrk taskWrk : taskWrkList) {
            if (taskWrkService.saveToHistory(taskWrk.getTaskNo()) == 0) {
                log.error("任务档转任务历史档失败" + taskWrk);
                return ;
            }
            JSONObject jsonObject = null;
            String response = null;
            boolean success = false;
src/main/java/com/zy/core/thread/RgvThread.java
@@ -378,7 +378,7 @@
                        > avoidDistance) {//无需避让
                    return true;
                } else {
                    if (rgvProtocolOther.getRgvPosDestination() >= rgvProtocolOther.getRgvPos()) {
                    if (rgvProtocolOther.getRgvPosDestination() >= rgvProtocolOther.getRgvPos()-50) {
                        long avoid = rgvProtocolOther.getRgvPos() - rgvProtocolOther.getCarBodyJiaoMing() - avoidDistance - rgvProtocol.getCarBodyKunPeng();
                        if (!new TrackRangeUtils().avoidRange(avoid, avoidRange[1])) {
                            log.error("行走超出范围!!!任务异常  联系管理员!!!");
@@ -450,7 +450,7 @@
                        > avoidDistance) {//无需避让
                    return true;
                } else {
                    if (rgvProtocolOther.getRgvPosDestination() <= rgvProtocolOther.getRgvPos()) {
                    if (rgvProtocolOther.getRgvPosDestination() <= rgvProtocolOther.getRgvPos() + 50) {
                        long avoid = rgvProtocolOther.getRgvPos() + rgvProtocolOther.getCarBodyKunPeng() + avoidDistance + rgvProtocol.getCarBodyJiaoMing();
                        if (!new TrackRangeUtils().avoidRange(avoid, avoidRange[0])) {
                            log.error("行走超出范围!!!任务异常  联系管理员!!!");
src/main/resources/mapper/TaskWrkMapper.xml
@@ -123,7 +123,7 @@
        select * from "SOURCE"."wcs_task_wrk"
        where 1=1
        and (("WRK_STS"=14 and "STATUS"=5) or "STATUS"=7 or "STATUS"=4
                 or ("WRK_STS"=4 and "STATUS"=5))
                 or ("WRK_STS"=4 and "STATUS"=5) or ("WRK_STS"=14 and "STATUS"=9))
        order by "IO_PRI" desc,"CREATE_TIME","WRK_NO" ASC
    </select>
@@ -131,7 +131,8 @@
        insert into "SOURCE"."wcs_task_wrk_log"
        select * from "SOURCE"."wcs_task_wrk"
        where "TASK_NO" = #{taskNo}
          and ("STATUS"=5 or "STATUS"=4 or "STATUS"=6)
          and ("STATUS"=5 or "STATUS"=4 or "STATUS"=6 or "STATUS"=7  or "STATUS"=9)
        and ("WRK_NO" not in (select "WRK_NO" from "SOURCE"."asr_bas_devp"))
    </insert>
    <insert id="saveToHistoryD">