Browse Source

[feat]

品质管理 制程检验
修改制程检验详情页面,补全字段,添加检验报告跳转方法;
新增检验报告详情页面;
修改制程检验controller,新增报告详情、导出接口;
修改制程检验service查询检验单物料接口,去除多余步骤;
新增制程检验service根据制程检验单号和料号查询详情接口;
dev
王晓迪 3 months ago
parent
commit
b71f486439
  1. 31
      ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityManufacturingCheckoutController.java
  2. 8
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityManufacturingCheckoutService.java
  3. 50
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityManufacturingCheckoutServiceImpl.java
  4. 275
      ruoyi-admin/src/main/resources/templates/quality/manufacturingCheckout/checkoutReportDetail.html
  5. 104
      ruoyi-admin/src/main/resources/templates/quality/manufacturingCheckout/detail.html

31
ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityManufacturingCheckoutController.java

@ -4,6 +4,7 @@ import java.util.List;
import com.ruoyi.aftersales.domain.AftersalesComplaintNoticeDetail;
import com.ruoyi.aftersales.domain.vo.AftersalesMaterialVO;
import com.ruoyi.erp.domain.ErpBom;
import com.ruoyi.quality.domain.QualityManufacturingCheckoutMaterial;
import com.ruoyi.quality.domain.QualityManufacturingProcess;
import com.ruoyi.quality.domain.VO.CheckoutMaterialVO;
@ -63,6 +64,22 @@ public class QualityManufacturingCheckoutController extends BaseController
@Log(title = "品质管理制程检验", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(@RequestBody String[] checkouts)
{
String checkoutString = String.join(",", checkouts); // 带分隔符
// List<ErpBom> list = erpBomService.getExportListByNos(bomNos);
// ExcelUtil<> util = new ExcelUtil<ErpBom>(ErpBom.class);
// return util.exportExcel(list, bomNoString);
return AjaxResult.success();
}
/**
* 导出品质管理制程检验列表
*/
@RequiresPermissions("quality:manufacturingCheckout:export")
@Log(title = "品质管理制程检验", businessType = BusinessType.EXPORT)
@PostMapping("/exportAll")
@ResponseBody
public AjaxResult export(QualityManufacturingCheckout qualityManufacturingCheckout)
{
List<QualityManufacturingCheckout> list = qualityManufacturingCheckoutService.selectQualityManufacturingCheckoutList(qualityManufacturingCheckout);
@ -226,7 +243,19 @@ public class QualityManufacturingCheckoutController extends BaseController
@PostMapping("/getMaterialListByCode")
public TableDataInfo getMaterialListByCode(QualityManufacturingCheckout qualityManufacturingCheckout){
startPage();
List<CheckoutMaterialVO> list = qualityManufacturingCheckoutService.selectMaterialListByCode(qualityManufacturingCheckout.getManufacturingCheckoutCode());
// List<CheckoutMaterialVO> list = qualityManufacturingCheckoutService.selectMaterialListByCode(qualityManufacturingCheckout.getManufacturingCheckoutCode());
List<QualityManufacturingCheckoutMaterial> list = qualityManufacturingCheckoutService.selectMaterialListByCode(qualityManufacturingCheckout.getManufacturingCheckoutCode());
return getDataTable(list);
}
/**
* 制程检验报告详情
*/
@GetMapping("/checkoutReportDetail/{materialNo}/{manufacturingCheckoutCode}")
public String checkoutReportDetail(@PathVariable("materialNo") String materialNo, @PathVariable("manufacturingCheckoutCode") String manufacturingCheckoutCode,ModelMap mmap)
{
QualityManufacturingCheckoutMaterial qualityManufacturingCheckoutMaterial = qualityManufacturingCheckoutService.selectDetailByCodes(materialNo,manufacturingCheckoutCode);
mmap.put("qualityManufacturingCheckoutMaterial", qualityManufacturingCheckoutMaterial);
return prefix + "/checkoutReportDetail";
}
}

8
ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityManufacturingCheckoutService.java

@ -102,10 +102,16 @@ public interface IQualityManufacturingCheckoutService
/*
* 根据制程检验单号查找制程检验物料
* */
List<CheckoutMaterialVO> selectMaterialListByCode(String manufacturingCheckoutCode);
List<QualityManufacturingCheckoutMaterial> selectMaterialListByCode(String manufacturingCheckoutCode);
/*
* 制程检验详情
* */
int detailQualityManufacturingCheckout(QualityManufacturingCheckout qualityManufacturingCheckout);
/*
* 根据制程检验单号和料号查找制程检验物料及详情
* */
QualityManufacturingCheckoutMaterial selectDetailByCodes(String materialNo, String manufacturingCheckoutCode);
}

50
ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityManufacturingCheckoutServiceImpl.java

@ -2,9 +2,7 @@ package com.ruoyi.quality.service.impl;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import com.ruoyi.aftersales.domain.vo.AftersalesMaterialVO;
@ -138,6 +136,7 @@ public class QualityManufacturingCheckoutServiceImpl implements IQualityManufact
}else{
for (QualityManufacturingUnqualifiedClass unqualified:unqualifiedClassList) {
unqualified.setManufacturingCheckoutCode(newCode);
unqualified.setMaterialNo(process.getMaterialNo());
unqualified.setManufacturingProcessCode(process.getManufacturingProcessCode());
unqualified.setManufacturingProcessName(process.getManufacturingProcessName());
unqualified.setCreateBy(loginName);
@ -329,30 +328,45 @@ public class QualityManufacturingCheckoutServiceImpl implements IQualityManufact
}
@Override
public List<CheckoutMaterialVO> selectMaterialListByCode(String manufacturingCheckoutCode) {
ArrayList<CheckoutMaterialVO> checkoutMaterialVOS = new ArrayList<>();
public List<QualityManufacturingCheckoutMaterial> selectMaterialListByCode(String manufacturingCheckoutCode) {
List<QualityManufacturingCheckoutMaterial> checkoutMaterials = checkoutMaterialMapper.selectCheckoutMaterialByCode(manufacturingCheckoutCode);
if (StringUtils.isEmpty(checkoutMaterials)){
// 记录日志
log.warn("未查找到与制程检验单号关联的物料相关数据, 制程检验单号: {}", manufacturingCheckoutCode);
}
for (QualityManufacturingCheckoutMaterial checkoutMaterial : checkoutMaterials) {
CheckoutMaterialVO checkoutMaterialVO = new CheckoutMaterialVO();
checkoutMaterialVO.setMaterialNo(checkoutMaterial.getMaterialNo());
checkoutMaterialVO.setMaterialBrand(checkoutMaterial.getMaterialBrand());
checkoutMaterialVO.setMaterialDescribe(checkoutMaterial.getMaterialDescribe());
checkoutMaterialVO.setMaterialName(checkoutMaterial.getMaterialName());
checkoutMaterialVO.setMaterialProcessMethod(checkoutMaterial.getMaterialProcessMethod());
checkoutMaterialVO.setMaterialPhotourl(checkoutMaterial.getMaterialPhotourl());
checkoutMaterialVO.setMaterialUnit(checkoutMaterial.getMaterialUnit());
checkoutMaterialVO.setMaterialType(checkoutMaterial.getMaterialType());
checkoutMaterialVOS.add(checkoutMaterialVO);
}
return checkoutMaterialVOS;
return checkoutMaterials;
}
@Override
public int detailQualityManufacturingCheckout(QualityManufacturingCheckout qualityManufacturingCheckout) {
return 1;
}
/*
* 根据制程检验单号和料号查找制程检验物料及详情
* */
@Override
public QualityManufacturingCheckoutMaterial selectDetailByCodes(String materialNo, String manufacturingCheckoutCode) {
Map<String, Object> params = new HashMap<>();
params.put("materialNo", materialNo);
params.put("manufacturingCheckoutCode", manufacturingCheckoutCode);
QualityManufacturingCheckoutMaterial checkoutMaterial = checkoutMaterialMapper.selectCheckoutMaterialByCodes(params);
List<QualityManufacturingMaterialProcess> materialProcessList = materialProcessMapper.selectCheckoutMaterialProcessByCodes(params);
if (StringUtils.isEmpty(materialProcessList)){
// 记录日志
log.warn("未查找到与制程检验单号和料号关联的工序相关数据, 制程检验单号: {}", manufacturingCheckoutCode);
}else{
for (QualityManufacturingMaterialProcess process:materialProcessList) {
Map<String, Object> codes = new HashMap<>();
codes.put("manufacturingCheckoutCode", manufacturingCheckoutCode);
codes.put("materialNo", materialNo);
codes.put("manufacturingProcessCode", process.getManufacturingProcessCode());
List<QualityManufacturingUnqualifiedClass> unqualifiedClassList = unqualifiedClassMapper.selectCheckoutUnqualifiedClassByCodes(codes);
process.setUnqualifiedClassList(unqualifiedClassList);
}
}
checkoutMaterial.setMaterialProcessList(materialProcessList);
return checkoutMaterial;
}
}

275
ruoyi-admin/src/main/resources/templates/quality/manufacturingCheckout/checkoutReportDetail.html

@ -0,0 +1,275 @@
<!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" />
<style>
.table-striped{
height: 135px;
}
.table-striped-two{
overflow: hidden;
scroll: auto;
}
.bordered-container {
/* 自动高度,根据内容自动调整 */
min-height: 0; /* 确保高度能收缩至内容高度 */
/* 自动宽度,对于块级元素已经是默认行为,但如果你想强调这一点或针对特定情况,可以显式声明 */
width: auto;
height: auto;
border: 2px solid #888; /* 灰色边框,可根据需要调整颜色 */
/* 以下可选,根据需要添加,用于控制内外边距和布局 */
padding: 1rem;
box-sizing: border-box; /* 包含边框和内边距在宽度计算中 */
margin-bottom: 20px;
}
.move-right{
margin-left: 13px
}
</style>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-checkoutReport-add" th:object="${qualityManufacturingCheckoutMaterial}">
<input name="manufacturingCheckoutMaterialId" th:field="*{manufacturingCheckoutMaterialId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">料号:</label>
<div class="col-sm-8">
<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-8">
<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-8">
<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-8">
<input name="checkedNum" th:field="*{checkedNum}" class="form-control" type="text">
</div>
</div>
<div class="container mt-5">
<div class="btn-group-sm">
<span>制程工序</span>
</div>
<div id="contentArea" class="mt-3">
<!-- 初始内容可以在这里,例如一个列表项和一个表单 -->
</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 manufacturingProcessNameDatas = [[${@dict.getType('manufacturing_process_name')}]];
var processBadClassificationDatas = [[${@dict.getType('process_bad_classification')}]];
var processBadGradeDatas = [[${@dict.getType('process_bad_grade')}]];
var prefix = ctx + "quality/manufacturingCheckout";
$("#form-checkoutReport-add").validate({focusCleanup: true});
$(function () {
var processList = [[${qualityManufacturingCheckoutMaterial.materialProcessList}]]
processList.forEach(function (process, index){
var newItem =
"<div class='container bordered-container'>" +
"<div class='col-sm-12 my-3'>" +
"<h5>制程工序"+(index+1)+"</h5>" +
"<div class='col-sm-12 select-table table-striped'>" +
'<table class="table-container checkoutMaterial-edit-table" id="bootstrap-manufacturingProcess-table-'+process.manufacturingProcessCode+'"></table>' +
"</div>" +
"</div>" +
"<div class='col-sm-12 move-right'>" +
"<h5>合格数</h5>" +
'<form id="form-manfa-'+ process.manufacturingProcessCode +'"> ' +
"<div class='form-group'> "+
"<label for='okAcceptedNum'>OK允收数:</label>" +
"<input type='text' class='form-control' id='okAcceptedNum' name='okAcceptedNum' value='"+process.okAcceptedNum+"'>" +
"</div>"+
" <div class='form-group'> "+
"<label for='qualifiedNum'>特采/让步数:</label>" +
"<input type='text' class='form-control' id='specialConcessionsNum' name='specialConcessionsNum' value='"+process.specialConcessionsNum+"'>"+
"</div>"+
"</form>"+
"</div>" +
"<div class='col-sm-12 my-3'>" +
"<h5>不合格数</h5>" +
"<div class='col-sm-12 select-table table-striped-two'>" +
'<table class="table-container checkoutMaterial-edit-table" id="bootstrap-unqualifiedClass-table-' + process.manufacturingProcessCode + '"></table>' +
"</div>" +
"</div>" +
"</div>";
$("#contentArea").append(newItem);
var processData = [];
processData.push(process);
var options1 = {
id:'bootstrap-manufacturingProcess-table-'+process.manufacturingProcessCode,
data: processData,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
pagination: false, // 设置不分页
modalName: "制程工序",
height:30,
columns: [
{
title: '制程工序编号',
field: 'manufacturingProcessCode',
},
{
title: '制程工序名称',
field: 'manufacturingProcessName',
formatter: function(value, row, index) {
return $.table.selectDictLabel(manufacturingProcessNameDatas, value);
}
},
{
title: '设备名称',
field: 'deviceName',
},
{
title: '设备型号',
field: 'deviceModelCode',
},
{
title: '工序顺序',
field: 'processSequence',
},
{
title: '车间名称',
field: 'workshopName',
},
{
title: '零件名称',
field: 'modName',
},
{
title: '工序检验项目',
field: 'processInspectionItem',
},
],
};
$.table.init(options1);
var unqualifiedClassList = process.unqualifiedClassList;
console.log(unqualifiedClassList);
//不合格数
var options2 = {
id:'bootstrap-unqualifiedClass-table-' + process.manufacturingProcessCode,
data: process.unqualifiedClassList,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
pagination: false, // 设置不分页
modalName: "不合格分类",
columns: [
{
title: '不合格分类Id',
field: 'manufacturingUnqualifiedClassId',
visible: false,
},
{
title: '不良分类',
field: 'processBadClassification',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processBadClassificationDatas, value);
}
},
{
title: '不良等级',
field: 'processBadGrade',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processBadGradeDatas, value);
}
},
{
title: '不良数量',
field: 'processBadNum',
},
]
};
$.table.init(options2);
})
})
function insertRow() {
var bootstarpId = "bootstrap-manufacturingProcess-table-" + uniqueId +"";
$("#bootstrap-manufacturingProcess-table-" +uniqueId ).bootstrapTable('insertRow', {
index: 1,
row: {
manufacturingProcessCode: '',
manufacturingProcessName: '',
deviceName: '',
deviceModelCode: '',
processSequence: '',
workshopName: '',
modName: ''
}
});
selectProcessCode(bootstarpId);
};
function handleManufacturingProcessChange(selectElement, tableId, selectId, index) {
var selectedValue = $(selectElement).val();
if (selectedValue) {
$.ajax({
url: ctx + 'quality/manufacturingProcess/getProcessByCode/' + selectedValue,
method: 'GET',
dataType: 'json',
success: function(response) {
if (response.data) {
var newData = response.data;
var newRowData = {
// manufacturingProcessCode: newData.manufacturingProcessCode || '', // 添加此行
manufacturingProcessName: newData.manufacturingProcessName || '',
deviceName: newData.deviceName || '',
deviceModelCode: newData.deviceModelCode || '',
processSequence: newData.processSequence || '',
workshopName: newData.workshopName || '',
modName: newData.modName || '',
processInspectionItem: newData.processInspectionItem || '',
};
var processName = newData.manufacturingProcessName;
// 使用Bootstrap Table的updateRow方法更新表格数据,注意这里使用传入的索引
$('#' + tableId).bootstrapTable('updateRow', {
index: index, // 使用传递进来的索引
row: newRowData
});
// 重新初始化下拉框
initSelector(tableId);
// 下拉框赋值
$('#' + tableId).find('select[name="manufacturingProcessCode"]').val(selectedValue);
$('#' + tableId).find('select[name="manufacturingProcessName"]').val(processName);
} else {
console.error('后端请求数据为空');
}
},
error: function(xhr, status, error) {
console.error('请求出错:', status, ", ", error);
}
});
}
}
</script>
</body>
</html>

104
ruoyi-admin/src/main/resources/templates/quality/manufacturingCheckout/detail.html

@ -12,9 +12,8 @@
<div class="form-group">
<label class="col-sm-4 control-label">生产单号:</label>
<div class="col-sm-8">
<select class="form-control" id="makeNo" name="makeNo" th:field="*{makeNo}" disabled>
<input class="form-control" id="makeNo" name="makeNo" th:field="*{makeNo}" disabled>
<!-- 这里动态生成生产单号选项 -->
</select>
</div>
</div>
<div class="form-group">
@ -44,9 +43,11 @@
var qualityManufacturingCheckout = [[${qualityManufacturingCheckout}]];
var makeNo = [[${qualityManufacturingCheckout.makeNo}]];
var prefix = ctx + "quality/manufacturingCheckout";
var processMethodDatas = [[${@dict.getType('processMethod')}]];
$("#form-manufacturingCheckout-edit").validate({focusCleanup: true });
//物料信息展示列表
$(function() {
$('#makeNo').val(makeNo);
var options = {
url: ctx + "quality/manufacturingCheckout/getMaterialListByCode",
showSearch: false,
@ -90,6 +91,9 @@
{
title: '物料加工方式',
field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
title: '订单数',
@ -111,7 +115,7 @@
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="checkoutReport(\'' + row.materialNo + '\')"><i class="fa fa-plus"></i>检验报告</a> ');
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="checkoutReport(\'' + row.materialNo + '\')">检验报告</a> ');
return actions.join('');
}
},
@ -123,19 +127,9 @@
title: '工序不合格数',
field: 'processUnqualifiedNum',
},
{
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.materialNo + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join('');
}
}
]
};
$.table.init(options);
loadAllMakeNos();
})
function queryParams(params) {
@ -158,90 +152,10 @@
});
/*加载所有的关联生产单号*/
function loadAllMakeNos(){
var url = ctx + 'system/makeorder/getAllMakeNos';
$.ajax({
type:'GET',//请求类型
url:url,//后端接口url
dataType:'json', //预期服务器返回数据类型
success: function (data){
if (data && Array.isArray(data)){
var selectElement = $("#form-manufacturingCheckout-edit select[name='makeNo']"); //获取生产编号下拉框元素
//清空下拉框现有选项
selectElement.empty();
// 添加默认选项(如果需要)
selectElement.append('<option value="">请选择关联生产单号</option>');
//遍历返回的数据,添加下拉框的选项
$.each(data,function (index,item){
//赋值遍历数据中的makeNo到下拉框中
selectElement.append('<option value="'+item.makeNo+'">'+item.makeNo+'</option>');
})
$("#makeNo").val(makeNo);
}else {
$.modal.error("数据为空");
}
}
})
}
/*选择物料按钮*/
function insertRow() {
var selectedMakeNo = $("#makeNo").val();
if (!selectedMakeNo) {
$.modal.alertWarning("请先选择生产单号。");
return;
}
var encodedMakeNo = encodeURIComponent(selectedMakeNo);
var url = ctx + 'quality/manufacturingCheckout/materialSelect?makeNo=' + encodedMakeNo;
var options = {
title: '选择物料',
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
function doSubmit(index, layero,uniqueId){
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-materialSelect-table').bootstrapTable('getSelections')[0];
console.log("rowData: "+rowData);
$("#bootstrap-table").bootstrapTable('insertRow', {
index:1,
row: {
materialNo:rowData.materialNo,
materialPhotourl:rowData.materialPhotourl,
materialName: rowData.materialName,
materialType: rowData.materialType,
materialDescribe: rowData.materialDescribe,
materialBrand: rowData.materialBrand,
materialUnit: rowData.materialUnit,
materialProcessMethod: rowData.materialProcessMethod,
makeTotal:rowData.makeTotal
}
})
layer.close(index);
}
// 逻辑删除前端的一行数据
function removeRow(materialNo){
$("#bootstrap-table").bootstrapTable('remove', {
field: 'materialNo',
values: materialNo
})
}
/*检验报告*/
function checkoutReport(materialNo){
var makeNo = $('#makeNo').val(); //获取生产编号下拉框元素
var url = ctx + 'quality/manufacturingCheckout/checkoutReport/' + materialNo+'/'+makeNo;
var manufacturingCheckoutCode = $('#manufacturingCheckoutCode').val(); //获取制程检验单编号
var url = ctx + 'quality/manufacturingCheckout/checkoutReportDetail/' + materialNo+'/'+manufacturingCheckoutCode;
$.modal.open("制程检验报告",url);
}
</script>

Loading…
Cancel
Save