This commit is contained in:
hongchao 2025-08-20 20:21:53 +08:00
commit d1e050469c
9 changed files with 129 additions and 43 deletions

View File

@ -622,6 +622,22 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
applyInfo.setIsConfirm(1);
}
}
} else {
if (!CollectionUtils.isEmpty(list)) {
for (LeaseApplyInfo applyInfo : list) {
// 根据id去查询出库数量
LeaseApplyInfo outList = leaseApplyInfoMapper.getOutList(applyInfo);
if (outList != null) {
if (applyInfo.getPreCountNum().compareTo(outList.getAlNum()) == 0) {
applyInfo.setIsConfirm(2);
} else {
applyInfo.setIsConfirm(1);
}
} else {
applyInfo.setIsConfirm(1);
}
}
}
}
//材料站权限过滤
String username = SecurityUtils.getLoginUser().getUsername();

View File

@ -196,4 +196,7 @@ public class RepairTask {
private String dataStatus;
private Integer num;
@ApiModelProperty(value = "退料ID")
private Long backId;
}

View File

@ -74,4 +74,9 @@ public class RepairDeviceSummaryVo extends BaseVO {
private List<BmFileInfo> fileList;
private Integer dataStatusNum;
private String unitValue;
@ApiModelProperty(value = "待修数量")
private BigDecimal waitRepairNum;
}

View File

@ -84,6 +84,9 @@ public class RepairDeviceVO {
@ApiModelProperty(value = "维修费用记录条数")
private Integer totalCostRecords;
@ApiModelProperty(value = "待修数量")
private BigDecimal waitRepairNum;
@ApiModelProperty(value = "维修费用小计计")
private BigDecimal totalCost;
@ -130,6 +133,8 @@ public class RepairDeviceVO {
@ApiModelProperty(value = "一级类型id")
private Long firstId;
private String unitValue;
/**
* 数据状态 0-未定损1-已定损 3-修饰后入库驳回
*/

View File

@ -355,4 +355,11 @@ public interface RepairMapper {
* @return
*/
int updatePartNum(RepairPart currentPart);
/**
* 查询维修任务信息
* @param repairTask
* @return
*/
RepairTask selectInfo(RepairTask repairTask);
}

View File

@ -112,6 +112,13 @@ public class RepairServiceImpl implements RepairService {
}
List<RepairTask> list = repairMapper.getRepairTaskList(bean);
if (CollectionUtil.isNotEmpty(list)) {
for (RepairTask repairTask : list) {
// 根据backId查询是否为定损单需追溯到拆分第一级
RepairTask task = repairMapper.selectInfo(repairTask);
if (task != null) {
repairTask.setNum(task.getNum());
}
}
if (CollectionUtil.isNotEmpty(typeIdList)) {
// 使用流过滤符合条件的元素
list = list.stream()
@ -174,6 +181,11 @@ public class RepairServiceImpl implements RepairService {
List<RepairDeviceSummaryVo> repairDeviceSummaryVoList = new ArrayList<>();
List<RepairDeviceVO> repairDeviceList = repairMapper.getRepairDeviceList(bean);
if (CollectionUtil.isNotEmpty(repairDeviceList)) {
for (RepairDeviceVO repairDeviceVO : repairDeviceList) {
// 获取待修数量
repairDeviceVO.setWaitRepairNum(repairDeviceVO.getRepairNum().subtract(repairDeviceVO.getRepairedNum()
.subtract(repairDeviceVO.getScrapNum())));
}
if (CollectionUtil.isNotEmpty(typeIdList)) {
repairDeviceList = repairDeviceList.stream()
.filter(item -> typeIdList.contains(item.getFirstId()))
@ -213,6 +225,8 @@ public class RepairServiceImpl implements RepairService {
.setTypeId(tempList.get(0).getTypeId()).setType(tempList.get(0).getType())
.setUnitName(tempList.get(0).getUnitName()).setManageType(tempList.get(0).getManageType())
.setDataStatusNum(dataStatusSum)
.setUnitValue(tempList.get(0).getUnitValue())
.setWaitRepairNum(tempList.get(0).getWaitRepairNum())
.setTypeCost(typeCostSum);
repairDeviceSummaryVoList.add(vo);
}
@ -548,6 +562,7 @@ public class RepairServiceImpl implements RepairService {
// 更新维修数量并修改维修人员
repairMapper.updateRepairedNumAndStatus(bean.getId(), BigDecimal.ONE, 1, loginUser.getUsername(), loginUser.getUserid());
// 保存内部维修文件
if (CollectionUtil.isNotEmpty(bean.getInRepairList())) {
if (CollectionUtil.isNotEmpty(bean.getInRepairList().get(0).getFileList())) {
for (BmFileInfo fileInfo : bean.getInRepairList().get(0).getFileList()) {
fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId())
@ -558,6 +573,7 @@ public class RepairServiceImpl implements RepairService {
bmFileInfoMapper.insertBmFileInfo(fileInfo);
}
}
}
break;
}
case RETURN_FACTORY: {
@ -565,6 +581,7 @@ public class RepairServiceImpl implements RepairService {
// 更新维修数量维修人员不变
repairMapper.updateRepairedNumTwoAndStatus(bean.getId(), BigDecimal.ONE, 1, loginUser.getUserid());
// 保存外部维修文件
if (CollectionUtil.isNotEmpty(bean.getOutRepairList())) {
if (CollectionUtil.isNotEmpty(bean.getOutRepairList().get(0).getFileList())) {
for (BmFileInfo fileInfo : bean.getOutRepairList().get(0).getFileList()) {
fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId())
@ -575,6 +592,7 @@ public class RepairServiceImpl implements RepairService {
bmFileInfoMapper.insertBmFileInfo(fileInfo);
}
}
}
break;
}
case TO_SCRAP: {
@ -648,6 +666,7 @@ public class RepairServiceImpl implements RepairService {
}
}
// 保存内部维修文件
if (CollectionUtil.isNotEmpty(bean.getInRepairList())) {
if (CollectionUtil.isNotEmpty(bean.getInRepairList().get(0).getFileList())) {
for (BmFileInfo fileInfo : bean.getInRepairList().get(0).getFileList()) {
fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId())
@ -658,6 +677,7 @@ public class RepairServiceImpl implements RepairService {
bmFileInfoMapper.insertBmFileInfo(fileInfo);
}
}
}
// 处理配件集合数据 -- 数量管理--外部返厂维修
if (CollectionUtil.isNotEmpty(bean.getNumberOutRepairPartList())) {
@ -688,11 +708,14 @@ public class RepairServiceImpl implements RepairService {
.setPartNum(repairPartDetails.getPartNum()).setRepairer(loginUser.getUsername())
.setPartPrice(Optional.ofNullable(repairPartDetails.getPartPrice()).orElse(BigDecimal.ZERO))
.setCreateBy(loginUser.getUsername());
if (CollectionUtil.isNotEmpty(bean.getOutRepairList())) {
repairApplyRecord.setRemark(StringUtils.isNotBlank(bean.getOutRepairList().get(0).getRemark()) ? bean.getOutRepairList().get(0).getRemark() : "");
}
// 新增维修记录表
repairMapper.addRecord(repairApplyRecord);
}
// 保存外部维修文件
if (CollectionUtil.isNotEmpty(bean.getOutRepairList())) {
if (CollectionUtil.isNotEmpty(bean.getOutRepairList().get(0).getFileList())) {
for (BmFileInfo fileInfo : bean.getOutRepairList().get(0).getFileList()) {
fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId())
@ -703,6 +726,7 @@ public class RepairServiceImpl implements RepairService {
bmFileInfoMapper.insertBmFileInfo(fileInfo);
}
}
}
for (int i = 0; i < partList.size(); i++) {
sfCosts = sfCosts.add(partList.get(i).getPartPrice());
}
@ -801,7 +825,7 @@ public class RepairServiceImpl implements RepairService {
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId());
// 生成维修单号
String code = genderWxTaskCode(thisMonthMaxOrder);
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId(), RepairTaskStatusEnum.TASK_STATUS_PROCESSING.getStatus(),
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId(), RepairTaskStatusEnum.TASK_LOSS_ASSESSMENT_COMPLETE.getStatus(),
null,thisMonthMaxOrder + 1, code);
tmTask.setCreateTime(DateUtils.getNowDate());
tmTask.setCreateBy(createBy);
@ -1196,7 +1220,7 @@ public class RepairServiceImpl implements RepairService {
repairTaskDetail.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
repairTaskDetail.setStatus("0");
repairTaskDetail.setNewTaskId(newTaskId);
repairTaskDetail.setIsDs(1);
repairTaskDetail.setIsDs(0);
repairMapper.insertRepaired(repairTaskDetail);
}
} else {

View File

@ -29,9 +29,10 @@ public class UseMaintenanceWarningBean extends BaseEntity {
@Excel(name = "下次检验日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date nextCheckTime;
/**
* 类型名称
*/
@ApiModelProperty(value = "物资类型")
@Excel(name = "物资类型")
private String materialType;
@ApiModelProperty(value = "机具类型")
@Excel(name = "机具类型")
private String typeName;
@ -61,6 +62,10 @@ public class UseMaintenanceWarningBean extends BaseEntity {
@Excel(name = "工程名称")
private String projectName;
@ApiModelProperty(value = "实施单位")
@Excel(name = "分公司")
private String impUnit;
/**
* 协议ID
*/

View File

@ -273,7 +273,8 @@
rd.level as level,
GROUP_CONCAT(DISTINCT mt4.type_id) as firstId,
rd.status as dataStatus,
rad2.num
rad2.num,
rd.back_id as backId
FROM
repair_apply_details rd
LEFT JOIN ma_type mt on rd.type_id = mt.type_id
@ -410,7 +411,7 @@
mt.unit_name as unitName,
mt.manage_type as manageType,
mm.ma_code as code,
rad.repair_num as repairNum,
ifnull(rad.repair_num, 0) as repairNum,
sum(ifnull(rad.repaired_num,0) + ifnull(rad.this_repaired_num,0)) as repairedNum,
sum(ifnull(rad.scrap_num,0) + ifnull(rad.this_scrap_num,0)) as scrapNum,
rad.status as status,
@ -425,7 +426,8 @@
mt4.type_id AS firstId,
( SELECT COUNT(*) FROM repair_cost rc WHERE rc.repair_id = rad.id ) AS totalCostRecords,
( SELECT COALESCE(SUM(rc.costs), 0) FROM repair_cost rc WHERE rc.repair_id = rad.id ) AS totalCost,
rad2.`status` as dataStatus
rad2.`status` as dataStatus,
mt.unit_value AS unitValue
from
repair_apply_details rad
left join ma_type mt on rad.type_id = mt.type_id
@ -1041,6 +1043,17 @@
ORDER BY part_num DESC
</select>
<select id="selectInfo" resultType="com.bonus.material.repair.domain.RepairTask">
SELECT
task_id as taskId,
SUM(`status`) as num
FROM
repair_apply_details
WHERE
is_ds='1' and back_id = #{backId}
GROUP BY task_id
</select>
<update id="updateRepairedAndScrapNum">
update
repair_apply_details

View File

@ -8,17 +8,21 @@
SELECT
mm.ma_id as maId,
mm.next_check_time as nextCheckTime,
mt3.type_name as materialType,
mt2.type_name as typeName,
mt.type_name as typeModelName,
mm.ma_code as maCode,
bu.unit_name as unitName,
bp.pro_name as projectName,
bai.agreement_code as agreementCode,
DATEDIFF(mm.next_check_time, CURDATE()) AS overDays
DATEDIFF(mm.next_check_time, CURDATE()) AS overDays,
sd.dept_name as impUnit
FROM
ma_machine mm
LEFT JOIN ma_type mt on mt.type_id=mm.type_id
LEFT JOIN ma_type mt2 on mt2.type_id=mt.parent_id
LEFT JOIN ma_type mt3 on mt3.type_id=mt2.parent_id
LEFT JOIN ma_type mt4 on mt4.type_id=mt3.parent_id
LEFT JOIN slt_agreement_info sai on sai.ma_id=mm.ma_id and mm.type_id=sai.type_id and sai.`status`='0' and
sai.end_time is null
LEFT JOIN bm_agreement_info bai on bai.agreement_id=sai.agreement_id
@ -26,12 +30,16 @@
AND bu.del_flag = '0'
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
AND bp.del_flag = '0'
LEFT JOIN sys_dept sd on sd.dept_id = bp.imp_unit
WHERE
mm.ma_status='2'
and bp.pro_name is not null
AND mm.next_check_time BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 1 MONTH)
<if test="keyWord != null and keyWord != ''">
and (mt2.type_name like concat('%', #{keyWord}, '%') or
and (
mt4.type_name like concat('%', #{keyWord}, '%') or
mt3.type_name like concat('%', #{keyWord}, '%') or
mt2.type_name like concat('%', #{keyWord}, '%') or
mt.type_name like concat('%', #{keyWord}, '%') or
mm.ma_code like concat('%', #{keyWord}, '%') or
bu.unit_name like concat('%', #{keyWord}, '%') or