Browse Source

[feat]

品质管理 品质单
修改生产入库开始品质(成品品质)页面,按照prd要求实现相应模块及功能;
修改生产入库开始品质详情页面,集成成品和半成品品质详情显示;
修改品质单列表页面,搜索栏新增字段,调整按钮对应显示状态及跳转函数;
修改来料品质开始品质页面,按照prd要求修改相应模块,实现页面显示效果;
dev
王晓迪 3 days ago
parent
commit
22b14260a1
  1. 629
      ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeStartingQuality.html
  2. 146
      ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeStartingQualityDetail.html
  3. 96
      ruoyi-admin/src/main/resources/templates/quality/qualityOrder/qualityOrder.html
  4. 436
      ruoyi-admin/src/main/resources/templates/quality/qualityOrder/startingQuality.html

629
ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeStartingQuality.html

@ -1,49 +1,56 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head> <head>
<th:block th:include="include :: header('生产入库品质')" /> <th:block th:include="include :: header('生产入库品质(成品品质)')" />
<th:block th:include="include :: datetimepicker-css" /> <th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: bootstrap-editable-css" />
</head> </head>
<style>
.fixed-table-container {
border: 0px solid #ddd;
min-height: 90px;
}
</style>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-makeInStartingQuality-edit" th:object="${qualityOrder}"> <form class="form-horizontal m" id="form-makeInStartingQuality-edit" th:object="${qualityOrder}">
<input name="qualityOrderId" th:field="*{qualityOrderId}" type="hidden"> <input name="qualityOrderId" th:field="*{qualityOrderId}" type="hidden">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">品质单号:</label> <label class="col-sm-4 control-label">品质单号:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="qualityOrderCode" th:field="*{qualityOrderCode}" class="form-control" type="text"> <input readonly name="qualityOrderCode" th:field="*{qualityOrderCode}" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">入库单号:</label> <label class="col-sm-4 control-label">入库单号:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="inStorageCode" th:field="*{inStorageCode}" class="form-control" type="text"> <input readonly name="inStorageCode" th:field="*{inStorageCode}" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">关联订单号:</label> <label class="col-sm-4 control-label">关联订单号:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="relatedOrderCode" th:field="*{relatedOrderCode}" class="form-control" type="text"> <input readonly name="relatedOrderCode" th:field="*{relatedOrderCode}" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">品质单订单类型:</label> <label class="col-sm-4 control-label">品质单订单类型:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="qualityOrderType" class="form-control m-b" th:with="type=${@dict.getType('quality_order_type')}"> <select disabled id="qualityOrderType" name="qualityOrderType" class="form-control m-b" th:with="type=${@dict.getType('quality_order_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{qualityOrderType}"></option> <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{qualityOrderType}"></option>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">品质单入库类型:</label> <label class="col-sm-4 control-label">品质单入库类型:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="qualityStorageStatus" class="form-control m-b" th:with="type=${@dict.getType('quality_storage_status')}"> <select disabled id="qualityStorageStatus" name="qualityStorageStatus" class="form-control m-b" th:with="type=${@dict.getType('quality_storage_status')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{qualityStorageStatus}"></option> <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{qualityStorageStatus}"></option>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">交付质检时间:</label> <label class="col-sm-4 control-label">交付质检时间:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div class="input-group date"> <div class="input-group date">
<input name="deliveryInspectionTime" th:value="${#dates.format(qualityOrder.deliveryInspectionTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text"> <input name="deliveryInspectionTime" th:value="${#dates.format(qualityOrder.deliveryInspectionTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
@ -51,26 +58,115 @@
</div> </div>
</div> </div>
</div> </div>
</form>
<!--物料信息--> <!--物料信息-->
<div class="container" > <div class="container" >
<div class="row"> <div class="row">
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12" style="height: 100px;padding-left: 50px;">
<table id="bootstrap-table"></table> <table id="bootstrap-material-table"></table>
</div>
</div>
</div>
<div class="container">
<h3 style="color: blue;">品质报告:</h3>
<div class="col-sm-12">
<h3>合格数</h3>
<div class="row">
<div class="form-group col-sm-6">
<label class="col-sm-4 control-label is-required">ok允收数:</label>
<div class="col-sm-8">
<input id="okAcceptedNum" name="okAcceptedNum" class="form-control" type="number" value="0" required>
</div>
</div>
<div class="form-group col-sm-6">
<label class="col-sm-4 control-label">ok报告图片:</label>
<div class="col-sm-8">
<input name="okReportUrl" class="form-control" type="text">
</div>
</div>
</div>
<div class="row">
<div class="form-group col-sm-6">
<label class="col-sm-4 control-label is-required">特采/让步数:</label>
<div class="col-sm-8">
<input id="specialConcessionsNum" name="specialConcessionsNum" class="form-control" type="number" value="0" required>
</div>
</div>
<div class="form-group col-sm-6">
<label class="col-sm-4 control-label">特采报告图片:</label>
<div class="col-sm-8">
<input name="specialReportUrl" class="form-control" type="text">
</div>
</div>
</div>
</div>
<!--不合格数-->
<div class="col-sm-12">
<div class="row">
<div class="col-sm-12 align-items-center">
<span style="font-weight: bold; font-family: Arial, sans-serif; font-size: 15px;padding-left: 0px;">不良数</span>
<div class="row">
<div class="form-group col-sm-6">
<label class="col-sm-4 control-label is-required">不良数:</label>
<div class="col-sm-8">
<input readonly id="processBadNum" name="processBadNum" class="form-control" type="number" value="0" required>
</div> </div>
</div> </div>
<div class="form-group col-sm-6">
<label class="col-sm-4 control-label">检验完成时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="checkoutCompletionTime" 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>
</div>
</div>
<div class="container">
<a class="btn btn-success ml-auto" onclick="addShippingDevice()">
<i class="fa fa-plus"></i> 添加出货设备
</a>
</div>
<div class="container" id="shippingDevice">
</div>
</div>
</div>
<!--其他字段-->
<div class="form-group" style="margin-top: 20px;">
<label class="col-sm-4 control-label">备注:</label>
<div class="col-sm-8">
<textarea name="remark" class="form-control" type="text"></textarea>
</div> </div>
</div> </div>
</form>
</div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" /> <th:block th:include="include :: datetimepicker-js" />
<!--用于可以修改列表字段的插件--> <!--用于可以修改列表字段的插件-->
<th:block th:include="include :: bootstrap-table-editable-js" /> <th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript"> <script th:inline="javascript">
var qualityOrderCode = [[${qualityOrder.qualityOrderCode}]] var qualityOrderCode = [[${qualityOrder.qualityOrderCode}]]
var qualityOrder = [[${qualityOrder}]] var qualityOrder = [[${qualityOrder}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var processBadClassificationDatas = [[${@dict.getType('process_bad_classification')}]];
var processBadGradeDatas = [[${@dict.getType('process_bad_grade')}]];
var tableIndex = 0;
var tableIdList = [];
var divIdList = [];
var prefix = ctx + "quality/qualityOrder"; var prefix = ctx + "quality/qualityOrder";
var reportPrefix = ctx + "quality/qualityReport";
$("#form-makeInStartingQuality-edit").validate({ $("#form-makeInStartingQuality-edit").validate({
focusCleanup: true focusCleanup: true
}); });
@ -81,67 +177,21 @@
autoclose: true autoclose: true
}); });
// 新增提交
function submitHandler() {
// 获取表单数据
const qualityOrderData = $("#form-makeInStartingQuality-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据
var table = $('#bootstrap-table').bootstrapTable('getData');
// 将表数据转换成与complaintNoticeData格式一致的数组
var materialDataList = table.map(function(item) {
// 根据实际字段名调整
return {
"qualityOrderDetailId": item.qualityOrderDetailId,
"materialNo": item.materialNo,
"materialNo": item.materialNo,
"materialName": item.materialName,
"materialType": item.materialType,
"materialPhotourl": item.materialPhotourl,
"materialDescribe": item.materialDescribe,
"materialBrand": item.materialBrand,
"materialUnit": item.materialUnit,
"materialProcessMethod": item.materialProcessMethod,
"thisArrivedNum": item.thisArrivedNum,
"qualityQualifiedNum": item.qualityQualifiedNum,
"qualityUnqualifiedNum": item.qualityUnqualifiedNum,
"makeTotal":item.makeTotal,
"materialDeptType": item.materialDeptType,
"makeCompletionNum":item.makeCompletionNum
// ...其他字段
};
});
const combinedData = Object.assign({}, qualityOrderData, {
qualityOrderDetailList: materialDataList,
});
// 合并表单数据和表格数据
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/makeStartingQuality", jsonData);
}
//物料信息展示列表 //物料信息展示列表
$(function() { $(function() {
sessionStorage.clear();
var options = { var options = {
modalName: "选择物料", modalName: "品质单物料",
id: "bootstrap-material-table",
url: prefix + "/getMaterialListByQualityOrderCode", url: prefix + "/getMaterialListByQualityOrderCode",
queryParams: queryParams, queryParams: queryParams,
showSearch: false, showSearch: false,
showRefresh: false, showRefresh: false,
showToggle: false, showToggle: false,
showColumns: false, showColumns: false,
height: 40,
pagination: false, // 设置不分页 pagination: false, // 设置不分页
columns: [{ columns: [
checkbox: true
},
{ {
title: '品质单详情ID', title: '品质单详情ID',
field: 'qualityOrderDetailId', field: 'qualityOrderDetailId',
@ -149,105 +199,464 @@
}, },
{ {
title: '料号', title: '料号',
field: 'materialNo' field: 'materialNo',
align: 'center',
}, },
{ {
title: '物料名称', title: '物料名称',
align: 'center',
field: 'materialName' field: 'materialName'
}, },
{ {
title: '物料类型', title: '物料类型',
align: 'center',
field: 'materialType', field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
}, },
{ {
title: '物料图片地址', field: 'materialModel',
align: 'center',
title: '型号',
},
{
title: '图片',
align: 'center',
field: 'materialPhotourl', field: 'materialPhotourl',
}, },
{ {
title: '物料描述', title: '描述',
align: 'center',
field: 'materialDescribe', field: 'materialDescribe',
}, },
{ {
title: '物料品牌', title: '品牌',
align: 'center',
field: 'materialBrand', field: 'materialBrand',
}, },
{ {
title: '物料单位', title: '单位',
align: 'center',
field: 'materialUnit', field: 'materialUnit',
}, },
{ {
title: '物料加工方式', title: '加工方式',
align: 'center',
field: 'materialProcessMethod', field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
}, },
{ {
title: '生产订单数', title: '检验数',
field: 'makeTotal', align: 'center',
field: 'checkNum',
}, },
{ {
title: '品质已合格数', title: '合格数',
field: 'qualityHasqualifiedNum', align: 'center',
field: 'qualityQualifiedNum',
}, },
{ {
title: '本次到货数', title: '不良数',
field: 'thisArrivedNum', align: 'center',
editable:{ field: 'qualityUnqualifiedNum',
type:'text',
validate: function (v) {
if (!v) return '本次到货数不能为空';
}
}, },
required:true {
title: '待审核数',
align: 'center',
field: 'pendingReviewNum',
}, },
]
};
$.table.init(options);
//移除表格上方toolbar(去除空白)
$(".fixed-table-toolbar").remove();
})
function initEquipTable(tableId){
var divId = "div_" + tableId;
divIdList.push(divId);
var $equipTable = $(
'<div id="'+ divId +'" style="border: 1px dashed blue;margin-top: 10px;">' +
' <div class="row">\n' +
' <div class="col-sm-11 table-striped" style="margin-left: 20px;padding-top: 10px;">\n' +
' <table id="'+tableId+'"></table>\n' +
' </div>\n' +
' </div>' +
'</div>'
)
$("#shippingDevice").append($equipTable);
var id = "bootstrap-equipment-table";
$("#"+tableId).bootstrapTable({
modalName: "出货设备",
showColumns: false,
pagination: false,
showToggle: false,
showRefresh:false,
showSearch:false,
singleSelect:true,
height: 40,
columns: [
{ {
title: '品质报告', title: '出货设备ID',
align: 'center',
field: 'shippingDeviceId',
},
{
title: '设备型号',
field: 'deviceModelCode',
align: 'center',
},
{
title: '追踪码',
align: 'center',
field: 'deviceRunningNumber',
},
{
title: '生产数量',
align: 'center',
field: 'makeNum',
},
{
title: '不良数量',
field: 'unqualifiedNum',
align: 'center',
},
{
title: '操作',
align: 'center', align: 'center',
formatter: function(value, row, index) { formatter: function(value, row, index) {
// 这里直接使用row对象获取supplierCode,假设它是存在的
var actions = []; var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="makeOrderReport(\'' + row.materialNo + '\')"><i class="fa fa-plus"></i>报告</a> '); actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeDevice(\'' + tableId + '\', \'' + row.shippingDeviceId + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join(''); return actions.join('');
} }
}, }
]
});
var unqualifyId = tableId + '_unqualifyList';
initUnqualifyTable(divId,unqualifyId);
//移除表格上方toolbar(去除空白)
$(".fixed-table-toolbar").remove();
}
function initUnqualifyTable(divId,tableId){
var $unqualifyDiv = $(
'<div>' +
' <a class="btn btn-success ml-auto" style="margin-left: 20px;margin-top: 5px;margin-bottom: 5px;" onclick="addUnqualified(\'' + tableId + '\')">\n' +
' <i class="fa fa-plus"></i> 添加不良分类\n' +
' </a>\n' +
' <div class="row" id="unqualified_'+tableId+'" style="padding-left: 40px;margin-bottom: 10px;">\n' +
' <div class="col-sm-11 table-striped">\n' +
' <table id="'+ tableId +'"></table>\n' +
' </div>\n' +
' </div>' +
'</div>'
)
$("#"+divId).append($unqualifyDiv);
var unqualifiedOption = {
id: tableId,
modalName: "不良数",
showColumns: false,
pagination: false,
showToggle: false,
showRefresh:false,
showSearch:false,
singleSelect:true,
height: 40,
columns: [
{ {
title: '品质合格数', title: '品质报告单id',
field: 'qualityQualifiedNum', field: 'qualityOrderReportId',
visible: false
},
{title: '不良分类',field: 'processBadClassification',
formatter:function (value, row, index) {
return processBadClassificationFormatter(value,row,index,tableId);
}
},
{title: '不良等级',field: 'processBadGrade',
formatter:function (value, row, index) {
return processBadGradeFormatter(value,row,index,tableId);
}
}, },
{ {
title: '品质不合格数', title: '数量',
field: 'qualityUnqualifiedNum', field: 'processBadNum',
editable:{
type: 'text',
mode:'inline',
validate: function (v) {
if (!v) return '数量不能为空';
if (isNaN(v)) return '数量必须是数字';
var processBadNum = parseInt(v);
if (processBadNum < 0) return '数量必须是正整数';
}
}
}, },
{ {
title: '生产完成数', title: '报告',
field: 'makeCompletionNum', field: 'unqualifiedReportUrl',
visible: false editable: {
mode:'inline',
type: 'text', // 表示该列可以被编辑为文本
},
}, },
{ {
title: '物料入库部门', title: '操作',
field: 'materialDeptType', align: 'center',
visible: false formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeUnqualify(\'' + tableId + '\', \'' + row.qualityOrderReportId + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join('');
}
} }
] ]
}; };
$.table.init(options); $.table.init(unqualifiedOption);
})
$(".fixed-table-container","#unqualified_" + tableId).css("min-height","200px");
}
function queryParams(params) { function queryParams(params) {
var curParams = { var curParams = {
// 传递参数查询参数 // 传递参数查询参数
qualityOrderCode: qualityOrderCode qualityOrderCode: qualityOrderCode
}; };
console.log(curParams);
return curParams; return curParams;
} }
$("input[name='checkoutCompletionTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
//添加不合格分类
function addUnqualified(tableId) {
var uniqueId = new Date().getTime();
var newRow = {
qualityOrderReportId:uniqueId,
processBadClassification: "",
processBadGrade: "",
processBadNum: "",
unqualifiedReportUrl: ""
};
$('#'+tableId).bootstrapTable('append', newRow);
}
function addShippingDevice(){
var qualityOrderCode = $("#qualityOrderCode").val();
var url = prefix + "/addShippingDevice/" + qualityOrderCode;
var options = {
title: '添加出货设备',
url: url,
callBack: handleShippingDeviceData
};
$.modal.openOptions(options);
}
function handleShippingDeviceData(index,layero){
var iframeWin = window[layero.find('iframe')[0]['name']];
var tableData = iframeWin.$("#bootstrap-select-table").bootstrapTable('getSelections');
if(tableData.length<=0){
$.modal.msgError("请选择一条出货设备!");
return;
}
var shippingDeviceId = tableData[0].shippingDeviceId
var equipTableId = "bootstrap-equip-table_"+shippingDeviceId;
tableIdList.push(equipTableId);
sessionStorage.setItem(shippingDeviceId,'true');
initEquipTable(equipTableId);
insertShippingDevice(equipTableId,tableData);
var unqualifiedNum = $("input[name='processBadNum']").val();
unqualifiedNum ++;
$("input[name='processBadNum']").val(unqualifiedNum);
layer.close(index);
}
function insertShippingDevice(tableId,shippingDevices){
shippingDevices.forEach(function (device){
var newRow = {
shippingDeviceId: device.shippingDeviceId,
deviceModelCode: device.deviceModelCode,
deviceRunningNumber: device.deviceRunningNumber,
makeNum: 1,
unqualifiedNum: 1,
}
$("#"+tableId).bootstrapTable('append',newRow);
})
}
//删除出货设备
function removeDevice(tableId,shippingDeviceId){
//删除整个div模块
var divId = 'div_'+tableId;
$("#"+divId).remove();
//移除div/表id列表中的值
divIdList = divIdList.filter(id => id !== divId);
tableIdList = tableIdList.filter(id => id!== tableId);
function makeOrderReport(materialNo) { //删除session中保存的已选中标识
var qualityOrderCode = [[${qualityOrder.qualityOrderCode}]]; sessionStorage.removeItem(shippingDeviceId);
var queryParams = new URLSearchParams();
queryParams.append('materialNo', materialNo);
queryParams.append('qualityOrderCode',encodeURIComponent(qualityOrderCode));
var url = ctx + 'quality/qualityOrder/makeOrderReport?' + queryParams.toString(); //不良数减少
$.modal.open("品质报告", url); var unqualifiedNum = $("input[name='processBadNum']").val();
unqualifiedNum --;
$("input[name='processBadNum']").val(unqualifiedNum);
}
//删除不良分类
function removeUnqualify(tableId,qualityOrderReportId){
$("#"+tableId).bootstrapTable('remove',{
field: 'qualityOrderReportId',
values: qualityOrderReportId
})
}
// 自定义不良分类的初始化函数
function processBadClassificationFormatter(value, row, index,tableId) {
var selectHtml = `<select class="form-control" onchange="onProcessBadClassification(this, ${index}, '${tableId}')">`;
selectHtml += '<option value=""' + (value === undefined || value === '' ? ' selected' : '') + '>所有</option>';
processBadClassificationDatas.forEach(function (child) {
selectHtml += '<option value="' + child.dictValue + '"' + (value === child.dictValue ? ' selected' : '') + '>' + child.dictLabel + '</option>';
});
selectHtml += '</select>';
return selectHtml;
}
// 列中获取不良分类的下拉改变数据
function onProcessBadClassification(selectElement, rowIndex, tableId) {
var processBadClassificationValue = $(selectElement).val();
var tableData = $("#"+tableId).bootstrapTable('getData');
var newRow = tableData[rowIndex]; // 获取当前行数据
// 更新行数据
newRow.processBadClassification = processBadClassificationValue;
$("#"+tableId).bootstrapTable('updateRow', {index: rowIndex, row: newRow});
}
// 自定义不良等级的格式化函数
function processBadGradeFormatter(value, row, index, tableId) {
var selectHtml = `<select class="form-control" onchange="onProcessBadGrade(this, ${index}, '${tableId}')">`;
selectHtml += '<option value=""' + (value === undefined || value === '' ? ' selected' : '') + '>所有</option>';
processBadGradeDatas.forEach(function (child) {
selectHtml += '<option value="' + child.dictValue + '"' + (value === child.dictValue ? ' selected' : '') + '>' + child.dictLabel + '</option>';
});
selectHtml += '</select>';
return selectHtml;
}
// 列中获取不良等级的下拉改变数据
function onProcessBadGrade(selectElement, rowIndex,tableId) {
var processBadGradeValue = $(selectElement).val();
var tableData = $("#"+tableId).bootstrapTable('getData');
var newRow = tableData[rowIndex]; // 获取当前行数据
// 重新渲染成本小类的设备名称列
// 更新行数据
newRow.processBadGrade = processBadGradeValue;
$("#"+tableId).bootstrapTable('updateRow', {index: rowIndex, row: newRow});
}
// 新增提交
function submitHandler() {
var materialData = $('#bootstrap-material-table').bootstrapTable('getData')[0];
var materialNo = materialData.materialNo;
var materialName = materialData.materialName;
const qualityReport = $("#form-makeInStartingQuality-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
qualityReport.materialNo = materialNo;
qualityReport.materialName = materialName;
//计算页面本次品质数和检验数,添加限制
var checkNum = Number(materialData.checkNum);
var qualifiedNum = Number(materialData.qualityQualifiedNum);
var unQualifiedNum = Number(materialData.qualityUnqualifiedNum);
var pendingReviewNum = Number(materialData.pendingReviewNum);
//待检验数
var remainNum = checkNum - qualifiedNum - unQualifiedNum - pendingReviewNum;
var qualityNum = 0;
//本次品质数
qualifiedNum = Number(qualityReport.okAcceptedNum) + Number(qualityReport.specialConcessionsNum) + Number(qualityReport.processBadNum);
if(qualifiedNum == 0){
$.modal.msgError('合格数、不良数不能全为空!');
return;
}
if(qualifiedNum > remainNum){
$.modal.msgError('本次品质数'+qualifiedNum+'已超过待品质数'+remainNum);
return;
}
var qualityDeviceIds = [];
var unqualifyList = [];
var unqualifyNull = false;
var classNull = false;
var gradeNull = false;
var numNull = false;
tableIdList.forEach(function (tableId){
var device = $("#" + tableId).bootstrapTable('getData')[0];
qualityDeviceIds.push(device.shippingDeviceId);
var unqualifyId = tableId + '_unqualifyList';
var unqualifyClass = $("#" + unqualifyId).bootstrapTable('getData');
if(unqualifyClass.length <= 0){
unqualifyNull = true;
return;
}
unqualifyClass.forEach(function (unqualify){
if(unqualify.processBadClassification ==''){
classNull = true;
return;
}
if(unqualify.processBadGrade ==''){
gradeNull = true;
return;
}
if(unqualify.processBadNum ==''){
numNull = true;
return;
}
unqualify.shippingDeviceId = device.shippingDeviceId;
unqualify.materialNo = materialNo;
unqualify.materialName = materialName;
unqualifyList.push(unqualify);
});
});
if(unqualifyNull){
$.modal.msgError("出货设备不良分类为空,请检查");
return;
};
if(classNull){
$.modal.msgError("不良分类值为空,请检查");
return;
};
if(gradeNull){
$.modal.msgError("不良分类等级为空,请检查");
return;
};
if(numNull){
$.modal.msgError("不良分类数量为空,请检查");
return;
};
qualityReport.qualityOrderReportType = "0";//生产成品品质
qualityReport.unqualifiedDataList = unqualifyList;
qualityReport.qualityReportDeviceIds = qualityDeviceIds;
// console.log(qualityReport);
$.operate.saveJson(reportPrefix + "/add", JSON.stringify(qualityReport));
} }
</script> </script>

146
ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeStartingQualityDetail.html

@ -4,6 +4,12 @@
<th:block th:include="include :: header('生产入库品质详情')" /> <th:block th:include="include :: header('生产入库品质详情')" />
<th:block th:include="include :: datetimepicker-css" /> <th:block th:include="include :: datetimepicker-css" />
</head> </head>
<style>
.fixed-table-container {
border: 0px solid #ddd;
min-height: 120px;
}
</style>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-makeInStartingQualityDetail-edit" th:object="${qualityOrder}"> <form class="form-horizontal m" id="form-makeInStartingQualityDetail-edit" th:object="${qualityOrder}">
@ -55,11 +61,22 @@
<!--物料信息--> <!--物料信息-->
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 table-striped">
<table id="bootstrap-table"></table> <table id="bootstrap-table"></table>
</div> </div>
</div> </div>
</div> </div>
<!--物料信息-->
<div class="container">
<h4>品质报告单:</h4>
<div class="row">
<div class="col-sm-12 table-striped" id="reportTable">
<table id="bootstrap-report-table"></table>
</div>
</div>
</div>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" /> <th:block th:include="include :: datetimepicker-js" />
@ -68,9 +85,13 @@
<script th:inline="javascript"> <script th:inline="javascript">
var qualityOrderCode = [[${qualityOrder.qualityOrderCode}]] var qualityOrderCode = [[${qualityOrder.qualityOrderCode}]];
var qualityOrder = [[${qualityOrder}]] var processMethodDatas = [[${@dict.getType('processMethod')}]];
var auditStatusDatas = [[${@dict.getType('auditStatus')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var qualityOrder = [[${qualityOrder}]];
var prefix = ctx + "quality/qualityOrder"; var prefix = ctx + "quality/qualityOrder";
var reportPrefix = ctx + "quality/qualityReport";
$("#form-makeInStartingQualityDetail-edit").validate({ $("#form-makeInStartingQualityDetail-edit").validate({
focusCleanup: true focusCleanup: true
}); });
@ -81,56 +102,19 @@
autoclose: true autoclose: true
}); });
// 新增提交
function submitHandler() {
// 获取表单数据
const qualityOrderData = $("#form-makeInStartingQualityDetail-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据
var table = $('#bootstrap-table').bootstrapTable('getData');
// 将表数据转换成与complaintNoticeData格式一致的数组
var materialDataList = table.map(function(item) {
// 根据实际字段名调整
return {
"qualityOrderDetailId": item.qualityOrderDetailId,
"materialNo": item.materialNo,
"thisArrivedNum": item.thisArrivedNum,
"qualityQualifiedNum": item.qualityQualifiedNum,
"qualityUnqualifiedNum": item.qualityUnqualifiedNum
// ...其他字段
};
});
const combinedData = Object.assign({}, qualityOrderData, {
qualityOrderDetailList: materialDataList,
});
// 合并表单数据和表格数据
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/makeInStartingQualityDetail", jsonData);
}
//物料信息展示列表 //物料信息展示列表
$(function() { $(function() {
var options = { var options = {
modalName: "选择物料", modalName: "品质单物料",
url: prefix + "/getMaterialListByQualityOrderCode", url: prefix + "/getMaterialListByQualityOrderCode",
queryParams: queryParams, queryParams: queryParams,
showSearch: false, showSearch: false,
showRefresh: false, showRefresh: false,
showToggle: false, showToggle: false,
showColumns: false, showColumns: false,
height: 40,
pagination: false, // 设置不分页 pagination: false, // 设置不分页
columns: [{ columns: [
checkbox: true
},
{ {
title: '品质单详情ID', title: '品质单详情ID',
field: 'qualityOrderDetailId', field: 'qualityOrderDetailId',
@ -147,38 +131,44 @@
{ {
title: '物料类型', title: '物料类型',
field: 'materialType', field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
}, },
{ {
title: '物料图片地址', title: '图片',
field: 'materialPhotourl', field: 'materialPhotourl',
}, },
{ {
title: '物料描述', title: '型号',
field: 'materialModel',
},
{
title: '描述',
field: 'materialDescribe', field: 'materialDescribe',
}, },
{ {
title: '物料品牌', title: '品牌',
field: 'materialBrand', field: 'materialBrand',
}, },
{ {
title: '物料单位', title: '单位',
field: 'materialUnit', field: 'materialUnit',
}, },
{ {
title: '物料加工方式', title: '加工方式',
field: 'materialProcessMethod', field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
}, },
{ {
title: '生产订单数', title: '生产订单数',
field: 'makeTotal', field: 'makeTotal',
}, },
{ {
title: '品质已合格数', title: '检验数',
field: 'qualityHasqualifiedNum', field: 'checkNum',
},
{
title: '本次到货数',
field: 'thisArrivedNum',
}, },
{ {
title: '品质合格数', title: '品质合格数',
@ -190,6 +180,54 @@
}] }]
}; };
$.table.init(options); $.table.init(options);
var reportOptions = {
id: "bootstrap-report-table",
modalName: "品质报告单",
url: reportPrefix + "/getReportList",
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
queryParams: {
qualityOrderCode: qualityOrderCode,
},
height: 40,
pagination: false, // 设置不分页
columns: [
{
title: '品质报告单号',
field: 'qualityOrderReportCode',
},
{
title: '审核状态',
field: 'auditStatus',
formatter: function(value, row, index) {
return $.table.selectDictLabel(auditStatusDatas, value);
}
},
{
title: '合格数',
field: 'qualityHasqualifiedNum'
},
{
title: '不良数',
field: 'processBadNum',
},
{
title: '创建人',
field: 'updateBy',
},
{
title: '创建时间',
field: 'updateTime',
},
]
};
$.table.init(reportOptions);
$(".fixed-table-container","#reportTable").css("min-height","200px");
}) })
function queryParams(params) { function queryParams(params) {

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

@ -18,6 +18,14 @@
<label>入库单号:</label> <label>入库单号:</label>
<input type="text" name="inStorageCode"/> <input type="text" name="inStorageCode"/>
</li> </li>
<li>
<label>料号:</label>
<input type="text" name="materialNo"/>
</li>
<li>
<label>物料名称:</label>
<input type="text" name="materialName"/>
</li>
<li> <li>
<label>品质状态:</label> <label>品质状态:</label>
<select name="qualityStatus" th:with="type=${@dict.getType('qualityStatus')}"> <select name="qualityStatus" th:with="type=${@dict.getType('qualityStatus')}">
@ -63,7 +71,6 @@
var makeStartingQualityDetailFlag = [[${@permission.hasPermi('quality:qualityOrder:makeStartingQualityDetail')}]]; var makeStartingQualityDetailFlag = [[${@permission.hasPermi('quality:qualityOrder:makeStartingQualityDetail')}]];
var qualityStatusDatas = [[${@dict.getType('qualityStatus')}]]; var qualityStatusDatas = [[${@dict.getType('qualityStatus')}]];
var qualityOrderTypeDatas = [[${@dict.getType('quality_order_type')}]]; var qualityOrderTypeDatas = [[${@dict.getType('quality_order_type')}]];
var qualityStorageStatusDatas = [[${@dict.getType('quality_storage_status')}]]; var qualityStorageStatusDatas = [[${@dict.getType('quality_storage_status')}]];
@ -71,15 +78,18 @@
$(function() { $(function() {
var options = { var options = {
url: prefix + "/list", url: prefix + "/makeQualityList",
createUrl: prefix + "/add", createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}", updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove", removeUrl: prefix + "/remove",
cancelUrl: prefix + "/cancel/{id}", cancelUrl: prefix + "/cancel/{id}",
restoreUrl: prefix + "/restore/{id}", restoreUrl: prefix + "/restore/{id}",
exportUrl: prefix + "/export", exportUrl: prefix + "/export",
fixedColumns: true, // 启用冻结列
fixedRightNumber: 1, // 冻结右列个数
modalName: "品质管理品质单", modalName: "品质管理品质单",
columns: [{ columns: [
{
checkbox: true checkbox: true
}, },
{ {
@ -101,6 +111,7 @@
{ {
title: '入库单号', title: '入库单号',
field: 'inStorageCode', field: 'inStorageCode',
visible: false,
}, },
{ {
title: '关联订单号', title: '关联订单号',
@ -122,17 +133,29 @@
} }
}, },
{ {
title: '本次到货数量', title: '料号',
field: 'materialNo',
},
{
title: '物料名称',
field: 'materialName',
},
{
title: '检验数',
field: 'thisArrivedNum', field: 'thisArrivedNum',
}, },
{ {
title: '品质合格数', title: '合格数',
field: 'qualityQualifiedNum', field: 'qualityQualifiedNum',
}, },
{ {
title: '品质不合格数', title: '不良数',
field: 'qualityUnqualifiedNum', field: 'qualityUnqualifiedNum',
}, },
{
title: '待审核数',
field: 'pendingReviewNum',
},
{ {
title: '交检时间', title: '交检时间',
field: 'deliveryInspectionTime', field: 'deliveryInspectionTime',
@ -162,40 +185,20 @@
align: 'center', align: 'center',
formatter: function(value, row, index) { formatter: function(value, row, index) {
var actions = []; var actions = [];
//采购订单品质
if (row.qualityStatus != 2 && row.qualityStorageStatus == 0 ){
actions.push('<a class="btn btn-success btn-xs ' + qualityFlag + '" href="javascript:void(0)" onclick="startingQuality(\'' + row.qualityOrderId + '\')"><i class="fa fa-edit"></i>品质</a> ');
}
//采购订单品质详情
if (row.qualityStorageStatus == 0 ){
actions.push('<a class="btn btn-success btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.qualityOrderId + '\')"><i class="fa fa-edit"></i>详情</a> ');
}
//委内入库品质
if (row.qualityStatus != 2 && row.qualityStorageStatus == 1 ){
actions.push('<a class="btn btn-success btn-xs ' + makeInStartingQualityFlag + '" href="javascript:void(0)" onclick="makeInStartingQuality(\'' + row.qualityOrderId + '\')"><i class="fa fa-edit"></i>品质</a> ');
}
//委内入库品质详情
if (row.qualityStorageStatus == 1 ){
actions.push('<a class="btn btn-success btn-xs ' + makeInStartingQualityDetailFlag + '" href="javascript:void(0)" onclick="makeInStartingQualityDetail(\'' + row.qualityOrderId + '\')"><i class="fa fa-edit"></i>详情</a> ');
}
//生产订单品质 //生产订单成品品质
if (row.qualityStatus != 2 && row.qualityStorageStatus == 4 ){ if (row.qualityStatus != 2 && row.qualityStorageStatus == 4 && (row.materialNo!=null && row.materialNo.startsWith("8"))){
actions.push('<a class="btn btn-success btn-xs ' + makeStartingQualityFlag + '" href="javascript:void(0)" onclick="makeStartingQuality(\'' + row.qualityOrderId + '\')"><i class="fa fa-edit"></i>品质</a> '); actions.push('<a class="btn btn-success btn-xs ' + makeStartingQualityFlag + '" href="javascript:void(0)" onclick="makeStartingQuality(\'' + row.qualityOrderId + '\')"><i class="fa fa-edit"></i>品质</a> ');
} }
//生产订单其他物料品质
if (row.qualityStatus != 2 && row.qualityStorageStatus == 4 && !(row.materialNo!=null && row.materialNo.startsWith("8"))){
actions.push('<a class="btn btn-success btn-xs ' + makeStartingQualityFlag + '" href="javascript:void(0)" onclick="makeOtherStartingQuality(\'' + row.qualityOrderId + '\')"><i class="fa fa-edit"></i>品质</a> ');
}
//生产订单品质详情 //生产订单品质详情
if (row.qualityStorageStatus == 4 ){ if (row.qualityStorageStatus == 4 ){
actions.push('<a class="btn btn-success btn-xs ' + makeStartingQualityDetailFlag + '" href="javascript:void(0)" onclick="makeStartingQualityDetail(\'' + row.qualityOrderId + '\')"><i class="fa fa-edit"></i>详情</a> '); actions.push('<a class="btn btn-success btn-xs ' + makeStartingQualityDetailFlag + '" href="javascript:void(0)" onclick="makeStartingQualityDetail(\'' + row.qualityOrderId + '\')"><i class="fa fa-edit"></i>详情</a> ');
} }
//委外入库品质
if (row.qualityStatus != 2 && row.qualityStorageStatus == 2 ){
actions.push('<a class="btn btn-success btn-xs ' + makeInStartingQualityFlag + '" href="javascript:void(0)" onclick="makeOutStartingQuality(\'' + row.qualityOrderId + '\')"><i class="fa fa-edit"></i>品质</a> ');
}
//委外入库品质详情
if (row.qualityStorageStatus == 2 ){
actions.push('<a class="btn btn-success btn-xs ' + makeInStartingQualityDetailFlag + '" href="javascript:void(0)" onclick="makeOutStartingQualityDetail(\'' + row.qualityOrderId + '\')"><i class="fa fa-edit"></i>详情</a> ');
}
return actions.join(''); return actions.join('');
} }
}] }]
@ -216,40 +219,35 @@
$.modal.open("品质单详情",url) $.modal.open("品质单详情",url)
} }
//委内加工单品质
function makeInStartingQuality(qualityOrderId){
var url = ctx +'quality/qualityOrder/makeInStartingQuality/' + qualityOrderId;
$.modal.open("进行品质",url)
}
//委内加工单品质详情
function makeInStartingQualityDetail(qualityOrderId){
var url = ctx +'quality/qualityOrder/makeInStartingQualityDetail/' + qualityOrderId;
$.modal.open("进行品质详情",url)
}
//委加工单品质 //委外加工单品质
function makeOutStartingQuality(qualityOrderId){ function makeOutStartingQuality(qualityOrderId){
var url = ctx +'quality/qualityOrder/makeOutStartingQuality/' + qualityOrderId; var url = ctx +'quality/qualityOrder/makeOutStartingQuality/' + qualityOrderId;
$.modal.open("进行品质",url) $.modal.open("进行品质",url)
} }
//委加工单品质详情 //委外加工单品质详情
function makeOutStartingQualityDetail(qualityOrderId){ function makeOutStartingQualityDetail(qualityOrderId){
var url = ctx +'quality/qualityOrder/makeOutStartingQualityDetail/' + qualityOrderId; var url = ctx +'quality/qualityOrder/makeOutStartingQualityDetail/' + qualityOrderId;
$.modal.open("品质详情",url) $.modal.open("品质详情",url)
} }
//生产入库品质 //生产入库成品品质
function makeStartingQuality(qualityOrderId){ function makeStartingQuality(qualityOrderId){
var url = ctx +'quality/qualityOrder/makeStartingQuality/' + qualityOrderId; var url = ctx +'quality/qualityOrder/makeStartingQuality/' + qualityOrderId;
$.modal.open("进行品质",url) $.modal.open("进行成品品质",url)
}
//生产入库半成品、其他品质
function makeOtherStartingQuality(qualityOrderId){
var url = ctx +'quality/qualityOrder/makeOtherStartingQuality/' + qualityOrderId;
$.modal.open("进行半成品、其他物料品质",url)
} }
//生产入库品质详情 //生产入库品质详情
function makeStartingQualityDetail(qualityOrderId){ function makeStartingQualityDetail(qualityOrderId){
var url = ctx +'quality/qualityOrder/makeStartingQualityDetail/' + qualityOrderId; var url = ctx +'quality/qualityOrder/makeStartingQualityDetail/' + qualityOrderId;
$.modal.open("进行品质详情",url) $.modal.open("生产入库品质详情",url)
} }

436
ruoyi-admin/src/main/resources/templates/quality/qualityOrder/startingQuality.html

@ -22,71 +22,144 @@
</head> </head>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-qualityOrder-edit" th:object="${qualityOrder}"> <form class="form-horizontal m" id="form-qualityOrder-edit" th:object="${qualityOrderDetail}">
<input name="qualityOrderId" th:field="*{qualityOrderId}" type="hidden"> <input name="qualityOrderDetailId" th:field="*{qualityOrderDetailId}" type="hidden">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">品质单号:</label> <label class="col-sm-4 control-label">品质单号:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="qualityOrderCode" th:field="*{qualityOrderCode}" class="form-control" type="text"> <input readonly name="qualityOrderCode" th:field="*{qualityOrderCode}" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">入库单号:</label> <label class="col-sm-4 control-label">入库单号:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="inStorageCode" th:field="*{inStorageCode}" class="form-control" type="text"> <input readonly name="inStorageCode" th:field="*{inStorageCode}" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">关联订单号:</label> <label class="col-sm-4 control-label">关联订单号:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="relatedOrderCode" th:field="*{relatedOrderCode}" class="form-control" type="text"> <input readonly name="relatedOrderCode" th:field="*{relatedOrderCode}" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">品质单订单类型:</label> <label class="col-sm-4 control-label">订单类型:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="qualityOrderType" class="form-control m-b" th:with="type=${@dict.getType('quality_order_type')}"> <select disabled name="qualityOrderType" class="form-control m-b" th:with="type=${@dict.getType('quality_order_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{qualityOrderType}"></option> <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{qualityOrderType}"></option>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">品质单入库类型:</label> <label class="col-sm-4 control-label">品质单入库类型:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="qualityStorageStatus" class="form-control m-b" th:with="type=${@dict.getType('quality_storage_status')}"> <select disabled name="qualityStorageStatus" class="form-control m-b" th:with="type=${@dict.getType('quality_storage_status')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{qualityStorageStatus}"></option> <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{qualityStorageStatus}"></option>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">交付质检时间:</label> <label class="col-sm-4 control-label">交付质检时间:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div class="input-group date"> <div class="input-group date">
<input name="deliveryInspectionTime" th:value="${#dates.format(qualityOrder.deliveryInspectionTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text"> <input readonly name="deliveryInspectionTime" th:value="${#dates.format(qualityOrderDetail.deliveryInspectionTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span> <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group"> <div class="container">
<label class="col-sm-3 control-label">仓库Id:</label> <!--物料相关-->
<div class="row">
<div class="col-sm-12" id="tablesContainer">
</div>
</div>
</div>
<div class="container">
<h3 style="color: blue;">品质报告:</h3>
<div class="col-sm-12">
<h3>合格数</h3>
<div class="row">
<div class="form-group col-sm-6">
<label class="col-sm-4 control-label is-required">ok允收数:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="warehouseCode" th:field="*{warehouseCode}" class="form-control" type="text"> <input id="okAcceptedNum" name="okAcceptedNum" class="form-control" type="number" value="0" required>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group col-sm-6">
<label class="col-sm-3 control-label">仓库名称:</label> <label class="col-sm-4 control-label">ok报告图片:</label>
<div class="col-sm-8">
<input name="okReportUrl" class="form-control" type="text">
</div>
</div>
</div>
<div class="row">
<div class="form-group col-sm-6">
<label class="col-sm-4 control-label is-required">特采/让步数:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="warehouseName" th:field="*{warehouseName}" class="form-control" type="text"> <input id="specialConcessionsNum" name="specialConcessionsNum" class="form-control" type="number" value="0" required>
</div>
</div>
<div class="form-group col-sm-6">
<label class="col-sm-4 control-label">特采报告图片:</label>
<div class="col-sm-8">
<input name="specialReportUrl" class="form-control" type="text">
</div>
</div>
</div>
</div>
<!--不合格数-->
<div class="col-sm-12">
<div class="row">
<div class="col-sm-12 align-items-center">
<span style="font-weight: bold; font-family: Arial, sans-serif; font-size: 15px;padding-left: 0px;">不良数</span>
<div class="row">
<div class="form-group col-sm-6">
<label class="col-sm-4 control-label is-required">不良数:</label>
<div class="col-sm-8">
<input id="processBadNum" name="processBadNum" class="form-control" type="number" value="0" required>
</div>
</div>
<div class="form-group col-sm-6">
<label class="col-sm-4 control-label">检验完成时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="checkoutCompletionTime" 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>
</div> </div>
</div> </div>
<div class="container"> <div class="container">
<!--物料相关--> <div class="col-sm-12">
<div class="row"> <div class="row">
<div class="col-sm-12" id="tablesContainer"> <div class="col-sm-12 d-flex align-items-center">
<!-- 表格将在这里动态生成 --> <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>
</div> </div>
</div>
</div>
<!--其他字段-->
<div class="form-group" style="margin-top: 20px;">
<label class="col-sm-4 control-label">备注:</label>
<div class="col-sm-8">
<textarea name="remark" class="form-control" type="text"></textarea>
</div>
</div>
</form> </form>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
@ -94,7 +167,12 @@
<th:block th:include="include :: bootstrap-table-editable-js" /> <th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript"> <script th:inline="javascript">
var qualityOrderCode = [[${qualityOrder.qualityOrderCode}]] var qualityOrderCode = [[${qualityOrderDetail.qualityOrderCode}]];
var qualityOrderDetail = [[${qualityOrderDetail}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var processBadClassificationDatas = [[${@dict.getType('process_bad_classification')}]];
var processBadGradeDatas = [[${@dict.getType('process_bad_grade')}]];
var prefix = ctx + "quality/qualityOrder"; var prefix = ctx + "quality/qualityOrder";
$("#form-qualityOrder-edit").validate({ $("#form-qualityOrder-edit").validate({
@ -154,44 +232,36 @@
autoclose: true autoclose: true
}); });
$("input[name='checkoutCompletionTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$(function() { $(function() {
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到 var supplierData = {
var qualityOrderCode = [[${qualityOrder.qualityOrderCode}]]; // 这里需要实际赋值,比如从前端某个地方读取 supplierCode: qualityOrderDetail.supplierCode,
supplierName: qualityOrderDetail.supplierName,
$.getJSON(prefix + "/detailListGroupedBySupplier?qualityOrderCode=" + qualityOrderCode, function(data) { customerContact: qualityOrderDetail.customerContact,
for (var supplierCode in data) { contactNumber: qualityOrderDetail.contactNumber,
if (data.hasOwnProperty(supplierCode)) { supplierAddress: qualityOrderDetail.supplierAddress,
var supplierData = data[supplierCode];
createTableForSupplier(supplierCode, supplierData);
} }
} var materialData = [];
}); materialData.push(qualityOrderDetail);
});
function createTableForSupplier(supplierCode, supplierData) {
var tableId = 'bootstrap-table-' + supplierCode.replace(/[^a-z0-9]/gi, '_').toLowerCase();
tableDatas.push(tableId);
var $tableWrapper = $('<div class="table-responsive mt-3"></div>'); var $tableWrapper = $('<div class="table-responsive mt-3"></div>');
// 确保supplierData至少有一条记录,并从中提取供应商详细信息
var supplierInfo = supplierData.length > 0 ? supplierData[0] : {}; // 默认为空对象,以防数据不存在
// 构建含有额外供应商信息的标题字符串 // 构建含有额外供应商信息的标题字符串
var headerTitle ='供应商'+'</br>'+supplierCode + ' - ' + (supplierInfo.supplierName || 'N/A') + var headerTitle ='供应商'+'</br>' + supplierData.supplierCode + ' - ' + (supplierData.supplierName || 'N/A') +
' </br> ' + (supplierInfo.customerContact || 'N/A') + ' </br> ' + (supplierData.customerContact || 'N/A') +
' - ' + (supplierInfo.contactNumber || 'N/A') + ' - ' + (supplierData.contactNumber || 'N/A') +
' - ' + (supplierInfo.supplierAddress || 'N/A'); ' - ' + (supplierData.supplierAddress || 'N/A');
var $header = $('<h4>' + headerTitle + '</h4>'); var $header = $('<h4>' + headerTitle + '</h4>');
var $table = $('<table id="' + tableId + '" class="table table-striped table-bordered"></table>'); var $table = $('<table id="bootstrap-material-table" class="table table-striped table-bordered"></table>');
$table.bootstrapTable({ $table.bootstrapTable({
data: supplierData, data: materialData,
columns: [{ columns: [
checkbox: true
},
{ {
title: '供应商ID', title: '供应商ID',
field: 'supplierCode', field: 'supplierCode',
@ -205,7 +275,9 @@
}, },
{ {
title: '料号', title: '料号',
field: 'materialNo' align: 'center',
field: 'materialNo',
}, { }, {
title: '物料名称', title: '物料名称',
field: 'materialName' field: 'materialName'
@ -213,80 +285,268 @@
{ {
title: '物料类型', title: '物料类型',
field: 'materialType', field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
}, },
{ {
title: '物料图片地址', title: '图片',
field: 'materialPhotourl', field: 'materialPhotourl',
}, },
{ {
title: '物料描述', title: '描述',
field: 'materialDescribe', field: 'materialDescribe',
}, },
{ {
title: '物料品牌', title: '品牌',
field: 'materialBrand', field: 'materialBrand',
}, },
{ {
title: '物料单位', title: '单位',
field: 'materialUnit', field: 'materialUnit',
}, },
{ {
title: '物料加工方式', title: '加工方式',
field: 'materialProcessMethod', field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
}, },
{ {
title: '实际到货数', title: '检验数',
field: 'actualArriveNum', field: 'checkNum',
}, },
{ {
title: '品质已合格数', title: '合格数',
field: 'qualityHasqualifiedNum', field: 'qualityQualifiedNum',
},
{
title: '不良数',
field: 'qualityUnqualifiedNum',
},
{
title: '待审核数',
field: 'pendingReviewNum',
},
]
});
$tableWrapper.append($header).append($table);
$('#tablesContainer').append($tableWrapper);
var unqualifiedOption = {
id: "bootstrap-unqualified-table",
modalName: "不良数",
showColumns: false,
pagination: false,
showToggle: false,
showRefresh:false,
showSearch:false,
singleSelect:true,
height: 40,
columns: [
{
title: '品质报告单id',
field: 'qualityOrderReportId',
visible: false
},
{title: '不良分类',field: 'processBadClassification',
formatter:function (value, row, index) {
return processBadClassificationFormatter(value,row,index);
}
},
{title: '不良等级',field: 'processBadGrade',
formatter:function (value, row, index) {
return processBadGradeFormatter(value,row,index);
}
}, },
{ {
title: '本次到货数', title: '数',
field: 'thisArrivedNum', field: 'processBadNum',
editable:{ editable:{
type: 'text', type: 'text',
mode:'inline',
validate: function (v) { validate: function (v) {
if (!v) return '本次到货数不能为空'; if (!v) return '数量不能为空';
if (isNaN(v)) return '数量必须是数字';
var processBadNum = parseInt(v);
if (processBadNum < 0) return '数量必须是正整数';
} }
}
},
{
title: '报告',
field: 'unqualifiedReportUrl',
editable: {
mode:'inline',
type: 'text', // 表示该列可以被编辑为文本
}, },
required:true
}, },
{ {
title: '品质报告', title: '操作',
align: 'center', align: 'center',
formatter: function(value, row, index) { formatter: function(value, row, index) {
// 这里直接使用row对象获取supplierCode,假设它是存在的
var actions = []; var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="qualityReport(\'' + row.materialNo + '\', \'' + row.supplierCode + '\')"><i class="fa fa-plus"></i>报告</a> '); actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeUnqualify(\'' + row.qualityOrderReportId + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join(''); return actions.join('');
} }
}, }
{ ]
title: '品质合格数', };
field: 'qualityQualifiedNum', $.table.init(unqualifiedOption);
},
{
title: '品质不合格数',
field: 'qualityUnqualifiedNum',
}]
}); });
$tableWrapper.append($header).append($table);
$('#tablesContainer').append($tableWrapper); function createTableForSupplier(supplierData) {
} }
//添加不合格分类
function addUnqualified() {
var uniqueId = new Date().getTime();
var newRow = {
qualityOrderReportId:uniqueId,
processBadClassification: "",
processBadGrade: "",
processBadNum: "",
unqualifiedReportUrl: ""
};
$('#bootstrap-unqualified-table').bootstrapTable('append', newRow);
}
function qualityReport(materialNo, supplierCode) { //删除不良分类
var qualityOrderCode = [[${qualityOrder.qualityOrderCode}]]; function removeUnqualify(qualityOrderReportId){
var queryParams = new URLSearchParams(); $("#bootstrap-unqualified-table").bootstrapTable('remove',{
queryParams.append('materialNo', materialNo); field: 'qualityOrderReportId',
queryParams.append('supplierCode', encodeURIComponent(supplierCode)); values: qualityOrderReportId
queryParams.append('qualityOrderCode',encodeURIComponent(qualityOrderCode)); })
}
// 自定义不良分类的初始化函数
function processBadClassificationFormatter(value, row, index) {
var selectHtml = `<select class="form-control" onchange="onProcessBadClassification(this, ${index})">`;
selectHtml += '<option value=""' + (value === undefined || value === '' ? ' selected' : '') + '>所有</option>';
processBadClassificationDatas.forEach(function (child) {
selectHtml += '<option value="' + child.dictValue + '"' + (value === child.dictValue ? ' selected' : '') + '>' + child.dictLabel + '</option>';
});
selectHtml += '</select>';
return selectHtml;
}
// 列中获取不良分类的下拉改变数据
function onProcessBadClassification(selectElement, rowIndex) {
var processBadClassificationValue = $(selectElement).val();
var tableData = $("#bootstrap-unqualified-table").bootstrapTable('getData');
var newRow = tableData[rowIndex]; // 获取当前行数据
// 更新行数据
newRow.processBadClassification = processBadClassificationValue;
$("#bootstrap-unqualified-table").bootstrapTable('updateRow', {index: rowIndex, row: newRow});
}
// 自定义不良等级的格式化函数
function processBadGradeFormatter(value, row, index) {
var selectHtml = `<select class="form-control" onchange="onProcessBadGrade(this, ${index})">`;
selectHtml += '<option value=""' + (value === undefined || value === '' ? ' selected' : '') + '>所有</option>';
processBadGradeDatas.forEach(function (child) {
selectHtml += '<option value="' + child.dictValue + '"' + (value === child.dictValue ? ' selected' : '') + '>' + child.dictLabel + '</option>';
});
selectHtml += '</select>';
return selectHtml;
}
// 列中获取不良等级的下拉改变数据
function onProcessBadGrade(selectElement, rowIndex) {
var processBadGradeValue = $(selectElement).val();
var tableData = $("#bootstrap-unqualified-table").bootstrapTable('getData');
var newRow = tableData[rowIndex]; // 获取当前行数据
// 重新渲染成本小类的设备名称列
// 更新行数据
newRow.processBadGrade = processBadGradeValue;
$("#bootstrap-unqualified-table").bootstrapTable('updateRow', {index: rowIndex, row: newRow});
}
var url = ctx + 'quality/qualityOrder/qualityReport?' + queryParams.toString(); function submitHandler(){
$.modal.open("品质报告", url); var materialData = $('#bootstrap-material-table').bootstrapTable('getData')[0];
var materialNo = materialData.materialNo;
var materialName = materialData.materialName;
const qualityReport = $("#form-qualityOrder-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
qualityReport.materialNo = materialNo;
qualityReport.materialName = materialName;
qualityReport.supplierCode = qualityOrderDetail.supplierCode;
//计算页面本次品质数和检验数,添加限制
var checkNum = Number(materialData.checkNum);
var qualifiedNum = Number(materialData.qualityQualifiedNum);
var unQualifiedNum = Number(materialData.qualityUnqualifiedNum);
var pendingReviewNum = Number(materialData.pendingReviewNum);
//待检验数
var remainNum = checkNum - qualifiedNum - unQualifiedNum - pendingReviewNum;
var qualityNum = 0;
var pageOkNum = Number(qualityReport.okAcceptedNum)+ Number(qualityReport.specialConcessionsNum);
var pageUnpassNum = Number(qualityReport.processBadNum);
//本次品质数
qualifiedNum = pageOkNum + pageUnpassNum;
if(qualifiedNum == 0){
$.modal.msgError('合格数、不良数不能全为空!');
return;
}
if(qualifiedNum > remainNum){
$.modal.msgError('本次品质数'+qualifiedNum+'已超过待品质数'+remainNum);
return;
}
var unqualifyList = [];
var classNull = false;
var gradeNull = false;
var numNull = false;
var unqualifyClass = $("#bootstrap-unqualified-table").bootstrapTable('getData');
if(pageUnpassNum>0) {
if (unqualifyClass.length <= 0) {
$.modal.msgError("不良分类列表为空,请检查");
return;
}
var classNull = false;
var gradeNull = false;
var numNull = false;
unqualifyClass.forEach(function (unqualify) {
if(unqualify.processBadClassification ==''){
classNull = true;
return;
}
if(unqualify.processBadGrade ==''){
gradeNull = true;
return;
}
if(unqualify.processBadNum ==''){
numNull = true;
return;
}
unqualify.materialNo = materialNo;
unqualify.materialName = materialName;
unqualifyList.push(unqualify);
});
if(classNull){
$.modal.msgError("不良分类值为空,请检查");
return;
};
if(gradeNull){
$.modal.msgError("不良分类等级为空,请检查");
return;
};
if(numNull){
$.modal.msgError("不良分类数量为空,请检查");
return;
};
}
qualityReport.qualityOrderReportType = "1";//生产其他品质
qualityReport.unqualifiedDataList = unqualifyList;
console.log(qualityReport);
$.operate.saveJson(reportPrefix + "/add", JSON.stringify(qualityReport));
} }
</script> </script>
</body> </body>

Loading…
Cancel
Save