From d3ba6a41849657e6cd9311fd7b27cd3e0cee58a5 Mon Sep 17 00:00:00 2001 From: "JinLu.Yin" <411641505@qq.com> Date: Tue, 30 Aug 2022 22:02:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=87=E7=A8=8B=E8=B4=A8=E6=A3=80=E7=9A=84?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=E8=AE=B0=E5=BD=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/QcDefectRecordController.java | 67 +++++++++++++++++-- .../mes/qc/service/IQcIpqcLineService.java | 8 +++ .../ktg/mes/qc/service/IQcIpqcService.java | 7 ++ .../service/impl/QcIpqcLineServiceImpl.java | 6 ++ .../qc/service/impl/QcIpqcServiceImpl.java | 6 ++ 5 files changed, 89 insertions(+), 5 deletions(-) diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcDefectRecordController.java b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcDefectRecordController.java index 0a00759..d96cb53 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcDefectRecordController.java +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/QcDefectRecordController.java @@ -2,8 +2,17 @@ package com.ktg.mes.qc.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.qc.domain.QcIqcDefect; +import com.ktg.mes.qc.domain.ValidList; +import com.ktg.mes.qc.service.*; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; @@ -17,7 +26,6 @@ import com.ktg.common.core.controller.BaseController; import com.ktg.common.core.domain.AjaxResult; import com.ktg.common.enums.BusinessType; import com.ktg.mes.qc.domain.QcDefectRecord; -import com.ktg.mes.qc.service.IQcDefectRecordService; import com.ktg.common.utils.poi.ExcelUtil; import com.ktg.common.core.page.TableDataInfo; @@ -34,6 +42,20 @@ public class QcDefectRecordController extends BaseController @Autowired private IQcDefectRecordService qcDefectRecordService; + @Autowired + private IQcIqcLineService qcIqcLineService; + + @Autowired + private IQcIqcService qcIqcService; + + @Autowired + private IQcIpqcLineService qcIpqcLineService; + + @Autowired + private IQcIpqcService qcIpqcService; + + + /** * 查询检验单缺陷记录列表 */ @@ -81,14 +103,49 @@ public class QcDefectRecordController extends BaseController } /** - * 修改检验单缺陷记录 + * 修改来料检验单缺陷记录 */ @PreAuthorize("@ss.hasPermi('mes:qc:defectrecord:edit')") @Log(title = "检验单缺陷记录", businessType = BusinessType.UPDATE) + @Transactional @PutMapping - public AjaxResult edit(@RequestBody QcDefectRecord qcDefectRecord) - { - return toAjax(qcDefectRecordService.updateQcDefectRecord(qcDefectRecord)); + public AjaxResult updateList(@Validated @RequestBody ValidList defects){ + Long qcId = -1L; + String qcType = ""; + Long lineId = -1L; + if(CollUtil.isNotEmpty(defects)){ + for (QcDefectRecord defect: defects + ) { + if(StringUtils.isNotNull(defect.getRecordId())){ + qcDefectRecordService.updateQcDefectRecord(defect); + }else { + qcDefectRecordService.insertQcDefectRecord(defect); + } + qcId = defect.getQcId(); + qcType = defect.getQcType(); + lineId = defect.getLineId(); + } + + if(UserConstants.QC_TYPE_IQC.equals(qcType)){ + //更新来料检验单行上的cr,maj,min数量 + qcIqcLineService.updateCrMajMinQuantity(qcId,lineId); + //更新来料检验单头上的cr,maj,min数量和比例 + qcIqcService.updateCrMajMinQuaAndRate(qcId); + + }else if(UserConstants.QC_TYPE_IPQC.equals(qcType)){ + //更新过程检验单行上的cr,maj,min数量 + qcIpqcLineService.updateCrMajMinQuantity(qcId,lineId); + //更新过程检验单头上的cr,maj,min数量和比例 + qcIpqcService.updateCrMajMinQuaAndRate(qcId); + }else { + //更新出货检验单行上的cr,maj,min数量 + + //更新出货检验单头上的cr,maj,min数量和比例 + + } + + } + return AjaxResult.success(); } /** diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIpqcLineService.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIpqcLineService.java index a002f0b..eb45ccd 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIpqcLineService.java +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIpqcLineService.java @@ -43,6 +43,14 @@ public interface IQcIpqcLineService */ public int updateQcIpqcLine(QcIpqcLine qcIpqcLine); + /** + * 计算并更新当前行的Cr,Maj,Min的总数量 + * @param qcId + * @param lineId + * @return + */ + public int updateCrMajMinQuantity(Long qcId,Long lineId); + /** * 批量删除过程检验单行 * diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIpqcService.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIpqcService.java index 135524b..8efa51b 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIpqcService.java +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/IQcIpqcService.java @@ -51,6 +51,13 @@ public interface IQcIpqcService */ public int updateQcIpqc(QcIpqc qcIpqc); + /** + * 更新头上的cr、maj、min数量 + * @param qcId + * @return + */ + public int updateCrMajMinQuaAndRate(Long qcId); + /** * 批量删除过程检验单 * diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIpqcLineServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIpqcLineServiceImpl.java index eb10963..319bafd 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIpqcLineServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIpqcLineServiceImpl.java @@ -70,6 +70,12 @@ public class QcIpqcLineServiceImpl implements IQcIpqcLineService return qcIpqcLineMapper.updateQcIpqcLine(qcIpqcLine); } + @Override + public int updateCrMajMinQuantity(Long qcId, Long lineId) { + //TODO: + return 0; + } + /** * 批量删除过程检验单行 * diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIpqcServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIpqcServiceImpl.java index 98dbc39..26ecdd8 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIpqcServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/QcIpqcServiceImpl.java @@ -83,6 +83,12 @@ public class QcIpqcServiceImpl implements IQcIpqcService return qcIpqcMapper.updateQcIpqc(qcIpqc); } + @Override + public int updateCrMajMinQuaAndRate(Long qcId) { + //TODO: + return 0; + } + /** * 批量删除过程检验单 *