From d80fe972b310c924cb482b9a221f66610dde5e09 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Sat, 21 Oct 2023 20:58:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=9F=E6=96=99=E6=A3=80=E9=AA=8C=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QcCheckTaskIncomeController.java | 6 +- .../op/quality/domain/QcCheckTaskDetail.java | 68 ++++++++++++++++- .../op/quality/domain/QcCheckTaskIncome.java | 6 +- .../mapper/QcCheckTaskDetailMapper.java | 19 +++-- .../mapper/QcCheckTaskIncomeMapper.java | 4 + .../mapper/QcCheckTypeProjectMapper.java | 19 +++-- .../mapper/QcMaterialGroupDetailMapper.java | 16 ++-- .../impl/QcCheckTaskIncomeServiceImpl.java | 74 ++++++++++++++++++- .../mapper/QcCheckTypeProjectMapper.xml | 46 ++++++++++-- .../mapper/QcMaterialGroupDetailMapper.xml | 21 ++++-- .../quality/QcCheckTaskDetailMapper.xml | 36 +++++++-- .../quality/QcCheckTaskIncomeMapper.xml | 5 ++ 12 files changed, 270 insertions(+), 50 deletions(-) diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskIncomeController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskIncomeController.java index 39663522..29382fe7 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskIncomeController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskIncomeController.java @@ -76,7 +76,11 @@ public class QcCheckTaskIncomeController extends BaseController { @Log(title = "来料检验", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody QcCheckTaskIncome qcCheckTaskIncome) { - return toAjax(qcCheckTaskIncomeService.insertQcCheckTaskIncome(qcCheckTaskIncome)); + int r = qcCheckTaskIncomeService.insertQcCheckTaskIncome(qcCheckTaskIncome); + if(r>0){ + return toAjax(r); + } + return error("添加失败:请检查物料的关联检测项"); } /** diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDetail.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDetail.java index 24eb45fa..7d8a9379 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDetail.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDetail.java @@ -8,7 +8,7 @@ import com.op.common.core.web.domain.BaseEntity; /** * 检验任务详情对象 qc_check_task_detail - * + * * @author Open Platform * @date 2023-10-19 */ @@ -81,6 +81,72 @@ public class QcCheckTaskDetail extends BaseEntity { /** 删除标识1删除0正常 */ private String delFlag; + private String projectId; + private Integer sort; + + private String standardValue; + private BigDecimal upperDiff; + private BigDecimal downDiff; + private BigDecimal sample; + private Integer sampleNum; + + public String getStandardValue() { + return standardValue; + } + + public void setStandardValue(String standardValue) { + this.standardValue = standardValue; + } + + public BigDecimal getUpperDiff() { + return upperDiff; + } + + public void setUpperDiff(BigDecimal upperDiff) { + this.upperDiff = upperDiff; + } + + public BigDecimal getDownDiff() { + return downDiff; + } + + public void setDownDiff(BigDecimal downDiff) { + this.downDiff = downDiff; + } + + public BigDecimal getSample() { + return sample; + } + + public void setSample(BigDecimal sample) { + this.sample = sample; + } + + public Integer getSampleNum() { + return sampleNum; + } + + public void setSampleNum(Integer sampleNum) { + this.sampleNum = sampleNum; + } + + public String getProjectId() { + return projectId; + } + + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + + public Integer getSort() { + return sort; + } + + public void setSort(Integer sort) { + this.sort = sort; + } + public void setRecordId(String recordId) { this.recordId = recordId; } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskIncome.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskIncome.java index b6b18817..ac38a453 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskIncome.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskIncome.java @@ -10,7 +10,7 @@ import com.op.common.core.web.domain.BaseEntity; /** * 来料检验对象 qc_check_task_income - * + * * @author Open Platform * @date 2023-10-19 */ @@ -57,8 +57,8 @@ public class QcCheckTaskIncome extends BaseEntity { private String supplierName; /** 来料时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "来料时间", width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "来料时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date incomeTime; /** 检测地点 */ diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskDetailMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskDetailMapper.java index 54db74ec..a1fe8ccd 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskDetailMapper.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskDetailMapper.java @@ -3,17 +3,20 @@ package com.op.quality.mapper; import java.util.List; import com.op.quality.domain.QcCheckTaskDetail; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 检验任务详情Mapper接口 - * + * * @author Open Platform * @date 2023-10-19 */ +@Mapper public interface QcCheckTaskDetailMapper { /** * 查询检验任务详情 - * + * * @param recordId 检验任务详情主键 * @return 检验任务详情 */ @@ -21,7 +24,7 @@ public interface QcCheckTaskDetailMapper { /** * 查询检验任务详情列表 - * + * * @param qcCheckTaskDetail 检验任务详情 * @return 检验任务详情集合 */ @@ -29,7 +32,7 @@ public interface QcCheckTaskDetailMapper { /** * 新增检验任务详情 - * + * * @param qcCheckTaskDetail 检验任务详情 * @return 结果 */ @@ -37,7 +40,7 @@ public interface QcCheckTaskDetailMapper { /** * 修改检验任务详情 - * + * * @param qcCheckTaskDetail 检验任务详情 * @return 结果 */ @@ -45,7 +48,7 @@ public interface QcCheckTaskDetailMapper { /** * 删除检验任务详情 - * + * * @param recordId 检验任务详情主键 * @return 结果 */ @@ -53,9 +56,11 @@ public interface QcCheckTaskDetailMapper { /** * 批量删除检验任务详情 - * + * * @param recordIds 需要删除的数据主键集合 * @return 结果 */ public int deleteQcCheckTaskDetailByRecordIds(String[] recordIds); + + int addBatch(@Param("list") List items); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskIncomeMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskIncomeMapper.java index 97bba6ea..86577d85 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskIncomeMapper.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskIncomeMapper.java @@ -6,6 +6,7 @@ import com.op.quality.domain.QcBomComponent; import com.op.quality.domain.QcCheckTaskIncome; import com.op.quality.domain.QcSupplier; import com.op.system.api.domain.SysUser; +import org.apache.ibatis.annotations.Mapper; /** * 来料检验Mapper接口 @@ -13,6 +14,7 @@ import com.op.system.api.domain.SysUser; * @author Open Platform * @date 2023-10-19 */ +@Mapper public interface QcCheckTaskIncomeMapper { /** * 查询来料检验 @@ -67,4 +69,6 @@ public interface QcCheckTaskIncomeMapper { public List getQcListSupplier(QcSupplier qcSupplier); public List getQcListUser(SysUser sysUser); + + int getTodayMaxNum(QcCheckTaskIncome qcCheckTaskIncome); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTypeProjectMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTypeProjectMapper.java index db219e0c..16969171 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTypeProjectMapper.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTypeProjectMapper.java @@ -2,12 +2,13 @@ package com.op.quality.mapper; import java.util.List; +import com.op.quality.domain.QcCheckTaskDetail; import com.op.quality.domain.QcCheckTypeProject; import org.apache.ibatis.annotations.Mapper; /** * 物料检验项目维护Mapper接口 - * + * * @author Open Platform * @date 2023-10-17 */ @@ -15,7 +16,7 @@ import org.apache.ibatis.annotations.Mapper; public interface QcCheckTypeProjectMapper { /** * 查询物料检验项目维护 - * + * * @param id 物料检验项目维护主键 * @return 物料检验项目维护 */ @@ -23,7 +24,7 @@ public interface QcCheckTypeProjectMapper { /** * 查询物料检验项目维护列表 - * + * * @param qcCheckTypeProject 物料检验项目维护 * @return 物料检验项目维护集合 */ @@ -31,7 +32,7 @@ public interface QcCheckTypeProjectMapper { /** * 新增物料检验项目维护 - * + * * @param qcCheckTypeProject 物料检验项目维护 * @return 结果 */ @@ -39,7 +40,7 @@ public interface QcCheckTypeProjectMapper { /** * 修改物料检验项目维护 - * + * * @param qcCheckTypeProject 物料检验项目维护 * @return 结果 */ @@ -47,7 +48,7 @@ public interface QcCheckTypeProjectMapper { /** * 删除物料检验项目维护 - * + * * @param id 物料检验项目维护主键 * @return 结果 */ @@ -55,9 +56,13 @@ public interface QcCheckTypeProjectMapper { /** * 批量删除物料检验项目维护 - * + * * @param ids 需要删除的数据主键集合 * @return 结果 */ public int deleteQcCheckTypeProjectByIds(String[] ids); + + List getTPByTypeMaterial(QcCheckTypeProject qctp); + + List getTPByTypeGroup(QcCheckTypeProject qctp); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcMaterialGroupDetailMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcMaterialGroupDetailMapper.java index 00450e3f..27070497 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcMaterialGroupDetailMapper.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcMaterialGroupDetailMapper.java @@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper; /** * 物料组成员Mapper接口 - * + * * @author Open Platform * @date 2023-10-18 */ @@ -15,7 +15,7 @@ import org.apache.ibatis.annotations.Mapper; public interface QcMaterialGroupDetailMapper { /** * 查询物料组成员 - * + * * @param id 物料组成员主键 * @return 物料组成员 */ @@ -23,7 +23,7 @@ public interface QcMaterialGroupDetailMapper { /** * 查询物料组成员列表 - * + * * @param qcMaterialGroupDetail 物料组成员 * @return 物料组成员集合 */ @@ -31,7 +31,7 @@ public interface QcMaterialGroupDetailMapper { /** * 新增物料组成员 - * + * * @param qcMaterialGroupDetail 物料组成员 * @return 结果 */ @@ -39,7 +39,7 @@ public interface QcMaterialGroupDetailMapper { /** * 修改物料组成员 - * + * * @param qcMaterialGroupDetail 物料组成员 * @return 结果 */ @@ -47,7 +47,7 @@ public interface QcMaterialGroupDetailMapper { /** * 删除物料组成员 - * + * * @param id 物料组成员主键 * @return 结果 */ @@ -55,9 +55,11 @@ public interface QcMaterialGroupDetailMapper { /** * 批量删除物料组成员 - * + * * @param ids 需要删除的数据主键集合 * @return 结果 */ public int deleteQcMaterialGroupDetailByIds(String[] ids); + + public QcMaterialGroupDetail getGroupByMaterial(String materialCode); } 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 06c65812..35d83c42 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 @@ -1,17 +1,27 @@ package com.op.quality.service.impl; +import java.util.ArrayList; +import java.util.Date; import java.util.List; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.utils.DateUtils; -import com.op.quality.domain.QcBomComponent; -import com.op.quality.domain.QcSupplier; +import com.op.common.core.utils.uuid.IdUtils; +import com.op.common.security.utils.SecurityUtils; +import com.op.quality.domain.*; +import com.op.quality.mapper.QcCheckTaskDetailMapper; +import com.op.quality.mapper.QcCheckTypeProjectMapper; +import com.op.quality.mapper.QcMaterialGroupDetailMapper; import com.op.system.api.domain.SysUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.op.quality.mapper.QcCheckTaskIncomeMapper; -import com.op.quality.domain.QcCheckTaskIncome; import com.op.quality.service.IQcCheckTaskIncomeService; +import org.springframework.util.CollectionUtils; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; /** * 来料检验Service业务层处理 @@ -24,6 +34,15 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { @Autowired private QcCheckTaskIncomeMapper qcCheckTaskIncomeMapper; + @Autowired + private QcCheckTypeProjectMapper qcCheckTypeProjectMapper; + + @Autowired + private QcMaterialGroupDetailMapper qcMaterialGroupDetailMapper; + + @Autowired + private QcCheckTaskDetailMapper qcCheckTaskDetailMapper; + /** * 查询来料检验 * @@ -57,8 +76,55 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { @Override @DS("#header.poolName") public int insertQcCheckTaskIncome(QcCheckTaskIncome qcCheckTaskIncome) { + + String bpDD = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate()); + int liushuiNum = qcCheckTaskIncomeMapper.getTodayMaxNum(qcCheckTaskIncome); + String liushuiStr = String.format("%04d", liushuiNum); + + String createBy = SecurityUtils.getUsername(); + //获取当前所选工厂 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + String factoryCode = request.getHeader(key.substring(8)).replace("ds_",""); + + qcCheckTaskIncome.setCheckNo(bpDD+liushuiStr); qcCheckTaskIncome.setCreateTime(DateUtils.getNowDate()); - return qcCheckTaskIncomeMapper.insertQcCheckTaskIncome(qcCheckTaskIncome); + + /**qc_check_task_income**/ + String beLongId = IdUtils.fastSimpleUUID(); + qcCheckTaskIncome.setRecordId(beLongId); + qcCheckTaskIncomeMapper.insertQcCheckTaskIncome(qcCheckTaskIncome); + + /**取检测项**/ + QcCheckTypeProject qctp= new QcCheckTypeProject(); + qctp.setTypeId("checkTypeLL");//来料检验 + qctp.setMaterialCode(qcCheckTaskIncome.getMaterialCode());//特性 + /**qc_check_type_project**/ + List items = qcCheckTypeProjectMapper.getTPByTypeMaterial(qctp); + if(CollectionUtils.isEmpty(items)){ + /**qc_material_group_detail**/ + QcMaterialGroupDetail group = qcMaterialGroupDetailMapper.getGroupByMaterial(qcCheckTaskIncome.getMaterialCode()); + if(group == null){ + return 0;//没有找到检测项目 + } + qctp.setGroupId(group.getGroupId());//共性 + items = qcCheckTypeProjectMapper.getTPByTypeGroup(qctp); + } + + /**qc_check_task_detail**/ + if(CollectionUtils.isEmpty(items)){ + return 0;//没有找到检测项目 + } + Date nowDate= DateUtils.getNowDate(); + + for(QcCheckTaskDetail item:items){ + item.setRecordId(IdUtils.fastSimpleUUID()); + item.setBelongTo(beLongId); + item.setCreateTime(nowDate); + item.setCreateBy(createBy); + item.setFactoryCode(factoryCode); + } + return qcCheckTaskDetailMapper.addBatch(items); } /** diff --git a/op-modules/op-quality/src/main/resources/mapper/QcCheckTypeProjectMapper.xml b/op-modules/op-quality/src/main/resources/mapper/QcCheckTypeProjectMapper.xml index 069ceb36..dc40731c 100644 --- a/op-modules/op-quality/src/main/resources/mapper/QcCheckTypeProjectMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/QcCheckTypeProjectMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + - + + + insert into qc_check_type_project @@ -120,9 +154,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from qc_check_type_project where id in + delete from qc_check_type_project where id in #{id} - \ No newline at end of file + diff --git a/op-modules/op-quality/src/main/resources/mapper/QcMaterialGroupDetailMapper.xml b/op-modules/op-quality/src/main/resources/mapper/QcMaterialGroupDetailMapper.xml index 07e6bf7a..b0361307 100644 --- a/op-modules/op-quality/src/main/resources/mapper/QcMaterialGroupDetailMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/QcMaterialGroupDetailMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + - - + + + insert into qc_material_group_detail id, @@ -90,9 +97,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from qc_material_group_detail where id in + delete from qc_material_group_detail where id in #{id} - \ No newline at end of file + diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskDetailMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskDetailMapper.xml index 28234802..daa06564 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskDetailMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskDetailMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -35,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + - + insert into qc_check_task_detail @@ -110,8 +110,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{delFlag}, + + insert into qc_check_task_detail( + record_id,belong_to, + project_id,rule_name,order_num, + property_code,check_mode, + check_tool,unit_code, + check_standard,actual_value, + status,create_by,create_time, + factory_code,del_flag + ) values + + ( + #{item.recordId},#{item.belongTo}, + #{item.projectId},#{item.ruleName},#{item.sort}, + #{item.propertyCode},#{item.checkMode}, + #{item.checkTool},#{item.unitCode}, + #{item.checkStandard},#{item.actualValue}, + '0',#{item.createBy},#{item.createTime}, + #{item.factoryCode},'0' + ) + + - + update qc_check_task_detail belong_to = #{belongTo}, @@ -144,9 +166,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from qc_check_task_detail where record_id in + delete from qc_check_task_detail where record_id in #{recordId} - \ No newline at end of file + 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 05e727b7..8d0d75a6 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 @@ -96,6 +96,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and user_name like concat('%', #{userCode}, '%') and nick_name like concat('%', #{userName}, '%') + insert into qc_check_task_income