自动化立体仓库 - WMS系统
src/main/java/com/zy/common/web/WcsController.java
@@ -1,5 +1,8 @@
package com.zy.common.web;
import com.alibaba.excel.util.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.core.common.Cools;
@@ -7,22 +10,29 @@
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.EmptyPlateOutParam;
import com.zy.asrs.entity.rcs.RcsReturn;
import com.zy.asrs.entity.result.FindLocNoAttributeVo;
import com.zy.asrs.service.*;
import com.zy.asrs.service.impl.RcsServiceImpl;
import com.zy.common.CodeRes;
import com.zy.common.model.LocTypeDto;
import com.zy.common.model.StartupDto;
import com.zy.common.service.CommonService;
import com.zy.common.utils.RedisUtil;
import com.zy.common.web.param.SearchLocParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import static com.zy.asrs.service.impl.RcsServiceImpl.sendPost;
/**
 * Created by vincent on 2020/10/30
@@ -50,13 +60,23 @@
    private RowLastnoService rowLastnoService;
    @Autowired
    private WorkService workService;
    @Autowired
    private RedisUtil redisUtil;
    @Value("${hik.url}")
    private String HIK_URL;
    private static final String IS_START_PRE_SCHEDULE = "schedule:check";
    // TODO:称重、拍照上报存储,CTU料箱运转
    @PostMapping("/pakin/loc/v1")
    @ResponseBody
    public synchronized R getLocNo(@RequestBody SearchLocParam param) {
        log.info("收到WCS入库接口请求====>>入参:{}", param);
        PreScheduling();
        if (Cools.isEmpty(param.getIoType())) {
            return R.error("入出库类型不能为空");
        }
@@ -313,4 +333,27 @@
        return dto;
    }
    public void PreScheduling(){
        if (redisUtil.get(IS_START_PRE_SCHEDULE)!=null && redisUtil.get(IS_START_PRE_SCHEDULE).equals("T")){
            return;
        }else {
            redisUtil.set(IS_START_PRE_SCHEDULE, "T",70);
        }
        String url = "api/robot/controller/task/pretask";
        String URL = HIK_URL + url;
        JSONObject preSchedule = new JSONObject();
        preSchedule.put("siteCode", "106");
        preSchedule.put("nextTaskTime", "70");
        preSchedule.put("robotType", "18,25");
        preSchedule.put("taskCount", 3);
        String response = sendPost(URL, JSONObject.toJSONString(preSchedule));
        if (!StringUtils.isEmpty(response) && response.contains("code")){
            log.info("预调度成功{}", preSchedule);
        } else {
            log.info("预调度失败{}", preSchedule);
        }
    }
}