|
|
@ -14,6 +14,7 @@ import com.xujie.sys.modules.oss.service.SysOssService; |
|
|
import com.xujie.sys.modules.pms.data.*; |
|
|
import com.xujie.sys.modules.pms.data.*; |
|
|
import com.xujie.sys.modules.pms.entity.QmsDataDictionaryData; |
|
|
import com.xujie.sys.modules.pms.entity.QmsDataDictionaryData; |
|
|
import com.xujie.sys.modules.pms.entity.vo.CheckSubDetailValueVo; |
|
|
import com.xujie.sys.modules.pms.entity.vo.CheckSubDetailValueVo; |
|
|
|
|
|
import com.xujie.sys.modules.pms.mapper.EamMapper; |
|
|
import com.xujie.sys.modules.pms.mapper.PqcMapper; |
|
|
import com.xujie.sys.modules.pms.mapper.PqcMapper; |
|
|
import com.xujie.sys.modules.pms.mapper.QcDao; |
|
|
import com.xujie.sys.modules.pms.mapper.QcDao; |
|
|
import com.xujie.sys.modules.pms.mapper.QcMapper; |
|
|
import com.xujie.sys.modules.pms.mapper.QcMapper; |
|
|
@ -39,6 +40,7 @@ import org.springframework.data.redis.core.RedisTemplate; |
|
|
import org.springframework.mail.javamail.JavaMailSenderImpl; |
|
|
import org.springframework.mail.javamail.JavaMailSenderImpl; |
|
|
import org.springframework.mail.javamail.MimeMessageHelper; |
|
|
import org.springframework.mail.javamail.MimeMessageHelper; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
@ -63,6 +65,8 @@ public class QcServiceImpl implements QcService { |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private QcMapper qcMapper; |
|
|
private QcMapper qcMapper; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private EamMapper eamMapper; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private PqcMapper pqcMapper; |
|
|
private PqcMapper pqcMapper; |
|
|
@ -3506,6 +3510,109 @@ public class QcServiceImpl implements QcService { |
|
|
return qcMapper.getButtonsPermission2(); |
|
|
return qcMapper.getButtonsPermission2(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional(propagation = Propagation.REQUIRES_NEW) |
|
|
|
|
|
public void eamWorkPlanSave(EamWorkPlanInData inData) { |
|
|
|
|
|
// 获得 site 和 bu |
|
|
|
|
|
if (inData.getBu().split("_").length >= 2 ) { |
|
|
|
|
|
inData.setSite(inData.getBu().split("_")[0]); |
|
|
|
|
|
inData.setBuNo(inData.getBu().split("_")[1]); |
|
|
|
|
|
} else { |
|
|
|
|
|
throw new RuntimeException("工厂和部门有误!"); |
|
|
|
|
|
} |
|
|
|
|
|
// 检查该日期内是否已有该设备的计划 |
|
|
|
|
|
for (EamObjectInData objectData : inData.getObjectList()) { |
|
|
|
|
|
inData.setObjectID(objectData.getObjectID()); |
|
|
|
|
|
List<EamWorkPlanInData> objectPlanList = eamMapper.checkObjectPlan(inData); |
|
|
|
|
|
if (!objectPlanList.isEmpty()) { |
|
|
|
|
|
throw new RuntimeException("设备 " + objectData.getObjectID() + " 已存在计划,请勿重复创建!"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 生成计划编码 |
|
|
|
|
|
if (inData.getFunctionType().equals("A")) { |
|
|
|
|
|
List<Object> params = new ArrayList<>(); |
|
|
|
|
|
params.add("*"); |
|
|
|
|
|
params.add("workPlanForCheckNo"); |
|
|
|
|
|
params.add(com.xujie.sys.common.utils.DateUtil.getStringDate(new Date(),"yyMMdd")); |
|
|
|
|
|
params.add("-126"); |
|
|
|
|
|
List<Map<String, Object>> resultList = procedureDao.getProcedureData("getWorkPlanNo", params); |
|
|
|
|
|
Map<String, Object> resultMap = resultList.get(0); |
|
|
|
|
|
String planNo = String.valueOf(resultMap.get("serial_no")); |
|
|
|
|
|
inData.setPlanID("DJ" + com.xujie.sys.common.utils.DateUtil.getStringDate(new Date(),"yyMMdd") + planNo); |
|
|
|
|
|
} else if (inData.getFunctionType().equals("B")) { |
|
|
|
|
|
List<Object> params = new ArrayList<>(); |
|
|
|
|
|
params.add("*"); |
|
|
|
|
|
params.add("workPlanForMaintenanceNo"); |
|
|
|
|
|
params.add(com.xujie.sys.common.utils.DateUtil.getStringDate(new Date(),"yyMMdd")); |
|
|
|
|
|
params.add("-127"); |
|
|
|
|
|
List<Map<String, Object>> resultList = procedureDao.getProcedureData("getWorkPlanNo", params); |
|
|
|
|
|
Map<String, Object> resultMap = resultList.get(0); |
|
|
|
|
|
String planNo = String.valueOf(resultMap.get("serial_no")); |
|
|
|
|
|
inData.setPlanID("WB" + com.xujie.sys.common.utils.DateUtil.getStringDate(new Date(),"yyMMdd") + planNo); |
|
|
|
|
|
} |
|
|
|
|
|
// 新增点检计划 |
|
|
|
|
|
eamMapper.saveWorkPlan(inData); |
|
|
|
|
|
for (int i = 0; i < inData.getObjectList().size(); i++) { |
|
|
|
|
|
// 调用存储过程 执行 |
|
|
|
|
|
String site = inData.getSite(); |
|
|
|
|
|
String buNo = inData.getBuNo(); |
|
|
|
|
|
String planID = inData.getPlanID(); |
|
|
|
|
|
String planDesc = inData.getPlanDesc(); |
|
|
|
|
|
String objectID = inData.getObjectList().get(i).getObjectID(); |
|
|
|
|
|
String functionType = inData.getFunctionType(); |
|
|
|
|
|
String propertiesCode = inData.getPropertiesCode(); |
|
|
|
|
|
String operator = inData.getOperator(); |
|
|
|
|
|
String operatorName = inData.getOperatorName(); |
|
|
|
|
|
String checker = inData.getChecker(); |
|
|
|
|
|
String checkerName = inData.getCheckerName(); |
|
|
|
|
|
Integer planPeriod = inData.getPlanPeriod(); |
|
|
|
|
|
String planStartDate = com.xujie.sys.common.utils.DateUtil.getStringDate(inData.getPlanStartDate()); |
|
|
|
|
|
String planEndDate = com.xujie.sys.common.utils.DateUtil.getStringDate(inData.getPlanEndDate()); |
|
|
|
|
|
String taskStartDate = ""; |
|
|
|
|
|
if (inData.getTaskStartDate() != null) { |
|
|
|
|
|
taskStartDate = com.xujie.sys.common.utils.DateUtil.getStringDate(inData.getTaskStartDate()); |
|
|
|
|
|
} |
|
|
|
|
|
String userId = inData.getUserId(); |
|
|
|
|
|
String remark = inData.getRemark(); |
|
|
|
|
|
String planCycle = inData.getPlanCycle(); |
|
|
|
|
|
String planHaltDate = ""; |
|
|
|
|
|
if (inData.getPlanHaltDate() != null) { |
|
|
|
|
|
planHaltDate = com.xujie.sys.common.utils.DateUtil.getStringDate(inData.getPlanHaltDate()); |
|
|
|
|
|
} |
|
|
|
|
|
String checkType = inData.getCheckType(); |
|
|
|
|
|
List<Object> params = new ArrayList<>(); |
|
|
|
|
|
params.add(site); |
|
|
|
|
|
params.add(buNo); |
|
|
|
|
|
params.add(planID); |
|
|
|
|
|
params.add(planDesc); |
|
|
|
|
|
params.add(objectID); |
|
|
|
|
|
params.add(functionType); |
|
|
|
|
|
params.add(propertiesCode); |
|
|
|
|
|
params.add(operator); |
|
|
|
|
|
params.add(operatorName); |
|
|
|
|
|
params.add(checker); |
|
|
|
|
|
params.add(checkerName); |
|
|
|
|
|
params.add(planPeriod); |
|
|
|
|
|
params.add(planStartDate); |
|
|
|
|
|
params.add(planEndDate); |
|
|
|
|
|
params.add(taskStartDate); |
|
|
|
|
|
params.add(userId); |
|
|
|
|
|
params.add(remark); |
|
|
|
|
|
params.add(planCycle); |
|
|
|
|
|
params.add(planHaltDate); |
|
|
|
|
|
params.add(checkType); |
|
|
|
|
|
//执行方法 |
|
|
|
|
|
List<Map<String, Object>> resultList = procedureDao.getProcedureData("eamWorkPlanSave", params); |
|
|
|
|
|
//判断是否检验成功 |
|
|
|
|
|
String code = String.valueOf(resultList.get(0).get("resultCode")); |
|
|
|
|
|
if ("400".equalsIgnoreCase(code)) { |
|
|
|
|
|
String msg = String.valueOf(resultList.get(0).get("resultMsg")); |
|
|
|
|
|
throw new XJException(msg, Integer.parseInt(code)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public void sendMailIQC(QcFAIRecordData data, String type) throws Exception { |
|
|
public void sendMailIQC(QcFAIRecordData data, String type) throws Exception { |
|
|
// 判断检验结论,不合格则发送邮件 |
|
|
// 判断检验结论,不合格则发送邮件 |
|
|
if ("不合格".equals(data.getInspectionResult())) { |
|
|
if ("不合格".equals(data.getInspectionResult())) { |
|
|
|