Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
99a9422d8e
|
|
@ -158,10 +158,10 @@ public interface BackApplyInfoMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询详情
|
* 查询详情
|
||||||
* @param id
|
* @param backApplyInfo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<BackApplyInfo> selectBackDetails(Long id);
|
List<BackApplyInfo> selectBackDetails(BackApplyInfo backApplyInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新任务状态
|
* 更新任务状态
|
||||||
|
|
|
||||||
|
|
@ -556,7 +556,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult submitBackApply(BackApplyInfo backApplyInfo) {
|
public AjaxResult submitBackApply(BackApplyInfo backApplyInfo) {
|
||||||
// 根据传入的id查询退料申请信息
|
// 根据传入的id查询退料申请信息
|
||||||
List<BackApplyInfo> applyInfoList = backApplyInfoMapper.selectBackDetails(backApplyInfo.getId());
|
List<BackApplyInfo> applyInfoList = backApplyInfoMapper.selectBackDetails(backApplyInfo);
|
||||||
// 设置更新信息
|
// 设置更新信息
|
||||||
backApplyInfo.setUpdateBy(SecurityUtils.getUsername());
|
backApplyInfo.setUpdateBy(SecurityUtils.getUsername());
|
||||||
backApplyInfo.setUpdateTime(DateUtils.getNowDate());
|
backApplyInfo.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
|
@ -564,23 +564,30 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
||||||
// 更新任务表及退料申请表状态
|
// 更新任务表及退料申请表状态
|
||||||
int result = updateTaskAndBackInfo(backApplyInfo);
|
int result = updateTaskAndBackInfo(backApplyInfo);
|
||||||
if (result > 0 && CollectionUtils.isNotEmpty(applyInfoList)) {
|
if (result > 0 && CollectionUtils.isNotEmpty(applyInfoList)) {
|
||||||
for (BackApplyInfo applyInfo : applyInfoList) {
|
// 获取applyInfoList的typeId并生成集合
|
||||||
// 查询待维修的机具设备
|
List<String> typeIdList = applyInfoList.stream()
|
||||||
backApplyInfo.setTypeId(applyInfo.getTypeId());
|
.map(BackApplyInfo::getTypeId).distinct()
|
||||||
List<BackApplyInfo> wxList = backApplyInfoMapper.getWxList(backApplyInfo);
|
.collect(Collectors.toList());
|
||||||
if (CollectionUtils.isNotEmpty(wxList)) {
|
|
||||||
// 插入任务表
|
// 插入任务表
|
||||||
Long newTaskId = insertTt(SecurityUtils.getUsername());
|
Long newTaskId = insertTt(SecurityUtils.getUsername());
|
||||||
// 插入协议任务表
|
// 插入协议任务表
|
||||||
result += insertTta(newTaskId, wxList);
|
result += insertTta(newTaskId, applyInfoList);
|
||||||
|
for (String typeId : typeIdList) {
|
||||||
|
// 查询待维修的机具设备
|
||||||
|
backApplyInfo.setTypeId(typeId);
|
||||||
|
List<BackApplyInfo> wxList = backApplyInfoMapper.getWxList(backApplyInfo);
|
||||||
|
if (CollectionUtils.isNotEmpty(wxList)) {
|
||||||
// 插入维修记录表
|
// 插入维修记录表
|
||||||
result += insertRad(newTaskId, wxList);
|
result += insertRad(newTaskId, wxList);
|
||||||
// 更新结算表
|
// 更新结算表
|
||||||
int res = updateSlt4Bean(backApplyInfo, applyInfo);
|
List<BackApplyInfo> allList = backApplyInfoMapper.selectBackDetails(backApplyInfo);
|
||||||
|
if (CollectionUtils.isNotEmpty(allList)) {
|
||||||
|
int res = updateSlt4Bean(backApplyInfo, allList);
|
||||||
// 检查机具是否领料
|
// 检查机具是否领料
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
throw new RuntimeException("该机具未被领料使用");
|
throw new RuntimeException("该机具未被领料使用");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 完成退料部分,更新 back_check_details
|
// 完成退料部分,更新 back_check_details
|
||||||
finishBackCheckDetails(backApplyInfo);
|
finishBackCheckDetails(backApplyInfo);
|
||||||
}
|
}
|
||||||
|
|
@ -620,10 +627,11 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
||||||
/**
|
/**
|
||||||
* 更新结算表
|
* 更新结算表
|
||||||
* @param record
|
* @param record
|
||||||
* @param bean
|
* @param allList
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private int updateSlt4Bean(BackApplyInfo record, BackApplyInfo bean) {
|
private int updateSlt4Bean(BackApplyInfo record, List<BackApplyInfo> allList) {
|
||||||
|
for (BackApplyInfo bean : allList) {
|
||||||
List<SltAgreementInfo> infoList = backApplyInfoMapper.getStlInfo(bean);
|
List<SltAgreementInfo> infoList = backApplyInfoMapper.getStlInfo(bean);
|
||||||
if (infoList.size() > 0) {
|
if (infoList.size() > 0) {
|
||||||
Integer backNum = bean.getBackNum();
|
Integer backNum = bean.getBackNum();
|
||||||
|
|
@ -645,6 +653,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN tm_task_agreement tta ON tta.task_id = bai.task_id
|
LEFT JOIN tm_task_agreement tta ON tta.task_id = bai.task_id
|
||||||
WHERE
|
WHERE
|
||||||
bcd.parent_id = #{id} and (bcd.is_finished is null or bcd.is_finished != 1)
|
bcd.parent_id = #{id} and (bcd.is_finished is null or bcd.is_finished != 1)
|
||||||
|
<if test="typeId != '' and typeId != null">
|
||||||
|
and bcd.type_id = #{typeId}
|
||||||
|
</if>
|
||||||
GROUP By bcd.type_id,bcd.ma_id
|
GROUP By bcd.type_id,bcd.ma_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue