维修模块优化

This commit is contained in:
sxu 2024-11-23 12:07:25 +08:00
parent 709f445119
commit fffd11e6d2
3 changed files with 46 additions and 26 deletions

View File

@ -57,6 +57,18 @@ public interface RepairMapper {
*/
int updateRepairedNum(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("repairer") Long repairer, @Param("userId") Long userId);
int updateRepairedNumAndStatus(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("status") int status, @Param("repairer") Long repairer, @Param("userId") Long userId);
/**
* 修改维修数量
* @param id 主键 key
* @param repairNum 维修数量
* @param userid 用户id
*/
int updateRepairedNumTwo(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("userId") Long userid);
int updateRepairedNumTwoAndStatus(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("status") int status, @Param("userId") Long userid);
/**
* 修改报废数量
* @param id 主键key
@ -108,14 +120,6 @@ public interface RepairMapper {
*/
int createAgreementTask(RepairTask task);
/**
* 修改维修数量
* @param id 主键 key
* @param repairNum 维修数量
* @param userid 用户id
*/
int updateRepairedNumTwo(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("userId") Long userid);
/**
* 查询是否存在未完成维修的
* @param task 任务信息

View File

@ -57,9 +57,6 @@ public class RepairServiceImpl implements RepairService {
// 1:内部维修 2:外部返厂维修 3:报废
private final int inRepairType = 1, outRepairType = 2, scrapRepairType = 3;
// 维修管理方式--0编码管理 1数量管理
private final int manageTypeByCode = 0, manageTypeByNumber = 1;
@Override
public List<RepairTask> getRepairTaskList(RepairTask bean) {
return repairMapper.getRepairTaskList(bean);
@ -375,7 +372,7 @@ public class RepairServiceImpl implements RepairService {
if (bean.getManageType() == null) {
throw new ServiceException("请选择物资管理方式");
}
if (Objects.equals(manageTypeByCode, bean.getManageType())) {
if (Objects.equals(MaTypeManageTypeEnum.CODE_DEVICE.getTypeId(), bean.getManageType())) {
// 物资管理方式--编码管理
if (bean.getRepairType() == null) {
continue;
@ -385,13 +382,13 @@ public class RepairServiceImpl implements RepairService {
case inRepairType: {
partList = bean.getCodeInRepairPartList();
// 更新维修数量并修改维修人员
repairMapper.updateRepairedNum(bean.getId(), 1, loginUser.getUserid(), loginUser.getUserid());
repairMapper.updateRepairedNumAndStatus(bean.getId(), 1, 1, loginUser.getUserid(), loginUser.getUserid());
break;
}
case outRepairType: {
partList = bean.getCodeOutRepairPartList();
// 更新维修数量维修人员不变
repairMapper.updateRepairedNumTwo(bean.getId(), 1, loginUser.getUserid());
repairMapper.updateRepairedNumTwoAndStatus(bean.getId(), 1, 1, loginUser.getUserid());
break;
}
case scrapRepairType: {
@ -408,7 +405,7 @@ public class RepairServiceImpl implements RepairService {
// 统一处理配件集合数据
copeNumberManageInList(bean, partList, loginUser, bean.getManageType());
} else if (Objects.equals(manageTypeByNumber, bean.getManageType())) {
} else if (Objects.equals(MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId(), bean.getManageType())) {
// 物资管理方式--数量管理
if (bean.getId() == null) {
throw new ServiceException("请完善参数维修详情ID为空!");
@ -598,7 +595,7 @@ public class RepairServiceImpl implements RepairService {
throw new ServiceException("请选择物资管理方式");
}
// 如果是数量管理那么默认为内部维修
if (bean.getRepairType() == null && manageType == manageTypeByNumber) {
if (bean.getRepairType() == null && MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(manageType)) {
bean.setRepairType(inRepairType);
}
// 再检查还是null的话直接结束任务
@ -613,11 +610,11 @@ public class RepairServiceImpl implements RepairService {
for (RepairPartDetails partDetails : partList) {
// 维修记录表信息
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()).setRepairType(inRepairType);
if (manageType == manageTypeByCode) {
if (MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(manageType)) {
repairApplyRecord.setRepairNum(scrapRepairType != bean.getRepairType() ? 1 : 0);
repairApplyRecord.setScrapNum(scrapRepairType == bean.getRepairType() ? 1 : 0);
}
if (manageType == manageTypeByNumber) {
if (MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(manageType)) {
repairApplyRecord.setRepairNum(partDetails.getRepairNum());
}
repairApplyRecord.setCreateBy(loginUser.getUsername());

View File

@ -42,6 +42,33 @@
where id = #{id}
</update>
<update id="updateRepairedNumAndStatus">
update repair_apply_details
set repaired_num = #{repairNum},
status = #{status},
repairer = #{repairer},
update_by = #{userId},
update_time = now()
where id = #{id}
</update>
<update id="updateRepairedNumTwo">
update repair_apply_details
set repaired_num = #{repairNum},
update_by = #{userId},
update_time = now()
where id = #{id}
</update>
<update id="updateRepairedNumTwoAndStatus">
update repair_apply_details
set repaired_num = #{repairNum},
status = #{status},
update_by = #{userId},
update_time = now()
where id = #{id}
</update>
<update id="updateScrapNum">
update repair_apply_details
set scrap_num = #{scrapNum},
@ -72,14 +99,6 @@
</foreach>
</update>
<update id="updateRepairedNumTwo">
update repair_apply_details
set repaired_num = #{repairNum},
update_by = #{userId},
update_time = now()
where id = #{id}
</update>
<select id="getRepairTaskInfoByTaskId" resultType="com.bonus.material.repair.domain.RepairTask">
SELECT
rd.task_id as taskId,