diff --git a/klp-wms/src/main/java/com/klp/controller/WmsDeliveryWaybillDetailController.java b/klp-wms/src/main/java/com/klp/controller/WmsDeliveryWaybillDetailController.java index 3130c895..9b773d73 100644 --- a/klp-wms/src/main/java/com/klp/controller/WmsDeliveryWaybillDetailController.java +++ b/klp-wms/src/main/java/com/klp/controller/WmsDeliveryWaybillDetailController.java @@ -6,6 +6,7 @@ import java.util.Date; import org.springframework.format.annotation.DateTimeFormat; import com.klp.domain.vo.WmsMaterialCoilBindVo; +import com.klp.domain.vo.WmsDeliveryCoilRelationVo; import lombok.RequiredArgsConstructor; import javax.servlet.http.HttpServletResponse; import javax.validation.constraints.*; @@ -71,6 +72,17 @@ public class WmsDeliveryWaybillDetailController extends BaseController { return R.ok(iWmsDeliveryWaybillDetailService.queryById(detailId)); } + /** + * 根据钢卷ID查询发货关联信息(发货单明细+发货单+发货计划+钢卷信息) + * + * @param coilId 钢卷ID + */ + @GetMapping("/coilRelation/{coilId}") + public R getCoilRelation(@NotNull(message = "钢卷ID不能为空") + @PathVariable Long coilId) { + return R.ok(iWmsDeliveryWaybillDetailService.queryRelationByCoilId(coilId)); + } + /** * 新增发货单明细 */ diff --git a/klp-wms/src/main/java/com/klp/domain/vo/WmsDeliveryCoilRelationVo.java b/klp-wms/src/main/java/com/klp/domain/vo/WmsDeliveryCoilRelationVo.java new file mode 100644 index 00000000..1a57816f --- /dev/null +++ b/klp-wms/src/main/java/com/klp/domain/vo/WmsDeliveryCoilRelationVo.java @@ -0,0 +1,183 @@ +package com.klp.domain.vo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.math.BigDecimal; + +/** + * 根据钢卷ID查询发货关联信息VO + * + * @author klp + * @date 2025-11-25 + */ +@Data +public class WmsDeliveryCoilRelationVo implements Serializable { + + private static final long serialVersionUID = 1L; + + // ==================== 发货单明细信息 ==================== + /** + * 明细唯一ID + */ + private Long detailId; + + /** + * 关联发货单主表ID + */ + private Long waybillId; + + /** + * 关联钢卷表ID + */ + private Long coilId; + + private String productName; + + private String edgeType; + + private String packaging; + + private String settlementType; + + private String rawMaterialFactory; + + private String coilNo; + + private String specification; + + private String material; + + private Long quantity; + + private BigDecimal weight; + + private BigDecimal unitPrice; + + private String remark; + + // ==================== 发货单信息 ==================== + /** + * 发货单唯一ID + */ + private Long waybillId2; + + /** + * 发货单编号 + */ + private String waybillNo; + + /** + * 发货单名称 + */ + private String waybillName; + + /** + * 关联发货计划ID + */ + private Long planId; + + /** + * 车牌 + */ + private String licensePlate; + + /** + * 收货单位 + */ + private String consigneeUnit; + + /** + * 发货单位 + */ + private String senderUnit; + + /** + * 发货时间 + */ + private Date deliveryTime; + + /** + * 磅房 + */ + private String weighbridge; + + /** + * 销售 + */ + private String salesPerson; + + /** + * 负责人 + */ + private String principal; + + /** + * 负责人电话 + */ + private String principalPhone; + + /** + * 完成状态(0=待发货,1=已发货,2=已完成,3=取消) + */ + private Long status; + + /** + * 发货单备注 + */ + private String waybillRemark; + + // ==================== 发货计划信息 ==================== + /** + * 计划唯一ID + */ + private Long planId2; + + /** + * 发货计划名称 + */ + private String planName; + + /** + * 计划日期 + */ + private Date planDate; + + /** + * 计划类型: 发货0,收货1 + */ + private Integer planType; + + /** + * 计划备注 + */ + private String planRemark; + + /** + * 审核状态 + */ + private Integer auditStatus; + + /** + * 审核人 + */ + private String auditBy; + + /** + * 审核时间 + */ + private Date auditTime; + + // ==================== 钢卷信息 ==================== + /** + * 入场钢卷号 + */ + private String enterCoilNo; + + /** + * 当前钢卷号 + */ + private String currentCoilNo; + +} diff --git a/klp-wms/src/main/java/com/klp/service/IWmsDeliveryWaybillDetailService.java b/klp-wms/src/main/java/com/klp/service/IWmsDeliveryWaybillDetailService.java index 49b43244..9f2149c2 100644 --- a/klp-wms/src/main/java/com/klp/service/IWmsDeliveryWaybillDetailService.java +++ b/klp-wms/src/main/java/com/klp/service/IWmsDeliveryWaybillDetailService.java @@ -2,6 +2,7 @@ package com.klp.service; import com.klp.domain.WmsDeliveryWaybillDetail; import com.klp.domain.vo.WmsDeliveryWaybillDetailVo; +import com.klp.domain.vo.WmsDeliveryCoilRelationVo; import com.klp.domain.bo.WmsDeliveryWaybillDetailBo; import com.klp.common.core.page.TableDataInfo; import com.klp.common.core.domain.PageQuery; @@ -23,6 +24,11 @@ public interface IWmsDeliveryWaybillDetailService { */ WmsDeliveryWaybillDetailVo queryById(Long detailId); + /** + * 根据钢卷ID查询发货关联信息(发货单明细+发货单+发货计划+钢卷信息) + */ + WmsDeliveryCoilRelationVo queryRelationByCoilId(Long coilId); + /** * 查询发货单明细列表 */ diff --git a/klp-wms/src/main/java/com/klp/service/impl/WmsDeliveryWaybillDetailServiceImpl.java b/klp-wms/src/main/java/com/klp/service/impl/WmsDeliveryWaybillDetailServiceImpl.java index ce4ad545..cd2ad4ef 100644 --- a/klp-wms/src/main/java/com/klp/service/impl/WmsDeliveryWaybillDetailServiceImpl.java +++ b/klp-wms/src/main/java/com/klp/service/impl/WmsDeliveryWaybillDetailServiceImpl.java @@ -8,15 +8,18 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.klp.common.exception.ServiceException; import com.klp.common.utils.StringUtils; +import com.klp.domain.WmsDeliveryPlan; import com.klp.domain.WmsDeliveryWaybill; import com.klp.domain.WmsDeliveryWaybillDetail; import com.klp.domain.WmsMaterialCoil; +import com.klp.mapper.WmsDeliveryPlanMapper; import com.klp.mapper.WmsDeliveryWaybillDetailMapper; import com.klp.mapper.WmsDeliveryWaybillMapper; import com.klp.mapper.WmsMaterialCoilMapper; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import com.klp.domain.bo.WmsDeliveryWaybillDetailBo; +import com.klp.domain.vo.WmsDeliveryCoilRelationVo; import com.klp.domain.vo.WmsDeliveryWaybillDetailVo; import com.klp.domain.vo.WmsCoilBindInfoVo; import com.klp.service.IWmsDeliveryWaybillDetailService; @@ -40,6 +43,8 @@ public class WmsDeliveryWaybillDetailServiceImpl implements IWmsDeliveryWaybillD private final WmsMaterialCoilMapper wmsMaterialCoilMapper; + private final WmsDeliveryPlanMapper wmsDeliveryPlanMapper; + /** * 查询发货单明细 */ @@ -48,6 +53,90 @@ public class WmsDeliveryWaybillDetailServiceImpl implements IWmsDeliveryWaybillD return baseMapper.selectVoById(detailId); } + /** + * 根据钢卷ID查询发货关联信息(发货单明细+发货单+发货计划+钢卷信息) + */ + @Override + public WmsDeliveryCoilRelationVo queryRelationByCoilId(Long coilId) { + if (coilId == null) { + return null; + } + + // 查询发货单明细 + LambdaQueryWrapper detailWrapper = Wrappers.lambdaQuery(); + detailWrapper.eq(WmsDeliveryWaybillDetail::getCoilId, coilId); + detailWrapper.eq(WmsDeliveryWaybillDetail::getDelFlag, 0); + WmsDeliveryWaybillDetail detail = baseMapper.selectOne(detailWrapper); + + if (detail == null) { + return null; + } + + WmsDeliveryCoilRelationVo vo = new WmsDeliveryCoilRelationVo(); + + // 发货单明细信息 + vo.setDetailId(detail.getDetailId()); + vo.setWaybillId(detail.getWaybillId()); + vo.setCoilId(detail.getCoilId()); + vo.setProductName(detail.getProductName()); + vo.setEdgeType(detail.getEdgeType()); + vo.setPackaging(detail.getPackaging()); + vo.setSettlementType(detail.getSettlementType()); + vo.setRawMaterialFactory(detail.getRawMaterialFactory()); + vo.setCoilNo(detail.getCoilNo()); + vo.setSpecification(detail.getSpecification()); + vo.setMaterial(detail.getMaterial()); + vo.setQuantity(detail.getQuantity()); + vo.setWeight(detail.getWeight()); + vo.setUnitPrice(detail.getUnitPrice()); + vo.setRemark(detail.getRemark()); + + if (detail.getWaybillId() != null) { + // 查询发货单信息 + WmsDeliveryWaybill waybill = wmsDeliveryWaybillMapper.selectById(detail.getWaybillId()); + if (waybill != null) { + vo.setWaybillId2(waybill.getWaybillId()); + vo.setWaybillNo(waybill.getWaybillNo()); + vo.setWaybillName(waybill.getWaybillName()); + vo.setPlanId(waybill.getPlanId()); + vo.setLicensePlate(waybill.getLicensePlate()); + vo.setConsigneeUnit(waybill.getConsigneeUnit()); + vo.setSenderUnit(waybill.getSenderUnit()); + vo.setDeliveryTime(waybill.getDeliveryTime()); + vo.setWeighbridge(waybill.getWeighbridge()); + vo.setSalesPerson(waybill.getSalesPerson()); + vo.setPrincipal(waybill.getPrincipal()); + vo.setPrincipalPhone(waybill.getPrincipalPhone()); + vo.setStatus(waybill.getStatus()); + vo.setWaybillRemark(waybill.getRemark()); + + if (waybill.getPlanId() != null) { + // 查询发货计划信息 + WmsDeliveryPlan plan = wmsDeliveryPlanMapper.selectById(waybill.getPlanId()); + if (plan != null) { + vo.setPlanId2(plan.getPlanId()); + vo.setPlanName(plan.getPlanName()); + vo.setPlanDate(plan.getPlanDate()); + vo.setPlanType(plan.getPlanType()); + vo.setPlanRemark(plan.getRemark()); + vo.setAuditStatus(plan.getAuditStatus()); + vo.setAuditBy(plan.getAuditBy()); + vo.setAuditTime(plan.getAuditTime()); + } + } + } + } + + // 查询钢卷信息 + WmsMaterialCoil coil = wmsMaterialCoilMapper.selectById(coilId); + if (coil != null) { + vo.setEnterCoilNo(coil.getEnterCoilNo()); + vo.setCurrentCoilNo(coil.getCurrentCoilNo()); + } + + return vo; + } + /** * 查询发货单明细列表 */