自动化立体仓库 - WCS系统
*
lsh
2025-04-28 e386fa74739a128349c9c0e60913896713044e43
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -8,10 +8,7 @@
import com.core.exception.CoolException;
import com.zy.asrs.domain.enums.TaskStatusType;
import com.zy.asrs.domain.enums.WorkNoType;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.StaDesc;
import com.zy.asrs.entity.TaskWrk;
import com.zy.asrs.entity.ToWmsDTO;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.TaskOverParam;
import com.zy.asrs.entity.param.WMSAndAGVInterfaceParam;
import com.zy.asrs.entity.param.TaskCreateParam;
@@ -50,6 +47,8 @@
    private CommonService commonService;
    @Autowired
    private LocMastService locMastService;
    @Autowired
    private BasDevpService basDevpService;
@@ -74,21 +73,40 @@
        Date now = new Date();
        taskWrk = new TaskWrk();
        LocMast locMast=locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",param.getStartPoint()));
        int workNo1 = commonService.getWorkNo(WorkNoType.PAKOUT.type);//获取入库工作号
        int workNo1 = 0;//获取入库工作号
        if (param.getIoType() .equals(1)){
            commonService.getWorkNo(WorkNoType.PAKOUT.type);
        } else {
            commonService.getWorkNo(WorkNoType.PAKIN.type);
        }
        taskWrk.setTaskNo(param.getTaskNo());//任务号
        taskWrk.setWrkNo(workNo1);
        taskWrk.setStatus(TaskStatusType.RECEIVE.id);//任务状态:接收
        taskWrk.setCreateTime(now);
        taskWrk.setModiTime(now);
        taskWrk.setAssignTime(new Date());
        taskWrk.setModiUser(6666L);
//        try{
//            if (param.getIoType()>1){
//                LocMast locMast=locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",param.getStartPoint()));
//                if (Utils.locNoRowBoolean(locMast.getRow1())){
//                      param.setTaskPriority(11);
//                }
//            }
//        }catch (Exception e){
//        }
        taskWrk.setIoPri(param.getTaskPriority());
        taskWrk.setIoType(param.getIoType());//任务类型
        taskWrk.setIoPri(param.getTaskPriority());//优先级
        taskWrk.setBarcode(param.getBarcode());//条码
        taskWrk.setCrnNo(locMast.getCrnNo());
        taskWrk.setCrnNo(param.getCrn());
        if(param.getIoType() == 1){
            taskWrk.setWrkSts(1);
            if (!Cools.isEmpty(param.getTargetPoint())) {
                taskWrk.setTargetPoint(Utils.getWcsLocNo(param.getTargetPoint()));//终点
                taskWrk.setOriginTargetPoint(param.getTargetPoint());
//                taskWrk.setTargetPoint(Utils.getWcsLocNo(param.getTargetPoint()));//终点  转换下
                taskWrk.setTargetPoint(param.getTargetPoint());//终点
                taskWrk.setOriginTargetPoint(param.getStartPoint());
            }
        } else if (param.getIoType() == 2) {
@@ -102,7 +120,7 @@
            taskWrk.setWrkSts(11);
            if (!Cools.isEmpty(param.getStartPoint())) {
                taskWrk.setStartPoint(param.getStartPoint());//起点
                taskWrk.setOriginStartPoint(param.getStartPoint());
                taskWrk.setTargetPoint(param.getTargetPoint());
            }
        }
@@ -219,12 +237,12 @@
            } else {
                staProtocol = staProtocol.clone();
            }
            Short workNo = staProtocol.getWorkNo();
            Integer workNo = staProtocol.getWorkNo();
            if (wharfCode1.contains(param.getWharfCode())){
                if (!staProtocol.isLoading() && !staProtocol.isCar() && staProtocol.getWorkNo() >0){
                if (!staProtocol.isLoading() && staProtocol.getWorkNo() >0){
                    //AGV出库完成以后
                    staProtocol.setWorkNo((short) 0);
                    staProtocol.setStaNo((short)0);
                    staProtocol.setWorkNo( 0);
                    staProtocol.setStaNo(0);
                    boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol));
                    if (result) {
@@ -236,10 +254,10 @@
                for (DevpSlave.Sta inSta : devp.getInSta()) {
                    if (inSta.getBackSta().equals(staDesc.getStnNo())){
                        if (staProtocol.isLoading() && !staProtocol.isCar() && workNo == 0){
                        if (staProtocol.isLoading() && workNo == 0){
                            //AGV入库完成以后
                            staProtocol.setWorkNo((short) 9999);
                            staProtocol.setStaNo(inSta.getStaNo().shortValue());
                            staProtocol.setWorkNo(9999);
                            staProtocol.setStaNo(inSta.getStaNo());
                            boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol));
                            if (result) {
@@ -254,6 +272,40 @@
        }
    }
//    @Override
//    public R getAgvPickAndPlaceV1(TaskOverParam param) {
//        BasDevp basDevp = basDevpService.selectById(param.getStaNo());
//        if (Cools.isEmpty(basDevp)){
//            return R.error("站点号有误"+param.getStaNo());
//        }
//        if (param.getType()==0 && basDevp.getAgvStartPick()==1){
//            return R.ok();
//        }else if (param.getType()==1 && basDevp.getAgvStartPlace()==1){
//            return R.ok();
//        }else {
//            return R.error("不允许");
//        }
//    }
//    @Override
//    public R getAgvPickAndPlaceV2(TaskOverParam param) {
//        BasDevp basDevp = basDevpService.selectById(param.getStaNo());
//        if (Cools.isEmpty(basDevp)){
//            return R.error("站点号有误"+param.getStaNo());
//        }
//        if (param.getType()==0){
//            basDevp.setAgvTargetPick(1);
//            basDevpService.updateById(basDevp);
//            return R.ok();
//        }else if (param.getType()==1){
//            basDevp.setAgvTargetPlace(1);
//            basDevpService.updateById(basDevp);
//            return R.ok();
//        }else {
//            return R.error("请求类型异常"+param.getType());
//        }
//    }
    public List<Integer> getInEnableRoadway(){
        int[] roadway = null;
@@ -278,7 +330,7 @@
                } else {
                    staProtocol = staProtocol.clone();
                }
                Short workNo = staProtocol.getWorkNo();
                Integer workNo = staProtocol.getWorkNo();
                if (workNo == 0 && !staProtocol.isLoading()){
                    if (Cools.isEmpty( map.get(inSta.getStaNo()))){
                        continue;
@@ -314,7 +366,7 @@
                } else {
                    staProtocol = staProtocol.clone();
                }
                Short workNo = staProtocol.getWorkNo();
                Integer workNo = staProtocol.getWorkNo();
                if (workNo == 0 && !staProtocol.isLoading()){
                    if (Cools.isEmpty( map.get(inSta.getStaNo()))){
                        continue;