检验任务不良类型优化

master
shaoyong 11 months ago
parent 677c6ddb83
commit 5ea60773d6

@ -0,0 +1,137 @@
package com.op.quality.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.quality.domain.QcCheckTaskDefect;
import com.op.quality.service.IQcCheckTaskDefectService;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.page.TableDataInfo;
/**
* --Controller
*
* @author Open Platform
* @date 2024-03-28
*/
@RestController
@RequestMapping("/qcCheckTaskDefect")
public class QcCheckTaskDefectController extends BaseController {
@Autowired
private IQcCheckTaskDefectService qcCheckTaskDefectService;
/**
* --
*/
@RequiresPermissions("quality:qcCheckTaskDefect:list")
@GetMapping("/list")
public TableDataInfo list(QcCheckTaskDefect qcCheckTaskDefect) {
startPage();
List<QcCheckTaskDefect> list = qcCheckTaskDefectService.selectQcCheckTaskDefectList(qcCheckTaskDefect);
return getDataTable(list);
}
/**
* --
*/
@RequiresPermissions("quality:qcCheckTaskDefect:export")
@Log(title = "来料检验任务--不良数量", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QcCheckTaskDefect qcCheckTaskDefect) {
List<QcCheckTaskDefect> list = qcCheckTaskDefectService.selectQcCheckTaskDefectList(qcCheckTaskDefect);
ExcelUtil<QcCheckTaskDefect> util = new ExcelUtil<QcCheckTaskDefect>(QcCheckTaskDefect. class);
util.exportExcel(response, list, "来料检验任务--不良数量数据");
}
/**
* --
*/
@RequiresPermissions("quality:qcCheckTaskDefect:query")
@GetMapping(value = "/{recordId}")
public AjaxResult getInfo(@PathVariable("recordId") String recordId) {
return success(qcCheckTaskDefectService.selectQcCheckTaskDefectByRecordId(recordId));
}
/**
* --
*/
@RequiresPermissions("quality:qcCheckTaskDefect:add")
@Log(title = "来料检验任务--不良数量", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody QcCheckTaskDefect qcCheckTaskDefect) {
return toAjax(qcCheckTaskDefectService.insertQcCheckTaskDefect(qcCheckTaskDefect));
}
/**
* --
*/
@RequiresPermissions("quality:qcCheckTaskDefect:edit")
@Log(title = "来料检验任务--不良数量", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody QcCheckTaskDefect qcCheckTaskDefect) {
return toAjax(qcCheckTaskDefectService.updateQcCheckTaskDefect(qcCheckTaskDefect));
}
/**
* --
*/
@RequiresPermissions("quality:qcCheckTaskDefect:remove")
@Log(title = "来料检验任务--不良数量", businessType = BusinessType.DELETE)
@DeleteMapping("/{recordIds}")
public AjaxResult remove(@PathVariable String[] recordIds) {
return toAjax(qcCheckTaskDefectService.deleteQcCheckTaskDefectByRecordIds(recordIds));
}
/**
* PC
*/
@GetMapping("/getDefectValue/{belongToDetail}")
public TableDataInfo getDefectValue(@PathVariable String belongToDetail) {
List<QcCheckTaskDefect> list = qcCheckTaskDefectService.getDefectListByBelongToDetail(belongToDetail);
return getDataTable(list);
}
/**
* PC
*/
@PostMapping("/commitDefectValue")
public AjaxResult commitDefectValue(@RequestBody List<QcCheckTaskDefect> checkTaskDefects) {
if (CollectionUtils.isEmpty(checkTaskDefects)) {
return error("操作失败,不良数据为空");
}else {
return toAjax(qcCheckTaskDefectService.commitDefectValue(checkTaskDefects));
}
}
/**
* PC
*/
@PutMapping("/updateDefectValue")
public AjaxResult updateDefectValue(@RequestBody List<QcCheckTaskDefect> checkTaskDefects) {
if (CollectionUtils.isEmpty(checkTaskDefects)) {
return error("操作失败,不良数据为空");
}else {
return toAjax(qcCheckTaskDefectService.updateDefectValue(checkTaskDefects));
}
}
}

@ -88,6 +88,8 @@ public class QcCheckTaskDefect extends BaseEntity {
@Excel(name = "不合格数量")
private BigDecimal noOkQuality;
private String belongTodetail;
private String defectCodes;
private String defectNames;
private String defectQualitys;
@ -220,6 +222,14 @@ public class QcCheckTaskDefect extends BaseEntity {
this.noOkQuality = noOkQuality;
}
public String getBelongTodetail() {
return belongTodetail;
}
public void setBelongTodetail(String belongTodetail) {
this.belongTodetail = belongTodetail;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -69,4 +69,7 @@ public interface QcCheckTaskDefectMapper {
public List<QcCheckTaskDefect> selectDefectByBelongTo(String belongTo);
@MapKey("belongToDetail")
public Map<String, QcCheckTaskDefect> getDefectMap(QcCheckTaskDetail qcCheckTaskDetail);
public List<QcCheckTaskDefect> getDefectListByBelongToDetail(String belongToDetail);
}

@ -62,4 +62,10 @@ public interface IQcCheckTaskDefectService {
public int deleteQcCheckTaskDefectByBelongTo(String belongTo);
public List<QcCheckTaskDefect> selectDefectByBelongTo(String belongTo);
public int commitDefectValue(List<QcCheckTaskDefect> qcCheckTaskDefect);
public int updateDefectValue(List<QcCheckTaskDefect> qcCheckTaskDefects);
public List<QcCheckTaskDefect> getDefectListByBelongToDetail(String belongToDetail);
}

@ -1,5 +1,6 @@
package com.op.quality.service.impl;
import java.util.Date;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
@ -116,4 +117,56 @@ public class QcCheckTaskDefectServiceImpl implements IQcCheckTaskDefectService {
public List<QcCheckTaskDefect> selectDefectByBelongTo(String belongTo) {
return qcCheckTaskDefectMapper.selectDefectByBelongTo(belongTo);
}
/**
*
* @param qcCheckTaskDefects
* @return
*/
@Override
@DS("#header.poolName")
public int commitDefectValue(List<QcCheckTaskDefect> qcCheckTaskDefects) {
/**qc_check_task_defect**/
String userName = SecurityUtils.getUsername();
Date now = DateUtils.getNowDate();
//获取当前所选工厂
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
String factoryCode = request.getHeader(key.substring(8)).replace("ds_","");
int count = 0;
for (QcCheckTaskDefect defect : qcCheckTaskDefects) {
defect.setRecordId(IdUtils.fastSimpleUUID());
defect.setCreateBy(userName);
defect.setCreateTime(now);
defect.setFactoryCode(factoryCode);
count += qcCheckTaskDefectMapper.insertQcCheckTaskDefect(defect);
}
return count;
}
/**
*
* @param qcCheckTaskDefects
* @return
*/
@Override
@DS("#header.poolName")
public int updateDefectValue(List<QcCheckTaskDefect> qcCheckTaskDefects) {
String userName = SecurityUtils.getUsername();
Date now = DateUtils.getNowDate();
int count = 0;
for (QcCheckTaskDefect defect : qcCheckTaskDefects) {
defect.setUpdateBy(userName);
defect.setUpdateTime(now);
count += qcCheckTaskDefectMapper.updateQcCheckTaskDefect(defect);
}
return count;
}
@Override
@DS("#header.poolName")
public List<QcCheckTaskDefect> getDefectListByBelongToDetail(String belongToDetail) {
List<QcCheckTaskDefect> defectList = qcCheckTaskDefectMapper.getDefectListByBelongToDetail(belongToDetail);
return defectList;
}
}

@ -21,10 +21,11 @@
<result property="belongTo" column="belong_to"/>
<result property="okQuality" column="ok_quality"/>
<result property="noOkQuality" column="noOk_quality"/>
<result property="belongToDetail" column="belong_to_detail"/>
</resultMap>
<sql id="selectQcCheckTaskDefectVo">
select record_id, defect_code, defect_subclass, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, factory_code, del_flag, belong_to, ok_quality, noOk_quality from qc_check_task_defect
select record_id, defect_code, defect_subclass, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, factory_code, del_flag, belong_to, ok_quality, noOk_quality, belong_to_detail from qc_check_task_defect
</sql>
<select id="selectQcCheckTaskDefectList" parameterType="QcCheckTaskDefect" resultMap="QcCheckTaskDefectResult">
@ -40,6 +41,7 @@
<if test="belongTo != null and belongTo != ''">and belong_to = #{belongTo}</if>
<if test="okQuality != null ">and ok_quality = #{okQuality}</if>
<if test="noOkQuality != null ">and noOk_quality = #{noOkQuality}</if>
and del_flag = '0'
</where>
</select>
@ -67,6 +69,7 @@
<if test="belongTo != null">belong_to,</if>
<if test="okQuality != null">ok_quality,</if>
<if test="noOkQuality != null">noOk_quality,</if>
<if test="belongToDetail != null">belong_to_detail,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="recordId != null">#{recordId},</if>
@ -85,6 +88,7 @@
<if test="belongTo != null">#{belongTo},</if>
<if test="okQuality != null">#{okQuality},</if>
<if test="noOkQuality != null">#{noOkQuality},</if>
<if test="belongToDetail != null">#{belongToDetail},</if>
</trim>
</insert>
@ -111,11 +115,11 @@
</update>
<delete id="deleteQcCheckTaskDefectByRecordId" parameterType="String">
delete from qc_check_task_defect where record_id = #{recordId}
update qc_check_task_defect set del_flag = '1' where record_id = #{recordId}
</delete>
<delete id="deleteQcCheckTaskDefectByRecordIds" parameterType="String">
delete from qc_check_task_defect where record_id in
update qc_check_task_defect set del_flag = '1' where record_id in
<foreach item="recordId" collection="array" open="(" separator="," close=")">
#{recordId}
</foreach>
@ -160,4 +164,11 @@
GROUP by qctd.belong_to,qctd.belong_to_detail
</select>
<select id="getDefectListByBelongToDetail" resultMap="QcCheckTaskDefectResult">
SELECT record_id,defect_code, defect_subclass,ok_quality, noOk_quality,belong_to,belong_to_detail
FROM qc_check_task_defect
WHERE del_flag = '0' and belong_to_detail = #{belongToDetail}
order by defect_code
</select>
</mapper>

Loading…
Cancel
Save