diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskDefectController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskDefectController.java new file mode 100644 index 00000000..85d03fb8 --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskDefectController.java @@ -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 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 list = qcCheckTaskDefectService.selectQcCheckTaskDefectList(qcCheckTaskDefect); + ExcelUtil util = new ExcelUtil(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 list = qcCheckTaskDefectService.getDefectListByBelongToDetail(belongToDetail); + return getDataTable(list); + } + + /** + * PC不良数据提交 + */ + @PostMapping("/commitDefectValue") + public AjaxResult commitDefectValue(@RequestBody List checkTaskDefects) { + if (CollectionUtils.isEmpty(checkTaskDefects)) { + return error("操作失败,不良数据为空"); + }else { + return toAjax(qcCheckTaskDefectService.commitDefectValue(checkTaskDefects)); + } + } + + + /** + * PC不良数据提交 + */ + @PutMapping("/updateDefectValue") + public AjaxResult updateDefectValue(@RequestBody List checkTaskDefects) { + if (CollectionUtils.isEmpty(checkTaskDefects)) { + return error("操作失败,不良数据为空"); + }else { + return toAjax(qcCheckTaskDefectService.updateDefectValue(checkTaskDefects)); + } + } + + + +} + diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDefect.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDefect.java index 2899c7f1..0bb07030 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDefect.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDefect.java @@ -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) diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskDefectMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskDefectMapper.java index 53f4929e..2ba307c9 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskDefectMapper.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskDefectMapper.java @@ -69,4 +69,7 @@ public interface QcCheckTaskDefectMapper { public List selectDefectByBelongTo(String belongTo); @MapKey("belongToDetail") public Map getDefectMap(QcCheckTaskDetail qcCheckTaskDetail); + + public List getDefectListByBelongToDetail(String belongToDetail); + } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckTaskDefectService.java b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckTaskDefectService.java index c390ff02..2b612f0e 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckTaskDefectService.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckTaskDefectService.java @@ -62,4 +62,10 @@ public interface IQcCheckTaskDefectService { public int deleteQcCheckTaskDefectByBelongTo(String belongTo); public List selectDefectByBelongTo(String belongTo); + + public int commitDefectValue(List qcCheckTaskDefect); + + public int updateDefectValue(List qcCheckTaskDefects); + + public List getDefectListByBelongToDetail(String belongToDetail); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskDefectServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskDefectServiceImpl.java index 1e04e610..d9fe4fd1 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskDefectServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskDefectServiceImpl.java @@ -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 selectDefectByBelongTo(String belongTo) { return qcCheckTaskDefectMapper.selectDefectByBelongTo(belongTo); } + + /** + * 不良类型提交 + * @param qcCheckTaskDefects + * @return + */ + @Override + @DS("#header.poolName") + public int commitDefectValue(List 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 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 getDefectListByBelongToDetail(String belongToDetail) { + List defectList = qcCheckTaskDefectMapper.getDefectListByBelongToDetail(belongToDetail); + return defectList; + } } diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskDefectMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskDefectMapper.xml index 87176d37..251b177e 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskDefectMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskDefectMapper.xml @@ -21,10 +21,11 @@ + - 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 @@ -67,6 +69,7 @@ belong_to, ok_quality, noOk_quality, + belong_to_detail, #{recordId}, @@ -85,6 +88,7 @@ #{belongTo}, #{okQuality}, #{noOkQuality}, + #{belongToDetail}, @@ -111,11 +115,11 @@ - delete from qc_check_task_defect where record_id = #{recordId} + update qc_check_task_defect set del_flag = '1' where record_id = #{recordId} - delete from qc_check_task_defect where record_id in + update qc_check_task_defect set del_flag = '1' where record_id in #{recordId} @@ -160,4 +164,11 @@ GROUP by qctd.belong_to,qctd.belong_to_detail + +