This commit is contained in:
parent
5c481ee8b4
commit
11d3ac48c4
|
|
@ -710,7 +710,43 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult delete(ScrapApplyDetails scrapApplyDetails) {
|
public AjaxResult delete(ScrapApplyDetails scrapApplyDetails) {
|
||||||
try {
|
try {
|
||||||
int result = scrapApplyDetailsMapper.delete(scrapApplyDetails);
|
int result = 0;
|
||||||
|
// 先根据taskId进行查询
|
||||||
|
List<ScrapApplyDetails> list = scrapApplyDetailsMapper.getDetailsList(scrapApplyDetails);
|
||||||
|
// 恢复设备库存及设备状态
|
||||||
|
for (ScrapApplyDetails details : list) {
|
||||||
|
result = scrapApplyDetailsMapper.updateStorageNumAdd(details);
|
||||||
|
if (result == 0) {
|
||||||
|
return AjaxResult.error("库存回滚失败");
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(details.getMaIds())) {
|
||||||
|
String[] maIds = details.getMaIds().split(",");
|
||||||
|
// 转换为long类型
|
||||||
|
for (String maId : maIds) {
|
||||||
|
Long maIdLong = Long.parseLong(maId);
|
||||||
|
// 更新设备状态
|
||||||
|
ScrapApplyDetails applyDetails = new ScrapApplyDetails();
|
||||||
|
applyDetails.setMaId(maIdLong);
|
||||||
|
applyDetails.setStatus(MaMachineStatusEnum.IN_STORE.getStatus().toString());
|
||||||
|
scrapApplyDetailsMapper.updateMaStatus(applyDetails);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result = scrapApplyDetailsMapper.delete(scrapApplyDetails);
|
||||||
|
if (result == 0) {
|
||||||
|
return AjaxResult.error("删除主任务失败");
|
||||||
|
}
|
||||||
|
// 删除任务表
|
||||||
|
result = taskMapper.deleteTmTaskByTaskId(scrapApplyDetails.getTaskId());
|
||||||
|
if (result == 0) {
|
||||||
|
return AjaxResult.error("删除任务信息失败");
|
||||||
|
}
|
||||||
|
// 删除文件信息
|
||||||
|
BmFileInfo fileInfo = new BmFileInfo();
|
||||||
|
fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_PART_SCRAP.getTaskTypeId());
|
||||||
|
fileInfo.setFileType(6L);
|
||||||
|
fileInfo.setTaskId(scrapApplyDetails.getTaskId());
|
||||||
|
result += fileInfoMapper.deleteBmFileInfoByBizInfo(fileInfo);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
return AjaxResult.success("删除成功");
|
return AjaxResult.success("删除成功");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue