不合规问题处理+报工问题修改

master
zhaoxiaolin 1 year ago
parent dcb357d143
commit 1b04a3f94e

@ -55,7 +55,7 @@ public class MesReportWork extends BaseEntity {
/** 工时 */
@Excel(name = "工时")
private Long workTime;
private BigDecimal workTime;
@Excel(name = "用人")
private Long useMan;
@ -702,13 +702,15 @@ public class MesReportWork extends BaseEntity {
public String getStatus() {
return status;
}
public void setWorkTime(Long workTime) {
this.workTime = workTime;
}
public Long getWorkTime() {
public BigDecimal getWorkTime() {
return workTime;
}
public void setWorkTime(BigDecimal workTime) {
this.workTime = workTime;
}
public void setMachineCode(String machineCode) {
this.machineCode = machineCode;
}

@ -108,7 +108,7 @@ public class OpenController extends BaseController {
}
//添加检测任务
return success(openService.insertQcCheckTaskProduce(qcCheckTaskProduce));
return toAjax(openService.insertQcCheckTaskProduce(qcCheckTaskProduce));
}
/**

@ -368,6 +368,7 @@ public class OpenServiceImpl implements OpenService {
/**qc_material_group_detail**/
QcMaterialGroupDetailDTO group = openMapper.getGroupByMaterial(qcCheckTaskProduce.getMaterialCode());
if (group == null) {
logger.info(qcCheckTaskProduce.getMaterialCode()+"没有维护物料组检测项,检验任务生成失败");
return 0;//没有找到检测项目
}
qctp.setGroupId(group.getGroupId());//共性

@ -46,15 +46,15 @@ public class QcCheckUnqualifiedController extends BaseController {
public TableDataInfo list(QcCheckUnqualified qcCheckUnqualified) {
startPage();
//默认时间范围T 00:00:00~T+1 00:00:00
if(StringUtils.isEmpty(qcCheckUnqualified.getCheckTimeStart())){
qcCheckUnqualified.setCheckTimeStart(DateUtils.getDate()+" 00:00:00");//start
LocalDate date = LocalDate.now();
LocalDate dateEnd = date.plusDays(1);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String dateEndStr = dtf.format(dateEnd)+" 00:00:00";
qcCheckUnqualified.setCheckTimeEnd(dateEndStr);//end
}
// //默认时间范围T 00:00:00~T+1 00:00:00
// if(StringUtils.isEmpty(qcCheckUnqualified.getCheckTimeStart())){
// qcCheckUnqualified.setCheckTimeStart(DateUtils.getDate()+" 00:00:00");//start
// LocalDate date = LocalDate.now();
// LocalDate dateEnd = date.plusDays(1);
// DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// String dateEndStr = dtf.format(dateEnd)+" 00:00:00";
// qcCheckUnqualified.setCheckTimeEnd(dateEndStr);//end
// }
qcCheckUnqualified.setDelFlag("0");
List<QcCheckUnqualified> list = qcCheckUnqualifiedService.selectQcCheckUnqualifiedList(qcCheckUnqualified);
return getDataTable(list);
@ -67,15 +67,15 @@ public class QcCheckUnqualifiedController extends BaseController {
@Log(title = "不合格处理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QcCheckUnqualified qcCheckUnqualified) {
//默认时间范围T 00:00:00~T+1 00:00:00
if(StringUtils.isEmpty(qcCheckUnqualified.getCheckTimeStart())){
qcCheckUnqualified.setCheckTimeStart(DateUtils.getDate()+" 00:00:00");//start
LocalDate date = LocalDate.now();
LocalDate dateEnd = date.plusDays(1);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String dateEndStr = dtf.format(dateEnd)+" 00:00:00";
qcCheckUnqualified.setCheckTimeEnd(dateEndStr);//end
}
// //默认时间范围T 00:00:00~T+1 00:00:00
// if(StringUtils.isEmpty(qcCheckUnqualified.getCheckTimeStart())){
// qcCheckUnqualified.setCheckTimeStart(DateUtils.getDate()+" 00:00:00");//start
// LocalDate date = LocalDate.now();
// LocalDate dateEnd = date.plusDays(1);
// DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// String dateEndStr = dtf.format(dateEnd)+" 00:00:00";
// qcCheckUnqualified.setCheckTimeEnd(dateEndStr);//end
// }
qcCheckUnqualified.setDelFlag("0");
List<QcCheckUnqualified> list = qcCheckUnqualifiedService.selectQcCheckUnqualifiedList(qcCheckUnqualified);
ExcelUtil<QcCheckUnqualified> util = new ExcelUtil<QcCheckUnqualified>(QcCheckUnqualified.class);
@ -102,10 +102,10 @@ public class QcCheckUnqualifiedController extends BaseController {
}
/**
*
* OA
*/
@RequiresPermissions("quality:unqualified:edit")
@Log(title = "不合格处理", businessType = BusinessType.UPDATE)
@Log(title = "不合格处理发起OA流程", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody QcCheckUnqualified qcCheckUnqualified) {
return toAjax(qcCheckUnqualifiedService.updateQcCheckUnqualified(qcCheckUnqualified));

@ -90,6 +90,51 @@ public class QcCheckUnqualified extends BaseEntity {
private String typeCode;
private String sampleQuality;
private String noOkQuality;
private String startManCode;
private String startManName;
private Date startTime;
private String startOaStatus;
private String startOaMsg;
public String getStartOaMsg() {
return startOaMsg;
}
public void setStartOaMsg(String startOaMsg) {
this.startOaMsg = startOaMsg;
}
public String getStartOaStatus() {
return startOaStatus;
}
public void setStartOaStatus(String startOaStatus) {
this.startOaStatus = startOaStatus;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public String getStartManCode() {
return startManCode;
}
public void setStartManCode(String startManCode) {
this.startManCode = startManCode;
}
public String getStartManName() {
return startManName;
}
public void setStartManName(String startManName) {
this.startManName = startManName;
}
public String getSampleQuality() {
return sampleQuality;

@ -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 01MATNR MAKTX suppliernum
* supplier CHARG comeQty testDate JYBH
* BJY OEMWLLY 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 JYRESULT0 2
* PROCODEBAK BZ CPCYS PCJYBHGMS */
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;
}
}

@ -350,21 +350,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
qct.supplier_name supplierName,
qct.income_batch_no incomeBatchNo,
qct.quality,
t.remark
qct.factory_code factoryCode,
case when pow.workorder_code_sap is not null then pow.workorder_code_sap
else qct.order_no end orderNo,
qct.create_time createTime,
qct.check_no checkNo,
qct.check_time checkTime,
qct.check_result checkResult
from qc_check_task qct
left join(
SELECT
belong_to,
STUFF(
(SELECT ';' + rule_name+':'+actual_value
FROM qc_check_task_detail
WHERE belong_to = qctd.belong_to
FOR xml path('')
),1,1,''
) remark
FROM qc_check_task_detail qctd where qctd.del_flag = '0' and belong_to=#{recordId}
GROUP by qctd.belong_to
) t on qct.record_id = t.belong_to
left join pro_order_workorder pow on pow.workorder_code = qct.order_no
where qct.record_id = #{recordId}
</select>

@ -58,10 +58,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectQcCheckUnqualifiedById" parameterType="String" resultType="com.op.quality.domain.QcCheckUnqualified">
select qcu.id,qcu.task_id taskId,qcu.status,qcu.next_node_code nextNodeCode,qcu.next_node_name nextNodeName,qcu.remark,
qcu.create_time createTime,
qct.check_type checkType,qtn.check_name checkName,qct.check_no checkNo,qct.income_batch_no incomeBatchNo,qct.order_no orderNo,
qct.check_type checkType,qtn.check_name checkName,qct.check_no checkNo,qct.income_batch_no incomeBatchNo,
qct.order_no orderNo,
qct.material_code materialCode,qct.material_name materialName,qct.quality,qct.unit,qct.supplier_code supplierCode,
qct.supplier_name supplierName,qct.income_time incomeTime,qct.check_loc checkLoc,qct.check_status checkStatus,qct.check_man_code checkManCode,
qct.check_man_name checkManName,qct.check_time checkTime,qct.check_result checkResult
qct.supplier_name supplierName,qct.income_time incomeTime,qct.check_loc checkLoc,qct.check_status checkStatus,
qct.check_man_code checkManCode,
qct.check_man_name checkManName,qct.check_time checkTime,qct.check_result checkResult,qct.type_code typeCode
from qc_check_unqualified qcu
left join qc_check_task qct on qcu.task_id = qct.record_id
left join qc_check_type qtn on qtn.id = qct.check_type
@ -258,6 +260,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="updateBy != null">start_man_code = #{startManCode},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="requestid != null">requestid = #{requestid},</if>
<if test="startOaStatus != null">start_oa_status = #{startOaStatus},</if>
<if test="startOaMsg != null">start_oa_msg = #{startOaMsg},</if>
<if test="startManCode != null">start_man_code = #{startManCode},</if>
<if test="startTime != null">start_time = #{startTime},</if>
</trim>
where id = #{id}
</update>

Loading…
Cancel
Save