维修模块优化
This commit is contained in:
parent
709f445119
commit
fffd11e6d2
|
|
@ -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 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
|
* @param id 主键key
|
||||||
|
|
@ -108,14 +120,6 @@ public interface RepairMapper {
|
||||||
*/
|
*/
|
||||||
int createAgreementTask(RepairTask task);
|
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 任务信息
|
* @param task 任务信息
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,6 @@ public class RepairServiceImpl implements RepairService {
|
||||||
// 1:内部维修 2:外部返厂维修 3:报废
|
// 1:内部维修 2:外部返厂维修 3:报废
|
||||||
private final int inRepairType = 1, outRepairType = 2, scrapRepairType = 3;
|
private final int inRepairType = 1, outRepairType = 2, scrapRepairType = 3;
|
||||||
|
|
||||||
// 维修管理方式--0:编码管理 1:数量管理
|
|
||||||
private final int manageTypeByCode = 0, manageTypeByNumber = 1;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RepairTask> getRepairTaskList(RepairTask bean) {
|
public List<RepairTask> getRepairTaskList(RepairTask bean) {
|
||||||
return repairMapper.getRepairTaskList(bean);
|
return repairMapper.getRepairTaskList(bean);
|
||||||
|
|
@ -375,7 +372,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
if (bean.getManageType() == null) {
|
if (bean.getManageType() == null) {
|
||||||
throw new ServiceException("请选择物资管理方式");
|
throw new ServiceException("请选择物资管理方式");
|
||||||
}
|
}
|
||||||
if (Objects.equals(manageTypeByCode, bean.getManageType())) {
|
if (Objects.equals(MaTypeManageTypeEnum.CODE_DEVICE.getTypeId(), bean.getManageType())) {
|
||||||
// 物资管理方式--编码管理
|
// 物资管理方式--编码管理
|
||||||
if (bean.getRepairType() == null) {
|
if (bean.getRepairType() == null) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -385,13 +382,13 @@ public class RepairServiceImpl implements RepairService {
|
||||||
case inRepairType: {
|
case inRepairType: {
|
||||||
partList = bean.getCodeInRepairPartList();
|
partList = bean.getCodeInRepairPartList();
|
||||||
// 更新维修数量、并修改维修人员
|
// 更新维修数量、并修改维修人员
|
||||||
repairMapper.updateRepairedNum(bean.getId(), 1, loginUser.getUserid(), loginUser.getUserid());
|
repairMapper.updateRepairedNumAndStatus(bean.getId(), 1, 1, loginUser.getUserid(), loginUser.getUserid());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case outRepairType: {
|
case outRepairType: {
|
||||||
partList = bean.getCodeOutRepairPartList();
|
partList = bean.getCodeOutRepairPartList();
|
||||||
// 更新维修数量、维修人员不变
|
// 更新维修数量、维修人员不变
|
||||||
repairMapper.updateRepairedNumTwo(bean.getId(), 1, loginUser.getUserid());
|
repairMapper.updateRepairedNumTwoAndStatus(bean.getId(), 1, 1, loginUser.getUserid());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case scrapRepairType: {
|
case scrapRepairType: {
|
||||||
|
|
@ -408,7 +405,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
// 统一处理配件集合数据
|
// 统一处理配件集合数据
|
||||||
copeNumberManageInList(bean, partList, loginUser, bean.getManageType());
|
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) {
|
if (bean.getId() == null) {
|
||||||
throw new ServiceException("请完善参数,维修详情ID为空!");
|
throw new ServiceException("请完善参数,维修详情ID为空!");
|
||||||
|
|
@ -598,7 +595,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
throw new ServiceException("请选择物资管理方式");
|
throw new ServiceException("请选择物资管理方式");
|
||||||
}
|
}
|
||||||
// 如果是数量管理,那么默认为内部维修
|
// 如果是数量管理,那么默认为内部维修
|
||||||
if (bean.getRepairType() == null && manageType == manageTypeByNumber) {
|
if (bean.getRepairType() == null && MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(manageType)) {
|
||||||
bean.setRepairType(inRepairType);
|
bean.setRepairType(inRepairType);
|
||||||
}
|
}
|
||||||
// 再检查还是null的话直接结束任务
|
// 再检查还是null的话直接结束任务
|
||||||
|
|
@ -613,11 +610,11 @@ public class RepairServiceImpl implements RepairService {
|
||||||
for (RepairPartDetails partDetails : partList) {
|
for (RepairPartDetails partDetails : partList) {
|
||||||
// 维修记录表信息
|
// 维修记录表信息
|
||||||
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()).setRepairType(inRepairType);
|
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.setRepairNum(scrapRepairType != bean.getRepairType() ? 1 : 0);
|
||||||
repairApplyRecord.setScrapNum(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.setRepairNum(partDetails.getRepairNum());
|
||||||
}
|
}
|
||||||
repairApplyRecord.setCreateBy(loginUser.getUsername());
|
repairApplyRecord.setCreateBy(loginUser.getUsername());
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,33 @@
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</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 id="updateScrapNum">
|
||||||
update repair_apply_details
|
update repair_apply_details
|
||||||
set scrap_num = #{scrapNum},
|
set scrap_num = #{scrapNum},
|
||||||
|
|
@ -72,14 +99,6 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</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 id="getRepairTaskInfoByTaskId" resultType="com.bonus.material.repair.domain.RepairTask">
|
||||||
SELECT
|
SELECT
|
||||||
rd.task_id as taskId,
|
rd.task_id as taskId,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue