This commit is contained in:
sxu 2024-09-07 21:45:04 +08:00
parent f15593e866
commit 63439f1c73
2 changed files with 47 additions and 11 deletions

View File

@ -259,18 +259,26 @@ public class BackReceiveServiceImpl implements BackReceiveService {
res = insertSad(newTaskId, bfList); res = insertSad(newTaskId, bfList);
} }
List<BackApplyInfo> allList = backReceiveMapper.getAllList(record); // List<BackApplyInfo> allList = backReceiveMapper.getAllList(record);
List<BackApplyInfo> allList2 = allList.stream().filter(o -> o.getTypeId().equals(record.getTypeId())).collect(Collectors.toList()); // List<BackApplyInfo> allList2 = allList.stream().filter(o -> o.getTypeId().equals(record.getTypeId())).collect(Collectors.toList());
if (allList2 != null && allList2.size() > 0) { // if (allList2 != null && allList2.size() > 0) {
res = updateSlt(record, allList2); // res = updateSlt(record, allList2);
// if (res == 0) {
// throw new RuntimeException("该机具未被领料使用");
// }
// BackApplyInfo b = allList2.get(0);
// record.setTypeId(b.getTypeId());
// int postStoreNum = backReceiveMapper.getmaChineByCt(record);
// record.setPostStoreNum(postStoreNum);
// }
res = updateSlt4Bean(record, bai);
if (res == 0) { if (res == 0) {
throw new RuntimeException("该机具未被领料使用"); throw new RuntimeException("该机具未被领料使用");
} }
BackApplyInfo b = allList2.get(0);
record.setTypeId(b.getTypeId());
int postStoreNum = backReceiveMapper.getmaChineByCt(record); int postStoreNum = backReceiveMapper.getmaChineByCt(record);
record.setPostStoreNum(postStoreNum); record.setPostStoreNum(postStoreNum);
}
//完成退料的部分更新 back_check_details is_finished=1此部分不支持撤回 //完成退料的部分更新 back_check_details is_finished=1此部分不支持撤回
finishBackCheckDetails(record); finishBackCheckDetails(record);
@ -295,6 +303,31 @@ public class BackReceiveServiceImpl implements BackReceiveService {
} }
} }
private int updateSlt4Bean(BackApplyInfo record, BackApplyInfo bean) {
List<SltAgreementInfo> infoList = backReceiveMapper.getStlInfo(bean);
if (infoList.size() > 0) {
Integer backNum = bean.getBackNum();
for (SltAgreementInfo info : infoList) {
Integer num = info.getNum();
if (backNum.equals(num)) {
backReceiveMapper.updateStlInfo(info, record);
break;
} else if (backNum > num) {
backNum = backNum - num;
backReceiveMapper.updateStlInfo(info, record);
} else if (backNum < num) {
Integer many = num - backNum;
backReceiveMapper.updateStlInfoTwo(info, record, backNum);
backReceiveMapper.insStlInfoTwo(info, many);
break;
}
}
} else {
return 0;
}
return 1;
}
private int updateSlt(BackApplyInfo record, List<BackApplyInfo> hgList) { private int updateSlt(BackApplyInfo record, List<BackApplyInfo> hgList) {
for (BackApplyInfo bean : hgList) { for (BackApplyInfo bean : hgList) {
List<SltAgreementInfo> infoList = backReceiveMapper.getStlInfo(bean); List<SltAgreementInfo> infoList = backReceiveMapper.getStlInfo(bean);

View File

@ -819,6 +819,7 @@
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
parent_id=#{parentId} parent_id=#{parentId}
and bcd.type_id=#{typeId}
and bcd.back_status='1' and (bcd.is_finished is null or bcd.is_finished != 1) and bcd.back_status='1' and (bcd.is_finished is null or bcd.is_finished != 1)
</select> </select>
@ -839,6 +840,7 @@
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
parent_id=#{parentId} parent_id=#{parentId}
and bcd.type_id=#{typeId}
and bcd.back_status='2' and (bcd.is_finished is null or bcd.is_finished != 1) and bcd.back_status='2' and (bcd.is_finished is null or bcd.is_finished != 1)
</select> </select>
@ -859,6 +861,7 @@
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
parent_id=#{parentId} parent_id=#{parentId}
and bcd.type_id=#{typeId}
and bcd.back_status='3' and (bcd.is_finished is null or bcd.is_finished != 1) and bcd.back_status='3' and (bcd.is_finished is null or bcd.is_finished != 1)
</select> </select>