| | |
| | | import com.zy.api.entity.StockAdjustParams; |
| | | import com.zy.api.entity.StockUpOrderParams; |
| | | import com.zy.api.entity.SyncMatParmas; |
| | | import com.zy.api.entity.dto.LocDetlDto; |
| | | import com.zy.api.entity.dto.XSR; |
| | | import com.zy.api.enums.MatLocType; |
| | | import com.zy.api.enums.OrderType; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | @Service("kopenApiServiceImpl") |
| | |
| | | */ |
| | | @Override |
| | | public XSR getStockInfo(List<PageRequestParams> params) { |
| | | EntityWrapper<LocDetl> wrapper = new EntityWrapper<>(); |
| | | if (!Objects.isNull(params.getPro_id())) { |
| | | wrapper.eq("supp_code", params.getPro_id()); |
| | | if (Objects.isNull(params) || params.isEmpty()) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | if (!Objects.isNull(params.getPro_komcode())) { |
| | | wrapper.eq("matnr", params.getPro_komcode()); |
| | | List<LocDetl> detls = new ArrayList<>(); |
| | | params.forEach(param -> { |
| | | List<LocDetl> selectList = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("supp_code", param.getPro_id()).eq("matnr", param.getPro_komcode())); |
| | | if (selectList != null && !selectList.isEmpty()) { |
| | | detls.addAll(selectList); |
| | | } |
| | | }); |
| | | |
| | | if (detls == null || detls.isEmpty()) { |
| | | return XSR.ok(); |
| | | } |
| | | List<LocDetlDto> dtos = new ArrayList<>(); |
| | | detls.forEach(item -> { |
| | | LocDetlDto locDetlDto = new LocDetlDto(); |
| | | if (item.getDiffQty().compareTo(BigDecimal.ZERO) == 0) { |
| | | locDetlDto.setLock_qty(0); |
| | | } else { |
| | | locDetlDto.setLock_qty(Integer.parseInt(item.getDiffQty().toString())); |
| | | } |
| | | |
| | | Page<LocDetl> locDetls = locDetlService.selectPage(new Page<>(params.getCurr(), params.getLimit()), wrapper); |
| | | |
| | | return XSR.ok(locDetls.getRecords()); |
| | | if (item.getBookQty().compareTo(BigDecimal.ZERO) == 0) { |
| | | locDetlDto.setStock_qty(0); |
| | | } else { |
| | | locDetlDto.setStock_qty(Integer.parseInt(item.getBookQty().toString())); |
| | | } |
| | | locDetlDto |
| | | .setPro_komcode(item.getMatnr()) |
| | | .setPro_id(item.getStandby1()) |
| | | .setLocation_no(item.getZpallet()) |
| | | .setTarget_location(""); |
| | | dtos.add(locDetlDto); |
| | | }); |
| | | return XSR.ok(dtos); |
| | | } |
| | | |
| | | /** |
| | |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(url + ":" + port) |
| | | .setPath(prefix + "/getOutDetailsResult") |
| | | .setPath(prefix + "/getOutDispatchResult") |
| | | .setJson(JSONObject.toJSONString(orderParams)) |
| | | .build() |
| | | .doPost(); |
| | | if (Objects.isNull(response) || response.trim().isEmpty()) { |
| | | if (!Objects.isNull(order)) { |
| | | int reportOnce = order.getReportOnce(); |
| | | reportOnce++; |
| | | order.setReportOnce(reportOnce); |
| | | orderService.updateById(order); |
| | | } |
| | | return XSR.error("外网接口无响应!!"); |
| | | } |
| | | JSONObject jsonObject = JSONObject.parseObject(response); |