| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.param.ShuttleTask; |
| | | import com.zy.asrs.service.LocMastService; |
| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | @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")) { |
| | | |
| | | } else if (!locMast1.getLocSts().equalsIgnoreCase(locMast.getLocSts())) { |
| | | log.info("库位状态不匹配{},WMS:{},RCS:{}", locMast1.getLocNo(), locMast1.getLocSts(), locMast.getLocSts()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // @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")) { |
| | | // |
| | | // } else if (!locMast1.getLocSts().equalsIgnoreCase(locMast.getLocSts())) { |
| | | // log.info("库位状态不匹配{},WMS:{},RCS:{}", locMast1.getLocNo(), locMast1.getLocSts(), locMast.getLocSts()); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | } |