进度大屏

This commit is contained in:
lcj
2025-12-18 09:27:02 +08:00
parent a943398499
commit 731b8bb1d2
5 changed files with 68 additions and 49 deletions

View File

@ -73,9 +73,8 @@ public class ProgressBigScreenController extends BaseController {
/**
* 获取材料进度详情
*/
@GetMapping("/materialProgress/detail/{projectId}")
public R<List<MaterialProgressDetailVo>> getMaterialProgressDetail(@NotNull(message = "项目主键不能为空")
@PathVariable Long projectId) {
return R.ok(progressBigScreenService.getMaterialProgressDetail(projectId));
@GetMapping("/materialProgress/detail")
public R<List<MaterialProgressDetailVo>> getMaterialProgressDetail(Long project, String name, String specification) {
return R.ok(progressBigScreenService.getMaterialProgressDetail(project, name, specification));
}
}

View File

@ -44,6 +44,11 @@ public class MaterialProgressDetailVo implements Serializable {
// region 接收单数据
/**
* 表单编号
*/
private String formCode;
/**
* 合同名称
*/

View File

@ -55,7 +55,7 @@ public interface ProgressBigScreenService {
* @param projectId 项目 id
* @return 物料进度详情
*/
List<MaterialProgressDetailVo> getMaterialProgressDetail(Long projectId);
List<MaterialProgressDetailVo> getMaterialProgressDetail(Long projectId, String name, String specification);
/**
* 获取物资进度

View File

@ -21,6 +21,7 @@ import org.dromara.materials.domain.MatMaterialReceive;
import org.dromara.materials.domain.MatMaterialReceiveItem;
import org.dromara.materials.service.IMatMaterialReceiveItemService;
import org.dromara.materials.service.IMatMaterialReceiveService;
import org.dromara.materials.service.IMatMaterialsService;
import org.dromara.progress.constant.PgsProgressCategoryConstant;
import org.dromara.progress.domain.PgsConstructionSchedulePlan;
import org.dromara.progress.domain.PgsProgressCategory;
@ -88,6 +89,9 @@ public class ProgressBigScreenServiceImpl implements ProgressBigScreenService {
@Resource
private IBusMrpBaseService mrpBaseService;
@Resource
private IMatMaterialsService matMaterialsService;
/**
* 获取项目总进度
*
@ -336,20 +340,19 @@ public class ProgressBigScreenServiceImpl implements ProgressBigScreenService {
* @return 物料进度详情
*/
@Override
public List<MaterialProgressDetailVo> getMaterialProgressDetail(Long projectId) {
List<MatMaterialReceive> receiveList = materialReceiveService.lambdaQuery()
.eq(MatMaterialReceive::getProjectId, projectId)
.list();
if (CollUtil.isEmpty(receiveList)) {
return List.of();
}
List<Long> ids = receiveList.stream().map(MatMaterialReceive::getId).toList();
public List<MaterialProgressDetailVo> getMaterialProgressDetail(Long projectId, String name, String specification) {
// 根据名称 规格获取材料
List<MatMaterialReceiveItem> itemList = materialReceiveItemService.lambdaQuery()
.in(MatMaterialReceiveItem::getReceiveId, ids)
.eq(MatMaterialReceiveItem::getName, name)
.eq(MatMaterialReceiveItem::getSpecification, specification)
.list();
if (CollUtil.isEmpty(itemList)) {
return List.of();
}
Set<Long> ids = itemList.stream().map(MatMaterialReceiveItem::getReceiveId).collect(Collectors.toSet());
List<MatMaterialReceive> receiveList = materialReceiveService.lambdaQuery()
.in(MatMaterialReceive::getId, ids)
.list();
Map<Long, MatMaterialReceive> receiveMap = receiveList.stream()
.collect(Collectors.toMap(MatMaterialReceive::getId, receive -> receive));
return itemList.stream().map(item -> {
@ -364,6 +367,7 @@ public class ProgressBigScreenServiceImpl implements ProgressBigScreenService {
vo.setQuantity(item.getQuantity());
vo.setAcceptedQuantity(item.getAcceptedQuantity());
vo.setShortageQuantity(item.getShortageQuantity());
vo.setFormCode(receive.getFormCode());
vo.setContractName(receive.getContractName());
vo.setOrderingUnit(receive.getOrderingUnit());
vo.setSupplierUnit(receive.getSupplierUnit());
@ -380,6 +384,20 @@ public class ProgressBigScreenServiceImpl implements ProgressBigScreenService {
*/
@Override
public List<wzxqysjdhdbVo> getMaterialProgress(Long projectId) {
return mrpBaseService.wzxqysjdhdb(projectId);
List<wzxqysjdhdbVo> wzxqysjdhdb = mrpBaseService.wzxqysjdhdb(projectId);
Map<String, List<wzxqysjdhdbVo>> map = wzxqysjdhdb.stream()
.collect(Collectors.groupingBy(o -> o.getName() + o.getSpecification()));
List<wzxqysjdhdbVo> wzxqysjdhdbList = new ArrayList<>();
map.forEach((k, v) -> {
wzxqysjdhdbVo vo = new wzxqysjdhdbVo();
vo.setName(v.getFirst().getName());
vo.setSpecification(v.getFirst().getSpecification());
BigDecimal design = v.stream().map(wzxqysjdhdbVo::getDesignTotalPrices).reduce(BigDecimal.ZERO, BigDecimal::add);
vo.setDesignTotalPrices(design);
BigDecimal arrival = v.stream().map(wzxqysjdhdbVo::getArrivalTotalPrices).reduce(BigDecimal.ZERO, BigDecimal::add);
vo.setArrivalTotalPrices(arrival);
wzxqysjdhdbList.add(vo);
});
return wzxqysjdhdbList;
}
}

View File

@ -4,21 +4,30 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.bigscreen.domain.vo.designAndArrivalComparisonVo;
import org.dromara.bigscreen.domain.vo.wzxqysjdhdbVo;
import org.dromara.cailiaoshebei.domain.BusMaterialbatchdemandplan;
import org.dromara.cailiaoshebei.domain.BusMrpBase;
import org.dromara.cailiaoshebei.domain.BusPlanDocAssociation;
import org.dromara.cailiaoshebei.domain.bo.BusMaterialbatchdemandplanBo;
import org.dromara.cailiaoshebei.domain.bo.BusMrpBaseBo;
import org.dromara.cailiaoshebei.domain.bo.BusMrpBaseReq;
import org.dromara.cailiaoshebei.domain.dto.BusMaterialbatchdemandplanExportDto;
import org.dromara.cailiaoshebei.domain.dto.BusMrpDto;
import org.dromara.cailiaoshebei.domain.dto.BusMrpExportDto;
import org.dromara.cailiaoshebei.domain.vo.BusMaterialbatchdemandplanVo;
import org.dromara.cailiaoshebei.domain.vo.BusMrpBaseVo;
import org.dromara.cailiaoshebei.domain.vo.BusMrpVo;
import org.dromara.cailiaoshebei.mapper.BusMrpBaseMapper;
import org.dromara.cailiaoshebei.service.IBusMaterialbatchdemandplanService;
import org.dromara.cailiaoshebei.service.IBusMrpBaseService;
import org.dromara.cailiaoshebei.service.IBusPlanDocAssociationService;
import org.dromara.common.core.domain.event.ProcessDeleteEvent;
import org.dromara.common.core.domain.event.ProcessEvent;
@ -27,15 +36,9 @@ import org.dromara.common.core.enums.BusinessStatusEnum;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.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 lombok.RequiredArgsConstructor;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.utils.excel.ExcelDynamicReader;
import org.dromara.design.domain.BusBillofquantities;
import org.dromara.design.service.IBusBillofquantitiesService;
import org.dromara.materials.domain.MatMaterialReceiveItem;
import org.dromara.materials.service.IMatMaterialReceiveItemService;
import org.dromara.tender.domain.BusBillofquantitiesLimitList;
@ -47,11 +50,6 @@ import org.jetbrains.annotations.NotNull;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
import org.dromara.cailiaoshebei.domain.bo.BusMrpBaseBo;
import org.dromara.cailiaoshebei.domain.vo.BusMrpBaseVo;
import org.dromara.cailiaoshebei.domain.BusMrpBase;
import org.dromara.cailiaoshebei.mapper.BusMrpBaseMapper;
import org.dromara.cailiaoshebei.service.IBusMrpBaseService;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
@ -77,14 +75,13 @@ public class BusMrpBaseServiceImpl extends ServiceImpl<BusMrpBaseMapper, BusMrpB
private final IBusBillofquantitiesLimitListService busBillofquantitiesService;
private final IBusTenderPlanningLimitListService tenderPlanningLimitListService;
private final IBusTenderPlanningLimitListService tenderPlanningLimitListService;
@Lazy
@Resource
private IMatMaterialReceiveItemService matMaterialReceiveItemService;
/**
* 查询物资-批次需求计划基础信息
*
@ -262,7 +259,7 @@ public class BusMrpBaseServiceImpl extends ServiceImpl<BusMrpBaseMapper, BusMrpB
.findFirst()
.map(item -> {
String name = item.getName() != null ? item.getName() : "";
return "名称:“"+name + "";
return "名称:“" + name + "";
})
.orElse("未知物料");
throw new ServiceException(itemName + "超出数量");
@ -312,7 +309,7 @@ public class BusMrpBaseServiceImpl extends ServiceImpl<BusMrpBaseMapper, BusMrpB
@Override
public Map<String, Object> remaining(Long projectId, Long limitListId,Long mrpBaseId) {
public Map<String, Object> remaining(Long projectId, Long limitListId, Long mrpBaseId) {
Map<String, Object> map = new HashMap<>();
List<BusTenderPlanningLimitList> busTenderPlanningLimitLists = tenderPlanningLimitListService.getBaseMapper()
.selectList(new LambdaQueryWrapper<BusTenderPlanningLimitList>()
@ -326,23 +323,23 @@ public class BusMrpBaseServiceImpl extends ServiceImpl<BusMrpBaseMapper, BusMrpB
// 获取数据库中已有的数量
List<BusMaterialbatchdemandplan> existingList = planservice.list(
Wrappers.lambdaQuery(BusMaterialbatchdemandplan.class)
.eq(BusMaterialbatchdemandplan::getSuppliespriceId ,limitListId)
.ne(mrpBaseId!=null,BusMaterialbatchdemandplan::getMrpBaseId, mrpBaseId)// 排除当前批次
.eq(BusMaterialbatchdemandplan::getSuppliespriceId, limitListId)
.ne(mrpBaseId != null, BusMaterialbatchdemandplan::getMrpBaseId, mrpBaseId)// 排除当前批次
);
BigDecimal reduce = BigDecimal.ZERO;
if(CollectionUtil.isNotEmpty(existingList)){
reduce = existingList.stream()
if (CollectionUtil.isNotEmpty(existingList)) {
reduce = existingList.stream()
.map(BusMaterialbatchdemandplan::getDemandQuantity)
.reduce(BigDecimal.ZERO, BigDecimal::add);
}
map.put("remainingQuantity",quantity.subtract(reduce));
map.put("suppliespriceId",limitListId);
map.put("remainingQuantity", quantity.subtract(reduce));
map.put("suppliespriceId", limitListId);
if (busBillofquantities != null) {
map.put("specification",busBillofquantities.getSpecification());
map.put("unit",busBillofquantities.getUnit());
map.put("unitPrice",busBillofquantities.getUnitPrice());
map.put("remark",busBillofquantities.getRemark());
map.put("name",busBillofquantities.getName());
map.put("specification", busBillofquantities.getSpecification());
map.put("unit", busBillofquantities.getUnit());
map.put("unitPrice", busBillofquantities.getUnitPrice());
map.put("remark", busBillofquantities.getRemark());
map.put("name", busBillofquantities.getName());
}
return map;
}
@ -357,26 +354,26 @@ public class BusMrpBaseServiceImpl extends ServiceImpl<BusMrpBaseMapper, BusMrpB
.like(BusMaterialbatchdemandplan::getName, req.getName()));
Iterator<BusMaterialbatchdemandplan> iterator = busMaterialbatchdemandplans.iterator();
Set<Long> mrpIds = new HashSet<>();
while (iterator.hasNext()){
while (iterator.hasNext()) {
BusMaterialbatchdemandplan next = iterator.next();
List<BusPlanDocAssociation> busPlanDocAssociations = planDocAssociationService.getBaseMapper().selectList(new LambdaQueryWrapper<BusPlanDocAssociation>()
.eq(BusPlanDocAssociation::getProjectId, req.getProjectId())
.eq(BusPlanDocAssociation::getPlanId, next.getId()));
BigDecimal demandQuantity = BigDecimal.ZERO;
busPlanDocAssociations.forEach(busPlanDocAssociation -> {
demandQuantity.add(busPlanDocAssociation.getDemandQuantity());
demandQuantity.add(busPlanDocAssociation.getDemandQuantity());
});
if (demandQuantity.compareTo(next.getDemandQuantity()) >= 0) {
iterator.remove();
}else {
} else {
mrpIds.add(next.getMrpBaseId());
}
}
if (mrpIds.isEmpty()){
if (mrpIds.isEmpty()) {
return null;
}
return baseMapper.selectVoList(new LambdaQueryWrapper<BusMrpBase>()
.eq(BusMrpBase::getStatus,BusinessStatusEnum.FINISH.getStatus()).in(BusMrpBase::getId,mrpIds));
.eq(BusMrpBase::getStatus, BusinessStatusEnum.FINISH.getStatus()).in(BusMrpBase::getId, mrpIds));
}
@Override
@ -411,14 +408,14 @@ public class BusMrpBaseServiceImpl extends ServiceImpl<BusMrpBaseMapper, BusMrpB
Set<Long> planIds = matMaterialReceiveItems.stream()
.map(MatMaterialReceiveItem::getPlanId)
.collect(Collectors.toSet());
if (CollUtil.isEmpty(planIds)){
if (CollUtil.isEmpty(planIds)) {
return new HashMap<>();
}
Map<Long, BigDecimal> planMap = matMaterialReceiveItems.stream()
.filter(matMaterialReceiveItem -> matMaterialReceiveItem.getPlanId() != null)
.collect(Collectors.groupingBy(
MatMaterialReceiveItem::getPlanId,
Collectors.reducing(BigDecimal.ZERO, MatMaterialReceiveItem::getQuantity, BigDecimal::add)
Collectors.reducing(BigDecimal.ZERO, MatMaterialReceiveItem::getAcceptedQuantity, BigDecimal::add)
));
// 根据入库数据反查批次需求计划数据 bus_materialbatchdemandplan
List<BusMaterialbatchdemandplan> materialbatchdemandplans = planservice.getBaseMapper().selectList(new LambdaQueryWrapper<BusMaterialbatchdemandplan>()