From 1b04a3f94e207f4a8e2748d30c4a1d496ae6e89a Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Wed, 17 Jan 2024 08:52:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E5=90=88=E8=A7=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=A4=84=E7=90=86+=E6=8A=A5=E5=B7=A5=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/op/mes/domain/MesReportWork.java | 12 +- .../op/open/controller/OpenController.java | 2 +- .../op/open/service/impl/OpenServiceImpl.java | 1 + .../QcCheckUnqualifiedController.java | 40 ++--- .../op/quality/domain/QcCheckUnqualified.java | 45 ++++++ .../impl/QcCheckUnqualifiedServiceImpl.java | 148 +++++++++++++++++- .../quality/QcCheckTaskIncomeMapper.xml | 22 +-- .../quality/QcCheckUnqualifiedMapper.xml | 15 +- 8 files changed, 240 insertions(+), 45 deletions(-) diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/MesReportWork.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesReportWork.java index 49d5e5bd..010e2284 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/domain/MesReportWork.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesReportWork.java @@ -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; } diff --git a/op-modules/op-open/src/main/java/com/op/open/controller/OpenController.java b/op-modules/op-open/src/main/java/com/op/open/controller/OpenController.java index 4d09ae01..1971c3be 100644 --- a/op-modules/op-open/src/main/java/com/op/open/controller/OpenController.java +++ b/op-modules/op-open/src/main/java/com/op/open/controller/OpenController.java @@ -108,7 +108,7 @@ public class OpenController extends BaseController { } //添加检测任务 - return success(openService.insertQcCheckTaskProduce(qcCheckTaskProduce)); + return toAjax(openService.insertQcCheckTaskProduce(qcCheckTaskProduce)); } /** diff --git a/op-modules/op-open/src/main/java/com/op/open/service/impl/OpenServiceImpl.java b/op-modules/op-open/src/main/java/com/op/open/service/impl/OpenServiceImpl.java index e7b079ed..c510be45 100644 --- a/op-modules/op-open/src/main/java/com/op/open/service/impl/OpenServiceImpl.java +++ b/op-modules/op-open/src/main/java/com/op/open/service/impl/OpenServiceImpl.java @@ -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());//共性 diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckUnqualifiedController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckUnqualifiedController.java index 1c65f21f..8be77956 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckUnqualifiedController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckUnqualifiedController.java @@ -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 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 list = qcCheckUnqualifiedService.selectQcCheckUnqualifiedList(qcCheckUnqualified); ExcelUtil util = new ExcelUtil(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)); diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckUnqualified.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckUnqualified.java index d23ad596..ef629586 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckUnqualified.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckUnqualified.java @@ -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; diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckUnqualifiedServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckUnqualifiedServiceImpl.java index adb2181b..6ac69090 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckUnqualifiedServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckUnqualifiedServiceImpl.java @@ -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 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 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; + } } diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskIncomeMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskIncomeMapper.xml index 7b66cc70..6b657b7d 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskIncomeMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskIncomeMapper.xml @@ -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} diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckUnqualifiedMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckUnqualifiedMapper.xml index b31c6fc4..160e1635 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckUnqualifiedMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckUnqualifiedMapper.xml @@ -58,10 +58,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"