|
|
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandDO;
|
|
|
|
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandDO;
|
|
|
|
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
|
|
|
|
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
|
|
|
|
import cn.iocoder.yudao.module.common.dal.mysql.mold.MoldBrandMapper;
|
|
|
|
import cn.iocoder.yudao.module.common.dal.mysql.mold.MoldBrandMapper;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.common.enums.MoldBrandStatusEnum;
|
|
|
|
import cn.iocoder.yudao.module.erp.controller.admin.autocode.util.AutoCodeUtil;
|
|
|
|
import cn.iocoder.yudao.module.erp.controller.admin.autocode.util.AutoCodeUtil;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.dashboard.vo.dashboard.EventStatisticsVO;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.dashboard.vo.dashboard.EventStatisticsVO;
|
|
|
|
import cn.iocoder.yudao.module.common.controller.admin.moldrepair.enums.RepairResultEnum;
|
|
|
|
import cn.iocoder.yudao.module.common.controller.admin.moldrepair.enums.RepairResultEnum;
|
|
|
|
@ -91,6 +92,7 @@ public class MoldRepairServiceImpl implements MoldRepairService {
|
|
|
|
// 插入
|
|
|
|
// 插入
|
|
|
|
MoldRepairDO moldRepair = BeanUtils.toBean(createReqVO, MoldRepairDO.class);
|
|
|
|
MoldRepairDO moldRepair = BeanUtils.toBean(createReqVO, MoldRepairDO.class);
|
|
|
|
moldRepairMapper.insert(moldRepair);
|
|
|
|
moldRepairMapper.insert(moldRepair);
|
|
|
|
|
|
|
|
updateMoldBrandStatus(moldRepair.getMoldId(), MoldBrandStatusEnum.REPAIRING.getStatus());
|
|
|
|
sendCreateNotifyMessage(moldRepair);
|
|
|
|
sendCreateNotifyMessage(moldRepair);
|
|
|
|
|
|
|
|
|
|
|
|
// 插入子表
|
|
|
|
// 插入子表
|
|
|
|
@ -124,7 +126,7 @@ public class MoldRepairServiceImpl implements MoldRepairService {
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public void updateMoldRepair(MoldRepairSaveReqVO updateReqVO) {
|
|
|
|
public void updateMoldRepair(MoldRepairSaveReqVO updateReqVO) {
|
|
|
|
// 校验存在
|
|
|
|
// 校验存在
|
|
|
|
validateMoldRepairExists(updateReqVO.getId());
|
|
|
|
MoldRepairDO oldMoldRepair = validateMoldRepairExists(updateReqVO.getId());
|
|
|
|
|
|
|
|
|
|
|
|
//编码重复判断
|
|
|
|
//编码重复判断
|
|
|
|
Long count = moldRepairMapper.selectCount(new LambdaQueryWrapper<MoldRepairDO>()
|
|
|
|
Long count = moldRepairMapper.selectCount(new LambdaQueryWrapper<MoldRepairDO>()
|
|
|
|
@ -140,6 +142,8 @@ public class MoldRepairServiceImpl implements MoldRepairService {
|
|
|
|
// 更新
|
|
|
|
// 更新
|
|
|
|
MoldRepairDO updateObj = BeanUtils.toBean(updateReqVO, MoldRepairDO.class);
|
|
|
|
MoldRepairDO updateObj = BeanUtils.toBean(updateReqVO, MoldRepairDO.class);
|
|
|
|
moldRepairMapper.updateById(updateObj);
|
|
|
|
moldRepairMapper.updateById(updateObj);
|
|
|
|
|
|
|
|
Long moldId = updateReqVO.getMoldId() != null ? updateReqVO.getMoldId() : oldMoldRepair.getMoldId();
|
|
|
|
|
|
|
|
updateMoldBrandStatusByRepairResult(moldId, updateReqVO.getRepairStatus());
|
|
|
|
|
|
|
|
|
|
|
|
// 更新子表
|
|
|
|
// 更新子表
|
|
|
|
// updateMoldRepairLineList(updateReqVO.getId(), updateReqVO.getMoldRepairLines());
|
|
|
|
// updateMoldRepairLineList(updateReqVO.getId(), updateReqVO.getMoldRepairLines());
|
|
|
|
@ -159,10 +163,12 @@ public class MoldRepairServiceImpl implements MoldRepairService {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void validateMoldRepairExists(Long id) {
|
|
|
|
private MoldRepairDO validateMoldRepairExists(Long id) {
|
|
|
|
if (moldRepairMapper.selectById(id) == null) {
|
|
|
|
MoldRepairDO moldRepair = moldRepairMapper.selectById(id);
|
|
|
|
|
|
|
|
if (moldRepair == null) {
|
|
|
|
throw exception(MOLD_REPAIR_NOT_EXISTS);
|
|
|
|
throw exception(MOLD_REPAIR_NOT_EXISTS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return moldRepair;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@ -304,6 +310,7 @@ public class MoldRepairServiceImpl implements MoldRepairService {
|
|
|
|
moldRepairDO.setConfirmDate(updateReqVO.getConfirmDate());
|
|
|
|
moldRepairDO.setConfirmDate(updateReqVO.getConfirmDate());
|
|
|
|
moldRepairDO.setRepairResult(updateReqVO.getRepairResult());
|
|
|
|
moldRepairDO.setRepairResult(updateReqVO.getRepairResult());
|
|
|
|
moldRepairMapper.updateById(moldRepairDO);
|
|
|
|
moldRepairMapper.updateById(moldRepairDO);
|
|
|
|
|
|
|
|
updateMoldBrandStatusByRepairResult(moldRepairDO.getMoldId(), updateReqVO.getRepairResult());
|
|
|
|
batchUpdateTicketResults(updateReqVO.getUpdateReqVOList());
|
|
|
|
batchUpdateTicketResults(updateReqVO.getUpdateReqVOList());
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -457,14 +464,49 @@ public class MoldRepairServiceImpl implements MoldRepairService {
|
|
|
|
.anyMatch(vo -> vo.getResult() != null && vo.getResult().equals(JobResultEnum.FAIL.getCode()));
|
|
|
|
.anyMatch(vo -> vo.getResult() != null && vo.getResult().equals(JobResultEnum.FAIL.getCode()));
|
|
|
|
if (hasFail) {
|
|
|
|
if (hasFail) {
|
|
|
|
moldRepairDO.setRepairStatus(JobResultEnum.FAIL.getCode());
|
|
|
|
moldRepairDO.setRepairStatus(JobResultEnum.FAIL.getCode());
|
|
|
|
|
|
|
|
updateMoldBrandStatus(moldRepairDO.getMoldId(), MoldBrandStatusEnum.REPAIRING.getStatus());
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
moldRepairDO.setRepairStatus(JobResultEnum.PASS.getCode());
|
|
|
|
moldRepairDO.setRepairStatus(JobResultEnum.PASS.getCode());
|
|
|
|
|
|
|
|
updateMoldBrandStatus(moldRepairDO.getMoldId(), MoldBrandStatusEnum.STANDBY.getStatus());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
moldRepairMapper.updateById(moldRepairDO);
|
|
|
|
moldRepairMapper.updateById(moldRepairDO);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void updateMoldBrandStatusByRepairResult(Long moldId, String repairResult) {
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(repairResult)) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Integer status = isRepairPassed(repairResult)
|
|
|
|
|
|
|
|
? MoldBrandStatusEnum.STANDBY.getStatus()
|
|
|
|
|
|
|
|
: MoldBrandStatusEnum.REPAIRING.getStatus();
|
|
|
|
|
|
|
|
updateMoldBrandStatus(moldId, status);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isRepairPassed(String repairResult) {
|
|
|
|
|
|
|
|
String value = repairResult.trim();
|
|
|
|
|
|
|
|
return RepairResultEnum.PASS.getCode().toString().equals(value)
|
|
|
|
|
|
|
|
|| RepairResultEnum.PASS.getDesc().equalsIgnoreCase(value)
|
|
|
|
|
|
|
|
|| JobResultEnum.PASS.getCode().toString().equals(value)
|
|
|
|
|
|
|
|
|| "PASS".equalsIgnoreCase(value)
|
|
|
|
|
|
|
|
|| "通过".equals(value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void updateMoldBrandStatus(Long moldId, Integer status) {
|
|
|
|
|
|
|
|
if (moldId == null || status == null) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
MoldBrandDO moldBrand = moldBrandMapper.selectById(moldId);
|
|
|
|
|
|
|
|
if (moldBrand == null) {
|
|
|
|
|
|
|
|
throw exception(MOLD_SET_NOT_EXISTS);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
MoldBrandDO updateObj = new MoldBrandDO();
|
|
|
|
|
|
|
|
updateObj.setId(moldId);
|
|
|
|
|
|
|
|
updateObj.setStatus(status);
|
|
|
|
|
|
|
|
moldBrandMapper.updateById(updateObj);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void validateBatchUpdateData(List<MoldRepairLineSaveReqVO> updateReqVOList) {
|
|
|
|
private void validateBatchUpdateData(List<MoldRepairLineSaveReqVO> updateReqVOList) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|