退料单电子签名、维修审核修改

This commit is contained in:
syruan 2025-01-10 09:47:54 +08:00
parent 9313ac3c2d
commit ee4b132a2c
11 changed files with 111 additions and 13 deletions

View File

@ -165,6 +165,19 @@ public class BackApplyInfoController extends BaseController {
}
}
@ApiOperation(value = "修改退料任务电子签名")
@PreventRepeatSubmit
// @RequiresPermissions("back:info:edit")
@SysLog(title = "退料任务电子签名", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改退料任务电子签名")
@PostMapping("/updateSignById")
public AjaxResult updateSignById(@RequestBody BackApplyInfo dto) {
try {
return toAjax(backApplyInfoService.updateSignById(dto));
} catch (Exception e) {
return error("系统错误, " + e.getMessage());
}
}
/**
* 退料申请提交
*/

View File

@ -77,6 +77,10 @@ public class BackApplyInfo implements Serializable {
@Size(max = 20, message = "退料人长度不能超过20个字符")
private String backPerson;
private String backSignUrl;
private Byte backSignType;
/**
* 退料数量
*/

View File

@ -142,6 +142,11 @@ public interface BackApplyInfoMapper {
*/
int updateBack(BackApplyInfo backApplyInfo);
/**
* 更新电子签名
*/
int updateSignById(BackApplyInfo backApplyInfo);
/**
* 更新详情
* @param backApplyInfo
@ -213,6 +218,12 @@ public interface BackApplyInfoMapper {
*/
int updateBackApplyDetails(BackApplyDetails applyDetail);
/**
* 删除详情退料详情限制必须是已出库的状态
* @param backTaskCode 退料任务单号
*/
int removeBackApplyDetails(String backTaskCode);
/**
* 维修驳回--回退在用量
*/

View File

@ -31,6 +31,11 @@ public interface IBackApplyInfoService {
*/
public List<BackApplyInfo> selectBackApplyInfoList(BackApplyInfo backApplyInfo);
/**
* 更新电子签名
*/
int updateSignById(BackApplyInfo backApplyInfo);
/**
* 新增退料任务
*

View File

@ -222,6 +222,16 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
return list;
}
/**
* 更新电子签名
*
* @param backApplyInfo 电子签名信息
*/
@Override
public int updateSignById(BackApplyInfo backApplyInfo) {
return backApplyInfoMapper.updateSignById(backApplyInfo);
}
/**
* 新增退料任务
*

View File

@ -473,6 +473,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
.map(RepairAuditDetails::getTaskId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (taskIds.isEmpty()) {
return 0;
}
@ -491,15 +492,25 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
Long agreementId = taskAgreementMapper.selectAgreementIdByTaskId(repairAuditDetail.getTaskId());
// 查询维修审核明细
final List<RepairAuditDetails> repairAuditDetailList = repairAuditDetailsMapper.selectRepairAuditDetailsByTaskIds(Collections.singletonList(repairAuditDetail.getTaskId()));
// 批量插入维修入库明细
batchInsertRepairInputDetails(repairAuditDetailList, agreementId);
// 更新任务状态
taskMapper.updateTaskStatus(String.valueOf(repairAuditDetail.getTaskId()), RepairTaskStatusEnum.TASK_STATUS_REVIEW.getStatus());
}
} else if ("2".equals(status)) {
for (RepairAuditDetails auditDetails : repairAuditDetails) {
// 处理维修详情的数量
repairApplyDetailsMapper.updateRepairApplyDetailsAfterReject(
ObjectUtils.defaultIfNull(auditDetails.getRepairedNum(),0).longValue(),
ObjectUtils.defaultIfNull(auditDetails.getScrapNum(),0).longValue(), auditDetails.getRepairId());
// 处理 -- 修饰审核任务状态
taskMapper.updateTaskStatus(String.valueOf(auditDetails.getTaskId()), RepairTaskStatusEnum.TASK_STATUS_NO_REVIEW.getStatus());
// 处理 -- 原维修任务单的状态提交修饰审核前拆分的任务
TmTask preTmTaskInfo = taskMapper.selectTmTaskByTaskId(auditDetails.getTaskId());
if (Objects.nonNull(preTmTaskInfo) && Objects.nonNull(preTmTaskInfo.getPreTaskId())) {
taskMapper.updateTaskStatus(String.valueOf(preTmTaskInfo.getTaskId()), RepairTaskStatusEnum.TASK_STATUS_NO_REVIEW.getStatus());
}
}
}

View File

@ -21,6 +21,7 @@ import com.bonus.material.repair.mapper.RepairApplyDetailsMapper;
import com.bonus.material.repair.mapper.RepairAuditDetailsMapper;
import com.bonus.material.repair.mapper.RepairMapper;
import com.bonus.material.repair.service.RepairService;
import com.bonus.material.settlement.mapper.SltAgreementInfoMapper;
import com.bonus.material.task.domain.TmTask;
import com.bonus.material.task.mapper.TmTaskMapper;
import com.bonus.system.api.domain.SysUser;
@ -64,6 +65,9 @@ public class RepairServiceImpl implements RepairService {
@Resource
private BackApplyInfoMapper backApplyInfoMapper;
@Resource
private SltAgreementInfoMapper sltAgreementInfoMapper;
// 1:内部维修 2:外部返厂维修 3:报废
private final int INNER_REPAIR = 1; // 需要严格匹配枚举值 RepairTypeEnum.INNER_REPAIR.getTypeId();
private final int RETURN_FACTORY = 2; // 需要严格匹配枚举值 RepairTypeEnum.RETURN_FACTORY.getTypeId();
@ -879,9 +883,10 @@ public class RepairServiceImpl implements RepairService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult rejectRepair(@NotNull List<Long> taskList) {
try {
taskList.forEach(taskId -> {
for (Long taskId : taskList) {
// 判断维修明细是否有已经维修的数据
final int repairedScrapNumber = repairMapper.getRepairedScrapNumByTaskId(taskId);
if (0 >= repairedScrapNumber) {
@ -894,19 +899,26 @@ public class RepairServiceImpl implements RepairService {
.setTaskId(tmTask.getPreTaskId())
.setTaskStatus(BackTaskStatusEnum.BACK_TASK_TO_REJECT.getStatus())
);
// 3.退料的在用数量恢复
backApplyInfoMapper.updateBackApplyDetailsTwo(tmTask.getPreTaskId());
// 4.更新退料明细状态
backApplyInfoMapper.updateBackApplyDetails(new BackApplyDetails()
.setParentId(tmTask.getPreTaskId())
.setStatus(String.valueOf(BackTaskStatusEnum.BACK_TASK_TO_REJECT.getStatus()))
);
// 3.退料的在用数量恢复 -- 2025.1.9 ruan修改 已弃用!!!
// backApplyInfoMapper.updateBackApplyDetailsTwo(tmTask.getPreTaskId());
// 3. 更新结算信息表
sltAgreementInfoMapper.backRejectSltCope(tmTask.getPreTaskId());
if (null == tmTask.getCode() || tmTask.getCode().isEmpty()) {
throw new ServiceException("维修任务:" + taskId + "没有退料单号,系统异常!");
}
// 4.更新退料明细状态 -- 2025.1.9 ruan修改 驳回时--退料明细直接删除
backApplyInfoMapper.removeBackApplyDetails(tmTask.getCode());
} else {
throw new ServiceException("维修任务:" + taskId + "没有前置任务,不能驳回");
}
} else {
throw new ServiceException("维修任务:" + taskId + "有已维修数据,不能驳回");
}
}
});
} catch (final DataAccessException e) {
System.err.println(e.getMessage());
return AjaxResult.error("数据库SQL修改执行失败" + e.getMessage());
throw new ServiceException("数据库SQL修改执行失败" + e.getMessage());
}
return AjaxResult.success("执行完成");
}

View File

@ -92,4 +92,9 @@ public interface SltAgreementInfoMapper {
int updateApply(SltAgreementApply apply);
int updateMaStatus(SltAgreementInfo agreementInfo);
/**
* 退料驳回结算信息处理
*/
int backRejectSltCope(Long backTaskId);
}

View File

@ -43,6 +43,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
tt.task_status as taskStatus,
bai.create_by as createBy,
bai.create_time as createTime,
bai.back_sign_url as backSignUrl,
bai.back_sign_type as backSignType,
GROUP_CONCAT(DISTINCT mt2.type_id) as typeId,
GROUP_CONCAT(DISTINCT mt2.type_name) AS typeName,
bai.`status` AS status,
@ -592,6 +594,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
where id = #{id}
</update>
<update id="updateTaskStatus">
update tm_task set task_status = #{taskStatus} where task_id = #{taskId}
</update>
@ -600,6 +603,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update back_apply_info set status = #{taskStatus} where id = #{id}
</update>
<update id="updateSignById">
update back_apply_info
<trim prefix="SET" suffixOverrides=",">
<if test="backSignUrl != null">back_sign_url = #{backSignUrl},</if>
<if test="backSignType != null">back_sign_type = #{backSignType},</if>
</trim>
where id = #{id}
</update>
<update id="updateBackDetails">
update back_apply_details set status = #{taskStatus} where parent_id = #{id}
</update>
@ -691,4 +703,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SET bad.use_num = IFNULL(bad.use_num, 0) + IFNULL(bad.audit_num, 0)
WHERE bai.task_id = #{taskId};
</update>
<delete id="removeBackApplyDetails">
delete from back_apply_details where code = #{code} and status = '2'
</delete>
</mapper>

View File

@ -394,4 +394,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
set ma_status =#{status}
where ma_id = #{maId}
</update>
<update id="backRejectSltCope">
update
slt_agreement_info sai
join
back_apply_info bai on sai.back_id = bai.id
set
sai.end_time = null, sai.back_id = null, sai.status = '0', sai.update_time = now()
where
bai.task_id = #{backTaskId} and sai.status = '1'
</update>
</mapper>