材料站优化
This commit is contained in:
parent
e7cecc89f3
commit
99b47f9fed
|
|
@ -1830,11 +1830,9 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
||||||
// 第1步:从协议中获取总领料数量(原listL5逻辑)
|
// 第1步:从协议中获取总领料数量(原listL5逻辑)
|
||||||
Map<Long, BigDecimal> totalLeaseNums = new HashMap<>();
|
Map<Long, BigDecimal> totalLeaseNums = new HashMap<>();
|
||||||
if (!CollectionUtils.isEmpty(agreementList)) {
|
if (!CollectionUtils.isEmpty(agreementList)) {
|
||||||
for (AgreementVo agreementVo : agreementList) {
|
// 获取agreementList中的协议id集合
|
||||||
BackApplyInfo backApplyInfo = new BackApplyInfo();
|
List<Long> agreementIds = agreementList.stream().map(agreementVo -> Long.valueOf(agreementVo.getAgreementId())).collect(Collectors.toList());
|
||||||
backApplyInfo.setAgreementId(Long.valueOf(agreementVo.getAgreementId()));
|
List<TypeTreeNode> listL4 = mapper.getTeamClzTree(agreementIds);
|
||||||
List<TypeTreeNode> listL4 = mapper.getUseTypeTreeL4(backApplyInfo);
|
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(listL4)) {
|
if (!CollectionUtils.isEmpty(listL4)) {
|
||||||
for (TypeTreeNode node : listL4) {
|
for (TypeTreeNode node : listL4) {
|
||||||
if (node.getTypeId() != 0L && node.getNum() != null) {
|
if (node.getTypeId() != 0L && node.getNum() != null) {
|
||||||
|
|
@ -1843,7 +1841,6 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 第2步:通过工程获取已在用数量(原list7逻辑)
|
// 第2步:通过工程获取已在用数量(原list7逻辑)
|
||||||
Map<Long, BigDecimal> usedNums = new HashMap<>();
|
Map<Long, BigDecimal> usedNums = new HashMap<>();
|
||||||
|
|
@ -1852,10 +1849,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
||||||
List<BmAgreementInfo> listAgreement = materialLeaseInfoMapper.getAgreementIdByProId(bean);
|
List<BmAgreementInfo> listAgreement = materialLeaseInfoMapper.getAgreementIdByProId(bean);
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(listAgreement)) {
|
if (!CollectionUtils.isEmpty(listAgreement)) {
|
||||||
for (BmAgreementInfo agreementInfo : listAgreement) {
|
List<TypeTreeNode> list6 = materialLeaseInfoMapper.getPlUseTypeTree(listAgreement);
|
||||||
bean.setAgreementId(agreementInfo.getAgreementId());
|
|
||||||
List<TypeTreeNode> list6 = materialLeaseInfoMapper.getUseTypeTree(bean);
|
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(list6)) {
|
if (!CollectionUtils.isEmpty(list6)) {
|
||||||
for (TypeTreeNode node : list6) {
|
for (TypeTreeNode node : list6) {
|
||||||
if (node.getTypeId() != 0L && node.getNum() != null) {
|
if (node.getTypeId() != 0L && node.getNum() != null) {
|
||||||
|
|
@ -1864,7 +1858,6 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 第3步:计算剩余库存 = 总领料数量 - 已在用数量
|
// 第3步:计算剩余库存 = 总领料数量 - 已在用数量
|
||||||
for (Long typeId : typeIds) {
|
for (Long typeId : typeIds) {
|
||||||
|
|
|
||||||
|
|
@ -793,7 +793,6 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
||||||
|
|
||||||
//查询目前还有库存的设备
|
//查询目前还有库存的设备
|
||||||
List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainInfoList(bean);
|
List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainInfoList(bean);
|
||||||
List<MaterialRetainedEquipmentInfo> infos = new ArrayList<>();
|
|
||||||
if (CollectionUtils.isNotEmpty(recordList)) {
|
if (CollectionUtils.isNotEmpty(recordList)) {
|
||||||
inCountNum = recordList.stream()
|
inCountNum = recordList.stream()
|
||||||
.filter(item -> "0".equals(item.getUnitValue()))
|
.filter(item -> "0".equals(item.getUnitValue()))
|
||||||
|
|
@ -811,17 +810,6 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.distinct()
|
.distinct()
|
||||||
.count());
|
.count());
|
||||||
// 获取集合中departName不为空,且去重的数据存放在新集合中
|
|
||||||
List<MaterialRetainedEquipmentInfo> distinctDepartNames = recordList.stream()
|
|
||||||
// 过滤出departName不为空的元素
|
|
||||||
.filter(entity -> StringUtils.isNotBlank(entity.getDepartName()))
|
|
||||||
// 根据departName进行去重
|
|
||||||
.distinct()
|
|
||||||
// 收集到新的List集合中
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (CollectionUtils.isNotEmpty(distinctDepartNames)) {
|
|
||||||
infos.addAll(distinctDepartNames);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
info.setProNum(0);
|
info.setProNum(0);
|
||||||
}
|
}
|
||||||
|
|
@ -834,26 +822,12 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.distinct()
|
.distinct()
|
||||||
.count());
|
.count());
|
||||||
// 获取集合中departName不为空,且去重的数据存放在新集合中
|
|
||||||
List<MaterialRetainedEquipmentInfo> userInfoList = usList.stream()
|
|
||||||
// 过滤出departName不为空的元素
|
|
||||||
.filter(entity -> StringUtils.isNotBlank(entity.getDepartName()))
|
|
||||||
// 根据departName进行去重
|
|
||||||
.distinct()
|
|
||||||
// 收集到新的List集合中
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (CollectionUtils.isNotEmpty(userInfoList)) {
|
|
||||||
infos.addAll(userInfoList);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
info.setTeamNum(0);
|
info.setTeamNum(0);
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isNotEmpty(infos)) {
|
List<MaterialRetainedEquipmentInfo> departNameList = materialMachineMapper.getDepartNameList(bean);
|
||||||
info.setDepartNum((int) infos.stream()
|
if (CollectionUtils.isNotEmpty(departNameList)) {
|
||||||
.map(MaterialRetainedEquipmentInfo::getDepartName)
|
info.setDepartNum(departNameList.size());
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.distinct()
|
|
||||||
.count());
|
|
||||||
} else {
|
} else {
|
||||||
info.setDepartNum(0);
|
info.setDepartNum(0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -770,8 +770,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||||
WHERE
|
WHERE
|
||||||
sai.`status` = '0'
|
sai.`status` = '0'
|
||||||
|
AND mm.ma_status = 2
|
||||||
AND mt.jiju_type = 2
|
AND mt.jiju_type = 2
|
||||||
AND sai.ma_id IS NOT NULL
|
AND sai.ma_id IS NOT NULL
|
||||||
|
AND mt2.type_id not in (6032,6008,6270,6012,6761)
|
||||||
<if test="impUnitName != null and impUnitName != ''">
|
<if test="impUnitName != null and impUnitName != ''">
|
||||||
and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
|
and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -1597,14 +1599,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDepartNameList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
|
<select id="getDepartNameList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
|
||||||
SELECT
|
SELECT DISTINCT
|
||||||
DISTINCT df.project_dept AS departName
|
sp.`name` AS departName
|
||||||
FROM
|
FROM
|
||||||
bm_project bp
|
bm_project bp
|
||||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||||
LEFT JOIN data_center.dx_fb_son df ON bp.external_id = df.id
|
LEFT JOIN sbd_audit.sg_project_department sp ON sd.company_code = sp.parent_id
|
||||||
WHERE
|
WHERE
|
||||||
df.project_dept IS NOT NULL
|
sp.`name` IS NOT NULL
|
||||||
|
AND sp.`status` = 1
|
||||||
<if test="impUnitName != null and impUnitName != ''">
|
<if test="impUnitName != null and impUnitName != ''">
|
||||||
AND sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
|
AND sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -1612,7 +1615,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="departName != null and departName != ''">
|
<if test="departName != null and departName != ''">
|
||||||
AND df.project_dept LIKE CONCAT('%', #{departName}, '%')
|
AND sp.`name` LIKE CONCAT('%', #{departName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="projectIdList != null and projectIdList.size() > 0">
|
<if test="projectIdList != null and projectIdList.size() > 0">
|
||||||
AND bp.external_id in
|
AND bp.external_id in
|
||||||
|
|
@ -1623,7 +1626,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="impUnit != null and impUnit != ''">
|
<if test="impUnit != null and impUnit != ''">
|
||||||
AND bp.imp_unit = #{impUnit}
|
AND bp.imp_unit = #{impUnit}
|
||||||
</if>
|
</if>
|
||||||
GROUP BY bp.pro_center
|
GROUP BY sp.`name`
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getProjectList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
|
<select id="getProjectList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue