Merge remote-tracking branch 'origin/master'

master
wws 1 year ago
commit ce8bbe3917

@ -1,185 +0,0 @@
package com.op.quality.controller;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.web.page.TableDataInfo;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.QcBomComponent;
import com.op.quality.domain.QcCheckReportIncome;
import com.op.quality.domain.QcCheckTaskDetail;
import com.op.quality.domain.QcSupplier;
import com.op.quality.service.IQcCheckReportFirstService;
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.*;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
/**
* Controller
*
* @author Open Platform
* @date 2023-10-19
*/
@RestController
@RequestMapping("/qcFirstReport")
public class QcCheckReportFirstController extends BaseController {
@Autowired
private IQcCheckReportFirstService qcCheckReportFirstService;
/**
*
*/
@RequiresPermissions("quality:firstReport:list")
@GetMapping("/list")
public TableDataInfo list(QcCheckReportIncome qcCheckReportIncome) {
//默认时间范围T 00:00:00~T+1 00:00:00
if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){
qcCheckReportIncome.setCheckTimeStart(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)+" 23:59:59";
qcCheckReportIncome.setCheckTimeEnd(dateEndStr);//end
}
// if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){
// qcCheckReportIncome.setCheckTimeStart(qcCheckReportIncome.getIncomeTimeStart());//start
// qcCheckReportIncome.setCheckTimeEnd(qcCheckReportIncome.getIncomeTimeStart());//end
// }
startPage();
List<QcCheckReportIncome> list = qcCheckReportFirstService.selectQcCheckReportIncomeList(qcCheckReportIncome);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("quality:firstReport:export")
@Log(title = "来料检验", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QcCheckReportIncome qcCheckReportIncome) {
//默认时间范围T 00:00:00~T+1 00:00:00
if(StringUtils.isEmpty(qcCheckReportIncome.getIncomeTimeStart())){
qcCheckReportIncome.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";
qcCheckReportIncome.setIncomeTimeEnd(dateEndStr);//end
}
// if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){
// qcCheckReportIncome.setCheckTimeStart(qcCheckReportIncome.getIncomeTimeStart());//start
// qcCheckReportIncome.setCheckTimeEnd(qcCheckReportIncome.getIncomeTimeStart());//end
// }
List<QcCheckReportIncome> list = qcCheckReportFirstService.selectQcCheckReportIncomeList(qcCheckReportIncome);
ExcelUtil<QcCheckReportIncome> util = new ExcelUtil<QcCheckReportIncome>(QcCheckReportIncome.class);
util.exportExcel(response, list, "来料检验数据");
}
/**
*
*/
@RequiresPermissions("quality:firstReport:query")
@GetMapping(value = "/{recordId}")
public AjaxResult getInfo(@PathVariable("recordId") String recordId) {
return success(qcCheckReportFirstService.selectQcCheckReportIncomeByRecordId(recordId));
}
/**
*
*/
@RequiresPermissions("quality:firstReport:add")
@Log(title = "来料检验", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody QcCheckReportIncome qcCheckReportIncome) {
int r = qcCheckReportFirstService.insertQcCheckReportIncome(qcCheckReportIncome);
if(r>0){
return toAjax(r);
}
return error("添加失败:请检查物料的关联检测项");
}
/**
*
*/
@RequiresPermissions("quality:firstReport:edit")
@Log(title = "来料检验", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody QcCheckReportIncome qcCheckReportIncome) {
return toAjax(qcCheckReportFirstService.updateQcCheckReportIncome(qcCheckReportIncome));
}
/**
*
*/
@RequiresPermissions("quality:firstReport:remove")
@Log(title = "来料检验", businessType = BusinessType.DELETE)
@DeleteMapping("/{recordIds}")
public AjaxResult remove(@PathVariable String[] recordIds) {
return toAjax(qcCheckReportFirstService.deleteQcCheckReportIncomeByRecordIds(recordIds));
}
/**
* BOM
*/
@GetMapping("/getQcListBom")
public TableDataInfo getQcListBom(QcBomComponent bomComponent) {
startPage();
List<QcBomComponent> list = qcCheckReportFirstService.getQcListBom(bomComponent);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/getQcListSupplier")
public TableDataInfo getQcListSupplier(QcSupplier qcSupplier) {
startPage();
List<QcSupplier> list = qcCheckReportFirstService.getQcListSupplier(qcSupplier);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/getQcListUser")
public TableDataInfo getQcListUser(SysUser sysUser) {
startPage();
List<SysUser> list = qcCheckReportFirstService.getQcListUser(sysUser);
return getDataTable(list);
}
/**
*
*/
@PutMapping("/changeIncomeStatus")
public AjaxResult changeIncomeStatus(@RequestBody QcCheckReportIncome qcCheckReportIncome) {
qcCheckReportIncome.setUpdateBy(SecurityUtils.getUsername());
qcCheckReportIncome.setUpdateTime(DateUtils.getNowDate());
return toAjax(qcCheckReportFirstService.updateIncomeStatus(qcCheckReportIncome));
}
/**
*
* @param
* @return
*/
@GetMapping("/getCkeckProjectList")
public TableDataInfo getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail) {
List<QcCheckTaskDetail> list = qcCheckReportFirstService.getCkeckProjectList(qcCheckTaskDetail);
return getDataTable(list);
}
}

@ -36,6 +36,12 @@ public class QcProjectType extends BaseEntity {
/** 删除标识1删除0正常 */
private String delFlag;
@Excel(name = "检验标准")
private String standardNo;
@Excel(name = "版本")
private String version;
public void setId(String id) {
this.id = id;
}
@ -79,6 +85,22 @@ public class QcProjectType extends BaseEntity {
return delFlag;
}
public String getStandardNo() {
return standardNo;
}
public void setStandardNo(String standardNo) {
this.standardNo = standardNo;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -92,6 +114,8 @@ public class QcProjectType extends BaseEntity {
.append("updateTime", getUpdateTime())
.append("factoryCode", getFactoryCode())
.append("delFlag", getDelFlag())
.append("standard", getStandardNo())
.append("version", getVersion())
.toString();
}
}

@ -1,78 +0,0 @@
package com.op.quality.service;
import com.op.quality.domain.QcBomComponent;
import com.op.quality.domain.QcCheckReportIncome;
import com.op.quality.domain.QcCheckTaskDetail;
import com.op.quality.domain.QcSupplier;
import com.op.system.api.domain.SysUser;
import java.util.List;
/**
* Service
*
* @author Open Platform
* @date 2023-10-19
*/
public interface IQcCheckReportFirstService {
/**
*
*
* @param recordId
* @return
*/
public QcCheckReportIncome selectQcCheckReportIncomeByRecordId(String recordId);
/**
*
*
* @param qcCheckReportIncome
* @return
*/
public List<QcCheckReportIncome> selectQcCheckReportIncomeList(QcCheckReportIncome qcCheckReportIncome);
/**
*
*
* @param qcCheckReportIncome
* @return
*/
public int insertQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome);
/**
*
*
* @param qcCheckReportIncome
* @return
*/
public int updateQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome);
/**
*
*
* @param recordIds
* @return
*/
public int deleteQcCheckReportIncomeByRecordIds(String[] recordIds);
/**
*
*
* @param recordId
* @return
*/
public int deleteQcCheckReportIncomeByRecordId(String recordId);
public List<QcBomComponent> getQcListBom(QcBomComponent bomComponent);
public List<QcSupplier> getQcListSupplier(QcSupplier qcSupplier);
public List<SysUser> getQcListUser(SysUser sysUser);
int updateIncomeStatus(QcCheckReportIncome qcCheckReportIncome);
List<QcCheckTaskDetail> getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail);
public List<QcCheckReportIncome> getPrintData(QcCheckReportIncome qcCheckReportIncome);
}

@ -1,207 +0,0 @@
package com.op.quality.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
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.QcCheckReportIncomeMapper;
import com.op.quality.mapper.QcCheckTaskDetailMapper;
import com.op.quality.mapper.QcCheckTypeProjectMapper;
import com.op.quality.mapper.QcMaterialGroupDetailMapper;
import com.op.quality.service.IQcCheckReportFirstService;
import com.op.quality.service.IQcCheckReportIncomeService;
import com.op.system.api.domain.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
/**
* Service
*
* @author Open Platform
* @date 2023-10-19
*/
@Service
public class QcCheckReportFirstServiceImpl implements IQcCheckReportFirstService {
@Autowired
private QcCheckReportIncomeMapper qcCheckReportIncomeMapper;
@Autowired
private QcCheckTypeProjectMapper qcCheckTypeProjectMapper;
@Autowired
private QcMaterialGroupDetailMapper qcMaterialGroupDetailMapper;
@Autowired
private QcCheckTaskDetailMapper qcCheckTaskDetailMapper;
/**
*
*
* @param recordId
* @return
*/
@Override
@DS("#header.poolName")
public QcCheckReportIncome selectQcCheckReportIncomeByRecordId(String recordId) {
return qcCheckReportIncomeMapper.selectQcCheckReportIncomeByRecordId(recordId);
}
/**
*
*
* @param qcCheckReportIncome
* @return
*/
@Override
@DS("#header.poolName")
public List<QcCheckReportIncome> selectQcCheckReportIncomeList(QcCheckReportIncome qcCheckReportIncome) {
qcCheckReportIncome.setDelFlag("0");
qcCheckReportIncome.setTypeCode("produce");
qcCheckReportIncome.setCheckType("checkTypeSC");
return qcCheckReportIncomeMapper.selectQcCheckReportIncomeList(qcCheckReportIncome);
}
/**
*
*
* @param qcCheckReportIncome
* @return
*/
@Override
@DS("#header.poolName")
public int insertQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome) {
String bpDD = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate());
int liushuiNum = qcCheckReportIncomeMapper.getTodayMaxNum(qcCheckReportIncome);
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_","");
qcCheckReportIncome.setCheckNo(bpDD+liushuiStr);
/**qc_check_task_income**/
String beLongId = IdUtils.fastSimpleUUID();
qcCheckReportIncome.setRecordId(beLongId);
qcCheckReportIncome.setFactoryCode(factoryCode);
qcCheckReportIncome.setCreateTime(nowDate);
qcCheckReportIncomeMapper.insertQcCheckReportIncome(qcCheckReportIncome);
/**取检测项**/
QcCheckTypeProject qctp= new QcCheckTypeProject();
qctp.setTypeId(qcCheckReportIncome.getCheckType());//生产过程检验
qctp.setMaterialCode(qcCheckReportIncome.getMaterialCode());//特性
/**qc_check_type_project**/
List<QcCheckTaskDetail> items = qcCheckTypeProjectMapper.getTPByTypeMaterial(qctp);
if(CollectionUtils.isEmpty(items)){
/**qc_material_group_detail**/
QcMaterialGroupDetail group = qcMaterialGroupDetailMapper.getGroupByMaterial(qcCheckReportIncome.getMaterialCode());
if(group == null){
return 0;//没有找到检测项目
}
qctp.setGroupId(group.getGroupId());//共性
items = qcCheckTypeProjectMapper.getTPByTypeGroup(qctp);
}
/**qc_check_task_detail**/
if(CollectionUtils.isEmpty(items)){
return 0;//没有找到检测项目
}
for(QcCheckTaskDetail item:items){
item.setRecordId(IdUtils.fastSimpleUUID());
item.setBelongTo(beLongId);
item.setCreateTime(nowDate);
item.setCreateBy(createBy);
item.setFactoryCode(factoryCode);
item.setStatus("N");
}
return qcCheckTaskDetailMapper.addBatch(items);
}
/**
*
*
* @param qcCheckReportIncome
* @return
*/
@Override
@DS("#header.poolName")
public int updateQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome) {
qcCheckReportIncome.setUpdateTime(DateUtils.getNowDate());
return qcCheckReportIncomeMapper.updateQcCheckReportIncome(qcCheckReportIncome);
}
/**
*
*
* @param recordIds
* @return
*/
@Override
@DS("#header.poolName")
public int deleteQcCheckReportIncomeByRecordIds(String[] recordIds) {
return qcCheckReportIncomeMapper.deleteQcCheckReportIncomeByRecordIds(recordIds);
}
/**
*
*
* @param recordId
* @return
*/
@Override
@DS("#header.poolName")
public int deleteQcCheckReportIncomeByRecordId(String recordId) {
return qcCheckReportIncomeMapper.deleteQcCheckReportIncomeByRecordId(recordId);
}
@Override
@DS("#header.poolName")
public List<QcBomComponent> getQcListBom(QcBomComponent bomComponent) {
return qcCheckReportIncomeMapper.getQcListBom(bomComponent);
}
@Override
@DS("#header.poolName")
public List<QcSupplier> getQcListSupplier(QcSupplier qcSupplier) {
return qcCheckReportIncomeMapper.getQcListSupplier(qcSupplier);
}
@Override
@DS("master")
public List<SysUser> getQcListUser(SysUser sysUser) {
return qcCheckReportIncomeMapper.getQcListUser(sysUser);
}
@Override
@DS("#header.poolName")
public int updateIncomeStatus(QcCheckReportIncome qcCheckReportIncome) {
return qcCheckReportIncomeMapper.updateQcCheckReportIncome(qcCheckReportIncome);
}
@Override
@DS("#header.poolName")
public List<QcCheckTaskDetail> getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail) {
return qcCheckReportIncomeMapper.getCkeckProjectList(qcCheckTaskDetail);
}
@Override
@DS("#header.poolName")
public List<QcCheckReportIncome> getPrintData(QcCheckReportIncome qcCheckReportIncome) {
return null;
}
}

@ -35,13 +35,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="delFlag" column="del_flag" />
<result property="sampleQuality" column="sample_quality" />
<result property="checkName" column="check_name" />
<result property="checkType" column="check_type"/>
</resultMap>
<sql id="selectQcCheckReportIncomeVo">
select record_id, check_no, income_batch_no, order_no, material_code, material_name, quality, unit,
supplier_code, supplier_name, income_time, check_loc, check_status, check_man_code, check_man_name,sample_quality,
check_time, check_result, status, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time,
check_time, check_result, status, check_type, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time,
factory_code, del_flag from qc_check_task
</sql>

@ -15,10 +15,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="factoryCode" column="factory_code" />
<result property="delFlag" column="del_flag" />
<result property="standardNo" column="standard_no" />
<result property="version" column="version" />
</resultMap>
<sql id="selectQcProjectTypeVo">
select id, project_type_code, project_type_name, attr1, create_by, create_time, update_by, update_time, factory_code, del_flag from qc_project_type
select id, project_type_code, project_type_name, attr1, create_by, create_time, update_by, update_time,
factory_code, del_flag, standard_no, version from qc_project_type
</sql>
<select id="selectQcProjectTypeList" parameterType="QcProjectType" resultMap="QcProjectTypeResult">
@ -28,6 +31,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="projectTypeName != null and projectTypeName != ''"> and project_type_name like concat('%', #{projectTypeName}, '%')</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
<if test="standardNo != null and standardNo != ''"> and standard_no = #{standardNo}</if>
<if test="version != null and version != ''"> and version = #{version}</if>
</where>
</select>
@ -49,6 +54,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if>
<if test="factoryCode != null and factoryCode != ''">factory_code,</if>
<if test="delFlag != null">del_flag,</if>
<if test="standardNo != null">standard_no,</if>
<if test="version != null">version = #{version}</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -61,6 +68,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">#{updateTime},</if>
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="standardNo != null">#{standardNo}</if>
<if test="version != null">#{version}</if>
</trim>
</insert>
@ -76,6 +85,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="standardNo != null">standard_no = #{standardNo},</if>
<if test="version != null">version = #{version},</if>
</trim>
where id = #{id}
</update>

Loading…
Cancel
Save