whycxzp
2025-04-23 c330e65b8ea172fface685efaa8e9c2e8a7f9520
src/main/java/com/whyc/service/WmsService.java
@@ -92,6 +92,54 @@
        return response;
    }
    public Response sendTaskInbound(WmsTaskDto taskDto) {
        String httpUrl = "http://192.168.10.133:8051"+"/api/wms_task/inbound";
        Response response = HttpUtil.doPost(httpUrl, JsonUtil.getGson().toJson(taskDto));
        //对结果进行处理
        if(response.getCode() == 1){ //请求成功,data有正常数据
            String dataStr = (String) response.getData();
            WmsTaskResponse responseInside = JsonUtil.getGson().fromJson(dataStr, WmsTaskResponse.class);
            response.set(1,responseInside);
            if(responseInside.getCode() ==0) {
                //对下发的任务进行数据库存储
                Date date = new Date();
                String pallet = taskDto.getPallet_code();
                String startLocationCode = taskDto.getStartlocation_code();
                //1=搬运空托,2=搬运电池. 转化到字段Des中,1001=搬运空托,1002=搬运电池
                Integer type = taskDto.getType();
                String taskNo = responseInside.getTask_no();
                Task task = new Task();
                task.setTaskNo(taskNo);
                task.setPallets(pallet);
                task.setStartLocationCode(startLocationCode);
                task.setDes(type ==1?1001:1002);
                task.setCreateTime(date);
                taskService.add(task);
            }
        }
        return response;
    }
    public Response stopTask(WmsTaskStopDto stopDto) {
        String httpUrl = "http://192.168.10.133:8051"+"/api/wms_task/inbound";
        Response response = HttpUtil.doPost(httpUrl, JsonUtil.getGson().toJson(stopDto));
        //对结果进行处理
        if(response.getCode() == 1){ //请求成功,data有正常数据
            String dataStr = (String) response.getData();
            WmsResponseTaskStopDto responseInside = JsonUtil.getGson().fromJson(dataStr, WmsResponseTaskStopDto.class);
            response.set(1,responseInside);
            /*if(responseInside.getCode() ==0) {
            }*/
        }
        return response;
    }
    public Response getLocationList() {
        String httpUrl = "http://192.168.10.133:8051"+"/api/wms_location/get_all";
        Response response = HttpUtil.doGet(httpUrl, (String) null);
@@ -136,7 +184,7 @@
        //通过taskNo从数据库查找对应的记录
        Task taskInDB = taskService.getByTaskNo(taskNo);
        if(taskInDB == null){
            return new Response<>().setII(1,"未找到对应的任务");
            return new Response<>().setII(1,"任务上报失败,无法定位到任务,任务可能不是通过监控平台下发");
        }
        Task task = new Task();
        task.setTaskNo(taskNo);
@@ -184,7 +232,11 @@
                task.setActivationChamberStartTime(statusTime);
            }break;
            case 14:
                task.setActivationChamberPickUpTime(statusTime);break;
            case 24:
                //测压任务,开始取测压结束的电池. 读取abe_inf表中的内阻,插入到任务里
                AbeInf abeInf = abeInfService.get();
                task.setNowMonRes(abeInf.getNowMonRes());
                task.setActivationChamberPickUpTime(statusTime);break;
            case 15:
            case 25: