From 716dfd6db5f5b3ee679f13dfb01d283acc15b8cd Mon Sep 17 00:00:00 2001 From: shaoyong Date: Thu, 2 Nov 2023 17:24:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E9=AA=8C=E6=8A=A5=E5=91=8A=EF=BC=8C?= =?UTF-8?q?=E6=9D=A5=E6=96=99=E6=8A=A5=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QcCheckReportIncomeController.java | 186 +++++++++ .../controller/QcCheckTypeController.java | 9 +- .../quality/domain/QcCheckReportIncome.java | 376 ++++++++++++++++++ .../mapper/QcCheckReportIncomeMapper.java | 77 ++++ .../service/IQcCheckReportIncomeService.java | 74 ++++ .../QcCheckReportIncomeServiceImpl.java | 201 ++++++++++ .../serviceImpl/QcCheckTypeServiceImpl.java | 2 +- .../mapper/quality/QcCheckProjectMapper.xml | 2 +- .../quality/QcCheckReportIncomeMapper.xml | 247 ++++++++++++ 9 files changed, 1171 insertions(+), 3 deletions(-) create mode 100644 op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportIncomeController.java create mode 100644 op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckReportIncome.java create mode 100644 op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckReportIncomeMapper.java create mode 100644 op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckReportIncomeService.java create mode 100644 op-modules/op-quality/src/main/java/com/op/quality/service/serviceImpl/QcCheckReportIncomeServiceImpl.java create mode 100644 op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportIncomeController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportIncomeController.java new file mode 100644 index 00000000..e428cd02 --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportIncomeController.java @@ -0,0 +1,186 @@ +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.QcCheckTaskDetail; +import com.op.quality.domain.QcCheckReportIncome; +import com.op.quality.domain.QcSupplier; +import com.op.quality.service.IQcCheckReportIncomeService; +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("/qcIncomeReport") +public class QcCheckReportIncomeController extends BaseController { + @Autowired + private IQcCheckReportIncomeService qcCheckReportIncomeService; + + /** + * 查询来料检验列表 + */ + @RequiresPermissions("quality:qcIncomeReport:list") + @GetMapping("/list") + public TableDataInfo list(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 +// } + + startPage(); + List list = qcCheckReportIncomeService.selectQcCheckReportIncomeList(qcCheckReportIncome); + return getDataTable(list); + } + + /** + * 导出来料检验列表 + */ + @RequiresPermissions("quality:qcIncomeReport: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 list = qcCheckReportIncomeService.selectQcCheckReportIncomeList(qcCheckReportIncome); + ExcelUtil util = new ExcelUtil(QcCheckReportIncome.class); + util.exportExcel(response, list, "来料检验数据"); + } + + /** + * 获取来料检验详细信息 + */ + @RequiresPermissions("quality:qcIncomeReport:query") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") String recordId) { + return success(qcCheckReportIncomeService.selectQcCheckReportIncomeByRecordId(recordId)); + } + + /** + * 新增来料检验 + */ + @RequiresPermissions("quality:qcIncomeReport:add") + @Log(title = "来料检验", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QcCheckReportIncome qcCheckReportIncome) { + int r = qcCheckReportIncomeService.insertQcCheckReportIncome(qcCheckReportIncome); + if(r>0){ + return toAjax(r); + } + return error("添加失败:请检查物料的关联检测项"); + } + + /** + * 修改来料检验 + */ + @RequiresPermissions("quality:qcIncomeReport:edit") + @Log(title = "来料检验", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody QcCheckReportIncome qcCheckReportIncome) { + return toAjax(qcCheckReportIncomeService.updateQcCheckReportIncome(qcCheckReportIncome)); + } + + /** + * 删除来料检验 + */ + @RequiresPermissions("quality:qcIncomeReport:remove") + @Log(title = "来料检验", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable String[] recordIds) { + return toAjax(qcCheckReportIncomeService.deleteQcCheckReportIncomeByRecordIds(recordIds)); + } + + /** + * 查询BOM物料管理列表 + */ + @GetMapping("/getQcListBom") + public TableDataInfo getQcListBom(QcBomComponent bomComponent) { + startPage(); + List list = qcCheckReportIncomeService.getQcListBom(bomComponent); + return getDataTable(list); + } + /** + * 查询供应商列表 + */ + @GetMapping("/getQcListSupplier") + public TableDataInfo getQcListSupplier(QcSupplier qcSupplier) { + startPage(); + List list = qcCheckReportIncomeService.getQcListSupplier(qcSupplier); + return getDataTable(list); + } + /** + * 查询人员列表 + */ + @GetMapping("/getQcListUser") + public TableDataInfo getQcListUser(SysUser sysUser) { + startPage(); + List list = qcCheckReportIncomeService.getQcListUser(sysUser); + return getDataTable(list); + } + + /** + * 状态修改 + */ + @PutMapping("/changeIncomeStatus") + public AjaxResult changeIncomeStatus(@RequestBody QcCheckReportIncome qcCheckReportIncome) { + qcCheckReportIncome.setUpdateBy(SecurityUtils.getUsername()); + qcCheckReportIncome.setUpdateTime(DateUtils.getNowDate()); + return toAjax(qcCheckReportIncomeService.updateIncomeStatus(qcCheckReportIncome)); + } + + /** + * 检验项目弹窗列表 + * @param + * @return + */ + @GetMapping("/getCkeckProjectList") + public TableDataInfo getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail) { + startPage(); + List list = qcCheckReportIncomeService.getCkeckProjectList(qcCheckTaskDetail); + return getDataTable(list); + } +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTypeController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTypeController.java index bb84c5fa..b067368e 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTypeController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTypeController.java @@ -2,6 +2,8 @@ package com.op.quality.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.op.quality.domain.QcCheckReportIncome; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -72,7 +74,12 @@ public class QcCheckTypeController extends BaseController { @Log(title = "检验节点维护", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody QcCheckType qcCheckType) { - return toAjax(qcCheckTypeService.insertQcCheckType(qcCheckType)); + QcCheckType valiData = qcCheckTypeService.selectQcCheckTypeById(qcCheckType.getOrderCode()); + if (valiData != null){ + return AjaxResult.error("节点编码已存在,请重新输入!"); + }else { + return toAjax(qcCheckTypeService.insertQcCheckType(qcCheckType)); + } } /** diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckReportIncome.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckReportIncome.java new file mode 100644 index 00000000..af6b9441 --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckReportIncome.java @@ -0,0 +1,376 @@ +package com.op.quality.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * 来料检验对象 qc_check_task_income + * + * @author Open Platform + * @date 2023-10-19 + */ +public class QcCheckReportIncome extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** id */ + private String recordId; + + /** 检验任务编号 */ + @Excel(name = "检验任务编号") + private String checkNo; + + /** 来料批次号 */ + @Excel(name = "来料批次号") + private String incomeBatchNo; + + /** 订单号 */ + @Excel(name = "订单号") + private String orderNo; + + /** 物料号 */ + @Excel(name = "物料号") + private String materialCode; + + /** 物料名称 */ + @Excel(name = "物料名称") + private String materialName; + + /** 收货数量 */ + @Excel(name = "收货数量") + private BigDecimal quality; + + /** 单位 */ + @Excel(name = "单位") + private String unit; + + /** 供应商编码 */ + @Excel(name = "供应商编码") + private String supplierCode; + + /** 供应商名称 */ + @Excel(name = "供应商名称") + private String supplierName; + + /** 来料时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "来料时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date incomeTime; + + /** 检测地点 */ + @Excel(name = "检测地点") + private String checkLoc; + + /** 检测状态 */ + @Excel(name = "检测状态") + private String checkStatus; + + /** 检测人工号 */ + @Excel(name = "检测人工号") + private String checkManCode; + + /** 检测人姓名 */ + @Excel(name = "检测人姓名") + private String checkManName; + + /** 检验时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "检验时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date checkTime; + + /** 检验结果Y合格 */ + @Excel(name = "检验结果Y合格") + private String checkResult; + + /** 是否启用1启用0停用 */ + @Excel(name = "是否启用1启用0停用") + private String status; + + /** 预留字段1 */ + //@Excel(name = "预留字段1") + private String attr1; + + /** 预留字段2 */ + //@Excel(name = "预留字段2") + private String attr2; + + /** 预留字段3 */ + //@Excel(name = "预留字段3") + private String attr3; + + /** 预留字段4 */ + //@Excel(name = "预留字段4") + private String attr4; + + /** 工厂编码 */ + @Excel(name = "工厂编码") + private String factoryCode; + + /** 删除标识1删除0正常 */ + private String delFlag; + + private String incomeTimeStart; + private String incomeTimeEnd; + private String checkTimeStart; + private String checkTimeEnd; + private String typeCode; + private String checkType; + + + public String getCheckType() { + return checkType; + } + + public void setCheckType(String checkType) { + this.checkType = checkType; + } + + public String getTypeCode() { + return typeCode; + } + + public void setTypeCode(String typeCode) { + this.typeCode = typeCode; + } + + 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; + } + + public String getRecordId() { + return recordId; + } + public void setCheckNo(String checkNo) { + this.checkNo = checkNo; + } + + public String getCheckNo() { + return checkNo; + } + public void setIncomeBatchNo(String incomeBatchNo) { + this.incomeBatchNo = incomeBatchNo; + } + + public String getIncomeBatchNo() { + return incomeBatchNo; + } + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public String getOrderNo() { + return orderNo; + } + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + + public String getMaterialCode() { + return materialCode; + } + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public String getMaterialName() { + return materialName; + } + public void setQuality(BigDecimal quality) { + this.quality = quality; + } + + public BigDecimal getQuality() { + return quality; + } + public void setUnit(String unit) { + this.unit = unit; + } + + public String getUnit() { + return unit; + } + public void setSupplierCode(String supplierCode) { + this.supplierCode = supplierCode; + } + + public String getSupplierCode() { + return supplierCode; + } + public void setSupplierName(String supplierName) { + this.supplierName = supplierName; + } + + public String getSupplierName() { + return supplierName; + } + public void setIncomeTime(Date incomeTime) { + this.incomeTime = incomeTime; + } + + public Date getIncomeTime() { + return incomeTime; + } + public void setCheckLoc(String checkLoc) { + this.checkLoc = checkLoc; + } + + public String getCheckLoc() { + return checkLoc; + } + public void setCheckStatus(String checkStatus) { + this.checkStatus = checkStatus; + } + + public String getCheckStatus() { + return checkStatus; + } + public void setCheckManCode(String checkManCode) { + this.checkManCode = checkManCode; + } + + public String getCheckManCode() { + return checkManCode; + } + public void setCheckManName(String checkManName) { + this.checkManName = checkManName; + } + + public String getCheckManName() { + return checkManName; + } + public void setCheckTime(Date checkTime) { + this.checkTime = checkTime; + } + + public Date getCheckTime() { + return checkTime; + } + public void setCheckResult(String checkResult) { + this.checkResult = checkResult; + } + + public String getCheckResult() { + return checkResult; + } + public void setStatus(String status) { + this.status = status; + } + + public String getStatus() { + return status; + } + public void setAttr1(String attr1) { + this.attr1 = attr1; + } + + public String getAttr1() { + return attr1; + } + public void setAttr2(String attr2) { + this.attr2 = attr2; + } + + public String getAttr2() { + return attr2; + } + public void setAttr3(String attr3) { + this.attr3 = attr3; + } + + public String getAttr3() { + return attr3; + } + public void setAttr4(String attr4) { + this.attr4 = attr4; + } + + public String getAttr4() { + return attr4; + } + public void setFactoryCode(String factoryCode) { + this.factoryCode = factoryCode; + } + + public String getFactoryCode() { + return factoryCode; + } + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getDelFlag() { + return delFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("recordId", getRecordId()) + .append("checkNo", getCheckNo()) + .append("incomeBatchNo", getIncomeBatchNo()) + .append("orderNo", getOrderNo()) + .append("materialCode", getMaterialCode()) + .append("materialName", getMaterialName()) + .append("quality", getQuality()) + .append("unit", getUnit()) + .append("supplierCode", getSupplierCode()) + .append("supplierName", getSupplierName()) + .append("incomeTime", getIncomeTime()) + .append("checkLoc", getCheckLoc()) + .append("checkStatus", getCheckStatus()) + .append("checkManCode", getCheckManCode()) + .append("checkManName", getCheckManName()) + .append("checkTime", getCheckTime()) + .append("checkResult", getCheckResult()) + .append("status", getStatus()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("factoryCode", getFactoryCode()) + .append("delFlag", getDelFlag()) + .toString(); + } +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckReportIncomeMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckReportIncomeMapper.java new file mode 100644 index 00000000..7c6e169d --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckReportIncomeMapper.java @@ -0,0 +1,77 @@ +package com.op.quality.mapper; + +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 org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 检验报告来料Mapper接口 + * + * @author Open Platform + * @date 2023-10-19 + */ +@Mapper +public interface QcCheckReportIncomeMapper { + /** + * 查询来料报告 + * + * @param recordId 来料检验主键 + * @return 来料检验 + */ + public QcCheckReportIncome selectQcCheckReportIncomeByRecordId(String recordId); + + /** + * 查询来料报告 + * + * @param qcCheckReportIncome 来料检验 + * @return 来料检验集合 + */ + public List selectQcCheckReportIncomeList(QcCheckReportIncome qcCheckReportIncome); + + /** + * 新增来料报告 + * + * @param qcCheckReportIncome 来料检验 + * @return 结果 + */ + public int insertQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome); + + /** + * 修改来料报告 + * + * @param qcCheckReportIncome 来料检验 + * @return 结果 + */ + public int updateQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome); + + /** + * 删除来料报告 + * + * @param recordId 来料检验主键 + * @return 结果 + */ + public int deleteQcCheckReportIncomeByRecordId(String recordId); + + /** + * 批量删除来料报告 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQcCheckReportIncomeByRecordIds(String[] recordIds); + + public List getQcListBom(QcBomComponent bomComponent); + + public List getQcListSupplier(QcSupplier qcSupplier); + + public List getQcListUser(SysUser sysUser); + + int getTodayMaxNum(QcCheckReportIncome qcCheckReportIncome); + + List getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail); +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckReportIncomeService.java b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckReportIncomeService.java new file mode 100644 index 00000000..7206e83b --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckReportIncomeService.java @@ -0,0 +1,74 @@ +package com.op.quality.service; + +import com.op.quality.domain.*; +import com.op.system.api.domain.SysUser; + +import java.util.List; + +/** + * 来料报告Service接口 + * + * @author Open Platform + * @date 2023-10-19 + */ +public interface IQcCheckReportIncomeService { + /** + * 查询来料报告 + * + * @param recordId 来料报告主键 + * @return 来料检验 + */ + public QcCheckReportIncome selectQcCheckReportIncomeByRecordId(String recordId); + + /** + * 查询来料报告列表 + * + * @param qcCheckReportIncome 来料报告 + * @return 来料检验集合 + */ + public List 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 getQcListBom(QcBomComponent bomComponent); + + public List getQcListSupplier(QcSupplier qcSupplier); + + public List getQcListUser(SysUser sysUser); + + int updateIncomeStatus(QcCheckReportIncome qcCheckReportIncome); + + List getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail); + + public List getPrintData(QcCheckReportIncome qcCheckReportIncome); +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/serviceImpl/QcCheckReportIncomeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/serviceImpl/QcCheckReportIncomeServiceImpl.java new file mode 100644 index 00000000..d60f4283 --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/serviceImpl/QcCheckReportIncomeServiceImpl.java @@ -0,0 +1,201 @@ +package com.op.quality.service.serviceImpl; + +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; +import com.op.common.security.utils.SecurityUtils; +import com.op.quality.domain.*; +import com.op.quality.mapper.*; +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 QcCheckReportIncomeServiceImpl implements IQcCheckReportIncomeService { + @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 selectQcCheckReportIncomeList(QcCheckReportIncome qcCheckReportIncome) { + qcCheckReportIncome.setDelFlag("0"); + 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 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 getQcListBom(QcBomComponent bomComponent) { + return qcCheckReportIncomeMapper.getQcListBom(bomComponent); + } + + @Override + @DS("#header.poolName") + public List getQcListSupplier(QcSupplier qcSupplier) { + return qcCheckReportIncomeMapper.getQcListSupplier(qcSupplier); + } + + //在公共库里不需要切库 + @Override + public List 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 getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail) { + return qcCheckReportIncomeMapper.getCkeckProjectList(qcCheckTaskDetail); + } + + @Override + public List getPrintData(QcCheckReportIncome qcCheckReportIncome) { + return null; + } + +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/serviceImpl/QcCheckTypeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/serviceImpl/QcCheckTypeServiceImpl.java index 0d023254..e75c29b2 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/serviceImpl/QcCheckTypeServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/serviceImpl/QcCheckTypeServiceImpl.java @@ -62,7 +62,7 @@ public class QcCheckTypeServiceImpl implements IQcCheckTypeService { @DS("#header.poolName") public int insertQcCheckType(QcCheckType qcCheckType) { if (StringUtils.isNotBlank(qcCheckType.getCheckName())){ - qcCheckType.setId(IdUtils.fastSimpleUUID()); + qcCheckType.setId(qcCheckType.getOrderCode()); qcCheckType.setCreateBy(SecurityUtils.getUsername()); qcCheckType.setCreateTime(DateUtils.getNowDate()); HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckProjectMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckProjectMapper.xml index d8a447ef..515f9b92 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckProjectMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckProjectMapper.xml @@ -120,6 +120,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" \ No newline at end of file diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml new file mode 100644 index 00000000..bc241d47 --- /dev/null +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml @@ -0,0 +1,247 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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, check_time, check_result, status, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, factory_code, del_flag from qc_check_task + + + + + + + + + + + + + + + + + + insert into qc_check_task + + 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, + check_time, + check_result, + status, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + factory_code, + del_flag, + + + #{recordId}, + #{checkNo}, + #{incomeBatchNo}, + #{orderNo}, + #{materialCode}, + #{materialName}, + #{quality}, + #{unit}, + #{supplierCode}, + #{supplierName}, + #{incomeTime}, + #{checkLoc}, + #{checkStatus}, + #{checkManCode}, + #{checkManName}, + #{checkTime}, + #{checkResult}, + #{status}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{factoryCode}, + #{delFlag}, + + + + + update qc_check_task + + check_no = #{checkNo}, + income_batch_no = #{incomeBatchNo}, + order_no = #{orderNo}, + material_code = #{materialCode}, + material_name = #{materialName}, + quality = #{quality}, + unit = #{unit}, + supplier_code = #{supplierCode}, + supplier_name = #{supplierName}, + income_time = #{incomeTime}, + check_loc = #{checkLoc}, + check_status = #{checkStatus}, + check_man_code = #{checkManCode}, + check_man_name = #{checkManName}, + check_time = #{checkTime}, + check_result = #{checkResult}, + status = #{status}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + factory_code = #{factoryCode}, + del_flag = #{delFlag}, + + where record_id = #{recordId} + + + + delete from qc_check_task where record_id = #{recordId} + + + + delete from qc_check_task where record_id in + + #{recordId} + + +