原料检验任务

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

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

@ -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,6 +3,8 @@ 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
@ -10,6 +12,7 @@ import com.op.quality.domain.QcCheckTaskDetail;
* @author Open Platform
* @date 2023-10-19
*/
@Mapper
public interface QcCheckTaskDetailMapper {
/**
*
@ -58,4 +61,6 @@ public interface QcCheckTaskDetailMapper {
* @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,6 +2,7 @@ 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;
@ -60,4 +61,8 @@ public interface QcCheckTypeProjectMapper {
* @return
*/
public int deleteQcCheckTypeProjectByIds(String[] ids);
List<QcCheckTaskDetail> getTPByTypeMaterial(QcCheckTypeProject qctp);
List<QcCheckTaskDetail> getTPByTypeGroup(QcCheckTypeProject qctp);
}

@ -60,4 +60,6 @@ public interface QcMaterialGroupDetailMapper {
* @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);
}
/**

@ -49,6 +49,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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

@ -37,6 +37,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectQcMaterialGroupDetailVo"/>
where id = #{id}
</select>
<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

@ -110,6 +110,28 @@ 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 qc_check_task_detail

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