自动化立体仓库 - WCS系统
#
LSH
2023-11-17 33f0362968b36fab7fa33b3ee8f4c1d32644d355
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1,6 +1,7 @@
package com.zy.asrs.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
@@ -14,6 +15,7 @@
import com.zy.asrs.utils.PostMesDataUtils;
import com.zy.asrs.utils.Utils;
import com.zy.common.service.CommonService;
import com.zy.common.utils.HttpHandler;
import com.zy.core.CrnThread;
import com.zy.core.DevpThread;
import com.zy.core.cache.SlaveConnection;
@@ -320,25 +322,33 @@
                    // 双深库位且浅库位有货,则需先对浅库位进行库位移转
                    if (Utils.isDeepLoc(slaveProperties, taskWrk.getStartPoint())) {
                        taskWrkMapper.selectPakOutIoType(taskWrk.getCrnNo());
                        List<TaskWrk> taskWrks1 = taskWrkMapper.selectPakOutIoType(taskWrk.getCrnNo());
                        if (Cools.isEmpty(taskWrks1) && taskWrks1.size()!=0){
                            break;
                            continue;
                        }
                        String shallowLocNo = Utils.getShallowLoc(slaveProperties, taskWrk.getStartPoint());
                        LocMast shallowLoc = locMastService.selectById(shallowLocNo);
                        if (!shallowLoc.getLocSts().equals("O")){
                            // O.空库位、Q.拣料/盘点/并板再入库、S.入库预约、X.禁用 直接搬!
                            if (shallowLoc.getLocSts().equals("P") || shallowLoc.getLocSts().equals("R")) {
                                log.error("工作号={},库位号={},浅库位异常:浅库位号:={},库位状态={}",taskWrk.getTaskNo(),taskWrk.getStartPoint(),shallowLocNo,shallowLoc.getLocSts());
                            } else if (shallowLoc.getLocSts().equals("F") || shallowLoc.getLocSts().equals("D")) {
                                taskWrk.setTransferMark(1);
                                taskWrkMapper.updateById(taskWrk);
                                WMSAndAGVInterfaceParam param = new WMSAndAGVInterfaceParam();
                                param.setTaskNo(taskWrk.getTaskNo());
                                new PostMesDataUtils().postMesData("MES系统",wmsUrl,movePath,param);
                                log.error("工作号={},库位号={},浅库位需要移库:浅库位号:={},库位状态={}",taskWrk.getTaskNo(),taskWrk.getStartPoint(),shallowLocNo,shallowLoc.getLocSts());
                            } else if (shallowLoc.getLocSts().equals("Q") || shallowLoc.getLocSts().equals("S")) {
                                log.error("工作号={},库位号={},浅库位异常:浅库位号:={},库位状态={}",taskWrk.getTaskNo(),taskWrk.getStartPoint(),shallowLocNo,shallowLoc.getLocSts());
                        TaskWrk hallowLocNoTask = taskWrkMapper.selectByStartPoint(shallowLocNo);
                        if (!Cools.isEmpty(hallowLocNoTask)){
                            if (!Cools.isEmpty(hallowLocNoTask.getTargetPoint())){
                                continue;
                            }
//                            new PostMesDataUtils().postMesData("移库任务分配库位",wmsUrl,movePath,hallowLocNoTask);
                            try {
                                String response = new HttpHandler.Builder()
                                        .setUri(wmsUrl)
                                        .setPath(movePath)
                                        .setJson(JSON.toJSONString(hallowLocNoTask))
                                        .build()
                                        .doPost();
                                System.out.println("response:"+response);
                                JSONObject jsonObject = JSON.parseObject(response);
                                if (jsonObject.getInteger("code").equals(200)) {
                                    //解析
                                }
                            }catch (Exception e){
                                log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl+"/"+movePath, JSON.toJSONString(hallowLocNoTask), "请求移库任务分配库位");
                            }
                            continue;
                        }
@@ -382,7 +392,7 @@
            // 获取工作状态为11(生成出库ID)的移库工作档
            List<TaskWrk> taskWrks = taskWrkMapper.selectPakOut3(slave.getId(), crnStn.getStaNo().toString());
            for (TaskWrk taskWrk : taskWrks){
                if (taskWrk == null) {
                if (taskWrk == null || Cools.isEmpty(taskWrk.getTargetPoint()) || taskWrk.getTargetPoint().equals("")) {
                    continue;
                }
                // 工作档状态判断