退料报废转到维修

This commit is contained in:
sxu 2024-08-22 13:44:10 +08:00
parent 566f8a6b08
commit 1fad55d44e
3 changed files with 36 additions and 29 deletions

View File

@ -99,4 +99,10 @@ public interface BackReceiveService {
List<BackApplyInfo> backReceiveRecordWeb(BackApplyInfo record);
List<BackApplyInfo> backReceiveRecordWebPt(BackApplyInfo record);
int insertRad(int taskId, List<BackApplyInfo> wxList);
int insertTt(List<BackApplyInfo> hgList, Integer taskType, String createBy);
int insertTta(int taskId, List<BackApplyInfo> list);
}

View File

@ -392,7 +392,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
return backApplyInfoList;
}
private int insertRad(int taskId, List<BackApplyInfo> wxList) {
public int insertRad(int taskId, List<BackApplyInfo> wxList) {
int result = 0;
if (wxList != null) {
for (BackApplyInfo wx : wxList) {
@ -414,14 +414,14 @@ public class BackReceiveServiceImpl implements BackReceiveService {
return result;
}
private int insertTta(int taskId, List<BackApplyInfo> list) {
public int insertTta(int taskId, List<BackApplyInfo> list) {
int res;
String agreementId = String.valueOf(list.get(0).getAgreementId());
res = backReceiveMapper.insertTta(taskId, agreementId);
return res;
}
private int insertTt(List<BackApplyInfo> hgList, Integer taskType, String createBy) {
public int insertTt(List<BackApplyInfo> hgList, Integer taskType, String createBy) {
int newTask;
//生成单号
String code = genCodeRule(taskType);

View File

@ -8,6 +8,8 @@ import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.bean.BeanUtil;
import com.bonus.sgzb.app.mapper.BackReceiveMapper;
import com.bonus.sgzb.app.service.BackReceiveService;
import com.bonus.sgzb.base.api.domain.BackApplyInfo;
import com.bonus.sgzb.common.core.constant.TaskTypeConstants;
import com.bonus.sgzb.common.core.enums.ReviewStatusEnum;
@ -56,6 +58,9 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
@Resource
private ScrapAuditorSetMapper scrapAuditorSetMapper;
@Resource
BackReceiveService backReceiveService;
/**
* 查询报废任务详细scrap_apply_details
*
@ -490,11 +495,11 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
if (notScrapList.size() == scrapApplyDetailsList.size()) {
task.setTaskStatus(59);
}
} else
{
} else {
status = "2";
List<ScrapApplyDetails> backList = new ArrayList<>();
List<ScrapApplyDetails> repairList = new ArrayList<>();
List<BackApplyInfo> wxList = new ArrayList<>();
if (scrapApplyDetailsList.size() > 0) {
for (ScrapApplyDetails bean : scrapApplyDetailsList) {
if ("1".equals(bean.getScrapSource())) {
@ -502,33 +507,29 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
} else if ("2".equals(bean.getScrapSource())) {
repairList.add(bean);
}
}
}
if (backList.size() > 0) {
if (backList.get(0).getCompanyId() != null) {
companyId = Math.toIntExact(backList.get(0).getCompanyId());
}
if (backList.get(0).getParentId() != null) {
parentId = Math.toIntExact(backList.get(0).getParentId());
}
taskCode = purchaseCodeRule("T", 36);
taskStatus = 38;
taskType = 36;
long backTaskId = genTask(taskCode, taskType, taskStatus, tmTaskAgreement, companyId);
BackApplyInfo backApplyInfo = scrapApplyDetailsMapper.getBackApplyInfo(parentId);
backApplyInfo.setCode(taskCode);
backApplyInfo.setTaskId((int) backTaskId);
BackApplyInfo backApplyInfo = new BackApplyInfo();
backApplyInfo.setAgreementId(tmTaskAgreement.getAgreementId().intValue());
backApplyInfo.setMaId(bean.getMaId().intValue());
backApplyInfo.setTypeId(String.valueOf(bean.getTypeId()));
backApplyInfo.setCompanyId(String.valueOf(bean.getCompanyId()));
backApplyInfo.setBackNum(bean.getScrapNum().intValue());
backApplyInfo.setId(bean.getParentId());
backApplyInfo.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
backApplyInfo.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
scrapApplyDetailsMapper.addBackInfo(backApplyInfo);
for (ScrapApplyDetails bean : backList) {
bean.setParentId(backApplyInfo.getId());
bean.setStatus("1");
bean.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
bean.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
scrapApplyDetailsMapper.addBackDetails(bean);
wxList.add(backApplyInfo);
}
}
//维修的创建维修任务插入任务协议表
if (wxList != null && wxList.size() > 0) {
//插入任务表tm_task
int newTaskId = backReceiveService.insertTt(wxList, TaskTypeEnum.MAINTENANCE_TASK.getCode(), SecurityUtils.getLoginUser().getUsername());
//插入协议任务表tm_task_agreement
backReceiveService.insertTta(newTaskId, wxList);
//插入维修记录表repair_apply_details
backReceiveService.insertRad(newTaskId, wxList);
}
if (repairList.size() > 0) {
if (repairList.get(0).getCompanyId() != null) {
companyId = Math.toIntExact(repairList.get(0).getCompanyId());