更新
This commit is contained in:
parent
e8b422510f
commit
eb1edbfee9
|
@ -41,13 +41,20 @@ public class OrderVO extends Order{
|
||||||
if (this.storeNum == null || this.getTotalNum() == null) {
|
if (this.storeNum == null || this.getTotalNum() == null) {
|
||||||
return BigDecimal.ZERO;
|
return BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
|
BigDecimal total = this.getTotalNum();
|
||||||
|
if (this.getNum() != null) {
|
||||||
|
total = total.subtract(this.getNum());
|
||||||
|
}
|
||||||
|
if (total.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
return BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
|
||||||
return this.storeNum
|
return this.storeNum
|
||||||
.subtract(this.getNum())
|
|
||||||
.multiply(new BigDecimal(100))
|
.multiply(new BigDecimal(100))
|
||||||
.divide(this.getTotalNum(), 2, RoundingMode.HALF_UP);
|
.divide(total, 2, RoundingMode.HALF_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiModelProperty("产品进度")
|
@ApiModelProperty("成品进度")
|
||||||
public BigDecimal getEndProgress() {
|
public BigDecimal getEndProgress() {
|
||||||
if (this.endStoreNum == null || this.getNum() == null) {
|
if (this.endStoreNum == null || this.getNum() == null) {
|
||||||
return BigDecimal.ZERO;
|
return BigDecimal.ZERO;
|
||||||
|
|
|
@ -23,4 +23,7 @@ public class ProdProcessQuery extends ProdProcessVO{
|
||||||
|
|
||||||
@ApiModelProperty("订单状态列表")
|
@ApiModelProperty("订单状态列表")
|
||||||
private List<String> orderStatusList;
|
private List<String> orderStatusList;
|
||||||
|
|
||||||
|
@ApiModelProperty("精准产品名称列表")
|
||||||
|
private List<String> eqNames;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.ruoyi.bst.prodProcess.domain.vo;
|
||||||
|
|
||||||
|
import com.ruoyi.bst.prodProcess.domain.ProdProcessVO;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ProdProcessNameVO {
|
||||||
|
|
||||||
|
@ApiModelProperty("产品名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("总数量")
|
||||||
|
private BigDecimal totalNum;
|
||||||
|
|
||||||
|
@ApiModelProperty("上报数量")
|
||||||
|
private BigDecimal reportNum;
|
||||||
|
|
||||||
|
@ApiModelProperty("入库数量")
|
||||||
|
private BigDecimal storeNum;
|
||||||
|
|
||||||
|
@ApiModelProperty("工序列表")
|
||||||
|
private List<ProdProcessVO> processList;
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package com.ruoyi.bst.prodProcess.mapper;
|
||||||
import com.ruoyi.bst.prodProcess.domain.ProdProcess;
|
import com.ruoyi.bst.prodProcess.domain.ProdProcess;
|
||||||
import com.ruoyi.bst.prodProcess.domain.ProdProcessQuery;
|
import com.ruoyi.bst.prodProcess.domain.ProdProcessQuery;
|
||||||
import com.ruoyi.bst.prodProcess.domain.ProdProcessVO;
|
import com.ruoyi.bst.prodProcess.domain.ProdProcessVO;
|
||||||
|
import com.ruoyi.bst.prodProcess.domain.vo.ProdProcessNameVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -82,4 +83,9 @@ public interface ProdProcessMapper
|
||||||
* 查询汇总
|
* 查询汇总
|
||||||
*/
|
*/
|
||||||
public List<Map<String, Object>> selectSum(@Param("query")ProdProcessQuery query, @Param("groupBy")List<String> groupBy);
|
public List<Map<String, Object>> selectSum(@Param("query")ProdProcessQuery query, @Param("groupBy")List<String> groupBy);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询名称列表
|
||||||
|
*/
|
||||||
|
public List<ProdProcessNameVO> selectProdProcessNames(@Param("query") ProdProcessQuery query);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="query.deptName != null and query.deptName != ''"> and sd.dept_name like concat('%', #{query.deptName}, '%')</if>
|
<if test="query.deptName != null and query.deptName != ''"> and sd.dept_name like concat('%', #{query.deptName}, '%')</if>
|
||||||
<if test="query.orderId != null">and bop.order_id = #{query.orderId}</if>
|
<if test="query.orderId != null">and bop.order_id = #{query.orderId}</if>
|
||||||
<if test="query.orderStatus != null">and bo.status = #{query.orderStatus}</if>
|
<if test="query.orderStatus != null">and bo.status = #{query.orderStatus}</if>
|
||||||
|
<if test="query.eqNames != null and query.eqNames.size() > 0">
|
||||||
|
and bop.name in
|
||||||
|
<foreach collection="query.eqNames" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="query.orderProdIds != null and query.orderProdIds.size() > 0">
|
<if test="query.orderProdIds != null and query.orderProdIds.size() > 0">
|
||||||
and bpp.order_prod_id in
|
and bpp.order_prod_id in
|
||||||
<foreach collection="query.orderProdIds" item="item" open="(" close=")" separator=",">
|
<foreach collection="query.orderProdIds" item="item" open="(" close=")" separator=",">
|
||||||
|
@ -343,4 +349,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- selectProdProcessNames -->
|
||||||
|
<select id="selectProdProcessNames" resultType="ProdProcessNameVO">
|
||||||
|
select distinct bop.name
|
||||||
|
from <include refid="searchTables"/>
|
||||||
|
<where>
|
||||||
|
<include refid="searchCondition"/>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.ruoyi.bst.prodProcess.service;
|
||||||
import com.ruoyi.bst.prodProcess.domain.ProdProcess;
|
import com.ruoyi.bst.prodProcess.domain.ProdProcess;
|
||||||
import com.ruoyi.bst.prodProcess.domain.ProdProcessQuery;
|
import com.ruoyi.bst.prodProcess.domain.ProdProcessQuery;
|
||||||
import com.ruoyi.bst.prodProcess.domain.ProdProcessVO;
|
import com.ruoyi.bst.prodProcess.domain.ProdProcessVO;
|
||||||
|
import com.ruoyi.bst.prodProcess.domain.vo.ProdProcessNameVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -85,4 +86,9 @@ public interface IProdProcessService
|
||||||
int logicDelByOrderId(Long orderId);
|
int logicDelByOrderId(Long orderId);
|
||||||
|
|
||||||
List<ProdProcessVO> selectByIds(List<Long> ids);
|
List<ProdProcessVO> selectByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询名称列表
|
||||||
|
*/
|
||||||
|
List<ProdProcessNameVO> selectProdProcessNames(ProdProcessQuery query);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package com.ruoyi.bst.prodProcess.service;
|
package com.ruoyi.bst.prodProcess.service;
|
||||||
|
|
||||||
import com.ruoyi.bst.prodProcess.domain.ProdProcessBO;
|
import com.ruoyi.bst.prodProcess.domain.ProdProcessBO;
|
||||||
|
import com.ruoyi.bst.prodProcess.domain.ProdProcessQuery;
|
||||||
import com.ruoyi.bst.prodProcess.domain.ProdProcessVO;
|
import com.ruoyi.bst.prodProcess.domain.ProdProcessVO;
|
||||||
|
import com.ruoyi.bst.prodProcess.domain.vo.ProdProcessNameVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -31,4 +33,14 @@ public interface ProdProcessAssembler {
|
||||||
* 拼接进度
|
* 拼接进度
|
||||||
*/
|
*/
|
||||||
void assembleProgress(List<ProdProcessVO> list);
|
void assembleProgress(List<ProdProcessVO> list);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼接明细
|
||||||
|
*/
|
||||||
|
void assembleProdList(List<ProdProcessNameVO> list, ProdProcessQuery query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼接总数量
|
||||||
|
*/
|
||||||
|
void assembleTotalNum(List<ProdProcessNameVO> list);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,10 @@ package com.ruoyi.bst.prodProcess.service.impl;
|
||||||
|
|
||||||
import com.ruoyi.bst.prodProcess.domain.ProdProcess;
|
import com.ruoyi.bst.prodProcess.domain.ProdProcess;
|
||||||
import com.ruoyi.bst.prodProcess.domain.ProdProcessBO;
|
import com.ruoyi.bst.prodProcess.domain.ProdProcessBO;
|
||||||
|
import com.ruoyi.bst.prodProcess.domain.ProdProcessQuery;
|
||||||
import com.ruoyi.bst.prodProcess.domain.ProdProcessVO;
|
import com.ruoyi.bst.prodProcess.domain.ProdProcessVO;
|
||||||
|
import com.ruoyi.bst.prodProcess.domain.vo.ProdProcessNameVO;
|
||||||
|
import com.ruoyi.bst.prodProcess.service.IProdProcessService;
|
||||||
import com.ruoyi.bst.prodProcess.service.ProdProcessAssembler;
|
import com.ruoyi.bst.prodProcess.service.ProdProcessAssembler;
|
||||||
import com.ruoyi.bst.store.domain.StoreQuery;
|
import com.ruoyi.bst.store.domain.StoreQuery;
|
||||||
import com.ruoyi.bst.store.domain.enums.StoreGroupBy;
|
import com.ruoyi.bst.store.domain.enums.StoreGroupBy;
|
||||||
|
@ -17,8 +20,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wjh
|
* @author wjh
|
||||||
|
@ -32,6 +38,9 @@ public class ProdProcessAssemblerImpl implements ProdProcessAssembler {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IStoreService storeService;
|
private IStoreService storeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IProdProcessService prodProcessService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void assembleDept(List<ProdProcessBO> list) {
|
public void assembleDept(List<ProdProcessBO> list) {
|
||||||
if (CollectionUtils.isEmptyElement(list)) {
|
if (CollectionUtils.isEmptyElement(list)) {
|
||||||
|
@ -100,4 +109,45 @@ public class ProdProcessAssemblerImpl implements ProdProcessAssembler {
|
||||||
this.assembleReportNum(list);
|
this.assembleReportNum(list);
|
||||||
this.assembleStoreNum(list);
|
this.assembleStoreNum(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void assembleProdList(List<ProdProcessNameVO> list, ProdProcessQuery query) {
|
||||||
|
if (CollectionUtils.isEmptyElement(list)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询列表
|
||||||
|
query.setEqNames(CollectionUtils.map(list, ProdProcessNameVO::getName));
|
||||||
|
List<ProdProcessVO> prodList = prodProcessService.selectProdProcessList(query);
|
||||||
|
// 拼接进度
|
||||||
|
this.assembleProgress(prodList);
|
||||||
|
// 分组
|
||||||
|
Map<String, List<ProdProcessVO>> group = prodList.stream().collect(Collectors.groupingBy(ProdProcessVO::getOrderProdName));
|
||||||
|
|
||||||
|
// 组装数据
|
||||||
|
for (ProdProcessNameVO vo : list) {
|
||||||
|
List<ProdProcessVO> groupList = group.get(vo.getName());
|
||||||
|
if (groupList == null) {
|
||||||
|
groupList = new ArrayList<>();
|
||||||
|
}
|
||||||
|
vo.setProcessList(groupList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void assembleTotalNum(List<ProdProcessNameVO> list) {
|
||||||
|
if (CollectionUtils.isEmptyElement(list)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (ProdProcessNameVO vo : list) {
|
||||||
|
List<ProdProcessVO> processList = vo.getProcessList();
|
||||||
|
if (CollectionUtils.isEmptyElement(processList)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
vo.setTotalNum(CollectionUtils.sumDecimal(processList, ProdProcessVO::getNum));
|
||||||
|
vo.setReportNum(CollectionUtils.sumDecimal(processList, ProdProcessVO::getReportNum));
|
||||||
|
vo.setStoreNum(CollectionUtils.sumDecimal(processList, ProdProcessVO::getStoreNum));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.ruoyi.bst.prodProcess.service.impl;
|
||||||
import com.ruoyi.bst.prodProcess.domain.ProdProcess;
|
import com.ruoyi.bst.prodProcess.domain.ProdProcess;
|
||||||
import com.ruoyi.bst.prodProcess.domain.ProdProcessQuery;
|
import com.ruoyi.bst.prodProcess.domain.ProdProcessQuery;
|
||||||
import com.ruoyi.bst.prodProcess.domain.ProdProcessVO;
|
import com.ruoyi.bst.prodProcess.domain.ProdProcessVO;
|
||||||
|
import com.ruoyi.bst.prodProcess.domain.vo.ProdProcessNameVO;
|
||||||
import com.ruoyi.bst.prodProcess.mapper.ProdProcessMapper;
|
import com.ruoyi.bst.prodProcess.mapper.ProdProcessMapper;
|
||||||
import com.ruoyi.bst.prodProcess.service.IProdProcessService;
|
import com.ruoyi.bst.prodProcess.service.IProdProcessService;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
@ -155,4 +156,9 @@ public class ProdProcessServiceImpl implements IProdProcessService
|
||||||
}
|
}
|
||||||
return prodProcessMapper.batchInsert(list);
|
return prodProcessMapper.batchInsert(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ProdProcessNameVO> selectProdProcessNames(ProdProcessQuery query) {
|
||||||
|
return prodProcessMapper.selectProdProcessNames(query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.ruoyi.web.bst;
|
||||||
import com.ruoyi.bst.prodProcess.domain.ProdProcess;
|
import com.ruoyi.bst.prodProcess.domain.ProdProcess;
|
||||||
import com.ruoyi.bst.prodProcess.domain.ProdProcessQuery;
|
import com.ruoyi.bst.prodProcess.domain.ProdProcessQuery;
|
||||||
import com.ruoyi.bst.prodProcess.domain.ProdProcessVO;
|
import com.ruoyi.bst.prodProcess.domain.ProdProcessVO;
|
||||||
|
import com.ruoyi.bst.prodProcess.domain.vo.ProdProcessNameVO;
|
||||||
import com.ruoyi.bst.prodProcess.service.IProdProcessService;
|
import com.ruoyi.bst.prodProcess.service.IProdProcessService;
|
||||||
import com.ruoyi.bst.prodProcess.service.ProdProcessAssembler;
|
import com.ruoyi.bst.prodProcess.service.ProdProcessAssembler;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
|
@ -120,4 +121,22 @@ public class ProdProcessController extends BaseController
|
||||||
{
|
{
|
||||||
return toAjax(prodProcessService.deleteProdProcessByIds(ids));
|
return toAjax(prodProcessService.deleteProdProcessByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按名称分组查询
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bst:prodProcess:list')")
|
||||||
|
@GetMapping("/groupByName")
|
||||||
|
@DataScope(deptAlias = "sd")
|
||||||
|
public TableDataInfo groupByName(ProdProcessQuery query){
|
||||||
|
startPage();
|
||||||
|
// 查询名称列表
|
||||||
|
List<ProdProcessNameVO> list = prodProcessService.selectProdProcessNames(query);
|
||||||
|
|
||||||
|
// 拼接明细
|
||||||
|
prodProcessAssembler.assembleProdList(list, query);
|
||||||
|
// 汇总数量
|
||||||
|
prodProcessAssembler.assembleTotalNum(list);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ spring:
|
||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://localhost:3306/factory?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://61.174.243.28:15864/factory?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: a22dae15cab2bde7
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
# 从数据源开关/默认关闭
|
# 从数据源开关/默认关闭
|
||||||
|
|
Loading…
Reference in New Issue
Block a user