From 3671723f7e731ac704e80deb00303c494b7985f8 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Thu, 21 Dec 2023 08:28:09 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E8=B4=A8=E9=87=8F=E7=9C=8B=E6=9D=BF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/quality/QcCheckTaskProduceDTO.java | 28 ++ .../api/domain/quality/QcUserMaterialDTO.java | 258 ++++++++++++++++++ .../op/open/controller/OpenController.java | 2 +- .../java/com/op/open/mapper/OpenMapper.java | 7 +- .../op/open/service/impl/OpenServiceImpl.java | 19 +- .../main/resources/mapper/open/OpenMapper.xml | 6 + .../com/op/quality/domain/QcCheckType.java | 9 + .../service/impl/QcCheckTypeServiceImpl.java | 4 +- .../impl/QcUserMaterialServiceImpl.java | 6 + .../mapper/quality/QcCheckTypeMapper.xml | 22 +- .../mapper/quality/QcProCheckMapper.xml | 8 +- .../mapper/quality/QcUserMaterialMapper.xml | 10 +- 12 files changed, 348 insertions(+), 31 deletions(-) create mode 100644 op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/QcUserMaterialDTO.java diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/QcCheckTaskProduceDTO.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/QcCheckTaskProduceDTO.java index 5ea4b6b6..2e6cf0da 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/QcCheckTaskProduceDTO.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/QcCheckTaskProduceDTO.java @@ -128,6 +128,10 @@ public class QcCheckTaskProduceDTO extends BaseEntity { private String checkTimeEnd; private String typeCode; private String checkType; + private String carName; + private String carCode; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date produceDate; @Excel(name = "抽样数量") private BigDecimal sampleQuality; @@ -144,6 +148,30 @@ public class QcCheckTaskProduceDTO extends BaseEntity { @Excel(name = "C类不合格数量") private BigDecimal cNoOkquality; + public Date getProduceDate() { + return produceDate; + } + + public void setProduceDate(Date produceDate) { + this.produceDate = produceDate; + } + + public String getCarName() { + return carName; + } + + public void setCarName(String carName) { + this.carName = carName; + } + + public String getCarCode() { + return carCode; + } + + public void setCarCode(String carCode) { + this.carCode = carCode; + } + public BigDecimal getaNoOkquality() { return aNoOkquality; } diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/QcUserMaterialDTO.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/QcUserMaterialDTO.java new file mode 100644 index 00000000..526c9dce --- /dev/null +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/QcUserMaterialDTO.java @@ -0,0 +1,258 @@ +package com.op.system.api.domain.quality; + +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.List; + +/** + * 人员物料绑定对象 qc_user_material + * + * @author Open Platform + * @date 2023-10-09 + */ +public class QcUserMaterialDTO extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** id */ + private String id; + + /** 员工编码 */ + @Excel(name = "员工编码") + private String userCode; + + /** 员工名称 */ + @Excel(name = "员工名称") + private String userName; + + /** 物料编码 */ + @Excel(name = "物料编码") + private String materialCode; + + /** 物料名称 */ + @Excel(name = "物料名称") + private String materialName; + + /** 预留字段1 */ + @Excel(name = "预留字段1") + private String attr1; + + /** 预留字段2 */ + @Excel(name = "预留字段2") + private String attr2; + + /** 预留字段3 */ + @Excel(name = "预留字段3") + private String attr3; + + /** 预留字段4 */ + @Excel(name = "预留字段4") + private String attr4; + + /** 工厂编码 */ + @Excel(name = "工厂编码") + private String factoryCode; + + /** 删除标识1删除0正常 */ + private String delFlag; + + /** 编号 */ + private String userId; + /** 手机号 */ + private String phonenumber; + private String email; + private String materialNames; + /** 状态 */ + private String status; + + private String materialId; + + private String[] userCodes; + private String label; + private String key; + + private List selectedValues; + + public void setId(String id) { + this.id = id; + } + + public String getId() { + return id; + } + public void setUserCode(String userCode) { + this.userCode = userCode; + } + + public String getUserCode() { + return userCode; + } + public void setUserName(String userName) { + this.userName = userName; + } + + public String getUserName() { + return userName; + } + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + + public String getMaterialCode() { + return materialCode; + } + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public String getMaterialName() { + return materialName; + } + public void setAttr1(String attr1) { + this.attr1 = attr1; + } + + public String getAttr1() { + return attr1; + } + public void setAttr2(String attr2) { + this.attr2 = attr2; + } + + public String getAttr2() { + return attr2; + } + public void setAttr3(String attr3) { + this.attr3 = attr3; + } + + public String getAttr3() { + return attr3; + } + public void setAttr4(String attr4) { + this.attr4 = attr4; + } + + public String getAttr4() { + return attr4; + } + public void setFactoryCode(String factoryCode) { + this.factoryCode = factoryCode; + } + + public String getFactoryCode() { + return factoryCode; + } + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getDelFlag() { + return delFlag; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getPhonenumber() { + return phonenumber; + } + + public void setPhonenumber(String phonenumber) { + this.phonenumber = phonenumber; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getMaterialNames() { + return materialNames; + } + + public void setMaterialNames(String materialNames) { + this.materialNames = materialNames; + } + + public String getMaterialId() { + return materialId; + } + + public void setMaterialId(String materialId) { + this.materialId = materialId; + } + public String[] getUserCodes() { + return userCodes; + } + + public void setUserCodes(String[] userCodes) { + this.userCodes = userCodes; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public List getSelectedValues() { + return selectedValues; + } + + public void setSelectedValues(List selectedValues) { + this.selectedValues = selectedValues; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("userCode", getUserCode()) + .append("userName", getUserName()) + .append("materialCode", getMaterialCode()) + .append("materialName", getMaterialName()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("userId", getUserId()) + .append("phonenumber", getPhonenumber()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("factoryCode", getFactoryCode()) + .append("delFlag", getDelFlag()) + .toString(); + } +} 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 f5613f8d..125378e7 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 @@ -83,7 +83,7 @@ public class OpenController extends BaseController { } /**创建生产过程(烘房 首检)检验*/ - @PostMapping(value = "createCheckProduceTask") + @PostMapping(value = "/createCheckProduceTask") public AjaxResult createCheckProduceTask(@RequestBody QcCheckTaskProduceDTO qcCheckTaskProduce) { if(StringUtils.isBlank(qcCheckTaskProduce.getIncomeBatchNo())){ return error("[IncomeBatchNo]不能为空"); diff --git a/op-modules/op-open/src/main/java/com/op/open/mapper/OpenMapper.java b/op-modules/op-open/src/main/java/com/op/open/mapper/OpenMapper.java index dd58e6f2..07ca7e42 100644 --- a/op-modules/op-open/src/main/java/com/op/open/mapper/OpenMapper.java +++ b/op-modules/op-open/src/main/java/com/op/open/mapper/OpenMapper.java @@ -7,10 +7,7 @@ import com.op.system.api.domain.mes.MesReportWorkConsumeDTO; import com.op.system.api.domain.mes.MesReportWorkDTO; import com.op.system.api.domain.mes.ProOrderWorkorderDTO; import com.op.system.api.domain.mes.ProRfidProcessDetail; -import com.op.system.api.domain.quality.QcCheckTaskDetailDTO; -import com.op.system.api.domain.quality.QcCheckTaskProduceDTO; -import com.op.system.api.domain.quality.QcCheckTypeProjectDTO; -import com.op.system.api.domain.quality.QcMaterialGroupDetailDTO; +import com.op.system.api.domain.quality.*; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -78,5 +75,7 @@ public interface OpenMapper { void insertQcCheckTaskProduce(QcCheckTaskProduceDTO qcCheckTaskProduce); public int addBatch(@Param("list") List items); + + QcUserMaterialDTO getUserByMaterial(String materialCode); } 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 9a77787c..d1ecd5f1 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 @@ -23,10 +23,7 @@ import com.op.system.api.domain.mes.MesReportWorkConsumeDTO; import com.op.system.api.domain.mes.MesReportWorkDTO; import com.op.system.api.domain.mes.ProOrderWorkorderDTO; import com.op.system.api.domain.mes.ProRfidProcessDetail; -import com.op.system.api.domain.quality.QcCheckTaskDetailDTO; -import com.op.system.api.domain.quality.QcCheckTaskProduceDTO; -import com.op.system.api.domain.quality.QcCheckTypeProjectDTO; -import com.op.system.api.domain.quality.QcMaterialGroupDetailDTO; +import com.op.system.api.domain.quality.*; import com.op.system.api.domain.sap.SapCloseOrderQuery; import com.op.system.api.domain.sap.SapRFW; import org.apache.commons.lang.StringUtils; @@ -305,6 +302,17 @@ public class OpenServiceImpl implements OpenService { QcCheckTypeProjectDTO qctp= new QcCheckTypeProjectDTO(); qctp.setTypeId(qcCheckTaskProduce.getCheckType());//生产过程检验 qctp.setMaterialCode(qcCheckTaskProduce.getMaterialCode());//特性 + + /**qc_user_material取默认检查人**/ + QcUserMaterialDTO qcUserMaterialDTO = openMapper.getUserByMaterial(qcCheckTaskProduce.getMaterialCode()); + if(qcUserMaterialDTO == null){ + qcCheckTaskProduce.setCheckManCode("mobile"); + qcCheckTaskProduce.setCheckManName("手持测试用户"); + }else{ + qcCheckTaskProduce.setCheckManCode(qcUserMaterialDTO.getUserCode()); + qcCheckTaskProduce.setCheckManName(qcUserMaterialDTO.getUserName()); + } + /**qc_check_type_project**/ List items = openMapper.getTPByTypeMaterial(qctp); if(CollectionUtils.isEmpty(items)){ @@ -328,6 +336,9 @@ public class OpenServiceImpl implements OpenService { qcCheckTaskProduce.setFactoryCode(factoryCode); qcCheckTaskProduce.setCreateTime(nowDate); qcCheckTaskProduce.setTypeCode("produce");//大检验节点 + qcCheckTaskProduce.setIncomeTime(qcCheckTaskProduce.getProduceDate()); + qcCheckTaskProduce.setSupplierCode(qcCheckTaskProduce.getCarCode()); + qcCheckTaskProduce.setSupplierName(qcCheckTaskProduce.getCarName()); openMapper.insertQcCheckTaskProduce(qcCheckTaskProduce); /**qc_check_task_detail**/ for(QcCheckTaskDetailDTO item:items){ diff --git a/op-modules/op-open/src/main/resources/mapper/open/OpenMapper.xml b/op-modules/op-open/src/main/resources/mapper/open/OpenMapper.xml index a49649be..b12931ec 100644 --- a/op-modules/op-open/src/main/resources/mapper/open/OpenMapper.xml +++ b/op-modules/op-open/src/main/resources/mapper/open/OpenMapper.xml @@ -195,6 +195,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and qctp.type_id = #{typeId} order by qctp.sort + insert into equ_repair_order diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckType.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckType.java index 79249d12..cb3bbbe3 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckType.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckType.java @@ -45,6 +45,15 @@ public class QcCheckType extends BaseEntity { private String delFlag; private int taskNum; + private String checkManCode; + + public String getCheckManCode() { + return checkManCode; + } + + public void setCheckManCode(String checkManCode) { + this.checkManCode = checkManCode; + } public int getTaskNum() { return taskNum; diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTypeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTypeServiceImpl.java index 88ee8cb9..d7a9bc58 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTypeServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTypeServiceImpl.java @@ -2,6 +2,7 @@ package com.op.quality.service.impl; import java.util.List; +import com.alibaba.nacos.common.utils.CollectionUtils; import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.op.common.core.utils.DateUtils; @@ -123,7 +124,8 @@ public class QcCheckTypeServiceImpl implements IQcCheckTypeService { @Override public List getTopTaskInfo(QcCheckType qcCheckType) { DynamicDataSourceContextHolder.push(qcCheckType.getFactoryCode());// 这是数据源的key - return qcCheckTypeMapper.getTopTaskInfo(qcCheckType); + List dtos = qcCheckTypeMapper.getTopTaskInfo(qcCheckType);//检验任务 + return dtos; } } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcUserMaterialServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcUserMaterialServiceImpl.java index 3c01ce35..e937c8c4 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcUserMaterialServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcUserMaterialServiceImpl.java @@ -1,5 +1,7 @@ package com.op.quality.service.impl; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Date; import java.util.List; @@ -73,6 +75,10 @@ public class QcUserMaterialServiceImpl implements IQcUserMaterialService { @Override @DS("#header.poolName") public int insertQcUserMaterial(QcUserMaterial qcUserMaterial) { + List userCodes = new ArrayList<>(); + userCodes.add(qcUserMaterial.getUserCode()); + qcUserMaterial.setUserCodes(userCodes.toArray(new String[userCodes.size()])); + Date now = DateUtils.getNowDate(); if (StringUtils.isNotEmpty(qcUserMaterial.getUserCodes())) { //删除之前的关联关系 diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeMapper.xml index e234127c..ac85dcb5 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeMapper.xml @@ -47,21 +47,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" count(0) taskNum, '检验任务' attr1 from qc_check_task qct - left join qc_check_type qc on qct.check_type = qc.order_code - where qct.check_status = '0' + left join qc_check_type qc on qct.check_type = qc.order_code + left join qc_user_material qum on qum.material_code = qct.material_code + where qct.check_status = '0' and qum.user_code = #{checkManCode} group by qct.check_type,qc.check_name - union ALL - select qcu.type, - qc.check_name, - count(0) taskNum, - '不合格处理' + union all + select '','', + count(0) taskNum, + '不合格处理' attr1 from qc_check_unqualified qcu - left join qc_check_type qc on qcu.type = qc.order_code - where qcu.status != '2' - group by qcu.type,qc.check_name + left join qc_check_task qct on qcu.task_id = qct.record_id + left join qc_user_material qum on qum.material_code = qct.material_code + where qcu.status != '2' and qum.user_code = #{checkManCode} - - insert into qc_check_type diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcProCheckMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcProCheckMapper.xml index 7693fcec..c08df09b 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcProCheckMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcProCheckMapper.xml @@ -66,6 +66,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + select id,rfid,factory_id,factory_code,order_id,machine_id,bad_meg,product_id,isqua,file_id,attr1,attr2, @@ -248,7 +253,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" qct.material_code, qct.material_name, qct.quality, qct.unit, qct.supplier_code, qct.supplier_name, qct.income_time, qct.check_loc, qct.check_status, qct.check_man_code,qct.check_man_name, qct.check_time, qct.check_result, - qct.status,qct.create_by,qct.create_time,qct.check_type + qct.status,qct.create_by,qct.create_time,qct.check_type, + qct.noOk_quality,qct.aNoOkquality,qct.bNoOkquality,qct.cNoOkquality,qct.sample_quality from qc_check_task qct and qct.del_flag = '0' diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcUserMaterialMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcUserMaterialMapper.xml index df89fef3..6d55176d 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcUserMaterialMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcUserMaterialMapper.xml @@ -81,10 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and bp.product_code not in ( select um.material_code from qc_user_material um - where um.user_code in - - #{userCode} - + where um.user_code =#{userCode} ) and bp.product_desc_zh like concat('%', #{materialName}, '%') @@ -94,10 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" concat(bp.product_desc_zh,'(',bp.product_code,')') label from qc_user_material um left join base_product bp on um.material_code = bp.product_code - where um.user_code in - - #{userCode} - + where um.user_code = #{userCode} and bp.product_desc_zh like concat('%', #{materialName}, '%') From 4dd5c4895ffe9e675cbfe86bf8f4a0d2c8f06f1b Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Thu, 21 Dec 2023 08:45:42 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E6=8A=A5=E9=94=99=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/op/sap/service/SapOrderService.java | 6 +----- .../java/com/op/sap/service/impl/SapOrderServiceImpl.java | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/SapOrderService.java b/op-modules/op-sap/src/main/java/com/op/sap/service/SapOrderService.java index 14968ba9..4d4d23de 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/service/SapOrderService.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/SapOrderService.java @@ -3,12 +3,8 @@ package com.op.sap.service; import com.op.common.core.domain.R; import com.op.sap.domain.vo.SapOrderReceiptQuery; -import com.op.sap.domain.vo.SapPurchaseOrderQuery; -import com.op.system.api.domain.sap.SapCloseOrderQuery; -import com.op.system.api.domain.sap.SapCreateOrder; -import com.op.system.api.domain.sap.SapRFW; -import com.op.system.api.domain.sap.SapShopOrderQuery; +import com.op.system.api.domain.sap.*; import com.op.system.api.model.SapProOrder; import java.util.List; diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java index 62c8c454..7e7a9d74 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java @@ -8,13 +8,9 @@ import com.op.common.core.utils.StringUtils; import com.op.common.core.utils.uuid.IdUtils; import com.op.sap.domain.vo.SapOrderReceiptQuery; -import com.op.sap.domain.vo.SapPurchaseOrderQuery; import com.op.sap.service.SapOrderService; -import com.op.system.api.domain.sap.SapCloseOrderQuery; -import com.op.system.api.domain.sap.SapCreateOrder; -import com.op.system.api.domain.sap.SapRFW; -import com.op.system.api.domain.sap.SapShopOrderQuery; +import com.op.system.api.domain.sap.*; import com.op.system.api.model.SapProOrder; import com.sap.conn.jco.*; From 0ccb32d068c93b86ad303c51ee0da65084426b93 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Thu, 21 Dec 2023 10:11:17 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E8=B4=A8=E9=87=8F=E8=B4=A8=E6=A3=80qc=5Fst?= =?UTF-8?q?atus=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../quality/service/impl/QcCheckTaskIncomeServiceImpl.java | 6 +++--- .../resources/mapper/quality/QcCheckUnqualifiedMapper.xml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java index f56e54c4..60bb70ec 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java @@ -285,8 +285,8 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { n = qcCheckTaskProduceMapper.updateQcCheckTaskProduce(qcCheckTaskProduce); - /**pro_order_workorder-->status->w5**/ - qcCheckTaskIncome.setStatus("w5"); + /**pro_order_workorder-->qc_status->2**/ + qcCheckTaskIncome.setStatus("2"); qcCheckUnqualifiedMapper.updateWorkOrderStatus(qcCheckTaskIncome); }else if("product".equals(qcCheckTaskIncome.getTypeCode())){ QcCheckTaskWarehousing warehousing = new QcCheckTaskWarehousing(); @@ -414,7 +414,7 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { qcCheckUnqualifiedMapper.updateQualityStatus(qcCheckTaskIncome); }else if("produce".equals(qcCheckTaskIncome.getTypeCode())){ /**pro_order_workorder-->status->w5**/ - qcCheckTaskIncome.setStatus("w5"); + qcCheckTaskIncome.setStatus("2"); qcCheckUnqualifiedMapper.updateWorkOrderStatus(qcCheckTaskIncome); }else if("product".equals(qcCheckTaskIncome.getTypeCode())){ 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 12c5f80f..ffa96336 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 @@ -187,7 +187,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where order_no = #{orderNo} - update pro_order_workorder set status = #{status} where workorder_code_sap = #{orderNo} + update pro_order_workorder set qc_status = #{status} where workorder_code_sap = #{orderNo} From e9528b28dac32a8748f7c05bd223c60a73b51b67 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Thu, 21 Dec 2023 10:25:43 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E8=B4=A8=E9=87=8F=E8=B4=A8=E6=A3=80qc=5Fst?= =?UTF-8?q?atus=E6=B7=BB=E5=8A=A0=E6=89=B9=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/op/quality/mapper/QcCheckUnqualifiedMapper.java | 2 +- .../service/impl/QcCheckTaskIncomeServiceImpl.java | 8 ++++---- .../resources/mapper/quality/QcCheckUnqualifiedMapper.xml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckUnqualifiedMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckUnqualifiedMapper.java index f39cdaeb..7d8aac35 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckUnqualifiedMapper.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckUnqualifiedMapper.java @@ -79,5 +79,5 @@ public interface QcCheckUnqualifiedMapper { List getWorkOrder(QcCheckTaskIncome qcCheckTaskIncome); - int updateWorkOrderStatus(QcCheckTaskIncome qcCheckTaskIncome); + int updateWorkOrderBatchStatus(QcCheckTaskIncome qcCheckTaskIncome); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java index 60bb70ec..216c7d43 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java @@ -285,9 +285,9 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { n = qcCheckTaskProduceMapper.updateQcCheckTaskProduce(qcCheckTaskProduce); - /**pro_order_workorder-->qc_status->2**/ + /**pro_order_workorder_batch-->qc_status->2**/ qcCheckTaskIncome.setStatus("2"); - qcCheckUnqualifiedMapper.updateWorkOrderStatus(qcCheckTaskIncome); + qcCheckUnqualifiedMapper.updateWorkOrderBatchStatus(qcCheckTaskIncome); }else if("product".equals(qcCheckTaskIncome.getTypeCode())){ QcCheckTaskWarehousing warehousing = new QcCheckTaskWarehousing(); warehousing.setCheckStatus("2"); @@ -413,9 +413,9 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { qcCheckTaskIncome.setCheckResult(result.equals("Y")?"1":"2"); qcCheckUnqualifiedMapper.updateQualityStatus(qcCheckTaskIncome); }else if("produce".equals(qcCheckTaskIncome.getTypeCode())){ - /**pro_order_workorder-->status->w5**/ + /**pro_order_workorder_batch-->status->w5**/ qcCheckTaskIncome.setStatus("2"); - qcCheckUnqualifiedMapper.updateWorkOrderStatus(qcCheckTaskIncome); + qcCheckUnqualifiedMapper.updateWorkOrderBatchStatus(qcCheckTaskIncome); }else if("product".equals(qcCheckTaskIncome.getTypeCode())){ } 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 ffa96336..3001405b 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 @@ -186,8 +186,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update wms_raw_order_in set quality_status = #{checkResult} where order_no = #{orderNo} - - update pro_order_workorder set qc_status = #{status} where workorder_code_sap = #{orderNo} + + update pro_order_workorder_batch set qc_stauts = #{status} where batch_code = #{incomeBatchNo} From 245301f4f868ac77d99834d8e89cd9a7426d0800 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Thu, 21 Dec 2023 10:31:05 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E8=B4=A8=E9=87=8F=E8=B4=A8=E6=A3=80qc=5Fst?= =?UTF-8?q?atus=E6=B7=BB=E5=8A=A0=E6=89=B9=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/quality/QcCheckUnqualifiedMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 3001405b..6696008b 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 @@ -187,7 +187,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where order_no = #{orderNo} - update pro_order_workorder_batch set qc_stauts = #{status} where batch_code = #{incomeBatchNo} + update pro_order_workorder_batch set qc_status = #{status} where batch_code = #{incomeBatchNo} From f1f895ee2081534d267b6546293c5f5a687a10d9 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Thu, 21 Dec 2023 15:57:50 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E8=B4=A8=E9=87=8F=E8=B4=A8=E6=A3=80+?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E7=AE=A1=E7=90=86=E7=95=8C=E9=9D=A2=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E6=AF=8D=E5=8D=95=E4=BF=A1=E6=81=AF+=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E5=9B=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/op/plan/domain/ProOrderWorkorder.java | 34 ++++++++++- .../plan/mapper/ProOrderWorkorderMapper.java | 1 + .../mapper/plan/ProOrderWorkorderMapper.xml | 61 ++++++++++--------- .../controller/QcInterfaceController.java | 7 +++ .../com/op/quality/domain/QcInterface.java | 27 ++++++++ .../com/op/quality/domain/QcLineChartDto.java | 39 ++++++++++++ .../quality/domain/QcLineChartSeriesDto.java | 48 +++++++++++++++ .../op/quality/mapper/QcInterfaceMapper.java | 4 ++ .../quality/service/IQcInterfaceService.java | 3 + .../impl/QcCheckTaskIncomeServiceImpl.java | 9 ++- .../service/impl/QcInterfaceServiceImpl.java | 52 +++++++++++++++- .../mapper/quality/QcCheckTypeMapper.xml | 6 +- .../mapper/quality/QcInterfaceMapper.xml | 19 ++++++ 13 files changed, 268 insertions(+), 42 deletions(-) create mode 100644 op-modules/op-quality/src/main/java/com/op/quality/domain/QcLineChartDto.java create mode 100644 op-modules/op-quality/src/main/java/com/op/quality/domain/QcLineChartSeriesDto.java diff --git a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java index 01c5dba5..0a7b37f1 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java @@ -33,7 +33,7 @@ public class ProOrderWorkorder extends TreeEntity { private String orderId; /** 订单编码 */ - @Excel(name = "子订单编码") + @Excel(name = "子订单旧编码") private String orderCode; /** 产品ID */ @@ -211,7 +211,7 @@ public class ProOrderWorkorder extends TreeEntity { } private String prepareId; - + @Excel(name = "子订单新编号") private String workorderCodeSap; /** 批次号 */ @@ -219,9 +219,39 @@ public class ProOrderWorkorder extends TreeEntity { private List batchNumList; private List batchInfo; + private String pproductCode; + @Excel(name = "母产品名称") + private String pproductName; + @Excel(name = "母订单新编号") + private String pworkorderCodeSap; + /** $column.columnComment */ private String factoryCode; + public String getPproductCode() { + return pproductCode; + } + + public void setPproductCode(String pproductCode) { + this.pproductCode = pproductCode; + } + + public String getPproductName() { + return pproductName; + } + + public void setPproductName(String pproductName) { + this.pproductName = pproductName; + } + + public String getPworkorderCodeSap() { + return pworkorderCodeSap; + } + + public void setPworkorderCodeSap(String pworkorderCodeSap) { + this.pworkorderCodeSap = pworkorderCodeSap; + } + public List getBatchInfo() { return batchInfo; } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java index 16a3d725..421ad7ff 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java @@ -166,5 +166,6 @@ public interface ProOrderWorkorderMapper { int updateWhiteWorkOrder(ProOrderWorkorder whiteOrder); ProOrderWorkorder getPWorkOrder(ProOrderWorkorder whiteOrder); + } diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml index 88fe27ae..853fc9ab 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml @@ -38,6 +38,11 @@ + + + + + @@ -49,37 +54,33 @@ diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcInterfaceController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcInterfaceController.java index b7629199..0619f7b0 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcInterfaceController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcInterfaceController.java @@ -3,6 +3,7 @@ package com.op.quality.controller; import com.op.common.core.utils.StringUtils; import com.op.quality.domain.QcCheckType; import com.op.quality.domain.QcInterface; +import com.op.quality.domain.QcLineChartDto; import com.op.quality.service.IQcInterfaceService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -126,4 +127,10 @@ public class QcInterfaceController { public List getMonthOfYearContrast(@RequestBody QcInterface qcInterface) { return qcInterfaceService.getMonthOfYearContrast(qcInterface); } + + @GetMapping("/getLineQcData") + public QcLineChartDto getLineQcData(QcInterface qcInterface) { + return qcInterfaceService.getLineQcData(qcInterface); + } + } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcInterface.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcInterface.java index f10f74a7..b68ed1a5 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcInterface.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcInterface.java @@ -47,6 +47,33 @@ public class QcInterface extends BaseEntity { private List data; private String reasons; private String typeCode; + private String productDateStart; + private String ProductDateEnd; + private String nameDate; + + public String getNameDate() { + return nameDate; + } + + public void setNameDate(String nameDate) { + this.nameDate = nameDate; + } + + public String getProductDateStart() { + return productDateStart; + } + + public void setProductDateStart(String productDateStart) { + this.productDateStart = productDateStart; + } + + public String getProductDateEnd() { + return ProductDateEnd; + } + + public void setProductDateEnd(String productDateEnd) { + ProductDateEnd = productDateEnd; + } public String getTypeCode() { return typeCode; diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcLineChartDto.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcLineChartDto.java new file mode 100644 index 00000000..554b4226 --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcLineChartDto.java @@ -0,0 +1,39 @@ +package com.op.quality.domain; + +import java.util.List; + +/** + * echart图返回数据 + * + * @author Open Platform + * @date 2023-07-03 + */ +public class QcLineChartDto { + private List seriesNames; + private List xAxisDatas; + private List seriesDatas; + + public List getSeriesNames() { + return seriesNames; + } + + public void setSeriesNames(List seriesNames) { + this.seriesNames = seriesNames; + } + + public List getxAxisDatas() { + return xAxisDatas; + } + + public void setxAxisDatas(List xAxisDatas) { + this.xAxisDatas = xAxisDatas; + } + + public List getSeriesDatas() { + return seriesDatas; + } + + public void setSeriesDatas(List seriesDatas) { + this.seriesDatas = seriesDatas; + } +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcLineChartSeriesDto.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcLineChartSeriesDto.java new file mode 100644 index 00000000..2dce8f24 --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcLineChartSeriesDto.java @@ -0,0 +1,48 @@ +package com.op.quality.domain; + +import java.util.List; + +/** + * echart图返回数据 + * + * @author Open Platform + * @date 2023-07-03 + */ +public class QcLineChartSeriesDto { + private String name; + private String type; + private String stack; + private List data; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getStack() { + return stack; + } + + public void setStack(String stack) { + this.stack = stack; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcInterfaceMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcInterfaceMapper.java index d00c0ad8..8c7d9d92 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcInterfaceMapper.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcInterfaceMapper.java @@ -41,4 +41,8 @@ public interface QcInterfaceMapper { Map getMothNoOkNum(QcInterface qcInterface); List getReasons(QcInterface dto); + + List getLineChartsNames(QcInterface qcInterface); + @MapKey("nameDate") + Map getLineChartsDatas(QcInterface qcInterface); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcInterfaceService.java b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcInterfaceService.java index 6676f007..d50e1c97 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcInterfaceService.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcInterfaceService.java @@ -3,6 +3,7 @@ package com.op.quality.service; import com.op.quality.domain.QcCheckType; import com.op.quality.domain.QcInterface; +import com.op.quality.domain.QcLineChartDto; import java.util.List; import java.util.Map; @@ -35,4 +36,6 @@ public interface IQcInterfaceService { QcInterface getLineDayNoOk(QcInterface qcInterface); List getMonthOfYearContrast(QcInterface qcInterface); + + QcLineChartDto getLineQcData(QcInterface qcInterface); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java index 216c7d43..767fffdf 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java @@ -386,13 +386,16 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { qcCheckTask.setCheckResult(result);//检验结果Y合格 N不合格 BigDecimal noOkQquality = new BigDecimal("0"); if(qcCheckTaskIncome.getaNoOkquality()!=null){ - noOkQquality.add(qcCheckTaskIncome.getaNoOkquality()); + noOkQquality = noOkQquality.add(qcCheckTaskIncome.getaNoOkquality()); + qcCheckTask.setaNoOkquality(qcCheckTaskIncome.getaNoOkquality()); } if(qcCheckTaskIncome.getbNoOkquality()!=null){ - noOkQquality.add(qcCheckTaskIncome.getbNoOkquality()); + noOkQquality = noOkQquality.add(qcCheckTaskIncome.getbNoOkquality()); + qcCheckTask.setbNoOkquality(qcCheckTaskIncome.getbNoOkquality()); } if(qcCheckTaskIncome.getcNoOkquality()!=null){ - noOkQquality.add(qcCheckTaskIncome.getcNoOkquality()); + noOkQquality = noOkQquality.add(qcCheckTaskIncome.getcNoOkquality()); + qcCheckTask.setcNoOkquality(qcCheckTaskIncome.getcNoOkquality()); } if(qcCheckTask.getNoOkQuality()==null){ qcCheckTask.setNoOkQuality(noOkQquality); diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcInterfaceServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcInterfaceServiceImpl.java index 554e0805..5971c5c5 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcInterfaceServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcInterfaceServiceImpl.java @@ -1,10 +1,9 @@ package com.op.quality.service.impl; +import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.op.common.core.utils.DateUtils; -import com.op.quality.domain.QcCheckTaskDetail; -import com.op.quality.domain.QcInterface; -import com.op.quality.domain.QcProCheck; +import com.op.quality.domain.*; import com.op.quality.mapper.QcInterfaceMapper; import com.op.quality.service.IQcInterfaceService; import org.apache.commons.lang.StringUtils; @@ -319,6 +318,53 @@ public class QcInterfaceServiceImpl implements IQcInterfaceService { return dtos; } + @Override + @DS("#header.poolName") + public QcLineChartDto getLineQcData(QcInterface qcInterface) { + QcLineChartDto lineChartDto = new QcLineChartDto(); + + Calendar calendar = Calendar.getInstance(); + Date now = calendar.getTime(); + calendar.set(Calendar.DAY_OF_MONTH, 1); + Date firstDayOfMonth = calendar.getTime(); + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + String startTime = dateFormat.format(firstDayOfMonth); + String endTime = dateFormat.format(now); + qcInterface.setProductDateStart(startTime); + qcInterface.setProductDateEnd(endTime); + //图例名称 + List seriesNames = qcInterfaceMapper.getLineChartsNames(qcInterface); + lineChartDto.setSeriesNames(seriesNames); + //日期名称数组 + List xAxisDatas = getDays(startTime,endTime); + lineChartDto.setxAxisDatas(xAxisDatas); + Map productdatas = qcInterfaceMapper.getLineChartsDatas(qcInterface); + //值 + List seriesDatas = new ArrayList<>(); + QcLineChartSeriesDto lineChartSeriesDto = null; + for(String productName:seriesNames){ + lineChartSeriesDto = new QcLineChartSeriesDto(); + lineChartSeriesDto.setName(productName); + lineChartSeriesDto.setType("line"); + List datas = new ArrayList<>(); + for(String dayStr:xAxisDatas) { + QcInterface data0 = productdatas.get(productName + dayStr); + if (data0 != null) { + BigDecimal rate = new BigDecimal(data0.getNoOkQuality()) + .multiply(new BigDecimal(100)) + .divide(new BigDecimal(data0.getQuality()),2,BigDecimal.ROUND_HALF_UP); + datas.add(rate.toString()); + } else { + datas.add("0"); + } + } + lineChartSeriesDto.setData(datas); + seriesDatas.add(lineChartSeriesDto); + } + lineChartDto.setSeriesDatas(seriesDatas); + return lineChartDto; + } + /**两个日期之间的所有日期**/ public static List getDays(String startTime,String endTime) { diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeMapper.xml index ac85dcb5..298e7dfc 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeMapper.xml @@ -48,8 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" '检验任务' attr1 from qc_check_task qct left join qc_check_type qc on qct.check_type = qc.order_code - left join qc_user_material qum on qum.material_code = qct.material_code - where qct.check_status = '0' and qum.user_code = #{checkManCode} + where qct.check_status = '0' and qct.check_man_code = #{checkManCode} group by qct.check_type,qc.check_name union all select '','', @@ -57,8 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" '不合格处理' attr1 from qc_check_unqualified qcu left join qc_check_task qct on qcu.task_id = qct.record_id - left join qc_user_material qum on qum.material_code = qct.material_code - where qcu.status != '2' and qum.user_code = #{checkManCode} + where qcu.status != '2' and qct.check_man_code = #{checkManCode} insert into qc_check_type diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcInterfaceMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcInterfaceMapper.xml index 6f0b51af..edad5b1b 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcInterfaceMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcInterfaceMapper.xml @@ -241,4 +241,23 @@ where belong_to = #{recordId} and status = 'N' and del_flag='0' + + From f5060ed72cb5bf73b1507d6b8ff8563dcc9e6cbf Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Thu, 21 Dec 2023 17:51:45 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=B9=B4=E5=A4=87=E4=BB=BD=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../op/system/api/RemoteDeviceService.java | 3 + .../factory/RemoteDeviceFallbackFactory.java | 5 ++ .../controller/DeviceTaskController.java | 13 ++++ .../op/device/mapper/EquOperationMapper.java | 15 +++- .../op/device/service/IDeviceTaskService.java | 2 + .../service/impl/DeviceTaskServiceImpl.java | 70 ++++++++++++++++++- .../mapper/device/EquOperationMapper.xml | 25 +++++++ .../src/main/java/com/op/job/task/RyTask.java | 6 ++ 8 files changed, 137 insertions(+), 2 deletions(-) diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/RemoteDeviceService.java b/op-api/op-api-system/src/main/java/com/op/system/api/RemoteDeviceService.java index 721ae6a8..bcda8719 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/RemoteDeviceService.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/RemoteDeviceService.java @@ -30,4 +30,7 @@ public interface RemoteDeviceService { @PostMapping("/deviceTask/createEquipmentOperationTask") public R createEquipmentOperationTask(); + + @PostMapping("/deviceTask/equipmentBKTask") + public R equipmentBKTask(); } diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteDeviceFallbackFactory.java b/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteDeviceFallbackFactory.java index d46844da..9868e0fb 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteDeviceFallbackFactory.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteDeviceFallbackFactory.java @@ -42,6 +42,11 @@ public class RemoteDeviceFallbackFactory implements FallbackFactory>> dateSources0 = remoteUserService.getPoolNameList(sysUser); + List> dateSources = dateSources0.getData(); + ExecutorService executorService = new ThreadPoolExecutor( + dateSources.size(), + dateSources.size(), + 0L, TimeUnit.MILLISECONDS, + new LinkedBlockingQueue()); + + try { + dateSources.forEach(dateSource -> { + logger.info("++++++++++++" + dateSource.get("poolName") + "++++设备运行记录数据库备份开始++++++++++"); + Runnable run = () -> backupEquipmentOperation(dateSource.get("poolName")); + executorService.execute(run); + }); + } catch (Exception e) { + logger.error("service == dataClearTask == exception", e); + return error("service == dataClearTask == exception"); + } finally { + executorService.shutdown(); + } + + return success(); + } + public void createSpotCheckPlanFunc(String poolName){ DynamicDataSourceContextHolder.push(poolName);// 这是数据源的key /**equ_plan equ_plan_equ**/ @@ -431,7 +465,7 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService { operation.setCreateTime(DateUtils.getNowDate()); } - int batchSize = 200;// 批次数量 + int batchSize = 100;// 批次数量 // 分批次处理 int batchCount = (operationList.size() + batchSize - 1)/batchSize;// 计算批次数量 @@ -450,6 +484,40 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService { } + private void backupEquipmentOperation(String poolName) { + DynamicDataSourceContextHolder.push(poolName);// 这是数据源的key + // 校验当前YEAR-2是否备份过数据 + EquOperation check = equOperationMapper.checkBackupOperation(); + if (check == null) { + // 获取插入数量 + int insertNum = equOperationMapper.getBackupOperationNum(); + int insertSize = 100;// 新增批次数量 + + // 分批次备份 + int batchCount = (insertNum + insertSize - 1)/insertSize;// 计算批次数量 + for (int i = 0;i < batchCount; i++) { + int startIndex = i * insertSize;// 索引开始值 + int endIndex = Math.min((i + 1)*insertSize,insertNum);// 索引结束值 + + // 备份至数据库 + int num = equOperationMapper.backupOperation(startIndex,insertSize); + + System.out.println("数据源:"+poolName+"--->"+"第"+(i+1)+"轮备份"+"开始索引:"+startIndex+"________结束索引:"+endIndex+"________成功插入数量:"+num); + } + + // 删除源数据库数据 + int delSize = 100;// 删除批次数量 + for (int i = 0; i < insertNum/delSize+1; i++) { + // 在源数据库中删除 + int num = equOperationMapper.deleteOperation(delSize); + System.out.println("数据源:"+poolName+"--->"+"第"+(i+1)+"轮删除"+"------>成功删除数量:"+num); + } + + }else { + System.out.println("数据源:"+poolName+"---->"+"年份:"+( LocalDate.now().getYear()-2) +"--->已备份"); + } + } + public static void main(String[] args) { int batchSize = 200;// 批次数量 diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquOperationMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquOperationMapper.xml index 04a90d78..f47df026 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquOperationMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquOperationMapper.xml @@ -119,6 +119,14 @@ where CONVERT(date, create_time) = CONVERT(date, GETDATE()) + + + + insert into equ_operation @@ -188,6 +196,15 @@ + + insert into equ_operation_backup + select s.* + from equ_operation s + where YEAR (s.create_time) = YEAR (GETDATE())-2 + ORDER BY id + OFFSET #{startIndex} ROWS FETCH NEXT #{batchSize} ROWS ONLY + + update equ_operation @@ -230,4 +247,12 @@ #{id} + + + delete + from equ_operation + where id in (select s.id from equ_operation s where YEAR (s.create_time) = YEAR (GETDATE())-2 + ORDER BY id + OFFSET 0 ROWS FETCH NEXT #{delSize} ROWS ONLY) + \ No newline at end of file diff --git a/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java b/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java index 443cd9a0..e2815c4d 100644 --- a/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java +++ b/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java @@ -144,4 +144,10 @@ public class RyTask { logger.info("++设备运行记录生成任务开始++createEquipmentOperationTask+++++"); remoteDeviceService.createEquipmentOperationTask(); } + + /** 每年1月1日1:50执行 **/ + public void equipmentBKTask(){ + logger.info("++设备运行记录+数据库备份的数据+开始++equipmentBkTask+++++"); + remoteDeviceService.equipmentBKTask(); + } } From 4edeb71b911ef4330c419457073297c773091110 Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Fri, 22 Dec 2023 13:44:04 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=AE=8C=E5=A5=BD?= =?UTF-8?q?=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DeviceInterfaceServiceImpl.java | 1 + .../service/impl/DeviceTaskServiceImpl.java | 2 +- .../mapper/device/DeviceInterfaceMapper.xml | 17 +++++++++++++---- .../mapper/device/EquOperationMapper.xml | 1 + 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java index dd9ba40a..5788fdbe 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java @@ -204,6 +204,7 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService { @DS("#header.poolName") public AjaxResult getEquipmentIntactRate(EquOperation equOperation) { //查询所有设备(设备停用的除外) + // CAST(SUM(CASE WHEN equipment_status = '1' or equipment_status = '3' THEN 1 Else 0 END)*100.00/COUNT(*) as decimal(18,2)) AS intactRate EquOperation equipmentIntactRate = deviceInterfaceMapper.getEquipmentIntactRate(equOperation); return success(equipmentIntactRate); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java index 7930ac80..dc3652ed 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java @@ -476,7 +476,7 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService { List subList = operationList.subList(startIndex,endIndex); int num = equOperationMapper.insertEquOperationByBatch(subList); - System.out.println("数据源:"+poolName+"--->"+"第"+i+"轮"+"开始索引:"+startIndex+"________结束索引:"+endIndex+"________成功插入数量:"+num); + System.out.println("数据源:"+poolName+"--->"+"第"+(i+1)+"轮"+"开始索引:"+startIndex+"________结束索引:"+endIndex+"________成功插入数量:"+num); } }else { System.out.println("数据源:"+poolName+"当天生成过运行记录"); diff --git a/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml index 90f2288d..1ce66128 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml @@ -78,10 +78,19 @@ diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquOperationMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquOperationMapper.xml index f47df026..1eda9f70 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquOperationMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquOperationMapper.xml @@ -89,6 +89,7 @@ and CONVERT(date,create_time) >= #{createTimeStart} and #{createTimeEnd} >= CONVERT(date,create_time) + order by CAST(create_time AS DATE) desc,group_line + + \ No newline at end of file