Browse Source
品质单 新增品质单报告domian 新增品质单报告Mapper 新增品质单报告Mapper.xml 新增品质单报告Service 新增品质单报告ServiceImpldev
liuxiaoxu
6 months ago
6 changed files with 1036 additions and 0 deletions
@ -0,0 +1,271 @@ |
|||
package com.ruoyi.quality.domain; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.ruoyi.quality.domain.VO.QualityOrderUnqualifiedVO; |
|||
import org.apache.commons.lang3.builder.ToStringBuilder; |
|||
import org.apache.commons.lang3.builder.ToStringStyle; |
|||
import com.ruoyi.common.annotation.Excel; |
|||
import com.ruoyi.common.core.domain.BaseEntity; |
|||
|
|||
/** |
|||
* 品质管理品质单报告对象 quality_order_report |
|||
* |
|||
* @author 刘晓旭 |
|||
* @date 2024-05-20 |
|||
*/ |
|||
public class QualityOrderReport extends BaseEntity |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** 品质单报告Id */ |
|||
private Long qualityOrderReportId; |
|||
|
|||
/** 供应商Id */ |
|||
@Excel(name = "供应商Id") |
|||
private String supplierCode; |
|||
|
|||
/** 供应商名称 */ |
|||
@Excel(name = "供应商名称") |
|||
private String supplierName; |
|||
|
|||
/** 料号 */ |
|||
@Excel(name = "料号") |
|||
private String materialNo; |
|||
|
|||
/** 物料名称 */ |
|||
@Excel(name = "物料名称") |
|||
private String materialName; |
|||
|
|||
/** 生产订单数 */ |
|||
@Excel(name = "生产订单数") |
|||
private Integer makeTotal; |
|||
|
|||
/** 品质已合格数 */ |
|||
@Excel(name = "品质已合格数") |
|||
private Integer qualityHasqualifiedNum; |
|||
|
|||
/** ok允收数 */ |
|||
@Excel(name = "ok允收数") |
|||
private String okAcceptedNum; |
|||
|
|||
/** ok报告图片 */ |
|||
@Excel(name = "ok报告图片") |
|||
private String okReportUrl; |
|||
|
|||
/** 特采/让步数 */ |
|||
@Excel(name = "特采/让步数") |
|||
private Integer specialConcessionsNum; |
|||
|
|||
/** 特采报告图片 */ |
|||
@Excel(name = "特采报告图片") |
|||
private String specialReportUrl; |
|||
|
|||
/** 检验完成时间 */ |
|||
@JsonFormat(pattern = "yyyy-MM-dd") |
|||
@Excel(name = "检验完成时间", width = 30, dateFormat = "yyyy-MM-dd") |
|||
private Date checkoutCompletionTime; |
|||
|
|||
/** 不良分类 */ |
|||
@Excel(name = "不良分类") |
|||
private String processBadClassification; |
|||
|
|||
/** 不良等级 */ |
|||
@Excel(name = "不良等级") |
|||
private String processBadGrade; |
|||
|
|||
/** 不良数量 */ |
|||
@Excel(name = "不良数量") |
|||
private String processBadNum; |
|||
|
|||
/** 不合格报告url */ |
|||
@Excel(name = "不合格报告url") |
|||
private String unqualifiedReportUrl; |
|||
|
|||
/*不合格数集合*/ |
|||
List<QualityOrderReportUnqualified> unqualifiedDataList; |
|||
|
|||
public void setQualityOrderReportId(Long qualityOrderReportId) |
|||
{ |
|||
this.qualityOrderReportId = qualityOrderReportId; |
|||
} |
|||
|
|||
public Long getQualityOrderReportId() |
|||
{ |
|||
return qualityOrderReportId; |
|||
} |
|||
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 setMaterialNo(String materialNo) |
|||
{ |
|||
this.materialNo = materialNo; |
|||
} |
|||
|
|||
public String getMaterialNo() |
|||
{ |
|||
return materialNo; |
|||
} |
|||
public void setMaterialName(String materialName) |
|||
{ |
|||
this.materialName = materialName; |
|||
} |
|||
|
|||
public String getMaterialName() |
|||
{ |
|||
return materialName; |
|||
} |
|||
public void setMakeTotal(Integer makeTotal) |
|||
{ |
|||
this.makeTotal = makeTotal; |
|||
} |
|||
|
|||
public Integer getMakeTotal() |
|||
{ |
|||
return makeTotal; |
|||
} |
|||
public void setQualityHasqualifiedNum(Integer qualityHasqualifiedNum) |
|||
{ |
|||
this.qualityHasqualifiedNum = qualityHasqualifiedNum; |
|||
} |
|||
|
|||
public Integer getQualityHasqualifiedNum() |
|||
{ |
|||
return qualityHasqualifiedNum; |
|||
} |
|||
public void setOkAcceptedNum(String okAcceptedNum) |
|||
{ |
|||
this.okAcceptedNum = okAcceptedNum; |
|||
} |
|||
|
|||
public String getOkAcceptedNum() |
|||
{ |
|||
return okAcceptedNum; |
|||
} |
|||
public void setOkReportUrl(String okReportUrl) |
|||
{ |
|||
this.okReportUrl = okReportUrl; |
|||
} |
|||
|
|||
public String getOkReportUrl() |
|||
{ |
|||
return okReportUrl; |
|||
} |
|||
public void setSpecialConcessionsNum(Integer specialConcessionsNum) |
|||
{ |
|||
this.specialConcessionsNum = specialConcessionsNum; |
|||
} |
|||
|
|||
public Integer getSpecialConcessionsNum() |
|||
{ |
|||
return specialConcessionsNum; |
|||
} |
|||
public void setSpecialReportUrl(String specialReportUrl) |
|||
{ |
|||
this.specialReportUrl = specialReportUrl; |
|||
} |
|||
|
|||
public String getSpecialReportUrl() |
|||
{ |
|||
return specialReportUrl; |
|||
} |
|||
public void setCheckoutCompletionTime(Date checkoutCompletionTime) |
|||
{ |
|||
this.checkoutCompletionTime = checkoutCompletionTime; |
|||
} |
|||
|
|||
public Date getCheckoutCompletionTime() |
|||
{ |
|||
return checkoutCompletionTime; |
|||
} |
|||
public void setProcessBadClassification(String processBadClassification) |
|||
{ |
|||
this.processBadClassification = processBadClassification; |
|||
} |
|||
|
|||
public String getProcessBadClassification() |
|||
{ |
|||
return processBadClassification; |
|||
} |
|||
public void setProcessBadGrade(String processBadGrade) |
|||
{ |
|||
this.processBadGrade = processBadGrade; |
|||
} |
|||
|
|||
public String getProcessBadGrade() |
|||
{ |
|||
return processBadGrade; |
|||
} |
|||
public void setProcessBadNum(String processBadNum) |
|||
{ |
|||
this.processBadNum = processBadNum; |
|||
} |
|||
|
|||
public String getProcessBadNum() |
|||
{ |
|||
return processBadNum; |
|||
} |
|||
public void setUnqualifiedReportUrl(String unqualifiedReportUrl) |
|||
{ |
|||
this.unqualifiedReportUrl = unqualifiedReportUrl; |
|||
} |
|||
|
|||
public String getUnqualifiedReportUrl() |
|||
{ |
|||
return unqualifiedReportUrl; |
|||
} |
|||
|
|||
|
|||
public List<QualityOrderReportUnqualified> getUnqualifiedDataList() { |
|||
return unqualifiedDataList; |
|||
} |
|||
|
|||
public void setUnqualifiedDataList(List<QualityOrderReportUnqualified> unqualifiedDataList) { |
|||
this.unqualifiedDataList = unqualifiedDataList; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
|||
.append("qualityOrderReportId", getQualityOrderReportId()) |
|||
.append("supplierCode", getSupplierCode()) |
|||
.append("supplierName", getSupplierName()) |
|||
.append("materialNo", getMaterialNo()) |
|||
.append("materialName", getMaterialName()) |
|||
.append("makeTotal", getMakeTotal()) |
|||
.append("qualityHasqualifiedNum", getQualityHasqualifiedNum()) |
|||
.append("okAcceptedNum", getOkAcceptedNum()) |
|||
.append("okReportUrl", getOkReportUrl()) |
|||
.append("specialConcessionsNum", getSpecialConcessionsNum()) |
|||
.append("specialReportUrl", getSpecialReportUrl()) |
|||
.append("checkoutCompletionTime", getCheckoutCompletionTime()) |
|||
.append("processBadClassification", getProcessBadClassification()) |
|||
.append("processBadGrade", getProcessBadGrade()) |
|||
.append("processBadNum", getProcessBadNum()) |
|||
.append("unqualifiedReportUrl", getUnqualifiedReportUrl()) |
|||
.append("remark", getRemark()) |
|||
.append("createBy", getCreateBy()) |
|||
.append("createTime", getCreateTime()) |
|||
.append("updateBy", getUpdateBy()) |
|||
.append("updateTime", getUpdateTime()) |
|||
.append("unqualifiedDataList",getUnqualifiedDataList()) |
|||
.toString(); |
|||
} |
|||
} |
@ -0,0 +1,80 @@ |
|||
package com.ruoyi.quality.mapper; |
|||
|
|||
import java.util.List; |
|||
import com.ruoyi.quality.domain.QualityOrderReport; |
|||
|
|||
/** |
|||
* 品质管理品质单报告Mapper接口 |
|||
* |
|||
* @author 刘晓旭 |
|||
* @date 2024-05-20 |
|||
*/ |
|||
public interface QualityOrderReportMapper |
|||
{ |
|||
/** |
|||
* 查询品质管理品质单报告 |
|||
* |
|||
* @param qualityOrderReportId 品质管理品质单报告ID |
|||
* @return 品质管理品质单报告 |
|||
*/ |
|||
public QualityOrderReport selectQualityOrderReportById(Long qualityOrderReportId); |
|||
|
|||
/** |
|||
* 查询品质管理品质单报告列表 |
|||
* |
|||
* @param qualityOrderReport 品质管理品质单报告 |
|||
* @return 品质管理品质单报告集合 |
|||
*/ |
|||
public List<QualityOrderReport> selectQualityOrderReportList(QualityOrderReport qualityOrderReport); |
|||
|
|||
/** |
|||
* 新增品质管理品质单报告 |
|||
* |
|||
* @param qualityOrderReport 品质管理品质单报告 |
|||
* @return 结果 |
|||
*/ |
|||
public int insertQualityOrderReport(QualityOrderReport qualityOrderReport); |
|||
|
|||
/** |
|||
* 修改品质管理品质单报告 |
|||
* |
|||
* @param qualityOrderReport 品质管理品质单报告 |
|||
* @return 结果 |
|||
*/ |
|||
public int updateQualityOrderReport(QualityOrderReport qualityOrderReport); |
|||
|
|||
/** |
|||
* 删除品质管理品质单报告 |
|||
* |
|||
* @param qualityOrderReportId 品质管理品质单报告ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteQualityOrderReportById(Long qualityOrderReportId); |
|||
|
|||
/** |
|||
* 批量删除品质管理品质单报告 |
|||
* |
|||
* @param qualityOrderReportIds 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteQualityOrderReportByIds(String[] qualityOrderReportIds); |
|||
|
|||
/** |
|||
* 作废品质管理品质单报告 |
|||
* |
|||
* @param qualityOrderReportId 品质管理品质单报告ID |
|||
* @return 结果 |
|||
*/ |
|||
public int cancelQualityOrderReportById(Long qualityOrderReportId); |
|||
|
|||
/** |
|||
* 恢复品质管理品质单报告 |
|||
* |
|||
* @param qualityOrderReportId 品质管理品质单报告ID |
|||
* @return 结果 |
|||
*/ |
|||
public int restoreQualityOrderReportById(Long qualityOrderReportId); |
|||
|
|||
/*根据供应商ID和物料号查询品质报告*/ |
|||
QualityOrderReport selectQualityOrderReportByNoAndCode(QualityOrderReport qualityOrderReport); |
|||
} |
@ -0,0 +1,78 @@ |
|||
package com.ruoyi.quality.service; |
|||
|
|||
import java.util.List; |
|||
import com.ruoyi.quality.domain.QualityOrderReport; |
|||
|
|||
/** |
|||
* 品质管理品质单报告Service接口 |
|||
* |
|||
* @author 刘晓旭 |
|||
* @date 2024-05-20 |
|||
*/ |
|||
public interface IQualityOrderReportService |
|||
{ |
|||
/** |
|||
* 查询品质管理品质单报告 |
|||
* |
|||
* @param qualityOrderReportId 品质管理品质单报告ID |
|||
* @return 品质管理品质单报告 |
|||
*/ |
|||
public QualityOrderReport selectQualityOrderReportById(Long qualityOrderReportId); |
|||
|
|||
/** |
|||
* 查询品质管理品质单报告列表 |
|||
* |
|||
* @param qualityOrderReport 品质管理品质单报告 |
|||
* @return 品质管理品质单报告集合 |
|||
*/ |
|||
public List<QualityOrderReport> selectQualityOrderReportList(QualityOrderReport qualityOrderReport); |
|||
|
|||
/** |
|||
* 新增品质管理品质单报告 |
|||
* |
|||
* @param qualityOrderReport 品质管理品质单报告 |
|||
* @return 结果 |
|||
*/ |
|||
public int insertQualityOrderReport(QualityOrderReport qualityOrderReport); |
|||
|
|||
/** |
|||
* 修改品质管理品质单报告 |
|||
* |
|||
* @param qualityOrderReport 品质管理品质单报告 |
|||
* @return 结果 |
|||
*/ |
|||
public int updateQualityOrderReport(QualityOrderReport qualityOrderReport); |
|||
|
|||
/** |
|||
* 批量删除品质管理品质单报告 |
|||
* |
|||
* @param ids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteQualityOrderReportByIds(String ids); |
|||
|
|||
/** |
|||
* 删除品质管理品质单报告信息 |
|||
* |
|||
* @param qualityOrderReportId 品质管理品质单报告ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteQualityOrderReportById(Long qualityOrderReportId); |
|||
|
|||
/** |
|||
* 作废品质管理品质单报告 |
|||
* @param qualityOrderReportId 品质管理品质单报告ID |
|||
* @return |
|||
*/ |
|||
int cancelQualityOrderReportById(Long qualityOrderReportId); |
|||
|
|||
/** |
|||
* 恢复品质管理品质单报告 |
|||
* @param qualityOrderReportId 品质管理品质单报告ID |
|||
* @return |
|||
*/ |
|||
int restoreQualityOrderReportById(Long qualityOrderReportId); |
|||
|
|||
/*根据供应商ID和物料号查询品质报告*/ |
|||
QualityOrderReport selectQualityOrderReportByNoAndCode(String materialNo, String supplierCode); |
|||
} |
@ -0,0 +1,184 @@ |
|||
package com.ruoyi.quality.service.impl; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
import com.ruoyi.common.utils.DateUtils; |
|||
import com.ruoyi.common.utils.ShiroUtils; |
|||
import com.ruoyi.common.utils.StringUtils; |
|||
import com.ruoyi.quality.domain.QualityOrderReportUnqualified; |
|||
import com.ruoyi.quality.domain.VO.QualityOrderUnqualifiedVO; |
|||
import com.ruoyi.quality.mapper.QualityOrderReportUnqualifiedMapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import com.ruoyi.quality.mapper.QualityOrderReportMapper; |
|||
import com.ruoyi.quality.domain.QualityOrderReport; |
|||
import com.ruoyi.quality.service.IQualityOrderReportService; |
|||
import com.ruoyi.common.core.text.Convert; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
/** |
|||
* 品质管理品质单报告Service业务层处理 |
|||
* |
|||
* @author 刘晓旭 |
|||
* @date 2024-05-20 |
|||
*/ |
|||
@Service |
|||
public class QualityOrderReportServiceImpl implements IQualityOrderReportService |
|||
{ |
|||
@Autowired |
|||
private QualityOrderReportMapper qualityOrderReportMapper; |
|||
|
|||
@Autowired |
|||
private QualityOrderReportUnqualifiedMapper unqualifiedMapper; |
|||
|
|||
/** |
|||
* 查询品质管理品质单报告 |
|||
* |
|||
* @param qualityOrderReportId 品质管理品质单报告ID |
|||
* @return 品质管理品质单报告 |
|||
*/ |
|||
@Override |
|||
public QualityOrderReport selectQualityOrderReportById(Long qualityOrderReportId) |
|||
{ |
|||
return qualityOrderReportMapper.selectQualityOrderReportById(qualityOrderReportId); |
|||
} |
|||
|
|||
/** |
|||
* 查询品质管理品质单报告列表 |
|||
* |
|||
* @param qualityOrderReport 品质管理品质单报告 |
|||
* @return 品质管理品质单报告 |
|||
*/ |
|||
@Override |
|||
public List<QualityOrderReport> selectQualityOrderReportList(QualityOrderReport qualityOrderReport) |
|||
{ |
|||
return qualityOrderReportMapper.selectQualityOrderReportList(qualityOrderReport); |
|||
} |
|||
|
|||
/** |
|||
* 新增品质管理品质单报告 |
|||
* |
|||
* @param qualityOrderReport 品质管理品质单报告 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int insertQualityOrderReport(QualityOrderReport qualityOrderReport) |
|||
{ |
|||
String loginName = ShiroUtils.getLoginName(); |
|||
qualityOrderReport.setCreateBy(loginName); |
|||
qualityOrderReport.setCreateTime(DateUtils.getNowDate()); |
|||
return qualityOrderReportMapper.insertQualityOrderReport(qualityOrderReport); |
|||
} |
|||
|
|||
/** |
|||
* 修改品质管理品质单报告 |
|||
* |
|||
* @param qualityOrderReport 品质管理品质单报告 |
|||
* @return 结果 |
|||
*/ |
|||
@Transactional |
|||
@Override |
|||
public int updateQualityOrderReport(QualityOrderReport qualityOrderReport) |
|||
{ |
|||
String loginName = ShiroUtils.getLoginName(); |
|||
|
|||
QualityOrderReportUnqualified tempOrderReportUnqualified = new QualityOrderReportUnqualified(); |
|||
String materialNo = qualityOrderReport.getMaterialNo(); |
|||
String supplierCode = qualityOrderReport.getSupplierCode(); |
|||
tempOrderReportUnqualified.setMaterialNo(materialNo); |
|||
tempOrderReportUnqualified.setSupplierCode(supplierCode); |
|||
List<QualityOrderReportUnqualified> unqualifiedDataList = qualityOrderReport.getUnqualifiedDataList(); |
|||
|
|||
|
|||
List<QualityOrderReportUnqualified> qualityOrderReportUnqualifieds = unqualifiedMapper.selectQualityOrderReportUnqualifiedByCodeAndNo(tempOrderReportUnqualified); |
|||
if (StringUtils.isEmpty(qualityOrderReportUnqualifieds)){ |
|||
//如果后端不合格数列表值为空,就新增一个
|
|||
for (QualityOrderReportUnqualified tempQualityOrderReportUnqualified : unqualifiedDataList) { |
|||
QualityOrderReportUnqualified qualityOrderReportUnqualified = getQualityOrderReportUnqualified(loginName, materialNo, supplierCode, tempQualityOrderReportUnqualified); |
|||
unqualifiedMapper.insertQualityOrderReportUnqualified(qualityOrderReportUnqualified); |
|||
} |
|||
}else { |
|||
//如果后端不合格数列表值为不空,就更新
|
|||
for (QualityOrderReportUnqualified tempQualityOrderReportUnqualified : unqualifiedDataList) { |
|||
QualityOrderReportUnqualified qualityOrderReportUnqualified = getQualityOrderReportUnqualified(loginName, materialNo, supplierCode, tempQualityOrderReportUnqualified); |
|||
unqualifiedMapper.updateQualityOrderReportUnqualified(qualityOrderReportUnqualified); |
|||
} |
|||
|
|||
} |
|||
|
|||
qualityOrderReport.setUpdateBy(loginName); |
|||
qualityOrderReport.setUpdateTime(DateUtils.getNowDate()); |
|||
return qualityOrderReportMapper.updateQualityOrderReport(qualityOrderReport); |
|||
} |
|||
|
|||
private static QualityOrderReportUnqualified getQualityOrderReportUnqualified(String loginName, String materialNo, String supplierCode, QualityOrderReportUnqualified tempQualityOrderReportUnqualified) { |
|||
QualityOrderReportUnqualified qualityOrderReportUnqualified = new QualityOrderReportUnqualified(); |
|||
qualityOrderReportUnqualified.setSupplierCode(supplierCode); |
|||
qualityOrderReportUnqualified.setMaterialNo(materialNo); |
|||
qualityOrderReportUnqualified.setProcessBadNum(tempQualityOrderReportUnqualified.getProcessBadNum()); |
|||
qualityOrderReportUnqualified.setProcessBadClassification(tempQualityOrderReportUnqualified.getProcessBadClassification()); |
|||
qualityOrderReportUnqualified.setProcessBadGrade(tempQualityOrderReportUnqualified.getProcessBadGrade()); |
|||
qualityOrderReportUnqualified.setUpdateBy(loginName); |
|||
qualityOrderReportUnqualified.setUpdateTime(new Date()); |
|||
return qualityOrderReportUnqualified; |
|||
} |
|||
|
|||
/** |
|||
* 删除品质管理品质单报告对象 |
|||
* |
|||
* @param ids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteQualityOrderReportByIds(String ids) |
|||
{ |
|||
return qualityOrderReportMapper.deleteQualityOrderReportByIds(Convert.toStrArray(ids)); |
|||
} |
|||
|
|||
/** |
|||
* 删除品质管理品质单报告信息 |
|||
* |
|||
* @param qualityOrderReportId 品质管理品质单报告ID |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteQualityOrderReportById(Long qualityOrderReportId) |
|||
{ |
|||
return qualityOrderReportMapper.deleteQualityOrderReportById(qualityOrderReportId); |
|||
} |
|||
|
|||
/** |
|||
* 作废品质管理品质单报告 |
|||
* |
|||
* @param qualityOrderReportId 品质管理品质单报告ID |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int cancelQualityOrderReportById(Long qualityOrderReportId) |
|||
{ |
|||
return qualityOrderReportMapper.cancelQualityOrderReportById(qualityOrderReportId); |
|||
} |
|||
|
|||
/** |
|||
* 恢复品质管理品质单报告信息 |
|||
* |
|||
* @param qualityOrderReportId 品质管理品质单报告ID |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int restoreQualityOrderReportById(Long qualityOrderReportId) |
|||
{ |
|||
return qualityOrderReportMapper.restoreQualityOrderReportById(qualityOrderReportId); |
|||
} |
|||
|
|||
/*根据供应商ID和物料号查询品质报告*/ |
|||
@Override |
|||
public QualityOrderReport selectQualityOrderReportByNoAndCode(String materialNo, String supplierCode) { |
|||
|
|||
QualityOrderReport tempQualityOrderReport = new QualityOrderReport(); |
|||
tempQualityOrderReport.setMaterialNo(materialNo); |
|||
tempQualityOrderReport.setSupplierCode(supplierCode); |
|||
QualityOrderReport qualityOrderReport = qualityOrderReportMapper.selectQualityOrderReportByNoAndCode(tempQualityOrderReport); |
|||
return qualityOrderReport; |
|||
} |
|||
} |
@ -0,0 +1,147 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper |
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.ruoyi.quality.mapper.QualityOrderReportMapper"> |
|||
|
|||
<resultMap type="QualityOrderReport" id="QualityOrderReportResult"> |
|||
<result property="qualityOrderReportId" column="quality_order_report_id" /> |
|||
<result property="supplierCode" column="supplier_code" /> |
|||
<result property="supplierName" column="supplier_name" /> |
|||
<result property="materialNo" column="material_no" /> |
|||
<result property="materialName" column="material_name" /> |
|||
<result property="makeTotal" column="make_total" /> |
|||
<result property="qualityHasqualifiedNum" column="quality_hasqualified_num" /> |
|||
<result property="okAcceptedNum" column="ok_accepted_num" /> |
|||
<result property="okReportUrl" column="ok_report_url" /> |
|||
<result property="specialConcessionsNum" column="special_concessions_num" /> |
|||
<result property="specialReportUrl" column="special_report_url" /> |
|||
<result property="checkoutCompletionTime" column="checkout_completion_time" /> |
|||
<result property="processBadClassification" column="process_bad_classification" /> |
|||
<result property="processBadGrade" column="process_bad_grade" /> |
|||
<result property="processBadNum" column="process_bad_num" /> |
|||
<result property="unqualifiedReportUrl" column="unqualified_report_url" /> |
|||
<result property="remark" column="remark" /> |
|||
<result property="createBy" column="create_by" /> |
|||
<result property="createTime" column="create_time" /> |
|||
<result property="updateBy" column="update_by" /> |
|||
<result property="updateTime" column="update_time" /> |
|||
</resultMap> |
|||
|
|||
<sql id="selectQualityOrderReportVo"> |
|||
select quality_order_report_id, supplier_code, supplier_name, material_no, material_name, make_total, quality_hasqualified_num, ok_accepted_num, ok_report_url, special_concessions_num, special_report_url, checkout_completion_time, process_bad_classification, process_bad_grade, process_bad_num, unqualified_report_url, remark, create_by, create_time, update_by, update_time from quality_order_report |
|||
</sql> |
|||
|
|||
<select id="selectQualityOrderReportList" parameterType="QualityOrderReport" resultMap="QualityOrderReportResult"> |
|||
<include refid="selectQualityOrderReportVo"/> |
|||
<where> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="selectQualityOrderReportById" parameterType="Long" resultMap="QualityOrderReportResult"> |
|||
<include refid="selectQualityOrderReportVo"/> |
|||
where quality_order_report_id = #{qualityOrderReportId} |
|||
</select> |
|||
|
|||
<select id="selectQualityOrderReportByNoAndCode" parameterType="QualityOrderReport" resultMap="QualityOrderReportResult"> |
|||
<include refid="selectQualityOrderReportVo"/> |
|||
where material_no = #{materialNo} |
|||
and supplier_code = #{supplierCode} |
|||
</select> |
|||
|
|||
<insert id="insertQualityOrderReport" parameterType="QualityOrderReport" useGeneratedKeys="true" keyProperty="qualityOrderReportId"> |
|||
insert into quality_order_report |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="supplierCode != null">supplier_code,</if> |
|||
<if test="supplierName != null">supplier_name,</if> |
|||
<if test="materialNo != null">material_no,</if> |
|||
<if test="materialName != null">material_name,</if> |
|||
<if test="makeTotal != null">make_total,</if> |
|||
<if test="qualityHasqualifiedNum != null">quality_hasqualified_num,</if> |
|||
<if test="okAcceptedNum != null">ok_accepted_num,</if> |
|||
<if test="okReportUrl != null">ok_report_url,</if> |
|||
<if test="specialConcessionsNum != null">special_concessions_num,</if> |
|||
<if test="specialReportUrl != null">special_report_url,</if> |
|||
<if test="checkoutCompletionTime != null">checkout_completion_time,</if> |
|||
<if test="processBadClassification != null">process_bad_classification,</if> |
|||
<if test="processBadGrade != null">process_bad_grade,</if> |
|||
<if test="processBadNum != null">process_bad_num,</if> |
|||
<if test="unqualifiedReportUrl != null">unqualified_report_url,</if> |
|||
<if test="remark != null">remark,</if> |
|||
<if test="createBy != null">create_by,</if> |
|||
<if test="createTime != null">create_time,</if> |
|||
<if test="updateBy != null">update_by,</if> |
|||
<if test="updateTime != null">update_time,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="supplierCode != null">#{supplierCode},</if> |
|||
<if test="supplierName != null">#{supplierName},</if> |
|||
<if test="materialNo != null">#{materialNo},</if> |
|||
<if test="materialName != null">#{materialName},</if> |
|||
<if test="makeTotal != null">#{makeTotal},</if> |
|||
<if test="qualityHasqualifiedNum != null">#{qualityHasqualifiedNum},</if> |
|||
<if test="okAcceptedNum != null">#{okAcceptedNum},</if> |
|||
<if test="okReportUrl != null">#{okReportUrl},</if> |
|||
<if test="specialConcessionsNum != null">#{specialConcessionsNum},</if> |
|||
<if test="specialReportUrl != null">#{specialReportUrl},</if> |
|||
<if test="checkoutCompletionTime != null">#{checkoutCompletionTime},</if> |
|||
<if test="processBadClassification != null">#{processBadClassification},</if> |
|||
<if test="processBadGrade != null">#{processBadGrade},</if> |
|||
<if test="processBadNum != null">#{processBadNum},</if> |
|||
<if test="unqualifiedReportUrl != null">#{unqualifiedReportUrl},</if> |
|||
<if test="remark != null">#{remark},</if> |
|||
<if test="createBy != null">#{createBy},</if> |
|||
<if test="createTime != null">#{createTime},</if> |
|||
<if test="updateBy != null">#{updateBy},</if> |
|||
<if test="updateTime != null">#{updateTime},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateQualityOrderReport" parameterType="QualityOrderReport"> |
|||
update quality_order_report |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="supplierCode != null">supplier_code = #{supplierCode},</if> |
|||
<if test="supplierName != null">supplier_name = #{supplierName},</if> |
|||
<if test="materialNo != null">material_no = #{materialNo},</if> |
|||
<if test="materialName != null">material_name = #{materialName},</if> |
|||
<if test="makeTotal != null">make_total = #{makeTotal},</if> |
|||
<if test="qualityHasqualifiedNum != null">quality_hasqualified_num = #{qualityHasqualifiedNum},</if> |
|||
<if test="okAcceptedNum != null">ok_accepted_num = #{okAcceptedNum},</if> |
|||
<if test="okReportUrl != null">ok_report_url = #{okReportUrl},</if> |
|||
<if test="specialConcessionsNum != null">special_concessions_num = #{specialConcessionsNum},</if> |
|||
<if test="specialReportUrl != null">special_report_url = #{specialReportUrl},</if> |
|||
<if test="checkoutCompletionTime != null">checkout_completion_time = #{checkoutCompletionTime},</if> |
|||
<if test="processBadClassification != null">process_bad_classification = #{processBadClassification},</if> |
|||
<if test="processBadGrade != null">process_bad_grade = #{processBadGrade},</if> |
|||
<if test="processBadNum != null">process_bad_num = #{processBadNum},</if> |
|||
<if test="unqualifiedReportUrl != null">unqualified_report_url = #{unqualifiedReportUrl},</if> |
|||
<if test="remark != null">remark = #{remark},</if> |
|||
<if test="createBy != null">create_by = #{createBy},</if> |
|||
<if test="createTime != null">create_time = #{createTime},</if> |
|||
<if test="updateBy != null">update_by = #{updateBy},</if> |
|||
<if test="updateTime != null">update_time = #{updateTime},</if> |
|||
</trim> |
|||
where material_no = #{materialNo} |
|||
and supplier_code = #{supplierCode} |
|||
</update> |
|||
|
|||
<delete id="deleteQualityOrderReportById" parameterType="Long"> |
|||
delete from quality_order_report where quality_order_report_id = #{qualityOrderReportId} |
|||
</delete> |
|||
|
|||
<delete id="deleteQualityOrderReportByIds" parameterType="String"> |
|||
delete from quality_order_report where quality_order_report_id in |
|||
<foreach item="qualityOrderReportId" collection="array" open="(" separator="," close=")"> |
|||
#{qualityOrderReportId} |
|||
</foreach> |
|||
</delete> |
|||
|
|||
<update id="cancelQualityOrderReportById" parameterType="Long"> |
|||
update quality_order_report set del_flag = '1' where quality_order_report_id = #{qualityOrderReportId} |
|||
</update> |
|||
|
|||
<update id="restoreQualityOrderReportById" parameterType="Long"> |
|||
update quality_order_report set del_flag = '0' where quality_order_report_id = #{qualityOrderReportId} |
|||
</update> |
|||
|
|||
</mapper> |
@ -0,0 +1,276 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
|||
<head> |
|||
<th:block th:include="include :: header('修改品质管理品质单报告')" /> |
|||
<th:block th:include="include :: datetimepicker-css" /> |
|||
</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}"> |
|||
<input name="supplierCode" th:field="*{supplierCode}" type="hidden"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">料号:</label> |
|||
<div class="col-sm-6"> |
|||
<input name="materialNo" th:field="*{materialNo}" class="form-control" type="text"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">物料名称:</label> |
|||
<div class="col-sm-6"> |
|||
<input name="materialName" th:field="*{materialName}" class="form-control" type="text"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">订单数:</label> |
|||
<div class="col-sm-6"> |
|||
<input name="makeTotal" th:field="*{makeTotal}" class="form-control" type="text"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">品质已合格数:</label> |
|||
<div class="col-sm-6"> |
|||
<input name="qualityHasqualifiedNum" th:field="*{qualityHasqualifiedNum}" class="form-control" type="text"> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="container"> |
|||
<!--合格数--> |
|||
<div class="col-sm-12"> |
|||
<h3>合格数</h3> |
|||
<div class="row"> |
|||
<div class="form-group col-sm-6"> |
|||
<label class="control-label">ok允收数:</label> |
|||
<input name="okAcceptedNum" th:field="*{okAcceptedNum}" class="form-control" type="text"> |
|||
</div> |
|||
<div class="form-group col-sm-6"> |
|||
<label class="control-label">ok报告图片:</label> |
|||
<input name="okReportUrl" th:field="*{okReportUrl}" class="form-control" type="text"> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="form-group col-sm-6"> |
|||
<label class="control-label">特采/让步数:</label> |
|||
<input name="specialConcessionsNum" th:field="*{specialConcessionsNum}" class="form-control" type="text"> |
|||
</div> |
|||
<div class="form-group col-sm-6"> |
|||
<label class="control-label">特采报告图片:</label> |
|||
<input name="specialReportUrl" th:field="*{specialReportUrl}" class="form-control" type="text"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!--不合格数--> |
|||
<div class="col-sm-12"> |
|||
<div class="row"> |
|||
<div class="col-sm-12 d-flex align-items-center"> |
|||
<span style="font-weight: bold; font-family: Arial, sans-serif; font-size: 15px;">不合格数</span> |
|||
<a class="btn btn-success ml-auto" onclick="addUnqualified()"> |
|||
<i class="fa fa-plus"></i> 添加 |
|||
</a> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="col-sm-12 select-table table-striped"> |
|||
<table id="bootstrap-unqualified-table"></table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<!--其他字段--> |
|||
<div class="form-group"> |
|||
<label class="col-sm-4 control-label">检验完成时间:</label> |
|||
<div class="col-sm-8"> |
|||
<div class="input-group date"> |
|||
<input name="checkoutCompletionTime" th:value="${#dates.format(qualityOrderReport.checkoutCompletionTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text"> |
|||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-4 control-label">备注:</label> |
|||
<div class="col-sm-8"> |
|||
<textarea name="remark" th:field="*{remark}" class="form-control" type="text"></textarea> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<th:block th:include="include :: footer" /> |
|||
<th:block th:include="include :: datetimepicker-js" /> |
|||
<th:block th:include="include :: bootstrap-table-editable-js"/> |
|||
<script th:inline="javascript"> |
|||
|
|||
var processBadClassificationDatas = [[${@dict.getType('process_bad_classification')}]]; |
|||
var processBadGradeDatas = [[${@dict.getType('process_bad_grade')}]]; |
|||
|
|||
var prefix = ctx + "quality/qualityOrder"; |
|||
$("#form-qualityReport-edit").validate({ |
|||
focusCleanup: true |
|||
}); |
|||
|
|||
function submitHandler() { |
|||
// 获取表单数据 |
|||
const qualityReportData = $("#form-qualityReport-edit").serializeArray().reduce((obj, item) => { |
|||
obj[item.name] = item.value; |
|||
return obj; |
|||
}, {}); |
|||
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据 |
|||
var table = $('#bootstrap-unqualified-table').bootstrapTable('getData'); |
|||
// 检查表格数据是否为空 |
|||
if (table.length===0){ |
|||
$.modal.alertWarning("请至少添加一条不合格数再保存!"); |
|||
return; |
|||
} |
|||
console.log(JSON.stringify(table)); |
|||
// 将表数据转换成与qualityReportData格式一致的数组 |
|||
var unqualifiedDataList = table.map(function(item) { |
|||
// 根据实际字段名调整 |
|||
return { |
|||
"processBadClassification": item.processBadClassification, |
|||
"processBadGrade": item.processBadGrade, |
|||
"processBadNum": item.processBadNum, |
|||
"unqualifiedReportUrl": item.unqualifiedReportUrl |
|||
// ...其他字段 |
|||
}; |
|||
}); |
|||
|
|||
const combinedData = Object.assign({}, qualityReportData, { unqualifiedDataList: unqualifiedDataList }); |
|||
// 合并表单数据和表格数据 |
|||
// const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData); |
|||
console.log(combinedData) |
|||
// 使用 JSON.stringify() 序列化数据 |
|||
const jsonData = JSON.stringify(combinedData); |
|||
// 发送 AJAX 请求到后端接口 |
|||
$.operate.saveJson(prefix + "/qualityReport", jsonData); |
|||
} |
|||
|
|||
$("input[name='checkoutCompletionTime']").datetimepicker({ |
|||
format: "yyyy-mm-dd", |
|||
minView: "month", |
|||
autoclose: true |
|||
}); |
|||
|
|||
|
|||
|
|||
//添加不合格数 |
|||
function addUnqualified() { |
|||
// 生成一个简单的唯一标识,这里使用时间戳作为示例 |
|||
var uniqueId = new Date().getTime(); |
|||
// 创建一个新行数据模板,这里仅为示例,具体根据表格列来定义 |
|||
var newRow = { |
|||
qualityOrderReportId:uniqueId, |
|||
processBadClassification: "", |
|||
processBadGrade: "", |
|||
processBadNum: "", |
|||
unqualifiedReportUrl: "" |
|||
}; |
|||
|
|||
// 使用Bootstrap Table的API插入新行 |
|||
$('#bootstrap-unqualified-table').bootstrapTable('append', newRow); |
|||
|
|||
} |
|||
//收款凭证table列表 |
|||
$(function() { |
|||
var options = { |
|||
id:"bootstrap-unqualified-table", |
|||
modalName: "收款凭证", |
|||
showColumns: false, |
|||
pagination: false, |
|||
showToggle: false, |
|||
showRefresh:false, |
|||
showSearch:false, |
|||
singleSelect:true, |
|||
columns: [{ |
|||
checkbox: false |
|||
}, |
|||
{ |
|||
title: '品质报告单id', |
|||
field: 'qualityOrderReportId', |
|||
visible: false |
|||
}, |
|||
{ |
|||
title: '不良分类', |
|||
field: 'processBadClassification', |
|||
formatter: function(index, row, value) { |
|||
return dictToSelectWithEvent(processBadClassificationDatas, value, "processBadClassification", "bootstrap-unqualified-table"); |
|||
} |
|||
}, |
|||
{ |
|||
title: '不良等级', |
|||
field: 'processBadGrade', |
|||
formatter: function(index, row, value) { |
|||
return dictToSelectWithEvent(processBadGradeDatas, value, "processBadGrade", "bootstrap-unqualified-table"); |
|||
} |
|||
|
|||
}, |
|||
|
|||
{ |
|||
title: '数量', |
|||
field: 'processBadNum', |
|||
editable:true |
|||
}, |
|||
{ |
|||
title: '报告', |
|||
field: 'unqualifiedReportUrl', |
|||
editable: { |
|||
type: 'text', // 表示该列可以被编辑为文本 |
|||
}, |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
align: 'center', |
|||
formatter: function(value, row, index) { |
|||
var actions = []; |
|||
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.qualityOrderReportId + '\')"><i class="fa fa-remove"></i>删除</a> '); |
|||
return actions.join(''); |
|||
} |
|||
} |
|||
] |
|||
}; |
|||
$.table.init(options); |
|||
|
|||
// 添加全局事件处理器 |
|||
window.updateTableRow = function(tableId, element) { |
|||
var $table = $("#" + tableId); |
|||
var rowIndex = $($element).closest('tr[data-index]').data('index'); |
|||
var fieldName = $(element).attr('name'); |
|||
var newValue = $(element).val(); |
|||
|
|||
// 直接更新Bootstrap Table的数据源 |
|||
var data = $table.bootstrapTable('getData'); |
|||
data[rowIndex][fieldName] = newValue; |
|||
$table.bootstrapTable('load', data); |
|||
}; |
|||
}) |
|||
|
|||
|
|||
// 逻辑删除不合格数前端的一行数据 |
|||
function removeRow(qualityOrderReportId){ |
|||
console.log(qualityOrderReportId); |
|||
// 直接使用 receivablesRecordsId 值进行删除操作 |
|||
$("#bootstrap-unqualified-table").bootstrapTable('remove', { |
|||
field: 'qualityOrderReportId', |
|||
values: qualityOrderReportId |
|||
}); |
|||
} |
|||
|
|||
|
|||
// 数据字典转下拉框,并添加事件监听 |
|||
function dictToSelectWithEvent(datas, value, name, tableId) { |
|||
var selectHtml = $("<select>", { |
|||
"class": "form-control", |
|||
"name": name, |
|||
"onchange": "updateTableRow('" + tableId + "', this);" |
|||
}); |
|||
$.each(datas, function(index, dict) { |
|||
$("<option>") |
|||
.val(dict.dictValue) |
|||
.text(dict.dictLabel) |
|||
.attr("selected", dict.dictValue === value) |
|||
.appendTo(selectHtml); |
|||
}); |
|||
return selectHtml.prop("outerHTML"); |
|||
} |
|||
</script> |
|||
</body> |
|||
</html> |
Loading…
Reference in new issue