| | |
| | | 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 com.zy.api.enums.OrderWkType; |
| | | import com.zy.api.service.KopenApiService; |
| | | import com.zy.asrs.entity.CheckOrder; |
| | | import com.zy.asrs.entity.CheckOrderDetl; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.Mat; |
| | | import com.zy.asrs.entity.Order; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.enums.CommonEnum; |
| | | import com.zy.asrs.enums.OrderSettle; |
| | | import com.zy.asrs.enums.OrderTypeEnum; |
| | | import com.zy.asrs.service.CheckOrderDetlService; |
| | | import com.zy.asrs.service.CheckOrderService; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.service.MatService; |
| | | import com.zy.asrs.service.OrderDetlService; |
| | | import com.zy.asrs.service.OrderService; |
| | | import com.zy.asrs.service.*; |
| | | |
| | | import com.zy.asrs.service.impl.BasAreasServiceImpl; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | @Service("kopenApiServiceImpl") |
| | |
| | | private String port; |
| | | @Value("${kopen.prefix}") |
| | | private String prefix; |
| | | @Autowired |
| | | private BasAreasService basAreasService; |
| | | |
| | | |
| | | /** |
| | |
| | | if (!Objects.isNull(code) && code.equals(200)) { |
| | | if (!Objects.isNull(order)) { |
| | | order.setReportOnce(5); |
| | | order.setSettle(6L); |
| | | orderService.updateById(order); |
| | | } |
| | | return XSR.ok("入库单上报完成!!"); |
| | |
| | | * @return com.core.common.R |
| | | */ |
| | | @Override |
| | | public XSR getStockInfo(PageRequestParams params) { |
| | | EntityWrapper<LocDetl> wrapper = new EntityWrapper<>(); |
| | | if (!Objects.isNull(params.getPro_id())) { |
| | | wrapper.eq("supp_code", params.getPro_id()); |
| | | public XSR getStockInfo(List<PageRequestParams> params) { |
| | | 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(); |
| | | } |
| | | |
| | | Page<LocDetl> locDetls = locDetlService.selectPage(new Page<>(params.getCurr(), params.getLimit()), wrapper); |
| | | |
| | | return XSR.ok(locDetls.getRecords()); |
| | | 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())); |
| | | } |
| | | if (item.getBookQty().compareTo(BigDecimal.ZERO) == 0) { |
| | | locDetlDto.setStock_qty(item.getAnfme().intValue()); |
| | | } else { |
| | | locDetlDto.setStock_qty(Integer.parseInt(item.getBookQty().toString())); |
| | | } |
| | | LocDetl barcode = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("barcode", item.getZpallet())); |
| | | if (!Objects.isNull(barcode)) { |
| | | BasAreas areas = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("id", barcode.getAreaId())); |
| | | if (!Objects.isNull(areas)) { |
| | | locDetlDto.setLocation_no(areas.getName()); |
| | | } |
| | | } |
| | | locDetlDto |
| | | .setPro_komcode(item.getMatnr()) |
| | | .setPro_id(item.getStandby1()) |
| | | .setLocation_no(item.getZpallet()) |
| | | .setTarget_location(""); |
| | | dtos.add(locDetlDto); |
| | | }); |
| | | return XSR.ok(dtos); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 备货指示派工单反馈 |
| | | * @author Ryan |
| | | * @date 2026/1/15 15:20 |
| | | * @param orderParams |
| | | * @param order |
| | | * @return com.zy.api.entity.dto.XSR |
| | | */ |
| | | @Override |
| | | public XSR reportOutDetailsResult(List<ReportOrderParam> orderParams, Order order) { |
| | | if (Objects.isNull(orderParams)) { |
| | | return XSR.error("参数不能为空!!"); |
| | | } |
| | | String response = null; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(url + ":" + port) |
| | | .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); |
| | | Integer code = jsonObject.getInteger("code"); |
| | | if (!Objects.isNull(code) && code.equals(200)) { |
| | | if (!Objects.isNull(order)) { |
| | | order.setReportOnce(5); |
| | | orderService.updateById(order); |
| | | } |
| | | return XSR.ok("入库单上报完成!!"); |
| | | } else { |
| | | if (!Objects.isNull(order)) { |
| | | int reportOnce = order.getReportOnce(); |
| | | reportOnce++; |
| | | order.setReportOnce(reportOnce); |
| | | orderService.updateById(order); |
| | | } |
| | | String msg = jsonObject.getString("message"); |
| | | return XSR.error(Objects.isNull(msg) ? "上报失败!!" : msg); |
| | | } |
| | | } catch (Exception e) { |
| | | if (!Objects.isNull(order)) { |
| | | int reportOnce = order.getReportOnce(); |
| | | reportOnce++; |
| | | order.setReportOnce(reportOnce); |
| | | orderService.updateById(order); |
| | | } |
| | | log.error(e.getMessage(), e); |
| | | return XSR.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 生成新的零件损溢单 |
| | | * |
| | | * @param userId |