Merge branch '0.8.X' of https://gitee.com/hdka/klp-oa into 0.8.X
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
package com.klp.controller;
|
package com.klp.controller;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import com.klp.domain.vo.WmsDeliveryPlanStatisticsVo;
|
import com.klp.domain.vo.WmsDeliveryPlanStatisticsVo;
|
||||||
|
import com.klp.domain.vo.WmsDeliveryReportVo;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
@@ -108,4 +110,19 @@ public class WmsDeliveryPlanController extends BaseController {
|
|||||||
List<WmsDeliveryPlanStatisticsVo> statistics = iWmsDeliveryPlanService.getDeliveryPlanStatistics(planId);
|
List<WmsDeliveryPlanStatisticsVo> statistics = iWmsDeliveryPlanService.getDeliveryPlanStatistics(planId);
|
||||||
return R.ok(statistics);
|
return R.ok(statistics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取发货报表统计信息
|
||||||
|
*
|
||||||
|
* @param startTime 开始时间
|
||||||
|
* @param endTime 结束时间
|
||||||
|
*/
|
||||||
|
@GetMapping("/report")
|
||||||
|
public R<List<WmsDeliveryReportVo>> getDeliveryReport(
|
||||||
|
@RequestParam(required = false) Date startTime,
|
||||||
|
@RequestParam(required = false) Date endTime) {
|
||||||
|
List<WmsDeliveryReportVo> report = iWmsDeliveryPlanService.getDeliveryReport(startTime, endTime);
|
||||||
|
return R.ok(report);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package com.klp.domain.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货报表统计VO
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class WmsDeliveryReportVo {
|
||||||
|
/**
|
||||||
|
* 钢卷类型(品名)
|
||||||
|
*/
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货单数量
|
||||||
|
*/
|
||||||
|
private Integer waybillCount = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 钢卷数量
|
||||||
|
*/
|
||||||
|
private Integer coilCount = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总重量(吨)
|
||||||
|
*/
|
||||||
|
private BigDecimal totalWeight = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日均发货单数量
|
||||||
|
*/
|
||||||
|
private BigDecimal dailyWaybillCount = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日均钢卷数量
|
||||||
|
*/
|
||||||
|
private BigDecimal dailyCoilCount = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日均重量(吨)
|
||||||
|
*/
|
||||||
|
private BigDecimal dailyWeight = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计开始时间
|
||||||
|
*/
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计结束时间
|
||||||
|
*/
|
||||||
|
private Date endTime;
|
||||||
|
}
|
||||||
@@ -4,7 +4,9 @@ import com.klp.domain.WmsDeliveryPlan;
|
|||||||
import com.klp.domain.vo.WmsDeliveryPlanStatisticsVo;
|
import com.klp.domain.vo.WmsDeliveryPlanStatisticsVo;
|
||||||
import com.klp.domain.vo.WmsDeliveryPlanVo;
|
import com.klp.domain.vo.WmsDeliveryPlanVo;
|
||||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||||
|
import com.klp.domain.vo.WmsDeliveryReportVo;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -16,4 +18,6 @@ import java.util.List;
|
|||||||
public interface WmsDeliveryPlanMapper extends BaseMapperPlus<WmsDeliveryPlanMapper, WmsDeliveryPlan, WmsDeliveryPlanVo> {
|
public interface WmsDeliveryPlanMapper extends BaseMapperPlus<WmsDeliveryPlanMapper, WmsDeliveryPlan, WmsDeliveryPlanVo> {
|
||||||
|
|
||||||
List<WmsDeliveryPlanStatisticsVo> selectDeliveryPlanStatistics(Long planId);
|
List<WmsDeliveryPlanStatisticsVo> selectDeliveryPlanStatistics(Long planId);
|
||||||
|
|
||||||
|
List<WmsDeliveryReportVo> selectDeliveryReport(Date startTime, Date endTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ import com.klp.domain.vo.WmsDeliveryPlanVo;
|
|||||||
import com.klp.domain.bo.WmsDeliveryPlanBo;
|
import com.klp.domain.bo.WmsDeliveryPlanBo;
|
||||||
import com.klp.common.core.page.TableDataInfo;
|
import com.klp.common.core.page.TableDataInfo;
|
||||||
import com.klp.common.core.domain.PageQuery;
|
import com.klp.common.core.domain.PageQuery;
|
||||||
|
import com.klp.domain.vo.WmsDeliveryReportVo;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,4 +51,6 @@ public interface IWmsDeliveryPlanService {
|
|||||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
List<WmsDeliveryPlanStatisticsVo> getDeliveryPlanStatistics(Long planId);
|
List<WmsDeliveryPlanStatisticsVo> getDeliveryPlanStatistics(Long planId);
|
||||||
|
|
||||||
|
List<WmsDeliveryReportVo> getDeliveryReport(Date startTime, Date endTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.klp.common.utils.StringUtils;
|
import com.klp.common.utils.StringUtils;
|
||||||
import com.klp.domain.vo.WmsDeliveryPlanStatisticsVo;
|
import com.klp.domain.vo.WmsDeliveryPlanStatisticsVo;
|
||||||
|
import com.klp.domain.vo.WmsDeliveryReportVo;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.klp.domain.bo.WmsDeliveryPlanBo;
|
import com.klp.domain.bo.WmsDeliveryPlanBo;
|
||||||
@@ -16,10 +17,7 @@ import com.klp.domain.WmsDeliveryPlan;
|
|||||||
import com.klp.mapper.WmsDeliveryPlanMapper;
|
import com.klp.mapper.WmsDeliveryPlanMapper;
|
||||||
import com.klp.service.IWmsDeliveryPlanService;
|
import com.klp.service.IWmsDeliveryPlanService;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发货计划Service业务层处理
|
* 发货计划Service业务层处理
|
||||||
@@ -120,4 +118,15 @@ public class WmsDeliveryPlanServiceImpl implements IWmsDeliveryPlanService {
|
|||||||
public List<WmsDeliveryPlanStatisticsVo> getDeliveryPlanStatistics(Long planId) {
|
public List<WmsDeliveryPlanStatisticsVo> getDeliveryPlanStatistics(Long planId) {
|
||||||
return baseMapper.selectDeliveryPlanStatistics(planId);
|
return baseMapper.selectDeliveryPlanStatistics(planId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取发货报表统计信息
|
||||||
|
*
|
||||||
|
* @param startTime 开始时间
|
||||||
|
* @param endTime 结束时间
|
||||||
|
* @return 报表统计信息列表
|
||||||
|
*/
|
||||||
|
public List<WmsDeliveryReportVo> getDeliveryReport(Date startTime, Date endTime) {
|
||||||
|
return baseMapper.selectDeliveryReport(startTime, endTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,40 @@
|
|||||||
ORDER BY dp.create_time DESC
|
ORDER BY dp.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDeliveryReport" resultType="com.klp.domain.vo.WmsDeliveryReportVo">
|
||||||
|
SELECT
|
||||||
|
dwd.product_name as productName,
|
||||||
|
COUNT(DISTINCT dw.waybill_id) as waybillCount,
|
||||||
|
SUM(dwd.quantity) as coilCount,
|
||||||
|
SUM(dwd.weight) as totalWeight,
|
||||||
|
CASE
|
||||||
|
WHEN #{startTime} IS NOT NULL AND #{endTime} IS NOT NULL THEN
|
||||||
|
ROUND(COUNT(DISTINCT dw.waybill_id) / (DATEDIFF(#{endTime}, #{startTime}) + 1), 2)
|
||||||
|
ELSE 0
|
||||||
|
END as dailyWaybillCount,
|
||||||
|
CASE
|
||||||
|
WHEN #{startTime} IS NOT NULL AND #{endTime} IS NOT NULL THEN
|
||||||
|
ROUND(SUM(dwd.quantity) / (DATEDIFF(#{endTime}, #{startTime}) + 1), 2)
|
||||||
|
ELSE 0
|
||||||
|
END as dailyCoilCount,
|
||||||
|
CASE
|
||||||
|
WHEN #{startTime} IS NOT NULL AND #{endTime} IS NOT NULL THEN
|
||||||
|
ROUND(SUM(dwd.weight) / (DATEDIFF(#{endTime}, #{startTime}) + 1), 2)
|
||||||
|
ELSE 0
|
||||||
|
END as dailyWeight
|
||||||
|
FROM wms_delivery_waybill_detail dwd
|
||||||
|
LEFT JOIN wms_delivery_waybill dw ON dwd.waybill_id = dw.waybill_id AND dw.del_flag = 0
|
||||||
|
WHERE dwd.del_flag = 0
|
||||||
|
<if test="startTime != null">
|
||||||
|
AND dw.create_time >= #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null">
|
||||||
|
AND dw.create_time <= #{endTime}
|
||||||
|
</if>
|
||||||
|
GROUP BY dwd.product_name
|
||||||
|
ORDER BY totalWeight DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user