|
|
@ -2071,15 +2071,6 @@ public class QcServiceImpl implements QcService { |
|
|
qcMapper.updateFAIDetailedRecord(data.getItemList().get(i)); |
|
|
qcMapper.updateFAIDetailedRecord(data.getItemList().get(i)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 判断检验结论,不合格则发送邮件 |
|
|
|
|
|
if ("不合格".equals(data.getInspectionResult())) { |
|
|
|
|
|
try { // 发送邮件 |
|
|
|
|
|
sendMail(data, "FAI"); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
//logger.info(e.getMessage()); |
|
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// 修改子明细提交标识 |
|
|
// 修改子明细提交标识 |
|
|
//qcMapper.updateSubDetailedRecord(data); |
|
|
//qcMapper.updateSubDetailedRecord(data); |
|
|
// 修改明细信息 |
|
|
// 修改明细信息 |
|
|
@ -2194,6 +2185,16 @@ public class QcServiceImpl implements QcService { |
|
|
qcMapper.updateFAIDetailSubmitFlag(qcData); |
|
|
qcMapper.updateFAIDetailSubmitFlag(qcData); |
|
|
// 修改子明细记录标识为已提交 |
|
|
// 修改子明细记录标识为已提交 |
|
|
qcMapper.updateFAISubDetailSubmitFlag(qcData); |
|
|
qcMapper.updateFAISubDetailSubmitFlag(qcData); |
|
|
|
|
|
// 发送邮件 |
|
|
|
|
|
if ("不合格".equals(qcData.getInspectionResult())) { |
|
|
|
|
|
try { |
|
|
|
|
|
List<QcFAIRecordData> list = qcMapper.faiDetailSearch(qcData); |
|
|
|
|
|
qcData.setItemList(list); |
|
|
|
|
|
sendMail(qcData, "FAI"); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
logger.info(e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -2706,15 +2707,6 @@ public class QcServiceImpl implements QcService { |
|
|
qcMapper.updateFQCDetailedRecord(data.getItemList().get(i)); |
|
|
qcMapper.updateFQCDetailedRecord(data.getItemList().get(i)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 判断检验结论,不合格则发送邮件 |
|
|
|
|
|
if ("不合格".equals(data.getInspectionResult())) { |
|
|
|
|
|
try { // 发送邮件 |
|
|
|
|
|
sendMail(data, "FQC"); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
//logger.info(e.getMessage()); |
|
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -2734,6 +2726,16 @@ public class QcServiceImpl implements QcService { |
|
|
qcMapper.updateFQCDetailSubmitFlag(qcData); |
|
|
qcMapper.updateFQCDetailSubmitFlag(qcData); |
|
|
// 修改子明细记录标识为已提交 |
|
|
// 修改子明细记录标识为已提交 |
|
|
qcMapper.updateFQCSubDetailSubmitFlag(qcData); |
|
|
qcMapper.updateFQCSubDetailSubmitFlag(qcData); |
|
|
|
|
|
// 发送邮件 |
|
|
|
|
|
if ("不合格".equals(qcData.getInspectionResult())) { |
|
|
|
|
|
try { |
|
|
|
|
|
List<QcFAIRecordData> list = qcMapper.fqcDetailSearch(qcData); |
|
|
|
|
|
qcData.setItemList(list); |
|
|
|
|
|
sendMail(qcData, "FQC"); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
logger.info(e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -3273,15 +3275,6 @@ public class QcServiceImpl implements QcService { |
|
|
for (int i = 0; i < data.getItemList().size(); i++) { |
|
|
for (int i = 0; i < data.getItemList().size(); i++) { |
|
|
qcMapper.updateIPQCDetailedRecord(data.getItemList().get(i)); |
|
|
qcMapper.updateIPQCDetailedRecord(data.getItemList().get(i)); |
|
|
} |
|
|
} |
|
|
// 判断检验结论,不合格则发送邮件 |
|
|
|
|
|
if ("不合格".equals(data.getInspectionResult())) { |
|
|
|
|
|
try { // 发送邮件 |
|
|
|
|
|
sendMail(data, "IPQC"); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
//logger.info(e.getMessage()); |
|
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -3301,6 +3294,17 @@ public class QcServiceImpl implements QcService { |
|
|
qcMapper.updateIPQCDetailSubmitFlag(qcData); |
|
|
qcMapper.updateIPQCDetailSubmitFlag(qcData); |
|
|
// 修改子明细记录标识为已提交 |
|
|
// 修改子明细记录标识为已提交 |
|
|
qcMapper.updateIPQCSubDetailSubmitFlag(qcData); |
|
|
qcMapper.updateIPQCSubDetailSubmitFlag(qcData); |
|
|
|
|
|
// 发送邮件 |
|
|
|
|
|
if ("不合格".equals(qcData.getInspectionResult())) { |
|
|
|
|
|
try { |
|
|
|
|
|
List<QcFAIRecordData> list = qcMapper.ipqcDetailSearch(qcData); |
|
|
|
|
|
qcData.setItemList(list); |
|
|
|
|
|
sendMail(qcData, "IPQC"); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
logger.info(e.getMessage()); |
|
|
|
|
|
//throw new RuntimeException(e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -3775,64 +3779,64 @@ public class QcServiceImpl implements QcService { |
|
|
qcMapper.updateIQCDetailedRecord(data.getItemList().get(i)); |
|
|
qcMapper.updateIQCDetailedRecord(data.getItemList().get(i)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
// 判断检验结论,不合格则发送邮件 |
|
|
|
|
|
if ("不合格".equals(data.getInspectionResult())) { |
|
|
|
|
|
// 获取数据库设置的邮件接收地址 |
|
|
|
|
|
MailAddressData qc = qcMapper.getSendMailAddress(data.getSite(), "IQC"); |
|
|
|
|
|
List<String> collect = data.getItemList().stream().filter(a -> "N".equals(a.getItemResult())).map(QcFAIRecordData::getItemDesc).collect(Collectors.toList()); |
|
|
|
|
|
if (qc != null) { |
|
|
|
|
|
//设置邮件内容 |
|
|
|
|
|
String text = "<!DOCTYPE>" + |
|
|
|
|
|
"<div>" + |
|
|
|
|
|
"单据号:"+ data.getPoOrderNo() + ",行号:" + data.getPoItemNo() + ",物料编码:" + data.getPartNo() + ",物料名称:" + data.getPartDesc() + ",SKU:" + data.getSku() + ",发生不合格,不合格项:" + collect + " (此邮件为自动提示发送,无需回复!)<br/><br/>" + |
|
|
|
|
|
"</div>"; |
|
|
|
|
|
//发送邮件 |
|
|
|
|
|
JavaMailSenderImpl sender = new JavaMailSenderImpl(); |
|
|
|
|
|
MailSendAddressData mailSendData = qcMapper.getSendMailFromAddress(); |
|
|
|
|
|
sender.setHost(mailSendData.getHost()); |
|
|
|
|
|
sender.setPort(mailSendData.getPort()); |
|
|
|
|
|
sender.setUsername(mailSendData.getUsername()); |
|
|
|
|
|
sender.setPassword(mailSendData.getPassword()); |
|
|
|
|
|
sender.setDefaultEncoding("Utf-8"); |
|
|
|
|
|
Properties p = new Properties(); |
|
|
|
|
|
p.setProperty("mail.smtp.timeout", mailSendData.getTimeout()); |
|
|
|
|
|
p.setProperty("mail.smtp.auth", "false"); |
|
|
|
|
|
p.setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); |
|
|
|
|
|
sender.setJavaMailProperties(p); |
|
|
|
|
|
MimeMessage mimeMessage = sender.createMimeMessage(); |
|
|
|
|
|
// 设置utf-8或GBK编码,否则邮件会有乱码 |
|
|
|
|
|
MimeMessageHelper messageHelper = new MimeMessageHelper(mimeMessage, true, "UTF-8"); |
|
|
|
|
|
messageHelper.setFrom(mailSendData.getEmailForm(), mailSendData.getPersonal()); |
|
|
|
|
|
//判断是否存在分号 |
|
|
|
|
|
if (qc.getMailAddress().contains(";")) { |
|
|
|
|
|
String[] toAddress = qc.getMailAddress().split(";"); |
|
|
|
|
|
messageHelper.setTo(toAddress[0]); |
|
|
|
|
|
String[] arr2 = new String[toAddress.length-1]; |
|
|
|
|
|
System.arraycopy(toAddress, 1, arr2, 0, toAddress.length-1); |
|
|
|
|
|
messageHelper.setCc(arr2); |
|
|
|
|
|
} else { |
|
|
|
|
|
messageHelper.setTo(qc.getMailAddress()); |
|
|
|
|
|
} |
|
|
|
|
|
messageHelper.setSubject("IQC"+"质量检验结果"); //标题 |
|
|
|
|
|
messageHelper.setText(text, true); |
|
|
|
|
|
sender.send(mimeMessage); |
|
|
|
|
|
logger.info("QC检验不合格通知邮件已发送!收件箱地址:"+qc.getMailAddress()); |
|
|
|
|
|
|
|
|
|
|
|
// 保存邮件记录 |
|
|
|
|
|
SendMailRecord mailRecord = new SendMailRecord(); |
|
|
|
|
|
mailRecord.setSite(data.getSite()); |
|
|
|
|
|
mailRecord.setBuNo(data.getBuNo()); |
|
|
|
|
|
mailRecord.setDocumentNo(data.getInspectionNo()); |
|
|
|
|
|
mailRecord.setSender(data.getInspectorNo()); |
|
|
|
|
|
mailRecord.setRecipient(qc.getMailAddress()); |
|
|
|
|
|
qcMapper.saveSendMailRecord(mailRecord); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
logger.info(e.getMessage()); |
|
|
|
|
|
//throw new RuntimeException(e); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// try { |
|
|
|
|
|
// // 判断检验结论,不合格则发送邮件 |
|
|
|
|
|
// if ("不合格".equals(data.getInspectionResult())) { |
|
|
|
|
|
// // 获取数据库设置的邮件接收地址 |
|
|
|
|
|
// MailAddressData qc = qcMapper.getSendMailAddress(data.getSite(), "IQC"); |
|
|
|
|
|
// List<String> collect = data.getItemList().stream().filter(a -> "N".equals(a.getItemResult())).map(QcFAIRecordData::getItemDesc).collect(Collectors.toList()); |
|
|
|
|
|
// if (qc != null) { |
|
|
|
|
|
// //设置邮件内容 |
|
|
|
|
|
// String text = "<!DOCTYPE>" + |
|
|
|
|
|
// "<div>" + |
|
|
|
|
|
// "单据号:"+ data.getPoOrderNo() + ",行号:" + data.getPoItemNo() + ",物料编码:" + data.getPartNo() + ",物料名称:" + data.getPartDesc() + ",SKU:" + data.getSku() + ",发生不合格,不合格项:" + collect + " (此邮件为自动提示发送,无需回复!)<br/><br/>" + |
|
|
|
|
|
// "</div>"; |
|
|
|
|
|
// //发送邮件 |
|
|
|
|
|
// JavaMailSenderImpl sender = new JavaMailSenderImpl(); |
|
|
|
|
|
// MailSendAddressData mailSendData = qcMapper.getSendMailFromAddress(); |
|
|
|
|
|
// sender.setHost(mailSendData.getHost()); |
|
|
|
|
|
// sender.setPort(mailSendData.getPort()); |
|
|
|
|
|
// sender.setUsername(mailSendData.getUsername()); |
|
|
|
|
|
// sender.setPassword(mailSendData.getPassword()); |
|
|
|
|
|
// sender.setDefaultEncoding("Utf-8"); |
|
|
|
|
|
// Properties p = new Properties(); |
|
|
|
|
|
// p.setProperty("mail.smtp.timeout", mailSendData.getTimeout()); |
|
|
|
|
|
// p.setProperty("mail.smtp.auth", "false"); |
|
|
|
|
|
// p.setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); |
|
|
|
|
|
// sender.setJavaMailProperties(p); |
|
|
|
|
|
// MimeMessage mimeMessage = sender.createMimeMessage(); |
|
|
|
|
|
// // 设置utf-8或GBK编码,否则邮件会有乱码 |
|
|
|
|
|
// MimeMessageHelper messageHelper = new MimeMessageHelper(mimeMessage, true, "UTF-8"); |
|
|
|
|
|
// messageHelper.setFrom(mailSendData.getEmailForm(), mailSendData.getPersonal()); |
|
|
|
|
|
// //判断是否存在分号 |
|
|
|
|
|
// if (qc.getMailAddress().contains(";")) { |
|
|
|
|
|
// String[] toAddress = qc.getMailAddress().split(";"); |
|
|
|
|
|
// messageHelper.setTo(toAddress[0]); |
|
|
|
|
|
// String[] arr2 = new String[toAddress.length-1]; |
|
|
|
|
|
// System.arraycopy(toAddress, 1, arr2, 0, toAddress.length-1); |
|
|
|
|
|
// messageHelper.setCc(arr2); |
|
|
|
|
|
// } else { |
|
|
|
|
|
// messageHelper.setTo(qc.getMailAddress()); |
|
|
|
|
|
// } |
|
|
|
|
|
// messageHelper.setSubject("IQC"+"质量检验结果"); //标题 |
|
|
|
|
|
// messageHelper.setText(text, true); |
|
|
|
|
|
// sender.send(mimeMessage); |
|
|
|
|
|
// logger.info("QC检验不合格通知邮件已发送!收件箱地址:"+qc.getMailAddress()); |
|
|
|
|
|
// |
|
|
|
|
|
// // 保存邮件记录 |
|
|
|
|
|
// SendMailRecord mailRecord = new SendMailRecord(); |
|
|
|
|
|
// mailRecord.setSite(data.getSite()); |
|
|
|
|
|
// mailRecord.setBuNo(data.getBuNo()); |
|
|
|
|
|
// mailRecord.setDocumentNo(data.getInspectionNo()); |
|
|
|
|
|
// mailRecord.setSender(data.getInspectorNo()); |
|
|
|
|
|
// mailRecord.setRecipient(qc.getMailAddress()); |
|
|
|
|
|
// qcMapper.saveSendMailRecord(mailRecord); |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// } catch (Exception e) { |
|
|
|
|
|
// logger.info(e.getMessage()); |
|
|
|
|
|
// //throw new RuntimeException(e); |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -3989,6 +3993,74 @@ public class QcServiceImpl implements QcService { |
|
|
throw new RuntimeException("未查询到采购订单!"); |
|
|
throw new RuntimeException("未查询到采购订单!"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 发送邮件 |
|
|
|
|
|
if ("不合格".equals(qcData.getInspectionResult())) { |
|
|
|
|
|
try { |
|
|
|
|
|
List<QcFAIRecordData> list = qcMapper.iqcDetailSearch(qcData); |
|
|
|
|
|
qcData.setItemList(list); |
|
|
|
|
|
sendMailIQC(qcData, "IQC"); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
logger.info(e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void sendMailIQC(QcFAIRecordData data, String type) throws Exception { |
|
|
|
|
|
// 判断检验结论,不合格则发送邮件 |
|
|
|
|
|
if ("不合格".equals(data.getInspectionResult())) { |
|
|
|
|
|
// 获取数据库设置的邮件接收地址 |
|
|
|
|
|
MailAddressData qc = qcMapper.getSendMailAddress(data.getSite(), type); |
|
|
|
|
|
List<String> collect = data.getItemList().stream().filter(a -> "N".equals(a.getItemResult())).map(QcFAIRecordData::getItemDesc).collect(Collectors.toList()); |
|
|
|
|
|
if (qc != null) { |
|
|
|
|
|
//设置邮件内容 |
|
|
|
|
|
String text = "<!DOCTYPE>" + |
|
|
|
|
|
"<div>" + |
|
|
|
|
|
"单据号:"+ data.getPoOrderNo() + ",行号:" + data.getPoItemNo() + ",物料编码:" + data.getPartNo() + ",物料名称:" + data.getPartDesc() + ",SKU:" + data.getSku() + ",发生不合格,不合格项:" + collect + " (此邮件为自动提示发送,无需回复!)<br/><br/>" + |
|
|
|
|
|
"</div>"; |
|
|
|
|
|
//发送邮件 |
|
|
|
|
|
JavaMailSenderImpl sender = new JavaMailSenderImpl(); |
|
|
|
|
|
MailSendAddressData mailSendData = qcMapper.getSendMailFromAddress(); |
|
|
|
|
|
sender.setHost(mailSendData.getHost()); |
|
|
|
|
|
sender.setPort(mailSendData.getPort()); |
|
|
|
|
|
sender.setUsername(mailSendData.getUsername()); |
|
|
|
|
|
sender.setPassword(mailSendData.getPassword()); |
|
|
|
|
|
sender.setDefaultEncoding("Utf-8"); |
|
|
|
|
|
Properties p = new Properties(); |
|
|
|
|
|
p.setProperty("mail.smtp.timeout", mailSendData.getTimeout()); |
|
|
|
|
|
p.setProperty("mail.smtp.auth", "false"); |
|
|
|
|
|
p.setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); |
|
|
|
|
|
sender.setJavaMailProperties(p); |
|
|
|
|
|
MimeMessage mimeMessage = sender.createMimeMessage(); |
|
|
|
|
|
// 设置utf-8或GBK编码,否则邮件会有乱码 |
|
|
|
|
|
MimeMessageHelper messageHelper = new MimeMessageHelper(mimeMessage, true, "UTF-8"); |
|
|
|
|
|
messageHelper.setFrom(mailSendData.getEmailForm(), mailSendData.getPersonal()); |
|
|
|
|
|
//判断是否存在分号 |
|
|
|
|
|
if (qc.getMailAddress().contains(";")) { |
|
|
|
|
|
String[] toAddress = qc.getMailAddress().split(";"); |
|
|
|
|
|
messageHelper.setTo(toAddress[0]); |
|
|
|
|
|
String[] arr2 = new String[toAddress.length-1]; |
|
|
|
|
|
System.arraycopy(toAddress, 1, arr2, 0, toAddress.length-1); |
|
|
|
|
|
messageHelper.setCc(arr2); |
|
|
|
|
|
} else { |
|
|
|
|
|
messageHelper.setTo(qc.getMailAddress()); |
|
|
|
|
|
} |
|
|
|
|
|
messageHelper.setSubject("IQC"+"质量检验结果"); //标题 |
|
|
|
|
|
messageHelper.setText(text, true); |
|
|
|
|
|
sender.send(mimeMessage); |
|
|
|
|
|
logger.info("QC检验不合格通知邮件已发送!收件箱地址:"+qc.getMailAddress()); |
|
|
|
|
|
|
|
|
|
|
|
// 保存邮件记录 |
|
|
|
|
|
SendMailRecord mailRecord = new SendMailRecord(); |
|
|
|
|
|
mailRecord.setSite(data.getSite()); |
|
|
|
|
|
mailRecord.setBuNo(data.getBuNo()); |
|
|
|
|
|
mailRecord.setDocumentNo(data.getInspectionNo()); |
|
|
|
|
|
mailRecord.setSender(data.getInspectorNo()); |
|
|
|
|
|
mailRecord.setRecipient(qc.getMailAddress()); |
|
|
|
|
|
qcMapper.saveSendMailRecord(mailRecord); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|