Browse Source

[feat]品质管理:

品质单
新增根据品质单报告不合格分类和合格分类计算品质合格数和不合格数
dev
liuxiaoxu 6 months ago
parent
commit
37837bfba9
  1. 1
      ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java
  2. 60
      ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderDetail.java
  3. 36
      ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderReport.java
  4. 14
      ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderReportUnqualified.java
  5. 7
      ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderDetailMapper.java
  6. 40
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderReportServiceImpl.java
  7. 8
      ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml
  8. 6
      ruoyi-admin/src/main/resources/templates/quality/qualityOrder/qualityOrderReport.html

1
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";

60
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)

36
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)

14
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,15 +113,15 @@ 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 setProcessBadNum(Integer processBadNum) {
this.processBadNum = processBadNum;
}
public void setUnqualifiedReportUrl(String unqualifiedReportUrl)
{
this.unqualifiedReportUrl = unqualifiedReportUrl;

7
ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderDetailMapper.java

@ -91,4 +91,11 @@ public interface QualityOrderDetailMapper
* @return 品质管理品质单详情集合
*/
List<QualityOrderDetail> selectQualityOrderDetailListByCode(String qualityOrderCode);
/**
* 根据供应商Id和物料号查询品质管理品质单详情
*
*/
QualityOrderDetail selectQualityOrderDetailListByCodeAndNo(QualityOrderDetail qualityOrderDetail);
}

40
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<QualityOrderReportUnqualified> unqualifiedDataList = qualityOrderReport.getUnqualifiedDataList();
//计算不良数量的合计值
int processBadNumTotal = unqualifiedDataList.stream().mapToInt(QualityOrderReportUnqualified::getProcessBadNum).sum();
if (processBadNumTotal>thisArrivedNum){
throw new BusinessException("不良数量的总和小于等于本次到货数");
}
qualityOrderDetail.setQualityUnqualifiedNum(processBadNumTotal);
orderDetailMapper.updateQualityOrderDetail(qualityOrderDetail);
List<QualityOrderReportUnqualified> qualityOrderReportUnqualifieds = unqualifiedMapper.selectQualityOrderReportUnqualifiedByCodeAndNo(tempOrderReportUnqualified);
if (StringUtils.isEmpty(qualityOrderReportUnqualifieds)){

8
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}
</select>
<select id="selectQualityOrderDetailListByCodeAndNo" parameterType="QualityOrderDetail" resultMap="QualityOrderDetailResult">
<include refid="selectQualityOrderDetailVo"/>
where supplier_code = #{supplierCode}
and material_no = #{materialNo}
</select>
<insert id="insertQualityOrderDetail" parameterType="QualityOrderDetail" useGeneratedKeys="true" keyProperty="qualityOrderDetailId">
insert into quality_order_detail
<trim prefix="(" suffix=")" suffixOverrides=",">

6
ruoyi-admin/src/main/resources/templates/quality/qualityOrder/qualityOrderReport.html

@ -6,7 +6,7 @@
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-qualityReport-edit" th:object="${qualityOrderReport}">
<form class="form-horizontal m" id="form-qualityOrderReport-edit" th:object="${qualityOrderReport}">
<input name="supplierCode" th:field="*{supplierCode}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">料号:</label>
@ -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;
}, {});

Loading…
Cancel
Save