自动化立体仓库 - WMS系统
#
1
1 天以前 8257d89c461f6553d66fad1e5e3df3d172a00924
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -14,13 +14,16 @@
import com.zy.asrs.entity.result.StockVo;
import com.zy.asrs.mapper.TagMapper;
import com.zy.asrs.service.*;
import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.utils.MatUtils;
import com.zy.asrs.utils.OrderInAndOutUtil;
import com.zy.asrs.utils.Utils;
import com.zy.common.constant.ArmConstant;
import com.zy.common.model.DetlDto;
import com.zy.common.service.CommonService;
import com.zy.common.utils.HttpHandler;
import com.zy.common.utils.NodeUtils;
import com.zy.erp.kingdee.utils.PostMesDataUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -663,7 +666,8 @@
                .eq("status", 1)
        );
        if (Cools.isEmpty(basArm)){
            throw new CoolException("机械臂配置异常,查询不到机械臂数据!!!"+ JSON.toJSONString(param));
            return;
//            throw new CoolException("机械臂配置异常,查询不到机械臂数据!!!"+ JSON.toJSONString(param));
        }
        try{
@@ -702,7 +706,8 @@
                        .eq("status", 1)
        );
        if (Cools.isEmpty(basArmMast)){
            throw new CoolException("未查询到相关机械臂拆码垛任务!!!"+ JSON.toJSONString(param));
            return;
//            throw new CoolException("未查询到相关机械臂拆码垛任务!!!"+ JSON.toJSONString(param));
        }
        if (Integer.parseInt(param.getPick_num()) !=1){
            basArmMast.setStatus(9);
@@ -733,7 +738,8 @@
        if (Cools.isEmpty(basArmMast)){
            throw new CoolException("未查询到相关机械臂拆码垛任务!!!"+ JSON.toJSONString(param));
        }
        basArmMastService.updateArmMastStatus(param.getArm_no(),basArmMast.getSortingLine(),2,3);
        basArmMastService.updateArmMastStatus(param.getArm_no(),basArmMast.getSortingLine(),basArmMast.getStaNo(),1,3);
        basArmMastService.updateArmMastStatus(param.getArm_no(),basArmMast.getSortingLine(),basArmMast.getStaNo(),2,3);
    }
    @Override
@@ -754,7 +760,7 @@
                        .eq("status", 5)
        );
        if (!Cools.isEmpty(basArmMast)){
            basArmMastService.updateArmMastStatus(param.getArm_no(),basArmMast.getSortingLine(), 5,6);
            basArmMastService.updateArmMastStatus(param.getArm_no(),basArmMast.getSortingLine(),basArmMast.getStaNo(), 5,6);
        }
    }
@@ -792,7 +798,6 @@
        if (param == null) {
            throw new CoolException("参数不能为空");
        }
        Integer devpId = 1;
        // 创建对象(构造函数中已生成 timestamp)
        BasAgvMast basAgvMast = new BasAgvMast();
        // 生成 WMS 任务号(如无外部传入,可以使用雪花ID 或自增)
@@ -808,7 +813,7 @@
        basAgvMast.setAppeTime(new Date());  // 添加时间
        basAgvMast.setModiTime(new Date());  // 修改时间
        basAgvMast.setIoType(param.getIoType());// 任务类型
        basAgvMast.setDevpId(devpId);
        basAgvMast.setFloorNo(param.getFloorNo()); //楼层
        // 插入数据库
        basAgvMastService.insert(basAgvMast);
@@ -867,23 +872,18 @@
        agvBindCtnrAndBinParam.setReqCode(String.valueOf(System.currentTimeMillis()));
        agvBindCtnrAndBinParam.setCtnrCode(param.getBarcode());
        agvBindCtnrAndBinParam.setCtnrTyp("1");
        agvBindCtnrAndBinParam.setPositionCode(
                basAgvLocNoSou != null && basAgvLocNoSou.getAgvLocNo() != null
                        ? basAgvLocNoSou.getAgvLocNo()
                        : ""
        );
        agvBindCtnrAndBinParam.setStgBinCode(
                basAgvLocNoEnd != null && basAgvLocNoEnd.getAgvLocNo() != null
                        ? basAgvLocNoEnd.getAgvLocNo()
                        : ""
        );
        if(basAgvLocNoEnd != null && basAgvLocNoEnd.getAgvLocNo() != null){
            agvBindCtnrAndBinParam.setStgBinCode(basAgvLocNoEnd.getAgvLocNo());
        }
        if(basAgvLocNoSou != null && basAgvLocNoSou.getAgvLocNo() != null){
            agvBindCtnrAndBinParam.setStgBinCode(basAgvLocNoSou.getAgvLocNo());
        }
        agvBindCtnrAndBinParam.setIndBind(param.getIndBind());
        try {
            String URL = "http://10.10.10.200:8181/rcms/services/rest/hikRpcService"; // AGV接口地址
            String mesPath = "bindCtnrAndBin"; // 接口路径
            String response = "";
            boolean success = false;
            try {
                log.info("AGV绑定容器接口请求参数: {}", JSON.toJSONString(agvBindCtnrAndBinParam));
@@ -914,5 +914,55 @@
    }
    @Override
    @Transactional
    public boolean agvApplicationPassedTheGrating(ArmAgvGratingParam arm) {
        ReturnT<String> result = new PostMesDataUtils().postMesDataArmGrating("光栅请求下发:", ArmConstant.getArmUrl(arm.getArmNo()), ArmConstant.ARM_ADAPTOR_GRATING_AGVENTER, arm);
        if (result.getCode()==200){
            return true;
        }
        return false;
    }
    @Override
    @Transactional
    public boolean agvApplicationPassedTheGrating(AgvGoTheArnParam param) {
        String URL = "http://10.10.10.200:8181/rcms/services/rest/hikRpcService"; // AGV接口地址
        String AGVPath = "continueTask"; // 接口路径
        AgvGoParam agvGoParam = new AgvGoParam();
        agvGoParam.setCode("0");
        agvGoParam.setMessage("继续执行");
        agvGoParam.setReqCode(param.getReqCode());
        ReturnT<String> result = new PostMesDataUtils().postMesDataArmGrating("光栅下发后继续任务:", URL, AGVPath, param);
        if (result.getCode()==200){
            return true;
        }
        return false;
    }
    @Override
    @Transactional
    public boolean agvBindAndBin(String taskNo) {
        String URL = "http://10.10.10.200:8181/"; // AGV接口地址
        String AGVPath = "rcms/services/rest/hikRpcService/bindCtnrAndBin"; // 接口路径
        BasAgvMast basAgvMast = basAgvMastService.selectOne(new EntityWrapper<BasAgvMast>().eq("task_no",taskNo));
        BasAgvLocNoService basAgvLocNoService = SpringUtils.getBean(BasAgvLocNoService.class);
        BasAgvLocNo basAgvLocNoEnd = basAgvLocNoService.selectOne(
                new EntityWrapper<BasAgvLocNo>().eq("sta_no", basAgvMast.getStaNo())
        );
        AgvBindCtnrAndBinParam agvBindCtnrAndBinParam = new AgvBindCtnrAndBinParam();
        agvBindCtnrAndBinParam.setReqCode(basAgvMast.getTaskNo() + "-" + basAgvMast.getTimestamp());
        agvBindCtnrAndBinParam.setCtnrCode(basAgvMast.getTimestamp().toString());
        agvBindCtnrAndBinParam.setCtnrTyp("1");
        agvBindCtnrAndBinParam.setStgBinCode(basAgvLocNoEnd.getAgvLocNo());
        agvBindCtnrAndBinParam.setIndBind("0");
        ReturnT<String> resultBind = new PostMesDataUtils().postMesDataArmGrating("AGV容器绑定解绑", URL,AGVPath, agvBindCtnrAndBinParam);
        if (resultBind.getCode()!=200){
            return true;
        }
        return false;
    }
}