feat(wms): 添加根据钢卷ID查询发货关联信息功能

- 在 IWmsDeliveryWaybillDetailService 中新增 queryRelationByCoilId 方法
- 在 WmsDeliveryWaybillDetailController 中新增 /coilRelation/{coilId} 接口
- 在 WmsDeliveryWaybillDetailServiceImpl 中实现完整的关联查询逻辑
- 创建 WmsDeliveryCoilRelationVo 数据传输对象
- 支持查询发货单明细、发货单、发货计划和钢卷的完整关联信息
This commit is contained in:
2026-04-23 09:54:22 +08:00
parent a553b8ddc4
commit b840574286
4 changed files with 290 additions and 0 deletions

View File

@@ -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<WmsDeliveryWaybillDetail> 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;
}
/**
* 查询发货单明细列表
*/