From f86c339a21e36802b2886fb54db644adf3f51d23 Mon Sep 17 00:00:00 2001 From: Joshi <3040996759@qq.com> Date: Tue, 9 Dec 2025 14:15:37 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat(wms):=20=E6=96=B0=E5=A2=9E=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E8=AE=A1=E5=88=92ID=E8=8E=B7=E5=8F=96=E5=8F=AF?= =?UTF-8?q?=E9=80=89=E9=92=A2=E5=8D=B7=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在IWmsDeliveryPlanService中新增getSelectableCoilsByPlanId方法 - 在WmsDeliveryPlanController中新增/selectableCoils GET接口 - 实现获取计划绑定钢卷但未被使用的钢卷列表逻辑 - 通过关联查询排除已被运单明细占用的钢卷 - 支持按钢卷ID集合查询完整钢卷信息 - 添加必要的空值检查和参数校验 --- .../controller/WmsDeliveryPlanController.java | 11 ++++ .../klp/service/IWmsDeliveryPlanService.java | 3 + .../impl/WmsDeliveryPlanServiceImpl.java | 63 +++++++++++++++++++ 3 files changed, 77 insertions(+) diff --git a/klp-wms/src/main/java/com/klp/controller/WmsDeliveryPlanController.java b/klp-wms/src/main/java/com/klp/controller/WmsDeliveryPlanController.java index 04d71303..8196f9e1 100644 --- a/klp-wms/src/main/java/com/klp/controller/WmsDeliveryPlanController.java +++ b/klp-wms/src/main/java/com/klp/controller/WmsDeliveryPlanController.java @@ -128,4 +128,15 @@ public class WmsDeliveryPlanController extends BaseController { } + /** + * 根据计划ID获取可选钢卷列表:计划绑定钢卷 - 明细已绑定钢卷 + * @param planId 计划ID + */ + @GetMapping("/selectableCoils") + public R> getSelectableCoils(@RequestParam @NotNull(message = "planId不能为空") Long planId) { + List list = iWmsDeliveryPlanService.getSelectableCoilsByPlanId(planId); + return R.ok(list); + } + + } diff --git a/klp-wms/src/main/java/com/klp/service/IWmsDeliveryPlanService.java b/klp-wms/src/main/java/com/klp/service/IWmsDeliveryPlanService.java index 8fe1752b..362c7125 100644 --- a/klp-wms/src/main/java/com/klp/service/IWmsDeliveryPlanService.java +++ b/klp-wms/src/main/java/com/klp/service/IWmsDeliveryPlanService.java @@ -60,4 +60,7 @@ public interface IWmsDeliveryPlanService { * 获取发货报表统计信息(包含汇总和按类型统计) */ WmsDeliveryReportResultVo getDeliveryReport(Date startTime, Date endTime); + + List getSelectableCoilsByPlanId(Long planId); + } diff --git a/klp-wms/src/main/java/com/klp/service/impl/WmsDeliveryPlanServiceImpl.java b/klp-wms/src/main/java/com/klp/service/impl/WmsDeliveryPlanServiceImpl.java index 1680e119..4ec47e0b 100644 --- a/klp-wms/src/main/java/com/klp/service/impl/WmsDeliveryPlanServiceImpl.java +++ b/klp-wms/src/main/java/com/klp/service/impl/WmsDeliveryPlanServiceImpl.java @@ -5,12 +5,17 @@ import com.klp.common.core.domain.entity.SysUser; import com.klp.common.core.page.TableDataInfo; import com.klp.common.core.domain.PageQuery; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.klp.common.utils.StringUtils; import com.klp.domain.WmsMaterialCoil; +import com.klp.domain.WmsDeliveryWaybill; +import com.klp.domain.WmsDeliveryWaybillDetail; import com.klp.domain.vo.*; import com.klp.mapper.WmsMaterialCoilMapper; +import com.klp.mapper.WmsDeliveryWaybillMapper; +import com.klp.mapper.WmsDeliveryWaybillDetailMapper; import com.klp.system.service.ISysUserService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -38,6 +43,10 @@ public class WmsDeliveryPlanServiceImpl implements IWmsDeliveryPlanService { private final WmsMaterialCoilMapper coilMapper; + private final WmsDeliveryWaybillMapper waybillMapper; + + private final WmsDeliveryWaybillDetailMapper waybillDetailMapper; + /** * 查询发货计划 */ @@ -169,4 +178,58 @@ public class WmsDeliveryPlanServiceImpl implements IWmsDeliveryPlanService { return result; } + @Override + public List getSelectableCoilsByPlanId(Long planId) { + if (planId == null) { + return Collections.emptyList(); + } + WmsDeliveryPlanVo planVo = baseMapper.selectVoById(planId); + if (planVo == null || StringUtils.isBlank(planVo.getCoil())) { + return Collections.emptyList(); + } + Set planCoilIds = Arrays.stream(planVo.getCoil().split(",")) + .map(String::trim) + .filter(StringUtils::isNotBlank) + .map(Long::valueOf) + .collect(Collectors.toSet()); + + if (planCoilIds.isEmpty()) { + return Collections.emptyList(); + } + + List waybills = waybillMapper.selectList( + Wrappers.lambdaQuery().eq(WmsDeliveryWaybill::getPlanId, planId) + ); + if (waybills == null || waybills.isEmpty()) { + return queryCoilsByIds(planCoilIds); + } + Set waybillIds = waybills.stream().map(WmsDeliveryWaybill::getWaybillId).collect(Collectors.toSet()); + if (waybillIds.isEmpty()) { + return queryCoilsByIds(planCoilIds); + } + List details = waybillDetailMapper.selectList( + Wrappers.lambdaQuery().in(WmsDeliveryWaybillDetail::getWaybillId, waybillIds) + ); + Set usedCoilIds = details == null ? Collections.emptySet() : details.stream() + .map(WmsDeliveryWaybillDetail::getCoilId) + .filter(Objects::nonNull) + .collect(Collectors.toSet()); + + planCoilIds.removeAll(usedCoilIds); + if (planCoilIds.isEmpty()) { + return Collections.emptyList(); + } + return queryCoilsByIds(planCoilIds); + } + + private List queryCoilsByIds(Set coilIds) { + if (coilIds == null || coilIds.isEmpty()) { + return Collections.emptyList(); + } + QueryWrapper qw = new QueryWrapper<>(); + qw.lambda().in(WmsMaterialCoil::getCoilId, coilIds); + // 使用动态联查以返回更完整的钢卷信息 + return coilMapper.selectVoListWithDynamicJoin(qw); + } + } From d4e882610b79110b8b4a5f10476c61e4286dc59e Mon Sep 17 00:00:00 2001 From: Joshi <3040996759@qq.com> Date: Tue, 9 Dec 2025 14:32:51 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix(wms):=20=E4=BF=AE=E5=A4=8D=E9=92=A2?= =?UTF-8?q?=E5=8D=B7=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6=E6=9E=84=E9=80=A0?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将Lambda表达式方式改为直接字段名方式构建查询条件 - 确保钢卷ID列表能正确传入并执行IN查询 - 修复因查询条件构造不当导致的数据查询异常问题 --- .../com/klp/service/impl/WmsDeliveryPlanServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/klp-wms/src/main/java/com/klp/service/impl/WmsDeliveryPlanServiceImpl.java b/klp-wms/src/main/java/com/klp/service/impl/WmsDeliveryPlanServiceImpl.java index 4ec47e0b..a00ae317 100644 --- a/klp-wms/src/main/java/com/klp/service/impl/WmsDeliveryPlanServiceImpl.java +++ b/klp-wms/src/main/java/com/klp/service/impl/WmsDeliveryPlanServiceImpl.java @@ -227,7 +227,10 @@ public class WmsDeliveryPlanServiceImpl implements IWmsDeliveryPlanService { return Collections.emptyList(); } QueryWrapper qw = new QueryWrapper<>(); - qw.lambda().in(WmsMaterialCoil::getCoilId, coilIds); + qw.in("mc.coil_id", coilIds); + qw.eq("mc.del_flag", 0); + //根据创建时间倒叙 + qw.orderByDesc("mc.create_time"); // 使用动态联查以返回更完整的钢卷信息 return coilMapper.selectVoListWithDynamicJoin(qw); } From 2d30a2f3fb8d0a5dd83bd3b8211c95f2502ff18f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= Date: Tue, 9 Dec 2025 14:37:46 +0800 Subject: [PATCH 3/6] =?UTF-8?q?feat(=E5=8F=91=E8=B4=A7=E5=8D=95):=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=91=E8=B4=A7=E5=8D=95=E9=92=A2=E5=8D=B7?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E8=8C=83=E5=9B=B4=E9=99=90=E5=88=B6=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在CoilSelector组件中新增rangeMode和rangeData属性,支持传入可选钢卷列表 - 发货单明细表增加对可选钢卷列表的支持,并在增删改时刷新列表 - 发货单打印时自动填充取货地点为实际库位前三位 - 调整操作列固定显示在表格右侧 --- klp-ui/src/api/wms/coil.js | 4 ++- klp-ui/src/api/wms/deliveryPlan.js | 15 +++++++++- klp-ui/src/components/CoilSelector/index.vue | 19 ++++++++++-- .../wms/delivery/components/detailTable.vue | 9 +++++- .../views/wms/delivery/components/wayBill.vue | 30 ++++--------------- klp-ui/src/views/wms/delivery/plan/index.vue | 2 +- .../src/views/wms/delivery/waybill/index.vue | 30 +++++++++++++++---- 7 files changed, 74 insertions(+), 35 deletions(-) diff --git a/klp-ui/src/api/wms/coil.js b/klp-ui/src/api/wms/coil.js index e57b5b0c..389d2e28 100644 --- a/klp-ui/src/api/wms/coil.js +++ b/klp-ui/src/api/wms/coil.js @@ -143,7 +143,9 @@ export function listCoilByIds(coilIds) { url: '/wms/materialCoil/list', method: 'get', params: { - coilIds + coilIds, + pageNum: 1, + pageSize: 1000 } }) } \ No newline at end of file diff --git a/klp-ui/src/api/wms/deliveryPlan.js b/klp-ui/src/api/wms/deliveryPlan.js index 2d07b347..0851b121 100644 --- a/klp-ui/src/api/wms/deliveryPlan.js +++ b/klp-ui/src/api/wms/deliveryPlan.js @@ -56,4 +56,17 @@ export function getDeliveryReport(query) { method: 'get', params: query }) -} \ No newline at end of file +} + +/** + * 获取当前可用的钢卷列表 + */ +export function listSelectableCoils(planId) { + return request({ + url: '/wms/deliveryPlan/selectableCoils', + method: 'get', + params: { + planId: planId + } + }) +} diff --git a/klp-ui/src/components/CoilSelector/index.vue b/klp-ui/src/components/CoilSelector/index.vue index 4046779e..2a1aff1d 100644 --- a/klp-ui/src/components/CoilSelector/index.vue +++ b/klp-ui/src/components/CoilSelector/index.vue @@ -18,7 +18,7 @@ - + @@ -47,7 +47,7 @@ -