| | |
| | | package com.zy.asrs.task; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.param.ShuttleTask; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.task.handler.ErrorStockHandler; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/7/7 |
| | |
| | | |
| | | @Autowired |
| | | private ErrorStockHandler errorStockHandler; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | |
| | | @Value("${shuttleWcs.url}") |
| | | private String shuttleWcsUrl; |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | private void execute(){ |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "0/15 * * * * ? ") |
| | | private void execute2() { |
| | | String response = null; |
| | | try { |
| | | ShuttleTask param = new ShuttleTask(); |
| | | response = new HttpHandler.Builder() |
| | | .setUri(shuttleWcsUrl) |
| | | .setJson(JSON.toJSONString(param)) |
| | | .setPath("/openapi/getAllLocInformation") |
| | | .build() |
| | | .doPost(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | Integer code = jsonObject.getInteger("code"); |
| | | if (code.equals(200)) { |
| | | String data = jsonObject.getString("data"); |
| | | List<LocMast> locMasts = JSONArray.parseArray(data, LocMast.class); |
| | | for (LocMast locMast : locMasts) { |
| | | if (locMast.getLocNo().startsWith("02003") || locMast.getLocNo().startsWith("12003")) { |
| | | continue; |
| | | } |
| | | String locNo = locMast.getLocNo(); |
| | | int row = Integer.parseInt(locNo.substring(0, 2)) + 4; |
| | | if (row >= 10) { |
| | | locNo = row + locMast.getLocNo().substring(2); |
| | | } else { |
| | | locNo = "0" + row + locMast.getLocNo().substring(2); |
| | | } |
| | | LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locNo)); |
| | | if (locMast1 == null) { |
| | | log.info("库位不匹配"); |
| | | } else { |
| | | if (locMast1.getLocSts().equalsIgnoreCase("X") && (locMast.getLocSts().equalsIgnoreCase("W") || locMast.getLocSts().equalsIgnoreCase("E"))) { |
| | | |
| | | } else if (!locMast1.getLocSts().equalsIgnoreCase(locMast.getLocSts())) { |
| | | log.info("库位状态不匹配{},WMS:{},RCS:{}", locMast1.getLocNo(), locMast1.getLocSts(), locMast.getLocSts()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |