原料检验任务

highway
zhaoxiaolin 1 year ago
parent c67c7a464d
commit d80fe972b3

@ -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("添加失败:请检查物料的关联检测项");
}
/**

@ -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;
}

@ -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;
/** 检测地点 */

@ -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<QcCheckTaskDetail> items);
}

@ -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<QcSupplier> getQcListSupplier(QcSupplier qcSupplier);
public List<SysUser> getQcListUser(SysUser sysUser);
int getTodayMaxNum(QcCheckTaskIncome qcCheckTaskIncome);
}

@ -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<QcCheckTaskDetail> getTPByTypeMaterial(QcCheckTypeProject qctp);
List<QcCheckTaskDetail> getTPByTypeGroup(QcCheckTypeProject qctp);
}

@ -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);
}

@ -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<QcCheckTaskDetail> 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);
}
/**

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.quality.mapper.QcCheckTypeProjectMapper">
<resultMap type="QcCheckTypeProject" id="QcCheckTypeProjectResult">
<result property="id" column="id" />
<result property="projectId" column="project_id" />
@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectQcCheckTypeProjectList" parameterType="QcCheckTypeProject" resultMap="QcCheckTypeProjectResult">
<include refid="selectQcCheckTypeProjectVo"/>
<where>
<where>
<if test="projectId != null and projectId != ''"> and project_id = #{projectId}</if>
<if test="typeId != null and typeId != ''"> and type_id = #{typeId}</if>
<if test="standardValue != null "> and standard_value = #{standardValue}</if>
@ -44,12 +44,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
</where>
</select>
<select id="selectQcCheckTypeProjectById" parameterType="String" resultMap="QcCheckTypeProjectResult">
<include refid="selectQcCheckTypeProjectVo"/>
where id = #{id}
</select>
<select id="getTPByTypeMaterial" resultType="com.op.quality.domain.QcCheckTaskDetail">
select qctp.project_id projectId,
qctp.standard_value standardValue,
qctp.upper_diff upperDiff,
qctp.down_diff downDiff,
qctp.sample,
qctp.sort,
qcp.rule_name ruleName,
qcp.property_code propertyCode,
qcp.check_tool checkTool,
qcp.unit_code unitCode
from qc_check_type_project qctp
left join qc_check_project qcp on qcp.id = qctp.project_id
where qctp.del_flag = '0' and qctp.status = '0'
and qctp.material_code = #{materialCode}
order by qctp.sort
</select>
<select id="getTPByTypeGroup" resultType="com.op.quality.domain.QcCheckTaskDetail">
select qctp.project_id projectId,
qctp.standard_value standardValue,
qctp.upper_diff upperDiff,
qctp.down_diff downDiff,
qctp.sample,
qctp.sort,
qcp.rule_name ruleName,
qcp.property_code propertyCode,
qcp.check_tool checkTool,
qcp.unit_code unitCode
from qc_check_type_project qctp
left join qc_check_project qcp on qcp.id = qctp.project_id
where qctp.del_flag = '0' and qctp.status = '0'
and qctp.group_id = #{groupId}
order by qctp.sort
</select>
<insert id="insertQcCheckTypeProject" parameterType="QcCheckTypeProject">
insert into qc_check_type_project
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -120,9 +154,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteQcCheckTypeProjectByIds" parameterType="String">
delete from qc_check_type_project where id in
delete from qc_check_type_project where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
</mapper>

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.quality.mapper.QcMaterialGroupDetailMapper">
<resultMap type="QcMaterialGroupDetail" id="QcMaterialGroupDetailResult">
<result property="id" column="id" />
<result property="groupId" column="group_id" />
@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectQcMaterialGroupDetailList" parameterType="QcMaterialGroupDetail" resultMap="QcMaterialGroupDetailResult">
<include refid="selectQcMaterialGroupDetailVo"/>
<where>
<where>
<if test="groupId != null and groupId != ''"> and group_id = #{groupId}</if>
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
@ -32,13 +32,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
</where>
</select>
<select id="selectQcMaterialGroupDetailById" parameterType="String" resultMap="QcMaterialGroupDetailResult">
<include refid="selectQcMaterialGroupDetailVo"/>
where id = #{id}
</select>
<insert id="insertQcMaterialGroupDetail" parameterType="QcMaterialGroupDetail">
<select id="getGroupByMaterial" resultType="com.op.quality.domain.QcMaterialGroupDetail">
select top 1 group_id groupId
from qc_material_group_detail
where material_code = #{materialCode}
and del_flag = '0'
order by create_time desc
</select>
<insert id="insertQcMaterialGroupDetail" parameterType="QcMaterialGroupDetail">
insert into qc_material_group_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
@ -90,9 +97,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteQcMaterialGroupDetailByIds" parameterType="String">
delete from qc_material_group_detail where id in
delete from qc_material_group_detail where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
</mapper>

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.quality.mapper.QcCheckTaskDetailMapper">
<resultMap type="QcCheckTaskDetail" id="QcCheckTaskDetailResult">
<result property="recordId" column="record_id" />
<result property="belongTo" column="belong_to" />
@ -35,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectQcCheckTaskDetailList" parameterType="QcCheckTaskDetail" resultMap="QcCheckTaskDetailResult">
<include refid="selectQcCheckTaskDetailVo"/>
<where>
<where>
<if test="belongTo != null and belongTo != ''"> and belong_to = #{belongTo}</if>
<if test="orderNum != null and orderNum != ''"> and order_num = #{orderNum}</if>
<if test="ruleName != null and ruleName != ''"> and rule_name like concat('%', #{ruleName}, '%')</if>
@ -53,12 +53,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
</where>
</select>
<select id="selectQcCheckTaskDetailByRecordId" parameterType="String" resultMap="QcCheckTaskDetailResult">
<include refid="selectQcCheckTaskDetailVo"/>
where record_id = #{recordId}
</select>
<insert id="insertQcCheckTaskDetail" parameterType="QcCheckTaskDetail">
insert into qc_check_task_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -110,8 +110,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<insert id="addBatch">
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
<foreach item="item" index="index" collection="list" separator=",">
(
#{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'
)
</foreach>
</insert>
<update id="updateQcCheckTaskDetail" parameterType="QcCheckTaskDetail">
<update id="updateQcCheckTaskDetail" parameterType="QcCheckTaskDetail">
update qc_check_task_detail
<trim prefix="SET" suffixOverrides=",">
<if test="belongTo != null">belong_to = #{belongTo},</if>
@ -144,9 +166,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteQcCheckTaskDetailByRecordIds" parameterType="String">
delete from qc_check_task_detail where record_id in
delete from qc_check_task_detail where record_id in
<foreach item="recordId" collection="array" open="(" separator="," close=")">
#{recordId}
</foreach>
</delete>
</mapper>
</mapper>

@ -96,6 +96,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userCode != null and userCode != ''"> and user_name like concat('%', #{userCode}, '%')</if>
<if test="userName != null and userName != ''"> and nick_name like concat('%', #{userName}, '%')</if>
</select>
<select id="getTodayMaxNum" resultType="java.lang.Integer">
select count(0)+1
from qc_check_task_income
where CONVERT(varchar(10),create_time, 120) = CONVERT(varchar(10),GETDATE(), 120)
</select>
<insert id="insertQcCheckTaskIncome" parameterType="QcCheckTaskIncome">
insert into qc_check_task_income

Loading…
Cancel
Save