Administrator
2 天以前 aa33e56e37cd19b88ae8eea69c5ebc7c6da8b1d2
src/main/java/com/zy/asrs/task/TaskReportScheduler.java
@@ -36,6 +36,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * 定时将任务(完成、取消)转成日志
@@ -80,6 +81,56 @@
        add(301);add(302);add(303);add(304);add(305);add(306);add(307);add(308);
    }};
    // WMS分配入库库位异常上报
    @Scheduled(cron = "0/5 * * * * ? ")
    public synchronized void locationAssignmentExceptionEscalation() {
        List<TaskWrk> taskWrkList = taskWrkMapper.selectList(new EntityWrapper<TaskWrk>().eq("wrk_sts", 5));
        for(TaskWrk taskWrk : taskWrkList) {
            Date now = new Date();
            WmsFeedback wmsFeedback = new WmsFeedback();
            wmsFeedback.setTaskNo(taskWrk.getTaskNo());
            wmsFeedback.setIoType(taskWrk.getIoType());
            wmsFeedback.setBarcode(taskWrk.getBarcode());
            wmsFeedback.setStatus(-1); // 入库库位分配异常
            wmsFeedback.setReportTime(DateUtils.convert(now));
            String response = "";
            boolean bool = false;
            try {
                log.info("入库wms分配库位有误上报wms={}", taskWrk);
                response = new HttpHandler.Builder()
                        // .setHeaders(headParam)
                        .setUri(wmsUrl)
                        .setPath(TaskExecCallback)
                        .setJson(JSON.toJSONString(wmsFeedback))
                        .build()
                        .doPost();
                if (!Cools.isEmpty(response)) {
                    JSONObject jsonObject = JSON.parseObject(response);
                    if (Integer.parseInt(String.valueOf(jsonObject.get("code"))) == 200) {
                        bool = true;
                        taskWrk.setWrkSts(6);
                        taskWrk.setModiTime(now);
                        taskWrkMapper.updateById(taskWrk);
                    }
                }
            } catch (Exception e) {
                log.error("入库wms分配库位有误上报wms失败{},返回值={}", taskWrk, response);
            } finally {
                apiLogService.save("wms分配库位有误上报"
                        , wmsUrl + TaskExecCallback
                        , null
                        , "127.0.0.1"
                        , JSON.toJSONString(wmsFeedback)
                        , response
                        , bool
                );
            }
        }
    }
    @Scheduled(cron = "0/5 * * * * ? ")
    public synchronized void execute() throws IOException {
        Page<TaskWrkReport> taskWrkReportPage = taskWrkReportService.selectPage(new Page<>(0, 100), new EntityWrapper<TaskWrkReport>().orderBy("create_time", true));