原料检验任务1.0

highway
zhaoxiaolin 1 year ago
parent b865658cb2
commit c1fac1f909

@ -1,11 +1,18 @@
package com.op.quality.controller;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.op.common.core.utils.DateUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.QcBomComponent;
import com.op.quality.domain.QcCheckTaskDetail;
import com.op.quality.domain.QcSupplier;
import com.op.system.api.domain.SysRole;
import com.op.system.api.domain.SysUser;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -43,6 +50,22 @@ public class QcCheckTaskIncomeController extends BaseController {
@RequiresPermissions("quality:qcIncome:list")
@GetMapping("/list")
public TableDataInfo list(QcCheckTaskIncome qcCheckTaskIncome) {
//默认时间范围T 00:00:00~T+1 00:00:00
if(StringUtils.isEmpty(qcCheckTaskIncome.getIncomeTimeStart())){
qcCheckTaskIncome.setIncomeTimeStart(DateUtils.getDate()+" 00:00:00");//start
LocalDate date = LocalDate.now();
LocalDate dateEnd = date.plusDays(1);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String dateEndStr = dtf.format(dateEnd)+" 00:00:00";
qcCheckTaskIncome.setIncomeTimeEnd(dateEndStr);//end
}
if(StringUtils.isEmpty(qcCheckTaskIncome.getCheckTimeStart())){
qcCheckTaskIncome.setCheckTimeStart(qcCheckTaskIncome.getIncomeTimeStart());//start
qcCheckTaskIncome.setCheckTimeEnd(qcCheckTaskIncome.getIncomeTimeStart());//end
}
startPage();
List<QcCheckTaskIncome> list = qcCheckTaskIncomeService.selectQcCheckTaskIncomeList(qcCheckTaskIncome);
return getDataTable(list);
@ -55,6 +78,22 @@ public class QcCheckTaskIncomeController extends BaseController {
@Log(title = "来料检验", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QcCheckTaskIncome qcCheckTaskIncome) {
//默认时间范围T 00:00:00~T+1 00:00:00
if(StringUtils.isEmpty(qcCheckTaskIncome.getIncomeTimeStart())){
qcCheckTaskIncome.setIncomeTimeStart(DateUtils.getDate()+" 00:00:00");//start
LocalDate date = LocalDate.now();
LocalDate dateEnd = date.plusDays(1);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String dateEndStr = dtf.format(dateEnd)+" 00:00:00";
qcCheckTaskIncome.setIncomeTimeEnd(dateEndStr);//end
}
if(StringUtils.isEmpty(qcCheckTaskIncome.getCheckTimeStart())){
qcCheckTaskIncome.setCheckTimeStart(qcCheckTaskIncome.getIncomeTimeStart());//start
qcCheckTaskIncome.setCheckTimeEnd(qcCheckTaskIncome.getIncomeTimeStart());//end
}
List<QcCheckTaskIncome> list = qcCheckTaskIncomeService.selectQcCheckTaskIncomeList(qcCheckTaskIncome);
ExcelUtil<QcCheckTaskIncome> util = new ExcelUtil<QcCheckTaskIncome>(QcCheckTaskIncome.class);
util.exportExcel(response, list, "来料检验数据");
@ -131,4 +170,53 @@ public class QcCheckTaskIncomeController extends BaseController {
return getDataTable(list);
}
/**
*
*/
@PutMapping("/changeIncomeStatus")
public AjaxResult changeIncomeStatus(@RequestBody QcCheckTaskIncome qcCheckTaskIncome) {
qcCheckTaskIncome.setUpdateBy(SecurityUtils.getUsername());
qcCheckTaskIncome.setUpdateTime(DateUtils.getNowDate());
return toAjax(qcCheckTaskIncomeService.updateIncomeStatus(qcCheckTaskIncome));
}
/**
*
* @param
* @return
*/
@GetMapping("/getCkeckProjectList")
public TableDataInfo getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail) {
startPage();
List<QcCheckTaskDetail> list = qcCheckTaskIncomeService.getCkeckProjectList(qcCheckTaskDetail);
return getDataTable(list);
}
/**
*
*/
@PutMapping("/changeCheckDetailStatus")
public AjaxResult changeCheckDetailStatus(@RequestBody QcCheckTaskDetail qcCheckTaskDetail) {
qcCheckTaskDetail.setUpdateBy(SecurityUtils.getUsername());
qcCheckTaskDetail.setUpdateTime(DateUtils.getNowDate());
return toAjax(qcCheckTaskIncomeService.changeCheckDetailStatus(qcCheckTaskDetail));
}
/**
*
*/
@PutMapping("/commitActualValue")
public AjaxResult commitActualValue(@RequestBody QcCheckTaskDetail qcCheckTaskDetail) {
qcCheckTaskDetail.setUpdateBy(SecurityUtils.getUsername());
qcCheckTaskDetail.setUpdateTime(DateUtils.getNowDate());
return toAjax(qcCheckTaskIncomeService.commitActualValue(qcCheckTaskDetail));
}
/**检测结果提交**/
@PutMapping("/commitCheckResult")
public AjaxResult commitCheckResult(@RequestBody QcCheckTaskIncome qcCheckTaskIncome) {
qcCheckTaskIncome.setUpdateBy(SecurityUtils.getUsername());
qcCheckTaskIncome.setUpdateTime(DateUtils.getNowDate());
return toAjax(qcCheckTaskIncomeService.commitCheckResult(qcCheckTaskIncome));
}
}

@ -1,6 +1,8 @@
package com.op.quality.domain;
import java.math.BigDecimal;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel;
@ -52,7 +54,7 @@ public class QcCheckTaskDetail extends BaseEntity {
/** 实际值 */
@Excel(name = "实际值")
private BigDecimal actualValue;
private String actualValue;
/** Y合格N不合格 */
@Excel(name = "Y合格N不合格")
@ -82,6 +84,7 @@ public class QcCheckTaskDetail extends BaseEntity {
private String delFlag;
private String projectId;
private String projectNo;
private Integer sort;
private String standardValue;
@ -89,6 +92,23 @@ public class QcCheckTaskDetail extends BaseEntity {
private BigDecimal downDiff;
private BigDecimal sample;
private Integer sampleNum;
private List<String> actualValues;
public List<String> getActualValues() {
return actualValues;
}
public void setActualValues(List<String> actualValues) {
this.actualValues = actualValues;
}
public String getProjectNo() {
return projectNo;
}
public void setProjectNo(String projectNo) {
this.projectNo = projectNo;
}
public String getStandardValue() {
return standardValue;
@ -210,11 +230,11 @@ public class QcCheckTaskDetail extends BaseEntity {
public String getCheckStandard() {
return checkStandard;
}
public void setActualValue(BigDecimal actualValue) {
public void setActualValue(String actualValue) {
this.actualValue = actualValue;
}
public BigDecimal getActualValue() {
public String getActualValue() {
return actualValue;
}
public void setStatus(String status) {

@ -91,19 +91,19 @@ public class QcCheckTaskIncome extends BaseEntity {
private String status;
/** 预留字段1 */
@Excel(name = "预留字段1")
//@Excel(name = "预留字段1")
private String attr1;
/** 预留字段2 */
@Excel(name = "预留字段2")
//@Excel(name = "预留字段2")
private String attr2;
/** 预留字段3 */
@Excel(name = "预留字段3")
//@Excel(name = "预留字段3")
private String attr3;
/** 预留字段4 */
@Excel(name = "预留字段4")
//@Excel(name = "预留字段4")
private String attr4;
/** 工厂编码 */
@ -113,6 +113,43 @@ public class QcCheckTaskIncome extends BaseEntity {
/** 删除标识1删除0正常 */
private String delFlag;
private String incomeTimeStart;
private String incomeTimeEnd;
private String checkTimeStart;
private String checkTimeEnd;
public String getIncomeTimeStart() {
return incomeTimeStart;
}
public void setIncomeTimeStart(String incomeTimeStart) {
this.incomeTimeStart = incomeTimeStart;
}
public String getIncomeTimeEnd() {
return incomeTimeEnd;
}
public void setIncomeTimeEnd(String incomeTimeEnd) {
this.incomeTimeEnd = incomeTimeEnd;
}
public String getCheckTimeStart() {
return checkTimeStart;
}
public void setCheckTimeStart(String checkTimeStart) {
this.checkTimeStart = checkTimeStart;
}
public String getCheckTimeEnd() {
return checkTimeEnd;
}
public void setCheckTimeEnd(String checkTimeEnd) {
this.checkTimeEnd = checkTimeEnd;
}
public void setRecordId(String recordId) {
this.recordId = recordId;
}

@ -3,6 +3,7 @@ package com.op.quality.mapper;
import java.util.List;
import com.op.quality.domain.QcCheckTaskDetail;
import com.op.quality.domain.QcCheckTaskIncome;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -62,5 +63,7 @@ public interface QcCheckTaskDetailMapper {
*/
public int deleteQcCheckTaskDetailByRecordIds(String[] recordIds);
int addBatch(@Param("list") List<QcCheckTaskDetail> items);
public int addBatch(@Param("list") List<QcCheckTaskDetail> items);
List<String> getProjectStatus(String belongTo);
}

@ -3,6 +3,7 @@ package com.op.quality.mapper;
import java.util.List;
import com.op.quality.domain.QcBomComponent;
import com.op.quality.domain.QcCheckTaskDetail;
import com.op.quality.domain.QcCheckTaskIncome;
import com.op.quality.domain.QcSupplier;
import com.op.system.api.domain.SysUser;
@ -71,4 +72,6 @@ public interface QcCheckTaskIncomeMapper {
public List<SysUser> getQcListUser(SysUser sysUser);
int getTodayMaxNum(QcCheckTaskIncome qcCheckTaskIncome);
List<QcCheckTaskDetail> getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail);
}

@ -3,6 +3,7 @@ package com.op.quality.service;
import java.util.List;
import com.op.quality.domain.QcBomComponent;
import com.op.quality.domain.QcCheckTaskDetail;
import com.op.quality.domain.QcCheckTaskIncome;
import com.op.quality.domain.QcSupplier;
import com.op.system.api.domain.SysUser;
@ -67,4 +68,14 @@ public interface IQcCheckTaskIncomeService {
public List<QcSupplier> getQcListSupplier(QcSupplier qcSupplier);
public List<SysUser> getQcListUser(SysUser sysUser);
int updateIncomeStatus(QcCheckTaskIncome qcCheckTaskIncome);
List<QcCheckTaskDetail> getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail);
int changeCheckDetailStatus(QcCheckTaskDetail qcCheckTaskDetail);
int commitActualValue(QcCheckTaskDetail qcCheckTaskDetail);
int commitCheckResult(QcCheckTaskIncome qcCheckTaskIncome);
}

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.alibaba.fastjson2.JSONArray;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
@ -82,17 +83,19 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
String liushuiStr = String.format("%04d", liushuiNum);
String createBy = SecurityUtils.getUsername();
Date nowDate= DateUtils.getNowDate();
//获取当前所选工厂
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());
/**qc_check_task_income**/
String beLongId = IdUtils.fastSimpleUUID();
qcCheckTaskIncome.setRecordId(beLongId);
qcCheckTaskIncome.setFactoryCode(factoryCode);
qcCheckTaskIncome.setCreateTime(nowDate);
qcCheckTaskIncomeMapper.insertQcCheckTaskIncome(qcCheckTaskIncome);
/**取检测项**/
@ -115,7 +118,6 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
if(CollectionUtils.isEmpty(items)){
return 0;//没有找到检测项目
}
Date nowDate= DateUtils.getNowDate();
for(QcCheckTaskDetail item:items){
item.setRecordId(IdUtils.fastSimpleUUID());
@ -123,6 +125,7 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
item.setCreateTime(nowDate);
item.setCreateBy(createBy);
item.setFactoryCode(factoryCode);
item.setStatus("Y");
}
return qcCheckTaskDetailMapper.addBatch(items);
}
@ -182,4 +185,44 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
return qcCheckTaskIncomeMapper.getQcListUser(sysUser);
}
@Override
@DS("#header.poolName")
public int updateIncomeStatus(QcCheckTaskIncome qcCheckTaskIncome) {
return qcCheckTaskIncomeMapper.updateQcCheckTaskIncome(qcCheckTaskIncome);
}
@Override
@DS("#header.poolName")
public List<QcCheckTaskDetail> getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail) {
return qcCheckTaskIncomeMapper.getCkeckProjectList(qcCheckTaskDetail);
}
@Override
@DS("#header.poolName")
public int changeCheckDetailStatus(QcCheckTaskDetail qcCheckTaskDetail) {
return qcCheckTaskDetailMapper.updateQcCheckTaskDetail(qcCheckTaskDetail);
}
@Override
@DS("#header.poolName")
public int commitActualValue(QcCheckTaskDetail qcCheckTaskDetail) {
String actualValue = JSONArray.toJSONString(qcCheckTaskDetail.getActualValues());
qcCheckTaskDetail.setActualValue(actualValue);
return qcCheckTaskDetailMapper.updateQcCheckTaskDetail(qcCheckTaskDetail);
}
@Override
@DS("#header.poolName")
public int commitCheckResult(QcCheckTaskIncome qcCheckTaskIncome) {
//遍历检测项目
List<String> projects= qcCheckTaskDetailMapper.getProjectStatus(qcCheckTaskIncome.getRecordId());
if(CollectionUtils.isEmpty(projects)){
qcCheckTaskIncome.setCheckResult("Y");//合格
}else{
qcCheckTaskIncome.setCheckResult("N");//不合格
}
qcCheckTaskIncome.setCheckTime(DateUtils.getNowDate());
return qcCheckTaskIncomeMapper.updateQcCheckTaskIncome(qcCheckTaskIncome);
}
}

@ -51,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="getTPByTypeMaterial" resultType="com.op.quality.domain.QcCheckTaskDetail">
select qctp.project_id projectId,
qctp.project_no projectNo,
qctp.standard_value standardValue,
qctp.upper_diff upperDiff,
qctp.down_diff downDiff,
@ -59,15 +60,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
qcp.rule_name ruleName,
qcp.property_code propertyCode,
qcp.check_tool checkTool,
qcp.unit_code unitCode
qcp.unit_code unitCode,
qcp.check_mode checkMode,
qcp.check_standard checkStandard
from qc_check_type_project qctp
left join qc_check_project qcp on qcp.id = qctp.project_id
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.project_no projectNo,
qctp.standard_value standardValue,
qctp.upper_diff upperDiff,
qctp.down_diff downDiff,
@ -76,7 +80,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
qcp.rule_name ruleName,
qcp.property_code propertyCode,
qcp.check_tool checkTool,
qcp.unit_code unitCode
qcp.unit_code unitCode,
qcp.check_mode checkMode,
qcp.check_standard checkStandard
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'

@ -30,7 +30,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectQcCheckTaskDetailVo">
select record_id, belong_to, order_num, rule_name, property_code, check_mode, check_tool, unit_code, check_standard, actual_value, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, factory_code, del_flag from qc_check_task_detail
select record_id, belong_to, order_num, rule_name, property_code, check_mode, check_tool, unit_code, check_standard,
actual_value, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time,
factory_code, del_flag
from qc_check_task_detail
</sql>
<select id="selectQcCheckTaskDetailList" parameterType="QcCheckTaskDetail" resultMap="QcCheckTaskDetailResult">
@ -58,8 +61,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectQcCheckTaskDetailVo"/>
where record_id = #{recordId}
</select>
<select id="getProjectStatus" resultType="java.lang.String">
select
td.status
from qc_check_task_detail td
where td.belong_to = #{belongTo} and td.status = 'N'
</select>
<insert id="insertQcCheckTaskDetail" parameterType="QcCheckTaskDetail">
<insert id="insertQcCheckTaskDetail" parameterType="QcCheckTaskDetail">
insert into qc_check_task_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="recordId != null">record_id,</if>
@ -113,7 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="addBatch">
insert into qc_check_task_detail(
record_id,belong_to,
project_id,rule_name,order_num,
project_id,project_no,rule_name,order_num,
property_code,check_mode,
check_tool,unit_code,
check_standard,actual_value,
@ -123,7 +132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<foreach item="item" index="index" collection="list" separator=",">
(
#{item.recordId},#{item.belongTo},
#{item.projectId},#{item.ruleName},#{item.sort},
#{item.projectId},#{item.projectNo},#{item.ruleName},#{item.sort},
#{item.propertyCode},#{item.checkMode},
#{item.checkTool},#{item.unitCode},
#{item.checkStandard},#{item.actualValue},

@ -64,6 +64,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
<if test="attr4 != null and attr4 != ''"> and attr4 = #{attr4}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
<if test="incomeTimeStart != null "> and CONVERT(varchar(30),income_time, 120) >= #{incomeTimeStart}</if>
<if test="incomeTimeEnd != null "> and #{incomeTimeEnd} > CONVERT(varchar(30),income_time, 120)</if>
<if test="checkTimeStart != null "> and CONVERT(varchar(30),check_time, 120) >= #{checkTimeStart}</if>
<if test="checkTimeEnd != null "> and #{checkTimeEnd} > CONVERT(varchar(30),check_time, 120)</if>
</where>
</select>
@ -101,6 +105,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from qc_check_task_income
where CONVERT(varchar(10),create_time, 120) = CONVERT(varchar(10),GETDATE(), 120)
</select>
<select id="getCkeckProjectList" resultType="com.op.quality.domain.QcCheckTaskDetail">
select td.record_id recordId,
td.project_id projectId,
td.project_no projectNo,
td.rule_name ruleName,
td.property_code propertyCode,
td.check_mode checkMode,
td.check_tool checkTool,
td.unit_code unitCode,
td.check_standard checkStandard,
td.actual_value actualValue,
td.status,
td.remark,
td.create_by createBy,
td.create_time createTime,
td.update_by updateBy,
td.update_time updateTime
from qc_check_task_detail td
where td.belong_to = #{belongTo}
</select>
<insert id="insertQcCheckTaskIncome" parameterType="QcCheckTaskIncome">
insert into qc_check_task_income

Loading…
Cancel
Save