From 37837bfba9584f48130433ae10a9457d24c2cc64 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Tue, 21 May 2024 19:32:26 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E5=93=81=E8=B4=A8=E7=AE=A1=E7=90=86:=20?= =?UTF-8?q?=E5=93=81=E8=B4=A8=E5=8D=95=20=E6=96=B0=E5=A2=9E=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E5=93=81=E8=B4=A8=E5=8D=95=E6=8A=A5=E5=91=8A=E4=B8=8D?= =?UTF-8?q?=E5=90=88=E6=A0=BC=E5=88=86=E7=B1=BB=E5=92=8C=E5=90=88=E6=A0=BC?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E8=AE=A1=E7=AE=97=E5=93=81=E8=B4=A8=E5=90=88?= =?UTF-8?q?=E6=A0=BC=E6=95=B0=E5=92=8C=E4=B8=8D=E5=90=88=E6=A0=BC=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/QualityOrderController.java | 1 - .../quality/domain/QualityOrderDetail.java | 60 +++++++++---------- .../quality/domain/QualityOrderReport.java | 36 +++++------ .../domain/QualityOrderReportUnqualified.java | 16 ++--- .../mapper/QualityOrderDetailMapper.java | 7 +++ .../impl/QualityOrderReportServiceImpl.java | 40 +++++++++++++ .../quality/QualityOrderDetailMapper.xml | 8 +++ .../qualityOrder/qualityOrderReport.html | 6 +- 8 files changed, 111 insertions(+), 63 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java index c725cbbc..0e998168 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java @@ -165,7 +165,6 @@ public class QualityOrderController extends BaseController public String qualityReport( @RequestParam("materialNo") String materialNo, @RequestParam("supplierCode") String supplierCode, ModelMap mmap) { -// QualityOrder qualityOrder = qualityOrderService.selectQualityOrderById(qualityOrderId); QualityOrderReport qualityOrderReport = orderReportService.selectQualityOrderReportByNoAndCode(materialNo,supplierCode); mmap.put("qualityOrderReport", qualityOrderReport); return prefix + "/qualityOrderReport"; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderDetail.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderDetail.java index 51dbed53..ccd903e2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderDetail.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderDetail.java @@ -111,23 +111,23 @@ public class QualityOrderDetail extends BaseEntity /** 生产订单数 */ @Excel(name = "生产订单数") - private String makeTotal; + private Integer makeTotal; /** 本次到货数量 */ @Excel(name = "本次到货数量") - private Long thisArrivedNum; + private Integer thisArrivedNum; /** 品质已合格数 */ @Excel(name = "品质已合格数") - private Long qualityHasqualifiedNum; + private Integer qualityHasqualifiedNum; /** 品质合格数 */ @Excel(name = "品质合格数") - private Long qualityQualifiedNum; + private Integer qualityQualifiedNum; /** 品质不合格数 */ @Excel(name = "品质不合格数") - private Long qualityUnqualifiedNum; + private Integer qualityUnqualifiedNum; public void setQualityOrderDetailId(Long qualityOrderDetailId) { @@ -332,56 +332,50 @@ public class QualityOrderDetail extends BaseEntity this.materialProcessMethod = materialProcessMethod; } - public String getMaterialProcessMethod() - { + public String getMaterialProcessMethod() { return materialProcessMethod; } - public void setMakeTotal(String makeTotal) - { - this.makeTotal = makeTotal; - } - public String getMakeTotal() - { + public Integer getMakeTotal() { return makeTotal; } - public void setThisArrivedNum(Long thisArrivedNum) - { - this.thisArrivedNum = thisArrivedNum; + + public void setMakeTotal(Integer makeTotal) { + this.makeTotal = makeTotal; } - public Long getThisArrivedNum() - { + public Integer getThisArrivedNum() { return thisArrivedNum; } - public void setQualityHasqualifiedNum(Long qualityHasqualifiedNum) - { - this.qualityHasqualifiedNum = qualityHasqualifiedNum; + + public void setThisArrivedNum(Integer thisArrivedNum) { + this.thisArrivedNum = thisArrivedNum; } - public Long getQualityHasqualifiedNum() - { + public Integer getQualityHasqualifiedNum() { return qualityHasqualifiedNum; } - public void setQualityQualifiedNum(Long qualityQualifiedNum) - { - this.qualityQualifiedNum = qualityQualifiedNum; + + public void setQualityHasqualifiedNum(Integer qualityHasqualifiedNum) { + this.qualityHasqualifiedNum = qualityHasqualifiedNum; } - public Long getQualityQualifiedNum() - { + public Integer getQualityQualifiedNum() { return qualityQualifiedNum; } - public void setQualityUnqualifiedNum(Long qualityUnqualifiedNum) - { - this.qualityUnqualifiedNum = qualityUnqualifiedNum; + + public void setQualityQualifiedNum(Integer qualityQualifiedNum) { + this.qualityQualifiedNum = qualityQualifiedNum; } - public Long getQualityUnqualifiedNum() - { + public Integer getQualityUnqualifiedNum() { return qualityUnqualifiedNum; } + public void setQualityUnqualifiedNum(Integer qualityUnqualifiedNum) { + this.qualityUnqualifiedNum = qualityUnqualifiedNum; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderReport.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderReport.java index 092e9be8..dc474e86 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderReport.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderReport.java @@ -48,7 +48,7 @@ public class QualityOrderReport extends BaseEntity /** ok允收数 */ @Excel(name = "ok允收数") - private String okAcceptedNum; + private Integer okAcceptedNum; /** ok报告图片 */ @Excel(name = "ok报告图片") @@ -77,7 +77,7 @@ public class QualityOrderReport extends BaseEntity /** 不良数量 */ @Excel(name = "不良数量") - private String processBadNum; + private Integer processBadNum; /** 不合格报告url */ @Excel(name = "不合格报告url") @@ -149,15 +149,7 @@ public class QualityOrderReport extends BaseEntity { return qualityHasqualifiedNum; } - public void setOkAcceptedNum(String okAcceptedNum) - { - this.okAcceptedNum = okAcceptedNum; - } - public String getOkAcceptedNum() - { - return okAcceptedNum; - } public void setOkReportUrl(String okReportUrl) { this.okReportUrl = okReportUrl; @@ -212,15 +204,7 @@ public class QualityOrderReport extends BaseEntity { return processBadGrade; } - public void setProcessBadNum(String processBadNum) - { - this.processBadNum = processBadNum; - } - public String getProcessBadNum() - { - return processBadNum; - } public void setUnqualifiedReportUrl(String unqualifiedReportUrl) { this.unqualifiedReportUrl = unqualifiedReportUrl; @@ -240,6 +224,22 @@ public class QualityOrderReport extends BaseEntity this.unqualifiedDataList = unqualifiedDataList; } + public Integer getOkAcceptedNum() { + return okAcceptedNum; + } + + public void setOkAcceptedNum(Integer okAcceptedNum) { + this.okAcceptedNum = okAcceptedNum; + } + + public Integer getProcessBadNum() { + return processBadNum; + } + + public void setProcessBadNum(Integer processBadNum) { + this.processBadNum = processBadNum; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderReportUnqualified.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderReportUnqualified.java index c7a22f16..d5b7426e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderReportUnqualified.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderReportUnqualified.java @@ -44,7 +44,7 @@ public class QualityOrderReportUnqualified extends BaseEntity /** 不良数量 */ @Excel(name = "不良数量") - private String processBadNum; + private Integer processBadNum; /** 不合格报告url */ @Excel(name = "不合格报告url") @@ -113,16 +113,16 @@ public class QualityOrderReportUnqualified extends BaseEntity { return processBadGrade; } - public void setProcessBadNum(String processBadNum) - { - this.processBadNum = processBadNum; - } - public String getProcessBadNum() - { + public Integer getProcessBadNum() { return processBadNum; } - public void setUnqualifiedReportUrl(String unqualifiedReportUrl) + + public void setProcessBadNum(Integer processBadNum) { + this.processBadNum = processBadNum; + } + + public void setUnqualifiedReportUrl(String unqualifiedReportUrl) { this.unqualifiedReportUrl = unqualifiedReportUrl; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderDetailMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderDetailMapper.java index d9ade2f9..a9c241ac 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderDetailMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderDetailMapper.java @@ -91,4 +91,11 @@ public interface QualityOrderDetailMapper * @return 品质管理品质单详情集合 */ List selectQualityOrderDetailListByCode(String qualityOrderCode); + + /** + * 根据供应商Id和物料号查询品质管理品质单详情 + * + */ + QualityOrderDetail selectQualityOrderDetailListByCodeAndNo(QualityOrderDetail qualityOrderDetail); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderReportServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderReportServiceImpl.java index 74ab6534..467b3fc7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderReportServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderReportServiceImpl.java @@ -2,11 +2,16 @@ package com.ruoyi.quality.service.impl; import java.util.Date; import java.util.List; + +import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.quality.domain.QualityOrderDetail; import com.ruoyi.quality.domain.QualityOrderReportUnqualified; +import com.ruoyi.quality.mapper.QualityOrderDetailMapper; import com.ruoyi.quality.mapper.QualityOrderReportUnqualifiedMapper; +import org.apache.avalon.framework.service.ServiceException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.quality.mapper.QualityOrderReportMapper; @@ -30,6 +35,9 @@ public class QualityOrderReportServiceImpl implements IQualityOrderReportService @Autowired private QualityOrderReportUnqualifiedMapper unqualifiedMapper; + @Autowired + private QualityOrderDetailMapper orderDetailMapper; + /** * 查询品质管理品质单报告 * @@ -86,8 +94,40 @@ public class QualityOrderReportServiceImpl implements IQualityOrderReportService String supplierCode = qualityOrderReport.getSupplierCode(); tempOrderReportUnqualified.setMaterialNo(materialNo); tempOrderReportUnqualified.setSupplierCode(supplierCode); + + QualityOrderDetail tempQualityOrderDetail = new QualityOrderDetail(); + tempQualityOrderDetail.setMaterialNo(materialNo); + tempQualityOrderDetail.setSupplierCode(supplierCode); + + + //从数据库查询品质报告详情数据 + QualityOrderDetail qualityOrderDetail = orderDetailMapper.selectQualityOrderDetailListByCodeAndNo(tempQualityOrderDetail); + //计算品质单详情中的品质合格数量 + Integer okAcceptedNum = qualityOrderReport.getOkAcceptedNum(); + Integer specialConcessionsNum = qualityOrderReport.getSpecialConcessionsNum(); + //品质合格数 + Integer qualityQualifiedNum = okAcceptedNum + specialConcessionsNum; + //本次到货数 + Integer thisArrivedNum = qualityOrderDetail.getThisArrivedNum(); + if (qualityQualifiedNum>thisArrivedNum){ + throw new BusinessException("OK允收数和特采/让步数总和小于等于本次到货数"); + } + //更新品质报告详情中的品质合格数的数据 + qualityOrderDetail.setQualityQualifiedNum(qualityQualifiedNum); + + List unqualifiedDataList = qualityOrderReport.getUnqualifiedDataList(); + //计算不良数量的合计值 + int processBadNumTotal = unqualifiedDataList.stream().mapToInt(QualityOrderReportUnqualified::getProcessBadNum).sum(); + + if (processBadNumTotal>thisArrivedNum){ + throw new BusinessException("不良数量的总和小于等于本次到货数"); + } + + qualityOrderDetail.setQualityUnqualifiedNum(processBadNumTotal); + orderDetailMapper.updateQualityOrderDetail(qualityOrderDetail); + List qualityOrderReportUnqualifieds = unqualifiedMapper.selectQualityOrderReportUnqualifiedByCodeAndNo(tempOrderReportUnqualified); if (StringUtils.isEmpty(qualityOrderReportUnqualifieds)){ diff --git a/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml b/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml index 80864f97..94774c6b 100644 --- a/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml @@ -66,6 +66,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where quality_order_code = #{qualityOrderCode} + + + + insert into quality_order_detail diff --git a/ruoyi-admin/src/main/resources/templates/quality/qualityOrder/qualityOrderReport.html b/ruoyi-admin/src/main/resources/templates/quality/qualityOrder/qualityOrderReport.html index 1e860cec..cca0cb1d 100644 --- a/ruoyi-admin/src/main/resources/templates/quality/qualityOrder/qualityOrderReport.html +++ b/ruoyi-admin/src/main/resources/templates/quality/qualityOrder/qualityOrderReport.html @@ -6,7 +6,7 @@
-
+
@@ -104,13 +104,13 @@ var processBadGradeDatas = [[${@dict.getType('process_bad_grade')}]]; var prefix = ctx + "quality/qualityOrder"; - $("#form-qualityReport-edit").validate({ + $("#form-qualityOrderReport-edit").validate({ focusCleanup: true }); function submitHandler() { // 获取表单数据 - const qualityReportData = $("#form-qualityReport-edit").serializeArray().reduce((obj, item) => { + const qualityReportData = $("#form-qualityOrderReport-edit").serializeArray().reduce((obj, item) => { obj[item.name] = item.value; return obj; }, {});