领料出库处理提交
This commit is contained in:
parent
62502471e7
commit
8e015c9bc6
|
|
@ -72,4 +72,7 @@ public interface RepairAuditDetailsMapper
|
||||||
|
|
||||||
List<RepairAuditDetailsVO> exportRepairQuestList(RepairAuditDetails bean);
|
List<RepairAuditDetailsVO> exportRepairQuestList(RepairAuditDetails bean);
|
||||||
|
|
||||||
|
List<RepairAuditDetails> selectRepairInputByTaskId(Long taskId);
|
||||||
|
|
||||||
|
List<RepairAuditDetails> selectScrapNumByTaskId(Long taskId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -167,85 +167,81 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
throw new Exception("任务已审核已通过");
|
throw new Exception("任务已审核已通过");
|
||||||
}
|
}
|
||||||
if ("通过".equals(checkResult)) {
|
if ("通过".equals(checkResult)) {
|
||||||
|
|
||||||
|
String taskCode ="";
|
||||||
|
int taskStatus= 0;
|
||||||
|
int taskType = 0;
|
||||||
|
int companyId = 0;
|
||||||
// 查询协议表
|
// 查询协议表
|
||||||
TmTaskAgreement tmTaskAgreement = agreementMapper.selectTmTaskAgreementByTaskId(taskId);
|
TmTaskAgreement tmTaskAgreement = agreementMapper.selectTmTaskAgreementByTaskId(taskId);
|
||||||
List<RepairAuditDetails> repairAuditDetailsList = repairAuditDetailsMapper.selectRepairAuditDetailsByTaskId(taskId);
|
List<RepairAuditDetails> repairInputList = repairAuditDetailsMapper.selectRepairInputByTaskId(taskId);
|
||||||
for (RepairAuditDetails repairAuditDetails : repairAuditDetailsList) {
|
List<RepairAuditDetails> scrapNumList = repairAuditDetailsMapper.selectScrapNumByTaskId(taskId);
|
||||||
Long typeId = repairAuditDetails.getTypeId();
|
if(repairInputList != null && repairInputList.size() > 0){
|
||||||
Long maId = repairAuditDetails.getMaId();
|
companyId = repairInputList.get(0).getCompanyId();
|
||||||
BigDecimal repairNum = repairAuditDetails.getRepairedNum();
|
taskCode = purchaseCodeRule("R",50);
|
||||||
|
taskStatus = 53;
|
||||||
|
taskType = 50;
|
||||||
|
long inputTaskId = genTask(taskCode,taskType,taskStatus,tmTaskAgreement,companyId);
|
||||||
|
|
||||||
|
|
||||||
|
for (RepairAuditDetails inputDetails : repairInputList) {
|
||||||
|
Long typeId = inputDetails.getTypeId();
|
||||||
|
Long maId = inputDetails.getMaId();
|
||||||
|
BigDecimal repairNum = inputDetails.getRepairedNum();
|
||||||
BigDecimal b = new BigDecimal(0);
|
BigDecimal b = new BigDecimal(0);
|
||||||
// 创建修饰后入库任务
|
// 创建修饰后入库任务
|
||||||
if (repairNum.compareTo(b) > 0) {
|
if (repairNum.compareTo(b) > 0) {
|
||||||
TmTask task = new TmTask();
|
|
||||||
task.setCode(purchaseCodeRule("R",50));
|
|
||||||
task.setTaskStatus(53);
|
|
||||||
task.setTaskType(50);
|
|
||||||
task.setCompanyId(repairAuditDetails.getCompanyId());
|
|
||||||
task.setCreateTime(new Date());
|
|
||||||
task.setCreateBy(SecurityUtils.getUsername());
|
|
||||||
taskMapper.insertTmTask(task);
|
|
||||||
// 添加协议信息表
|
|
||||||
TmTaskAgreement taskAgreement = new TmTaskAgreement();
|
|
||||||
taskAgreement.setTaskId(task.getTaskId());
|
|
||||||
if (tmTaskAgreement.getAgreementId() == null){
|
|
||||||
throw new ServiceException("缺少协议数据");
|
|
||||||
}else {
|
|
||||||
taskAgreement.setAgreementId(tmTaskAgreement.getAgreementId());
|
|
||||||
}
|
|
||||||
taskAgreement.setCreateBy(SecurityUtils.getUsername());
|
|
||||||
agreementMapper.insertTmTaskAgreement(taskAgreement);
|
|
||||||
|
|
||||||
// 添加修试后入库任务
|
// 添加修试后入库任务
|
||||||
RepairInputDetails repairInputDetails = new RepairInputDetails();
|
RepairInputDetails repairInputDetails = new RepairInputDetails();
|
||||||
repairInputDetails.setTaskId(task.getTaskId());
|
repairInputDetails.setTaskId(inputTaskId);
|
||||||
repairInputDetails.setAuditId(repairAuditDetails.getId());
|
repairInputDetails.setAuditId(inputDetails.getId());
|
||||||
repairInputDetails.setRepairId(repairAuditDetails.getRepairId());
|
repairInputDetails.setRepairId(inputDetails.getRepairId());
|
||||||
repairInputDetails.setRepairNum(repairAuditDetails.getRepairedNum());
|
repairInputDetails.setRepairNum(inputDetails.getRepairedNum());
|
||||||
repairInputDetails.setTypeId(repairAuditDetails.getTypeId());
|
repairInputDetails.setTypeId(inputDetails.getTypeId());
|
||||||
repairInputDetails.setMaId(repairAuditDetails.getMaId());
|
repairInputDetails.setMaId(inputDetails.getMaId());
|
||||||
repairInputDetails.setStatus("0");
|
repairInputDetails.setStatus("0");
|
||||||
repairInputDetails.setCreateById(SecurityUtils.getUserId());
|
repairInputDetails.setCreateById(SecurityUtils.getUserId());
|
||||||
repairInputDetails.setCreateTime(new Date());
|
repairInputDetails.setCreateTime(new Date());
|
||||||
repairTestInputMapper.insertRepairInputDetails(repairInputDetails);
|
repairTestInputMapper.insertRepairInputDetails(repairInputDetails);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(scrapNumList != null && scrapNumList.size() > 0){
|
||||||
|
|
||||||
|
companyId = scrapNumList.get(0).getCompanyId();
|
||||||
|
taskCode = purchaseCodeRule("BF",57);
|
||||||
|
taskStatus = 58;
|
||||||
|
taskType = 57;
|
||||||
|
long scrapTaskId = genTask(taskCode,taskType,taskStatus,tmTaskAgreement,companyId);
|
||||||
|
for (RepairAuditDetails scrapDetails : scrapNumList) {
|
||||||
|
Long typeId = scrapDetails.getTypeId();
|
||||||
|
Long maId = scrapDetails.getMaId();
|
||||||
|
BigDecimal repairNum = scrapDetails.getRepairedNum();
|
||||||
|
BigDecimal b = new BigDecimal(0);
|
||||||
|
|
||||||
|
|
||||||
// 创建报废任务
|
// 创建报废任务
|
||||||
BigDecimal scrapNum = repairAuditDetails.getScrapNum();
|
BigDecimal scrapNum = scrapDetails.getScrapNum();
|
||||||
if (scrapNum.compareTo(b) > 0) {
|
if (scrapNum.compareTo(b) > 0) {
|
||||||
TmTask task = new TmTask();
|
|
||||||
task.setCode(purchaseCodeRule("BF",57));
|
|
||||||
task.setTaskStatus(58);
|
|
||||||
task.setTaskType(57);
|
|
||||||
task.setCompanyId(repairAuditDetails.getCompanyId());
|
|
||||||
task.setCreateTime(new Date());
|
|
||||||
task.setCreateBy(SecurityUtils.getUsername());
|
|
||||||
taskMapper.insertTmTask(task);
|
|
||||||
// 添加协议信息表
|
|
||||||
TmTaskAgreement taskAgreement = new TmTaskAgreement();
|
|
||||||
taskAgreement.setTaskId(task.getTaskId());
|
|
||||||
if (tmTaskAgreement.getAgreementId() == null){
|
|
||||||
throw new ServiceException("缺少协议数据");
|
|
||||||
}else {
|
|
||||||
taskAgreement.setAgreementId(tmTaskAgreement.getAgreementId());
|
|
||||||
}
|
|
||||||
agreementMapper.insertTmTaskAgreement(taskAgreement);
|
|
||||||
|
|
||||||
// 添加退料任务
|
// 添加退料任务
|
||||||
ScrapApplyDetails scrapApplyDetails = new ScrapApplyDetails();
|
ScrapApplyDetails scrapApplyDetails = new ScrapApplyDetails();
|
||||||
scrapApplyDetails.setTaskId(task.getTaskId());
|
scrapApplyDetails.setTaskId(scrapTaskId);
|
||||||
scrapApplyDetails.setTypeId(typeId);
|
scrapApplyDetails.setTypeId(typeId);
|
||||||
scrapApplyDetails.setMaId(maId);
|
scrapApplyDetails.setMaId(maId);
|
||||||
scrapApplyDetails.setScrapNum(scrapNum);
|
scrapApplyDetails.setScrapNum(scrapNum);
|
||||||
scrapApplyDetails.setScrapSource("2");
|
scrapApplyDetails.setScrapSource("2");
|
||||||
scrapApplyDetails.setStatus("0");
|
scrapApplyDetails.setStatus("0");
|
||||||
scrapApplyDetails.setParentId(repairAuditDetails.getId());
|
scrapApplyDetails.setParentId(scrapDetails.getId());
|
||||||
scrapApplyDetails.setCreateById(SecurityUtils.getUserId());
|
scrapApplyDetails.setCreateById(SecurityUtils.getUserId());
|
||||||
scrapApplyDetails.setCreateTime(new Date());
|
scrapApplyDetails.setCreateTime(new Date());
|
||||||
scrapApplyDetailsMapper.insertScrapApplyDetails(scrapApplyDetails);
|
scrapApplyDetailsMapper.insertScrapApplyDetails(scrapApplyDetails);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// 修饰审核通过时改修任务为已通过审核
|
// 修饰审核通过时改修任务为已通过审核
|
||||||
task1.setTaskStatus(47);
|
task1.setTaskStatus(47);
|
||||||
task1.setUpdateTime(new Date());
|
task1.setUpdateTime(new Date());
|
||||||
|
|
@ -265,6 +261,29 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private long genTask(String taskCode,int taskType,int taskStatus,TmTaskAgreement tmTaskAgreement,int companyId){
|
||||||
|
TmTask task = new TmTask();
|
||||||
|
task.setCode(taskCode);
|
||||||
|
task.setTaskStatus(taskStatus);
|
||||||
|
task.setTaskType(taskType);
|
||||||
|
task.setCompanyId(companyId);
|
||||||
|
task.setCreateTime(new Date());
|
||||||
|
task.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
taskMapper.insertTmTask(task);
|
||||||
|
// 添加协议信息表
|
||||||
|
TmTaskAgreement taskAgreement = new TmTaskAgreement();
|
||||||
|
long taskId = task.getTaskId();
|
||||||
|
taskAgreement.setTaskId(taskId);
|
||||||
|
if (tmTaskAgreement.getAgreementId() == null){
|
||||||
|
throw new ServiceException("缺少协议数据");
|
||||||
|
}else {
|
||||||
|
taskAgreement.setAgreementId(tmTaskAgreement.getAgreementId());
|
||||||
|
}
|
||||||
|
taskAgreement.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
agreementMapper.insertTmTaskAgreement(taskAgreement);
|
||||||
|
return taskId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 采购单号编码生成规则
|
// 采购单号编码生成规则
|
||||||
|
|
|
||||||
|
|
@ -276,5 +276,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
) t
|
) t
|
||||||
GROUP BY task_id
|
GROUP BY task_id
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectRepairInputByTaskId" resultType="com.bonus.sgzb.material.domain.RepairAuditDetails">
|
||||||
|
<include refid="selectRepairAuditDetailsVo"/>
|
||||||
|
where task_id = #{taskId} and repaired_num > 0
|
||||||
|
</select>
|
||||||
|
<select id="selectScrapNumByTaskId" resultType="com.bonus.sgzb.material.domain.RepairAuditDetails">
|
||||||
|
<include refid="selectRepairAuditDetailsVo"/>
|
||||||
|
where task_id = #{taskId} and scrap_num > 0
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue