#
Junjie
1 天以前 8dc960dd9fda130ff19faaafed6b1234e622610b
src/main/java/com/zy/core/plugin/FakeProcess.java
@@ -8,10 +8,8 @@
import com.zy.asrs.domain.param.CreateOutTaskParam;
import com.zy.asrs.entity.*;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.StartupDto;
import com.zy.common.service.CommonService;
import com.zy.common.utils.HttpHandler;
import com.zy.common.utils.RedisUtil;
import com.zy.core.News;
import com.zy.core.cache.MessageQueue;
@@ -27,6 +25,7 @@
import com.zy.core.thread.StationThread;
import com.zy.core.utils.CrnOperateProcessUtils;
import com.zy.core.utils.StationOperateProcessUtils;
import com.zy.core.utils.WmsOperateUtils;
import com.zy.system.entity.Config;
import com.zy.system.service.ConfigService;
import lombok.extern.slf4j.Slf4j;
@@ -64,7 +63,7 @@
    @Autowired
    private StationOperateProcessUtils stationOperateProcessUtils;
    @Autowired
    private HttpRequestLogService httpRequestLogService;
    private WmsOperateUtils wmsOperateUtils;
    @Override
    public void run() {
@@ -372,55 +371,19 @@
                        continue;
                    }
                    String wmsUrl = null;
                    Config wmsSystemUriConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "wmsSystemUri"));
                    if (wmsSystemUriConfig != null) {
                        wmsUrl = wmsSystemUriConfig.getValue();
                    }
                    if(wmsUrl == null){
                        News.error("未配置WMS系统URI,配置文件Code编码:wmsSystemUri");
                        return;
                    }
                    String wmsSystemInUrl = null;
                    Config wmsSystemInUrlConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "wmsSystemInUrl"));
                    if (wmsSystemInUrlConfig != null) {
                        wmsSystemInUrl = wmsSystemInUrlConfig.getValue();
                    }
                    if(wmsSystemInUrlConfig == null){
                        News.error("未配置WMS入库接口地址,配置文件Code编码:wmsSystemInUrl");
                        return;
                    }
                    Object lock = redisUtil.get(RedisKeyType.GENERATE_IN_TASK_LIMIT.key + stationId);
                    if (lock != null) {
                        continue;
                    }
                    redisUtil.set(RedisKeyType.GENERATE_IN_TASK_LIMIT.key + stationId, "lock", 5);
                    HashMap<String, Object> requestParam = new HashMap<>();
                    String response = null;
                    try {
                        requestParam.put("barcode", stationProtocol.getBarcode());
                        requestParam.put("sourceStaNo", stationProtocol.getStationId());
                        requestParam.put("locType1", stationProtocol.getPalletHeight());
                        requestParam.put("row", Utils.getInTaskEnableRow());
                        response = new HttpHandler.Builder()
                                .setUri(wmsUrl)
                                .setPath(wmsSystemInUrl)
                                .setJson(JSON.toJSONString(requestParam))
                                .build()
                                .doPost();
                    String response = wmsOperateUtils.applyInTask(stationProtocol.getBarcode(), stationProtocol.getStationId(), stationProtocol.getPalletHeight());
                        JSONObject jsonObject = JSON.parseObject(response);
                        if (jsonObject.getInteger("code").equals(200)) {
                            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                            CreateInTaskParam taskParam = new CreateInTaskParam();
                            taskParam.setTaskNo(String.valueOf(dto.getTaskNo()));
                        taskParam.setTaskNo(dto.getTaskNo());
                            taskParam.setLocNo(dto.getLocNo());
                            taskParam.setTaskPri(dto.getTaskPri());
                            taskParam.setBarcode(stationProtocol.getBarcode());
@@ -432,19 +395,6 @@
                                continue;
                            }
                            MessageQueue.offer(SlaveType.Devp, basDevp.getDevpNo(), new Task(2, command));
                            News.info("请求WMS接口成功!!!url:{};request:{};response:{}", wmsUrl + wmsSystemInUrl, JSON.toJSONString(requestParam), response);
                        } else {
                            News.error("请求WMS接口失败!!!url:{};request:{};response:{}", wmsUrl + wmsSystemInUrl, JSON.toJSONString(requestParam), response);
                        }
                    } catch (Exception e) {
                        News.error("请求WMS接口异常!!!url:{};request:{};response:{}", wmsUrl + wmsSystemInUrl, JSON.toJSONString(requestParam), response, e);
                    } finally {
                        HttpRequestLog httpRequestLog = new HttpRequestLog();
                        httpRequestLog.setName(wmsUrl + wmsSystemInUrl);
                        httpRequestLog.setRequest(JSON.toJSONString(requestParam));
                        httpRequestLog.setResponse(response);
                        httpRequestLog.setCreateTime(new Date());
                        httpRequestLogService.insert(httpRequestLog);
                    }
                }
            }