自动化立体仓库 - WMS系统
zhangc
2025-01-08 617a8c4fc0b81ec4b96db8a013a91f4e666b0b96
src/main/java/com/zy/asrs/service/impl/AgvWrkMastServiceImp.java
@@ -29,6 +29,9 @@
@Slf4j
public class AgvWrkMastServiceImp extends ServiceImpl<AgvWrkMastMapper, AgvWrkMast> implements AgvWrkMastService {
    @Value("${agv.flag}")
    private boolean flag;
    @Value("${agv.url}")
    private String url;
@@ -63,13 +66,13 @@
    private AgvWrkMastService agvWrkMastService;
    public void updateWrkStsByWrkNo(int wrkNo, long wrkSts) {
    public Boolean updateWrkStsByWrkNo(int wrkNo, long wrkSts) {
        AgvWrkMast agvWrkMast = this.selectById(wrkNo);
        //判断要修改的工作档状态是否合理,如果不合理则抛出异常
        checkWrkSts(agvWrkMast, wrkSts);
        agvWrkMast.setWrkSts(wrkSts);
        agvWrkMast.setModiTime(new Date());
        this.updateById(agvWrkMast);
        return this.updateById(agvWrkMast);
    }
    public void updateWrkStsByWrkNo(int wrkNo, long wrkSts, String manuType, long userId) {
@@ -271,8 +274,12 @@
    }
    private int doHttpRequest(Object requestParam, String namespace, String url, String path, String appkey, String ip) {
        if (!flag) {
            return 1;
        }
        String response = "";
        boolean success = false;
        int code = 0;
        try {
            response = new HttpHandler.Builder()
                    .setUri(url)
@@ -283,7 +290,7 @@
                    .doPost();
            JSONObject jsonObject = JSON.parseObject(response);
            int code = Integer.parseInt(jsonObject.get("code").toString());
            code = Integer.parseInt(jsonObject.get("code").toString());
            if (code != 0) {
                if (code == 6) {
                    log.info("AGV任务单号已上报:{}", response);
@@ -300,19 +307,20 @@
            return code;
        } catch (Exception e) {
            log.error(e.getMessage());
            //TODO 张超
            throw new CoolException("调用AGV响应错误");
            //return 1;
        } finally {
            apiLogService.save(
                    namespace,
                    url + path,
                    appkey,
                    ip,
                    JSON.toJSONString(JSONObject.toJSONString(requestParam)),
                    response,
                    success
            );
            if (code != 6) {
                apiLogService.save(
                        namespace,
                        url + path,
                        appkey,
                        ip,
                        JSON.toJSONString(JSONObject.toJSONString(requestParam)),
                        response,
                        success
                );
            }
        }
    }