2025-11-25 15:44:19 +08:00
|
|
|
|
package com.klp.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
|
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.LambdaQueryWrapper;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
|
import com.klp.common.utils.StringUtils;
|
2025-11-25 16:58:47 +08:00
|
|
|
|
import com.klp.domain.vo.WmsDeliveryPlanStatisticsVo;
|
2025-11-26 09:38:22 +08:00
|
|
|
|
import com.klp.domain.vo.WmsDeliveryReportVo;
|
2025-11-25 15:44:19 +08:00
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.klp.domain.bo.WmsDeliveryPlanBo;
|
|
|
|
|
|
import com.klp.domain.vo.WmsDeliveryPlanVo;
|
|
|
|
|
|
import com.klp.domain.WmsDeliveryPlan;
|
|
|
|
|
|
import com.klp.mapper.WmsDeliveryPlanMapper;
|
|
|
|
|
|
import com.klp.service.IWmsDeliveryPlanService;
|
|
|
|
|
|
|
2025-11-26 09:38:22 +08:00
|
|
|
|
import java.util.*;
|
2025-11-25 15:44:19 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 发货计划Service业务层处理
|
|
|
|
|
|
*
|
|
|
|
|
|
* @author klp
|
|
|
|
|
|
* @date 2025-11-25
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
|
@Service
|
|
|
|
|
|
public class WmsDeliveryPlanServiceImpl implements IWmsDeliveryPlanService {
|
|
|
|
|
|
|
|
|
|
|
|
private final WmsDeliveryPlanMapper baseMapper;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询发货计划
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public WmsDeliveryPlanVo queryById(Long planId){
|
|
|
|
|
|
return baseMapper.selectVoById(planId);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询发货计划列表
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public TableDataInfo<WmsDeliveryPlanVo> queryPageList(WmsDeliveryPlanBo bo, PageQuery pageQuery) {
|
|
|
|
|
|
LambdaQueryWrapper<WmsDeliveryPlan> lqw = buildQueryWrapper(bo);
|
|
|
|
|
|
Page<WmsDeliveryPlanVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
|
|
|
return TableDataInfo.build(result);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询发货计划列表
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public List<WmsDeliveryPlanVo> queryList(WmsDeliveryPlanBo bo) {
|
|
|
|
|
|
LambdaQueryWrapper<WmsDeliveryPlan> lqw = buildQueryWrapper(bo);
|
|
|
|
|
|
return baseMapper.selectVoList(lqw);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private LambdaQueryWrapper<WmsDeliveryPlan> buildQueryWrapper(WmsDeliveryPlanBo bo) {
|
|
|
|
|
|
Map<String, Object> params = bo.getParams();
|
|
|
|
|
|
LambdaQueryWrapper<WmsDeliveryPlan> lqw = Wrappers.lambdaQuery();
|
|
|
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getPlanName()), WmsDeliveryPlan::getPlanName, bo.getPlanName());
|
|
|
|
|
|
lqw.eq(bo.getPlanDate() != null, WmsDeliveryPlan::getPlanDate, bo.getPlanDate());
|
|
|
|
|
|
return lqw;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 新增发货计划
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Boolean insertByBo(WmsDeliveryPlanBo bo) {
|
|
|
|
|
|
WmsDeliveryPlan add = BeanUtil.toBean(bo, WmsDeliveryPlan.class);
|
|
|
|
|
|
validEntityBeforeSave(add);
|
|
|
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
|
|
|
if (flag) {
|
|
|
|
|
|
bo.setPlanId(add.getPlanId());
|
|
|
|
|
|
}
|
|
|
|
|
|
return flag;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 修改发货计划
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Boolean updateByBo(WmsDeliveryPlanBo bo) {
|
|
|
|
|
|
WmsDeliveryPlan update = BeanUtil.toBean(bo, WmsDeliveryPlan.class);
|
|
|
|
|
|
validEntityBeforeSave(update);
|
|
|
|
|
|
return baseMapper.updateById(update) > 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 保存前的数据校验
|
|
|
|
|
|
*/
|
|
|
|
|
|
private void validEntityBeforeSave(WmsDeliveryPlan entity){
|
|
|
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 批量删除发货计划
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
|
|
|
|
if(isValid){
|
|
|
|
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
|
|
|
|
}
|
|
|
|
|
|
return baseMapper.deleteBatchIds(ids) > 0;
|
|
|
|
|
|
}
|
2025-11-25 16:58:47 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取发货计划统计信息
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param planId 计划ID,可选
|
|
|
|
|
|
* @return 统计信息列表
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<WmsDeliveryPlanStatisticsVo> getDeliveryPlanStatistics(Long planId) {
|
|
|
|
|
|
return baseMapper.selectDeliveryPlanStatistics(planId);
|
|
|
|
|
|
}
|
2025-11-26 09:38:22 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取发货报表统计信息
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param startTime 开始时间
|
|
|
|
|
|
* @param endTime 结束时间
|
|
|
|
|
|
* @return 报表统计信息列表
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<WmsDeliveryReportVo> getDeliveryReport(Date startTime, Date endTime) {
|
|
|
|
|
|
return baseMapper.selectDeliveryReport(startTime, endTime);
|
|
|
|
|
|
}
|
2025-11-25 15:44:19 +08:00
|
|
|
|
}
|