| | |
| | | package com.zy.api.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | |
| | | */ |
| | | @Override |
| | | public XSR receiveOrders(List<PubOrderParams> orderParams, String type) { |
| | | log.info("接收下发订单信息参数:{}", JSONObject.toJSONString(orderParams)); |
| | | orderParams.forEach(params -> { |
| | | if (params.getType().equals(OrderWkType.getTypeVal(params.getType()))) { |
| | | throw new CoolException("当前类型不是上架派工单!!"); |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public XSR getInDispatchResult(List<ReportOrderParam> params, Order order) { |
| | | log.info("上架派工单反馈请求参数:{}", JSONObject.toJSONString(params)); |
| | | if (Objects.isNull(params)) { |
| | | return XSR.error("参数不能为空!!"); |
| | | } |
| | |
| | | } |
| | | JSONObject jsonObject = JSONObject.parseObject(response); |
| | | Integer code = jsonObject.getInteger("code"); |
| | | log.info("上架派工单返回结果:{}", JSONObject.toJSONString(response)); |
| | | if (!Objects.isNull(code) && code.equals(200)) { |
| | | if (!Objects.isNull(order)) { |
| | | order.setReportOnce(5); |
| | |
| | | |
| | | /** |
| | | * 获取自定义请求头 |
| | | * |
| | | * @return java.util.Map<java.lang.String, java.lang.Object> |
| | | * @author Ryan |
| | | * @date 2025/12/29 9:11 |
| | | * @return java.util.Map<java.lang.String,java.lang.Object> |
| | | */ |
| | | private Map<String, Object> getHeaderParam() { |
| | | Map<String, Object> headerParam = new HashMap<>(); |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public XSR sendOutDispatch(List<PubOrderParams> pubOrderParams, String type) { |
| | | log.info("备货指示派工单下发参数:{}", JSONObject.toJSONString(pubOrderParams)); |
| | | |
| | | if (Objects.isNull(pubOrderParams) || pubOrderParams.isEmpty()) { |
| | | return XSR.error("参数不能为空!!"); |
| | | } |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public synchronized XSR basMatupdate(List<SyncMatParmas> params) { |
| | | log.info("基础零件变更:{}", JSONArray.toJSONString(params)); |
| | | |
| | | if (Objects.isNull(params) || params.isEmpty()) { |
| | | return XSR.error("参数不能为空!!"); |
| | | } |
| | |
| | | if (Objects.isNull(mats.getPro_type())) { |
| | | throw new CoolException("零件类型不能为空!!"); |
| | | } |
| | | Mat matnr = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", mats.getPro_komcode())); |
| | | if (Objects.isNull(mats.getPro_id())) { |
| | | throw new CoolException("供应商不能为空!!"); |
| | | } |
| | | Mat matnr = matService.selectOne(new EntityWrapper<Mat>() |
| | | .eq("supp_code", mats.getPro_id()) |
| | | .eq("matnr", mats.getPro_komcode())); |
| | | if (!Objects.isNull(matnr)) { |
| | | // 订单时间 |
| | | if (Utils.isValidFormat(mats.getUpdate_time(), "yyyy-MM-dd HH:mm:ss")) { |
| | |
| | | */ |
| | | @Override |
| | | public XSR getOutDetails(List<StockUpOrderParams> stockUpParams) { |
| | | log.info("备货单下发参数:{}", JSONArray.toJSONString(stockUpParams)); |
| | | |
| | | if (Objects.isNull(stockUpParams)) { |
| | | return XSR.error("参数不能为空!!"); |
| | | } |
| | |
| | | /** |
| | | * 零件损溢单下发 |
| | | * |
| | | * @author Ryan |
| | | * @date 2025/11/24 15:22 |
| | | * @param params |
| | | * @return com.core.common.R |
| | | * @author Ryan |
| | | * @date 2025/11/24 15:22 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public XSR sendStockAdjust(List<StockAdjustParams> params, Long userId) { |
| | | log.info("零件损溢单下发参数:{}", JSONArray.toJSONString(params)); |
| | | |
| | | if (Objects.isNull(params)) { |
| | | return XSR.error("参数不能为空!!"); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 损溢单完结上报 |
| | | * @author Ryan |
| | | * @date 2025/12/30 16:57 |
| | | * |
| | | * @param params |
| | | * @param order |
| | | * @return com.zy.api.entity.dto.XSR |
| | | * @author Ryan |
| | | * @date 2025/12/30 16:57 |
| | | */ |
| | | @Override |
| | | public XSR reportCheckOrder(List<StockAdjustParams> params, CheckOrder order) { |
| | |
| | | |
| | | /** |
| | | * 备货单反馈 |
| | | * |
| | | * @param params |
| | | * @param order |
| | | * @return |
| | |
| | | } |
| | | } |
| | | |
| | | /** 生成新的零件损溢单 |
| | | * @param userId */ |
| | | /** |
| | | * 备货指示派工单反馈 |
| | | * @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 + "/getOutDetailsResult") |
| | | .setJson(JSONObject.toJSONString(orderParams)) |
| | | .build() |
| | | .doPost(); |
| | | if (Objects.isNull(response) || response.trim().isEmpty()) { |
| | | 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 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void gentCheckOrders(StockAdjustParams params, Long userId) { |
| | | if (Objects.isNull(params.getDetails()) || params.getDetails().isEmpty()) { |