|
|
|
@ -1,9 +1,21 @@
|
|
|
|
|
package com.op.quality.service.impl;
|
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
|
|
import com.op.common.core.utils.DateUtils;
|
|
|
|
|
import com.op.common.core.web.domain.AjaxResult;
|
|
|
|
|
import com.op.common.security.utils.SecurityUtils;
|
|
|
|
|
import com.op.quality.domain.QcCheckProject;
|
|
|
|
|
import com.op.quality.domain.QcCheckTaskIncome;
|
|
|
|
|
import com.op.quality.mapper.QcCheckTaskIncomeMapper;
|
|
|
|
|
import com.op.system.api.RemoteOpenService;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import com.op.quality.mapper.QcCheckUnqualifiedMapper;
|
|
|
|
@ -18,9 +30,16 @@ import com.op.quality.service.IQcCheckUnqualifiedService;
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
|
|
|
|
public class QcCheckUnqualifiedServiceImpl implements IQcCheckUnqualifiedService {
|
|
|
|
|
protected Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
|
@Autowired
|
|
|
|
|
private QcCheckUnqualifiedMapper qcCheckUnqualifiedMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private QcCheckTaskIncomeMapper qcCheckTaskIncomeMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private RemoteOpenService remoteOpenService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询不合格处理
|
|
|
|
|
*
|
|
|
|
@ -67,8 +86,40 @@ public class QcCheckUnqualifiedServiceImpl implements IQcCheckUnqualifiedService
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public int updateQcCheckUnqualified(QcCheckUnqualified qcCheckUnqualified) {
|
|
|
|
|
qcCheckUnqualified.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
return qcCheckUnqualifiedMapper.updateQcCheckUnqualified(qcCheckUnqualified);
|
|
|
|
|
Date nowTime = DateUtils.getNowDate();
|
|
|
|
|
qcCheckUnqualified.setUpdateTime(nowTime);
|
|
|
|
|
qcCheckUnqualified.setStartManCode(SecurityUtils.getUsername());
|
|
|
|
|
qcCheckUnqualified.setStartTime(nowTime);
|
|
|
|
|
|
|
|
|
|
//发起来料检验OA流程
|
|
|
|
|
AjaxResult oaR = new AjaxResult();
|
|
|
|
|
QcCheckUnqualified taskIfo = qcCheckUnqualifiedMapper.selectQcCheckUnqualifiedById(qcCheckUnqualified.getId());
|
|
|
|
|
taskIfo.setRemark(qcCheckUnqualified.getRemark());
|
|
|
|
|
if("material".equals(taskIfo.getTypeCode())) {
|
|
|
|
|
//ZL0010-来料检验不合格控制流程
|
|
|
|
|
oaR = this.createLLOA(taskIfo);
|
|
|
|
|
}else if("produce".equals(taskIfo.getTypeCode())){
|
|
|
|
|
//ZL0030-品质异常流程
|
|
|
|
|
}else if("product".equals(taskIfo.getTypeCode())) {
|
|
|
|
|
//ZL0020-成品检验控制流程
|
|
|
|
|
oaR = this.createProductOA(taskIfo);
|
|
|
|
|
}
|
|
|
|
|
if(oaR!=null ){
|
|
|
|
|
if((oaR.get("code").toString()).equals("200")){
|
|
|
|
|
/**qc_check_unqualified**/
|
|
|
|
|
qcCheckUnqualified.setRequestid(oaR.get("data").toString());
|
|
|
|
|
qcCheckUnqualified.setStartOaStatus("1");
|
|
|
|
|
int m = qcCheckUnqualifiedMapper.updateQcCheckUnqualified(qcCheckUnqualified);
|
|
|
|
|
return m;
|
|
|
|
|
}else{
|
|
|
|
|
qcCheckUnqualified.setStartOaStatus("2");
|
|
|
|
|
qcCheckUnqualified.setStartOaMsg(oaR.get("msg").toString());
|
|
|
|
|
qcCheckUnqualifiedMapper.updateQcCheckUnqualified(qcCheckUnqualified);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -94,4 +145,97 @@ public class QcCheckUnqualifiedServiceImpl implements IQcCheckUnqualifiedService
|
|
|
|
|
public int deleteQcCheckUnqualifiedById(String id) {
|
|
|
|
|
return qcCheckUnqualifiedMapper.deleteQcCheckUnqualifiedById(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*来料检验不良OA流程
|
|
|
|
|
* CQ 厂区、 OEMCM 厂名 、 LLLB 来料类别【0、1】、MATNR 物料编号、MAKTX 物料名称、suppliernum 供应商编码
|
|
|
|
|
* supplier 供应商名称、CHARG 生产批号、comeQty 来料数量、testDate 检验日期 、 JYBH 检验编号、
|
|
|
|
|
* BJY 仓储报检人(OEM产品提报人)、WLLY 物料来源、ZCF 转出方、 ZCOEMCM 转出OEM厂名、
|
|
|
|
|
* memo 不合格情况描述 、PZGLBZG QC主管
|
|
|
|
|
*/
|
|
|
|
|
private AjaxResult createLLOA(QcCheckUnqualified task){
|
|
|
|
|
|
|
|
|
|
QcCheckTaskIncome detailInfo = qcCheckTaskIncomeMapper.getTaskInfo(task.getTaskId());
|
|
|
|
|
//发起来料检验OA流程
|
|
|
|
|
Map<String, Object> paramMap = new HashMap<>();
|
|
|
|
|
paramMap.put("user",SecurityUtils.getUsername());//提交人工号
|
|
|
|
|
paramMap.put("requestLevel",0);//流程紧急度
|
|
|
|
|
paramMap.put("requestName","ZL0010-来料检验不合格控制流程");//流程名称
|
|
|
|
|
paramMap.put("workflowId",26235);//该流程对应的唯- workFlowld
|
|
|
|
|
|
|
|
|
|
StringBuffer mainObject = new StringBuffer();
|
|
|
|
|
mainObject.append("{");
|
|
|
|
|
mainObject.append("\"CQ\":"+detailInfo.getFactoryCode());//厂区
|
|
|
|
|
mainObject.append(",\"LLLB\":"+0);//来料类别【0、1】
|
|
|
|
|
mainObject.append(",\"MATNR\":"+"\""+detailInfo.getMaterialCode()+"\"");//物料编码
|
|
|
|
|
mainObject.append(",\"MAKTX\":"+"\""+detailInfo.getMaterialName()+"\"");//物料名称
|
|
|
|
|
mainObject.append(",\"suppliernum\":"+"\""+detailInfo.getSupplierCode()+"\"");//供应商编码
|
|
|
|
|
mainObject.append(",\"supplier\":"+"\""+detailInfo.getSupplierName()+"\"");//供应商名称
|
|
|
|
|
mainObject.append(",\"CHARG\":"+"\""+detailInfo.getIncomeBatchNo()+"\"");//生产批号
|
|
|
|
|
mainObject.append(",\"comeQty\":"+"\""+detailInfo.getQuality()+"\"");//来料数量
|
|
|
|
|
mainObject.append(",\"memo\":"+"\""+task.getRemark()+"\"");//不合格情况描述
|
|
|
|
|
mainObject.append("}");
|
|
|
|
|
|
|
|
|
|
paramMap.put("mainObject",mainObject.toString());
|
|
|
|
|
logger.info("流程Id 26235:"+ JSONObject.toJSONString(paramMap));
|
|
|
|
|
AjaxResult oaR = remoteOpenService.OAInspection(paramMap);
|
|
|
|
|
logger.info("流程Id 26235:"+ JSONObject.toJSONString(oaR));
|
|
|
|
|
return oaR;
|
|
|
|
|
}
|
|
|
|
|
/*成品入库不良OA流程
|
|
|
|
|
* ZL0020-成品检验控制流程:"workflowId": 26234
|
|
|
|
|
*
|
|
|
|
|
* --------主表-------
|
|
|
|
|
* PGBCJ 申请部门/SSCJ 所属车间/ZRPSN报检人/GJZ关键字/SCLX生产类型/OEM OEM厂名/DH 单号/DW单位/MEMO01 不合格描述/
|
|
|
|
|
* MEMO03 备注/SFXZG 是否需要QC主管审核/PGZG QC主管
|
|
|
|
|
* PGZRJL 品管主任
|
|
|
|
|
* ----------明细表---
|
|
|
|
|
* 请求示例:{"colNames":"PROCODE,PRONAME,SCCODE......","details":[{"PROCODE":"","PRONAME":"",.....},{},{},.....]}
|
|
|
|
|
* PROCODE 产品编码、PRONAME 产品名称、SCCODE 批次号、SCTOTAL 数量、
|
|
|
|
|
* BJDATE 报检日期、JYCODE 检验编号、JYDATE 检验日期、JYRESULT检验结果:0合格 2不合格、
|
|
|
|
|
* PROCODEBAK 、BZ 备注、CPCYS 产品抽样数(PC)、JYBHGMS 不合格情况描述*/
|
|
|
|
|
private AjaxResult createProductOA(QcCheckUnqualified task){
|
|
|
|
|
|
|
|
|
|
QcCheckTaskIncome detailInfo = qcCheckTaskIncomeMapper.getTaskInfo(task.getTaskId());
|
|
|
|
|
|
|
|
|
|
//发起来料检验OA流程
|
|
|
|
|
Map<String, Object> paramMap = new HashMap<>();
|
|
|
|
|
paramMap.put("user","999999");//提交人工号qcCheckTaskIncome.getUpdateBy()
|
|
|
|
|
paramMap.put("requestLevel",0);//流程紧急度
|
|
|
|
|
paramMap.put("requestName","ZL0020-成品检验控制流程");//流程名称
|
|
|
|
|
paramMap.put("workflowId",26234);//该流程对应的唯- workFlowld
|
|
|
|
|
|
|
|
|
|
StringBuffer mainObject = new StringBuffer();
|
|
|
|
|
mainObject.append("{");
|
|
|
|
|
mainObject.append("\"SSCJ\":"+detailInfo.getSupplierName());//所属车间
|
|
|
|
|
mainObject.append(",\"ZRPSN\":"+"\""+SecurityUtils.getUsername()+"\"");//报检人
|
|
|
|
|
mainObject.append(",\"OEM\":"+"\""+detailInfo.getFactoryCode()+"\"");//OEM厂名
|
|
|
|
|
mainObject.append(",\"DH\":"+"\""+detailInfo.getOrderNo()+"\"");//单号
|
|
|
|
|
mainObject.append(",\"MEMO01\":"+"\""+task.getRemark()+"\"");//不合格情况描述
|
|
|
|
|
mainObject.append("}");
|
|
|
|
|
paramMap.put("mainObject",mainObject.toString());
|
|
|
|
|
|
|
|
|
|
StringBuffer detailObject = new StringBuffer();
|
|
|
|
|
detailObject.append("{");
|
|
|
|
|
detailObject.append("\"colNames\":\"PROCODE,PRONAME,SCCODE,SCTOTAL,BJDATE,JYCODE,JYDATE,JYRESULT,CPCYS,JYBHGMS\"");
|
|
|
|
|
detailObject.append(",\"details\":[");
|
|
|
|
|
|
|
|
|
|
detailObject.append("{\"PROCODE\":\""+detailInfo.getMaterialCode()+"\"},");//产品编码
|
|
|
|
|
detailObject.append("{\"PRONAME\":\""+detailInfo.getMaterialName()+"\"},");//产品名称
|
|
|
|
|
detailObject.append("{\"SCCODE\":\""+detailInfo.getIncomeBatchNo()+"\"},");//批次号
|
|
|
|
|
detailObject.append("{\"SCTOTAL\":\""+detailInfo.getQuality()+"\"},");//数量
|
|
|
|
|
detailObject.append("{\"BJDATE\":\""+detailInfo.getCreateTime()+"\"},");//报检日期
|
|
|
|
|
detailObject.append("{\"JYCODE\":\""+detailInfo.getCheckNo()+"\"},");// 检验编号
|
|
|
|
|
detailObject.append("{\"JYDATE\":\""+detailInfo.getCheckTime()+"\"},");// 检验日期
|
|
|
|
|
detailObject.append("{\"JYRESULT\":\""+(detailInfo.getCheckResult().equals("Y")?"0":"2")+"\"},");//检验结果:0合格 2不合格
|
|
|
|
|
detailObject.append("{\"CPCYS\":\""+detailInfo.getQuality()+"\"},");// 产品抽样数(PC)
|
|
|
|
|
detailObject.append("{\"JYBHGMS\":\""+task.getRemark()+"\"}");// 不合格情况描述
|
|
|
|
|
|
|
|
|
|
detailObject.append("]}");
|
|
|
|
|
paramMap.put("mainObject",detailObject.toString());
|
|
|
|
|
|
|
|
|
|
logger.info("流程Id 26234:"+ JSONObject.toJSONString(paramMap));
|
|
|
|
|
AjaxResult oaR = remoteOpenService.OAInspection(paramMap);
|
|
|
|
|
logger.info("流程Id 26234:"+ JSONObject.toJSONString(oaR));
|
|
|
|
|
return oaR;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|