This commit is contained in:
mashuai 2025-08-26 20:58:26 +08:00
parent b35d42ff20
commit 5e6c28baa4
9 changed files with 140 additions and 73 deletions

View File

@ -458,6 +458,19 @@ public class ComplexQueryController extends BaseController {
return AjaxResult.success(getDataTable(pageList));
}
/**
* 配件库存个人查询
* @param bean
* @return
*/
@ApiOperation(value = "综合查询--配件库存个人查询")
@GetMapping("/getPartPersonNum")
public AjaxResult getPartPersonNum(RetainedEquipmentInfo bean) {
startPage();
List<RetainedEquipmentInfo> pageList = complexQueryService.getPartPersonNum(bean);
return AjaxResult.success(getDataTable(pageList));
}
/**
* 施工机具需求供应分析统计表

View File

@ -190,4 +190,11 @@ public interface ComplexQueryMapper {
List<ProjUsingRecord> getAllUsDetails(ProjUsingRecord bean);
List<UseStorageInfo> batchSelectInfo(@Param("list") Set<Long> leaseIds);
/**
* 查询配件使用数量
* @param bean
* @return
*/
List<RetainedEquipmentInfo> getPartPersonNum(RetainedEquipmentInfo bean);
}

View File

@ -130,4 +130,11 @@ public interface ComplexQueryService {
* @return
*/
List<ProjUsingRecord> getAllUsDetails(ProjUsingRecord bean);
/**
* 配件库存个人查询
* @param bean
* @return
*/
List<RetainedEquipmentInfo> getPartPersonNum(RetainedEquipmentInfo bean);
}

View File

@ -377,16 +377,6 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
try {
List<UseStorageInfo> list = complexQueryMapper.getUserRecords(bean);
if (CollectionUtils.isNotEmpty(list)) {
/*for (UseStorageInfo useStorageInfo : list) {
// 查询出库信息
if (useStorageInfo.getLeaseId() != null) {
UseStorageInfo dto = complexQueryMapper.selectInFo(useStorageInfo);
if (dto != null) {
useStorageInfo.setCreator(dto.getCreator());
useStorageInfo.setOutTime(dto.getOutTime());
}
}
}*/
// 提取所有非空的leaseId批量查询出库信息
Set<Long> leaseIds = list.stream()
.map(UseStorageInfo::getLeaseId)
@ -701,4 +691,16 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
return new ArrayList<>();
}
}
/**
* 配件库存个人查询
* @param bean
* @return
*/
@Override
public List<RetainedEquipmentInfo> getPartPersonNum(RetainedEquipmentInfo bean) {
Long userId = SecurityUtils.getLoginUser().getUserid();
bean.setUserId(userId);
return complexQueryMapper.getPartPersonNum(bean);
}
}

View File

@ -863,30 +863,28 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
details.setStatus(MaMachineStatusEnum.SCRAP_TO_AUDIT.getStatus().toString());
repairAuditDetailsMapper.updateMachine(details);
}
ScrapApplyDetails bean = null;
if (!CollectionUtils.isEmpty(list)) {
bean = list.get(0);
}
if (!CollectionUtils.isEmpty(scrapApplyDetailList)) {
bean = scrapApplyDetailList.get(0);
for (ScrapApplyDetails info : list) {
if (info.getScrapNum().compareTo(BigDecimal.ZERO) == 0) {
continue;
}
ScrapApplyDetails scrapApplyDetails = new ScrapApplyDetails();
scrapApplyDetails.setTaskId(newScrapTaskId);
scrapApplyDetails.setTypeId(details.getTypeId());
scrapApplyDetails.setMaId(details.getMaId() == null ? null : details.getMaId());
scrapApplyDetails.setScrapNum(details.getScrapNum());
scrapApplyDetails.setScrapNum(info.getScrapNum());
scrapApplyDetails.setScrapSource("2");
scrapApplyDetails.setStatus("0");
scrapApplyDetails.setParentId(details.getId());
scrapApplyDetails.setCreateTime(new Date());
if (bean != null) {
scrapApplyDetails.setScrapReason(bean.getScrapReason() == null ? "" : bean.getScrapReason());
scrapApplyDetails.setScrapType(bean.getScrapType() == null ? null : bean.getScrapType());
scrapApplyDetails.setCreateBy(bean.getCreateBy() == null ? SecurityUtils.getLoginUser().getSysUser().getNickName() : bean.getCreateBy());
}
scrapApplyDetails.setScrapReason(info.getScrapReason() == null ? "" : info.getScrapReason());
scrapApplyDetails.setScrapType(info.getScrapType() == null ? null : info.getScrapType());
scrapApplyDetails.setCreateBy(info.getCreateBy() == null ? SecurityUtils.getLoginUser().getSysUser().getNickName() : info.getCreateBy());
scrapApplyDetailsMapper.insertScrapApplyDetails(scrapApplyDetails);
}
}
}
}
// 插入维修入库明细
if (!CollectionUtils.isEmpty(inputList)) {
repairInputDetailsMapper.batchInsertRepairInputDetails(inputList);

View File

@ -563,7 +563,7 @@ public class RepairServiceImpl implements RepairService {
fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId())
.setFileType(Long.valueOf(RepairTypeEnum.INNER_REPAIR.getTypeId()))
.setTaskId(bean.getTaskId()).setModelId(bean.getId())
.setCreateBy(loginUser.getUsername());
.setCreateBy(loginUser.getSysUser().getNickName());
fileInfo.setCreateTime(DateUtils.getNowDate());
bmFileInfoMapper.insertBmFileInfo(fileInfo);
}
@ -582,7 +582,7 @@ public class RepairServiceImpl implements RepairService {
fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId())
.setFileType(Long.valueOf(RepairTypeEnum.RETURN_FACTORY.getTypeId()))
.setTaskId(bean.getTaskId()).setModelId(bean.getId())
.setCreateBy(loginUser.getUsername());
.setCreateBy(loginUser.getSysUser().getNickName());
fileInfo.setCreateTime(DateUtils.getNowDate());
bmFileInfoMapper.insertBmFileInfo(fileInfo);
}
@ -635,7 +635,7 @@ public class RepairServiceImpl implements RepairService {
for (BmFileInfo bmFileInfo : partDetails.getFileList()) {
bmFileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR_NUM.getTaskTypeId())
.setTaskId(bean.getTaskId()).setModelId(bean.getId())
.setCreateBy(loginUser.getUsername());
.setCreateBy(loginUser.getSysUser().getNickName());
bmFileInfoMapper.insertBmFileInfo(bmFileInfo);
}
}
@ -667,7 +667,7 @@ public class RepairServiceImpl implements RepairService {
fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId())
.setFileType(Long.valueOf(RepairTypeEnum.INNER_REPAIR.getTypeId()))
.setTaskId(bean.getTaskId()).setModelId(bean.getId())
.setCreateBy(loginUser.getUsername());
.setCreateBy(loginUser.getSysUser().getNickName());
fileInfo.setCreateTime(DateUtils.getNowDate());
bmFileInfoMapper.insertBmFileInfo(fileInfo);
}
@ -702,7 +702,7 @@ public class RepairServiceImpl implements RepairService {
.setRepairContent(repairPartDetails.getRepairContent()).setSupplierId(repairPartDetails.getSupplierId())
.setPartNum(repairPartDetails.getPartNum()).setRepairer(loginUser.getUsername())
.setPartPrice(Optional.ofNullable(repairPartDetails.getPartPrice()).orElse(BigDecimal.ZERO))
.setCreateBy(loginUser.getUsername());
.setCreateBy(loginUser.getSysUser().getNickName());
if (CollectionUtil.isNotEmpty(bean.getOutRepairList())) {
repairApplyRecord.setRemark(StringUtils.isNotBlank(bean.getOutRepairList().get(0).getRemark()) ? bean.getOutRepairList().get(0).getRemark() : "");
}
@ -716,7 +716,7 @@ public class RepairServiceImpl implements RepairService {
fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId())
.setFileType(Long.valueOf(RepairTypeEnum.RETURN_FACTORY.getTypeId()))
.setTaskId(bean.getTaskId()).setModelId(bean.getId())
.setCreateBy(loginUser.getUsername());
.setCreateBy(loginUser.getSysUser().getNickName());
fileInfo.setCreateTime(DateUtils.getNowDate());
bmFileInfoMapper.insertBmFileInfo(fileInfo);
}
@ -919,7 +919,7 @@ public class RepairServiceImpl implements RepairService {
if (MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(manageType)) {
repairApplyRecord.setRepairNum(partDetails.getRepairNum());
}
repairApplyRecord.setCreateBy(loginUser.getUsername());
repairApplyRecord.setCreateBy(loginUser.getSysUser().getNickName());
repairApplyRecord.setStatus(0L);
if(bean.getInRepairList()!=null){
repairApplyRecord.setRemark(StringUtils.isNotBlank(bean.getInRepairList().get(0).getRemark()) ? bean.getInRepairList().get(0).getRemark() : "");
@ -1019,7 +1019,7 @@ public class RepairServiceImpl implements RepairService {
if (null == partList.get(i).getSupplierId()) {
throw new ServiceException("请选择返厂厂家");
}
repairApplyRecord.setCreateBy(loginUser.getUsername());
repairApplyRecord.setCreateBy(loginUser.getSysUser().getNickName());
repairApplyRecord.setSupplierId(partList.get(i).getSupplierId());
repairApplyRecord.setPartPrice(Optional.ofNullable(partList.get(i).getBackCost()).orElse(BigDecimal.ZERO));
repairApplyRecord.setRemark(StringUtils.isNotBlank(bean.getOutRepairList().get(0).getRemark()) ? bean.getOutRepairList().get(0).getRemark() : "");

View File

@ -5,11 +5,9 @@ import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.convert.Convert;
import com.bonus.common.biz.config.ListPagingUtil;
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.core.utils.ServletUtils;
import com.bonus.common.log.enums.OperaType;
import com.bonus.material.common.annotation.PreventRepeatSubmit;
import com.bonus.material.lease.domain.LeaseApplyDetails;
import com.bonus.material.scrap.domain.vo.ScrapDetailsListVo;
import com.bonus.material.scrap.domain.vo.ScrapTaskListVo;
import com.bonus.material.scrap.domain.vo.ScrapTotalListVo;

View File

@ -831,33 +831,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
mt.buy_price AS buyPrice,
sai.num AS usNum,
sai_agg.usNum,
mm.ma_code AS maCode,
bp.pro_name AS projectName,
sai.lease_id AS leaseId,
sai.type_id AS typeId,
sai_agg.lease_id AS leaseId,
sai_agg.type_id AS typeId,
GROUP_CONCAT( DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ' ) AS maKeeper
FROM
slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = sai.agreement_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN ma_type_keeper mtk ON sai.type_id = mtk.type_id
LEFT JOIN sys_user su ON mtk.user_id = su.user_id
(
SELECT
type_id,
ma_id,
lease_id,
agreement_id,
SUM( num ) AS usNum
FROM
slt_agreement_info
WHERE
sai.`status` = '0'
AND sai.end_time IS NULL
AND sai.back_id IS NULL
AND sai.`is_slt` = '0'
`status` = '0'
AND end_time IS NULL
AND back_id IS NULL
AND `is_slt` = '0'
<if test="typeId != null">
AND sai.type_id = #{typeId}
AND type_id = #{typeId}
</if>
GROUP BY
sai.type_id,
sai.ma_id,
bp.pro_id
type_id,
ma_id,
lease_id,
agreement_id
) AS sai_agg
LEFT JOIN ma_type mt ON mt.type_id = sai_agg.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN ma_machine mm ON mm.ma_id = sai_agg.ma_id
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = sai_agg.agreement_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN ma_type_keeper mtk ON sai_agg.type_id = mtk.type_id
LEFT JOIN sys_user su ON mtk.user_id = su.user_id
GROUP BY
sai_agg.type_id,
sai_agg.ma_id,
bp.pro_id,
sai_agg.lease_id
</select>
<select id="getRepairRecordList" resultType="com.bonus.material.basic.domain.RepairStorageInfo">
@ -1481,4 +1497,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY lod.parent_id
</select>
<select id="getPartPersonNum" resultType="com.bonus.material.basic.domain.RetainedEquipmentInfo">
SELECT
mt.pa_id AS typeId,
mt2.pa_name AS typeName,
mt2.pa_id AS thirdTypeId,
mt.pa_name AS typeModelName,
mt.unit_name AS unit,
mt.storage_num AS storeNum
FROM ma_part_type mt
LEFT JOIN ma_part_type mt2 on mt2.pa_id = mt.parent_id
<if test="userId != null">
JOIN ma_part_type_keeper mtk ON mtk.type_id = mt.pa_id AND mtk.user_id = #{userId}
</if>
WHERE mt.del_flag = '0' and mt.`level` = '3'
<if test="keyWord != null and keyWord != ''">
and (
mt2.pa_name like concat('%',#{keyWord},'%') or
mt.pa_name like concat('%',#{keyWord},'%')
)
</if>
<if test="typeName != null and typeName != ''">
and mt2.pa_name like concat('%',#{typeName},'%')
</if>
<if test="typeModelName != null and typeModelName != ''">
and mt.pa_name like concat('%',#{typeModelName},'%')
</if>
</select>
</mapper>

View File

@ -102,8 +102,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ifnull(rad.repair_num,0) as repairNum,
ifnull(rad.repaired_num,0) as repairedNum,
mt.buy_price as buyPrice,
rar.scrap_reason as scrapReason,
rar.scrap_type as scrapType
sad.scrap_reason as scrapReason,
sad.scrap_type as scrapType
from
scrap_apply_details sad
left join ma_type mt on sad.type_id = mt.type_id
@ -111,11 +111,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sys_user su on sad.create_by = su.user_id
left join ma_type mt2 on mt.parent_id = mt2.type_id
left join repair_audit_details rad on sad.parent_id = rad.id
LEFT JOIN repair_apply_details ra on rad.repair_id = ra.id
LEFT JOIN repair_apply_record rar on rar.task_id = ra.task_id
and (case when mt.manage_type = 0 then rar.ma_id = ra.ma_id
when mt.manage_type = 1 then rar.type_id = ra.type_id
else false end) and rar.repair_type = '3'
where
sad.task_id = #{taskId}
<if test="keyWord != null and keyWord != ''">
@ -366,6 +361,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN repair_apply_details ra ON rad.repair_id = ra.id
WHERE
sad.parent_id = #{parentId}
LIMIT 1
</select>
<select id="selectScrapByTaskId" resultType="com.bonus.material.scrap.domain.ScrapApplyDetails">
@ -373,9 +369,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
task_id as taskId,
ma_id as maId,
type_id as typeId,
GROUP_CONCAT(DISTINCT scrap_reason) AS scrapReason,
GROUP_CONCAT(DISTINCT scrap_type) AS scrapType,
GROUP_CONCAT(DISTINCT create_by) AS createBy
scrap_reason AS scrapReason,
scrap_type AS scrapType,
create_by AS createBy,
scrap_num AS scrapNum
FROM
repair_apply_record
WHERE repair_type = '3' and task_id = #{taskId} and type_id = #{typeId}
@ -584,9 +581,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
task_id AS taskId,
ma_id AS maId,
type_id AS typeId,
GROUP_CONCAT(DISTINCT scrap_reason) AS scrapReason,
GROUP_CONCAT(DISTINCT scrap_type) AS scrapType,
GROUP_CONCAT(DISTINCT create_by) AS createBy
scrap_reason AS scrapReason,
scrap_type AS scrapType,
create_by AS createBy,
scrap_num AS scrapNum
FROM repair_apply_record rc
WHERE rc.repair_type = '3'
<if test="list != null and list.size > 0">
@ -605,6 +603,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
)
</if>
GROUP BY rc.task_id, rc.ma_id, rc.type_id
GROUP BY rc.task_id, rc.ma_id
</select>
</mapper>