| | |
| | | } else { |
| | | if (!Objects.isNull(order)) { |
| | | int reportOnce = order.getReportOnce(); |
| | | reportOnce ++; |
| | | reportOnce++; |
| | | order.setReportOnce(reportOnce); |
| | | orderService.updateById(order); |
| | | } |
| | |
| | | } catch (Exception e) { |
| | | if (!Objects.isNull(order)) { |
| | | int reportOnce = order.getReportOnce(); |
| | | reportOnce ++; |
| | | reportOnce++; |
| | | order.setReportOnce(reportOnce); |
| | | orderService.updateById(order); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 获取自定义请求头 |
| | | * |
| | | * @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<>(); |
| | |
| | | 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")) { |
| | |
| | | // 判断订单是否存在 |
| | | if (Objects.isNull(order)) { |
| | | /** 不存在,新增订单 */ |
| | | generateOrders(params); |
| | | generateOrders(params, type); |
| | | } else { |
| | | if (order.getSettle() == 2) { |
| | | throw new CoolException("订单已处理,不可再变更!!"); |
| | |
| | | if (!orderService.deleteById(order.getId())) { |
| | | throw new CoolException("原单据删除失败!!"); |
| | | } |
| | | generateOrders(params); |
| | | generateOrders(params, type); |
| | | } |
| | | } |
| | | |
| | |
| | | * 生成订单信息 |
| | | * |
| | | * @param params |
| | | * @param type |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void generateOrders(PubOrderParams params) { |
| | | public void generateOrders(PubOrderParams params, String type) { |
| | | // 将数据当新订单插入 |
| | | Order newOrder = new Order(); |
| | | // 派工单号 |
| | |
| | | |
| | | if (OrderType.ORDER_IN.type.equals(OrderWkType.getTypeVal(params.getType()))) { |
| | | // 入库 |
| | | orderItem.setAnfme(Math.round(item.getInv_qty() * 10000) / 10000.0); |
| | | if (type.equals("add")) { |
| | | orderItem.setAnfme(Math.round(item.getInv_qty() * 10000) / 10000.0); |
| | | } else { |
| | | orderItem.setAnfme(Math.round(item.getNew_qty() * 10000) / 10000.0); |
| | | } |
| | | } else if (OrderType.ORDER_OUT.type.equals(OrderWkType.getTypeVal(params.getType()))) { |
| | | // 出库 |
| | | if (OrderWkType.ORDER_WK_ORDER_OUT.val.equals(params.getType())) { |
| | |
| | | } else if (OrderWkType.ORDER_WK_ORDER_OUT_EO.val.equals(params.getType()) |
| | | || OrderWkType.ORDER_WK_ORDER_OUT_SO.val.equals(params.getType())) { |
| | | // 备货指示派工单(EO/SO)出库 |
| | | orderItem.setAnfme(Math.round(item.getOrder_qty() * 10000) / 10000.0); |
| | | if (type.equals("add")) { |
| | | orderItem.setAnfme(Math.round(item.getOrder_qty() * 10000) / 10000.0); |
| | | } else { |
| | | orderItem.setAnfme(Math.round(item.getNew_qty() * 10000) / 10000.0); |
| | | } |
| | | } |
| | | } |
| | | orderItem.setMatnr(matnr.getMatnr()); |
| | |
| | | wrapper.eq("matnr", params.getPro_komcode()); |
| | | } |
| | | |
| | | Page<LocDetl> locDetls = locDetlService.selectPage(new Page<>(params.getCurr(), params.getLimit()), wrapper); |
| | | Page<LocDetl> locDetls = locDetlService.selectPage(new Page<>(params.getCurr(), params.getLimit()), wrapper); |
| | | |
| | | return XSR.ok(locDetls.getRecords()); |
| | | } |
| | | |
| | | /** |
| | | * 零件损溢单下发 |
| | | * |
| | | * @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) |
| | |
| | | |
| | | /** |
| | | * 损溢单完结上报 |
| | | * @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) { |
| | |
| | | } else { |
| | | if (!Objects.isNull(order)) { |
| | | int reportOnce = order.getReportOnce(); |
| | | reportOnce ++; |
| | | reportOnce++; |
| | | order.setReportOnce(reportOnce); |
| | | checkOrderService.updateById(order); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 备货单反馈 |
| | | * |
| | | * @param params |
| | | * @param order |
| | | * @return |
| | |
| | | } else { |
| | | if (!Objects.isNull(order)) { |
| | | int reportOnce = order.getReportOnce(); |
| | | reportOnce ++; |
| | | reportOnce++; |
| | | order.setReportOnce(reportOnce); |
| | | orderService.updateById(order); |
| | | } |
| | |
| | | } catch (Exception e) { |
| | | if (!Objects.isNull(order)) { |
| | | int reportOnce = order.getReportOnce(); |
| | | reportOnce ++; |
| | | reportOnce++; |
| | | order.setReportOnce(reportOnce); |
| | | orderService.updateById(order); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** 生成新的零件损溢单 |
| | | * @param userId */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** |
| | | * 生成新的零件损溢单 |
| | | * |
| | | * @param userId |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void gentCheckOrders(StockAdjustParams params, Long userId) { |
| | | if (Objects.isNull(params.getDetails()) || params.getDetails().isEmpty()) { |
| | | throw new CoolException("订单明细不能为空!!"); |