Browse Source

[feat]

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

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

@ -1,49 +1,56 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<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 :: bootstrap-editable-css" />
</head>
<style>
.fixed-table-container {
border: 0px solid #ddd;
min-height: 90px;
}
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-makeInStartingQuality-edit" th:object="${qualityOrder}">
<input name="qualityOrderId" th:field="*{qualityOrderId}" type="hidden">
<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">
<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 class="form-group">
<label class="col-sm-3 control-label">入库单号:</label>
<label class="col-sm-4 control-label">入库单号:</label>
<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 class="form-group">
<label class="col-sm-3 control-label">关联订单号:</label>
<label class="col-sm-4 control-label">关联订单号:</label>
<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 class="form-group">
<label class="col-sm-3 control-label">品质单订单类型:</label>
<label class="col-sm-4 control-label">品质单订单类型:</label>
<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>
</select>
</div>
</div>
<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">
<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>
</select>
</div>
</div>
<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="input-group date">
<input name="deliveryInspectionTime" th:value="${#dates.format(qualityOrder.deliveryInspectionTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
@ -51,15 +58,96 @@
</div>
</div>
</div>
</form>
<!--物料信息-->
<div class="container">
<div class="container" >
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
<div class="col-sm-12" style="height: 100px;padding-left: 50px;">
<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 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>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
@ -67,10 +155,18 @@
<th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript">
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 reportPrefix = ctx + "quality/qualityReport";
$("#form-makeInStartingQuality-edit").validate({
focusCleanup: true
});
@ -81,67 +177,21 @@
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() {
sessionStorage.clear();
var options = {
modalName: "选择物料",
modalName: "品质单物料",
id: "bootstrap-material-table",
url: prefix + "/getMaterialListByQualityOrderCode",
queryParams: queryParams,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
height: 40,
pagination: false, // 设置不分页
columns: [{
checkbox: true
},
columns: [
{
title: '品质单详情ID',
field: 'qualityOrderDetailId',
@ -149,105 +199,464 @@
},
{
title: '料号',
field: 'materialNo'
field: 'materialNo',
align: 'center',
},
{
title: '物料名称',
align: 'center',
field: 'materialName'
},
{
title: '物料类型',
align: 'center',
field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
field: 'materialModel',
align: 'center',
title: '型号',
},
{
title: '物料图片地址',
title: '图片',
align: 'center',
field: 'materialPhotourl',
},
{
title: '物料描述',
title: '描述',
align: 'center',
field: 'materialDescribe',
},
{
title: '物料品牌',
title: '品牌',
align: 'center',
field: 'materialBrand',
},
{
title: '物料单位',
title: '单位',
align: 'center',
field: 'materialUnit',
},
{
title: '物料加工方式',
title: '加工方式',
align: 'center',
field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
title: '生产订单数',
field: 'makeTotal',
title: '检验数',
align: 'center',
field: 'checkNum',
},
{
title: '品质已合格数',
field: 'qualityHasqualifiedNum',
title: '合格数',
align: 'center',
field: 'qualityQualifiedNum',
},
{
title: '本次到货数',
field: 'thisArrivedNum',
editable:{
type:'text',
validate: function (v) {
if (!v) return '本次到货数不能为空';
}
},
required:true
title: '不良数',
align: 'center',
field: 'qualityUnqualifiedNum',
},
{
title: '品质报告',
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: '出货设备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',
formatter: function(value, row, index) {
// 这里直接使用row对象获取supplierCode,假设它是存在的
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('');
}
},
}
]
});
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: '品质合格数',
field: 'qualityQualifiedNum',
title: '品质报告单id',
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: '品质不合格数',
field: 'qualityUnqualifiedNum',
title: '数量',
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: '生产完成数',
field: 'makeCompletionNum',
visible: false
title: '报告',
field: 'unqualifiedReportUrl',
editable: {
mode:'inline',
type: 'text', // 表示该列可以被编辑为文本
},
},
{
title: '物料入库部门',
field: 'materialDeptType',
visible: false
title: '操作',
align: 'center',
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) {
var curParams = {
// 传递参数查询参数
qualityOrderCode: qualityOrderCode
};
console.log(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 makeOrderReport(materialNo) {
var qualityOrderCode = [[${qualityOrder.qualityOrderCode}]];
var queryParams = new URLSearchParams();
queryParams.append('materialNo', materialNo);
queryParams.append('qualityOrderCode',encodeURIComponent(qualityOrderCode));
function handleShippingDeviceData(index,layero){
var iframeWin = window[layero.find('iframe')[0]['name']];
var tableData = iframeWin.$("#bootstrap-select-table").bootstrapTable('getSelections');
var url = ctx + 'quality/qualityOrder/makeOrderReport?' + queryParams.toString();
$.modal.open("品质报告", url);
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);
//删除session中保存的已选中标识
sessionStorage.removeItem(shippingDeviceId);
//不良数减少
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>

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 :: datetimepicker-css" />
</head>
<style>
.fixed-table-container {
border: 0px solid #ddd;
min-height: 120px;
}
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-makeInStartingQualityDetail-edit" th:object="${qualityOrder}">
@ -55,11 +61,22 @@
<!--物料信息-->
<div class="container">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<div class="col-sm-12 table-striped">
<table id="bootstrap-table"></table>
</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>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
@ -68,9 +85,13 @@
<script th:inline="javascript">
var qualityOrderCode = [[${qualityOrder.qualityOrderCode}]]
var qualityOrder = [[${qualityOrder}]]
var qualityOrderCode = [[${qualityOrder.qualityOrderCode}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var auditStatusDatas = [[${@dict.getType('auditStatus')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var qualityOrder = [[${qualityOrder}]];
var prefix = ctx + "quality/qualityOrder";
var reportPrefix = ctx + "quality/qualityReport";
$("#form-makeInStartingQualityDetail-edit").validate({
focusCleanup: true
});
@ -81,56 +102,19 @@
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() {
var options = {
modalName: "选择物料",
modalName: "品质单物料",
url: prefix + "/getMaterialListByQualityOrderCode",
queryParams: queryParams,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
height: 40,
pagination: false, // 设置不分页
columns: [{
checkbox: true
},
columns: [
{
title: '品质单详情ID',
field: 'qualityOrderDetailId',
@ -147,38 +131,44 @@
{
title: '物料类型',
field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
title: '物料图片地址',
title: '图片',
field: 'materialPhotourl',
},
{
title: '物料描述',
title: '型号',
field: 'materialModel',
},
{
title: '描述',
field: 'materialDescribe',
},
{
title: '物料品牌',
title: '品牌',
field: 'materialBrand',
},
{
title: '物料单位',
title: '单位',
field: 'materialUnit',
},
{
title: '物料加工方式',
title: '加工方式',
field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
title: '生产订单数',
field: 'makeTotal',
},
{
title: '品质已合格数',
field: 'qualityHasqualifiedNum',
},
{
title: '本次到货数',
field: 'thisArrivedNum',
title: '检验数',
field: 'checkNum',
},
{
title: '品质合格数',
@ -190,6 +180,54 @@
}]
};
$.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) {

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

@ -18,6 +18,14 @@
<label>入库单号:</label>
<input type="text" name="inStorageCode"/>
</li>
<li>
<label>料号:</label>
<input type="text" name="materialNo"/>
</li>
<li>
<label>物料名称:</label>
<input type="text" name="materialName"/>
</li>
<li>
<label>品质状态:</label>
<select name="qualityStatus" th:with="type=${@dict.getType('qualityStatus')}">
@ -63,7 +71,6 @@
var makeStartingQualityDetailFlag = [[${@permission.hasPermi('quality:qualityOrder:makeStartingQualityDetail')}]];
var qualityStatusDatas = [[${@dict.getType('qualityStatus')}]];
var qualityOrderTypeDatas = [[${@dict.getType('quality_order_type')}]];
var qualityStorageStatusDatas = [[${@dict.getType('quality_storage_status')}]];
@ -71,15 +78,18 @@
$(function() {
var options = {
url: prefix + "/list",
url: prefix + "/makeQualityList",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
cancelUrl: prefix + "/cancel/{id}",
restoreUrl: prefix + "/restore/{id}",
exportUrl: prefix + "/export",
fixedColumns: true, // 启用冻结列
fixedRightNumber: 1, // 冻结右列个数
modalName: "品质管理品质单",
columns: [{
columns: [
{
checkbox: true
},
{
@ -101,6 +111,7 @@
{
title: '入库单号',
field: 'inStorageCode',
visible: false,
},
{
title: '关联订单号',
@ -122,17 +133,29 @@
}
},
{
title: '本次到货数量',
title: '料号',
field: 'materialNo',
},
{
title: '物料名称',
field: 'materialName',
},
{
title: '检验数',
field: 'thisArrivedNum',
},
{
title: '品质合格数',
title: '合格数',
field: 'qualityQualifiedNum',
},
{
title: '品质不合格数',
title: '不良数',
field: 'qualityUnqualifiedNum',
},
{
title: '待审核数',
field: 'pendingReviewNum',
},
{
title: '交检时间',
field: 'deliveryInspectionTime',
@ -162,40 +185,20 @@
align: 'center',
formatter: function(value, row, index) {
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> ');
}
//生产订单其他物料品质
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 ){
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('');
}
}]
@ -216,40 +219,35 @@
$.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){
var url = ctx +'quality/qualityOrder/makeOutStartingQuality/' + qualityOrderId;
$.modal.open("进行品质",url)
}
//委加工单品质详情
//委外加工单品质详情
function makeOutStartingQualityDetail(qualityOrderId){
var url = ctx +'quality/qualityOrder/makeOutStartingQualityDetail/' + qualityOrderId;
$.modal.open("品质详情",url)
}
//生产入库品质
//生产入库成品品质
function 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){
var url = ctx +'quality/qualityOrder/makeStartingQualityDetail/' + qualityOrderId;
$.modal.open("进行品质详情",url)
$.modal.open("生产入库品质详情",url)
}

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

@ -22,71 +22,144 @@
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-qualityOrder-edit" th:object="${qualityOrder}">
<input name="qualityOrderId" th:field="*{qualityOrderId}" type="hidden">
<form class="form-horizontal m" id="form-qualityOrder-edit" th:object="${qualityOrderDetail}">
<input name="qualityOrderDetailId" th:field="*{qualityOrderDetailId}" type="hidden">
<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">
<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 class="form-group">
<label class="col-sm-3 control-label">入库单号:</label>
<label class="col-sm-4 control-label">入库单号:</label>
<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 class="form-group">
<label class="col-sm-3 control-label">关联订单号:</label>
<label class="col-sm-4 control-label">关联订单号:</label>
<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 class="form-group">
<label class="col-sm-3 control-label">品质单订单类型:</label>
<label class="col-sm-4 control-label">订单类型:</label>
<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>
</select>
</div>
</div>
<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">
<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>
</select>
</div>
</div>
<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="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>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">仓库Id:</label>
<div class="col-sm-8">
<input name="warehouseCode" th:field="*{warehouseCode}" 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="warehouseName" th:field="*{warehouseName}" class="form-control" type="text">
</div>
</div>
<div class="container">
<!--物料相关-->
<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">
<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 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 class="container">
<div class="col-sm-12">
<div class="row">
<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 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>
</div>
<th:block th:include="include :: footer" />
@ -94,7 +167,12 @@
<th:block th:include="include :: bootstrap-table-editable-js" />
<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";
$("#form-qualityOrder-edit").validate({
@ -154,44 +232,36 @@
autoclose: true
});
$(function() {
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到
var qualityOrderCode = [[${qualityOrder.qualityOrderCode}]]; // 这里需要实际赋值,比如从前端某个地方读取
$.getJSON(prefix + "/detailListGroupedBySupplier?qualityOrderCode=" + qualityOrderCode, function(data) {
for (var supplierCode in data) {
if (data.hasOwnProperty(supplierCode)) {
var supplierData = data[supplierCode];
createTableForSupplier(supplierCode, supplierData);
}
}
});
$("input[name='checkoutCompletionTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
function createTableForSupplier(supplierCode, supplierData) {
var tableId = 'bootstrap-table-' + supplierCode.replace(/[^a-z0-9]/gi, '_').toLowerCase();
tableDatas.push(tableId);
$(function() {
var supplierData = {
supplierCode: qualityOrderDetail.supplierCode,
supplierName: qualityOrderDetail.supplierName,
customerContact: qualityOrderDetail.customerContact,
contactNumber: qualityOrderDetail.contactNumber,
supplierAddress: qualityOrderDetail.supplierAddress,
}
var materialData = [];
materialData.push(qualityOrderDetail);
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') +
' </br> ' + (supplierInfo.customerContact || 'N/A') +
' - ' + (supplierInfo.contactNumber || 'N/A') +
' - ' + (supplierInfo.supplierAddress || 'N/A');
var headerTitle ='供应商'+'</br>' + supplierData.supplierCode + ' - ' + (supplierData.supplierName || 'N/A') +
' </br> ' + (supplierData.customerContact || 'N/A') +
' - ' + (supplierData.contactNumber || 'N/A') +
' - ' + (supplierData.supplierAddress || 'N/A');
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({
data: supplierData,
columns: [{
checkbox: true
},
data: materialData,
columns: [
{
title: '供应商ID',
field: 'supplierCode',
@ -205,7 +275,9 @@
},
{
title: '料号',
field: 'materialNo'
align: 'center',
field: 'materialNo',
}, {
title: '物料名称',
field: 'materialName'
@ -213,80 +285,268 @@
{
title: '物料类型',
field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
title: '物料图片地址',
title: '图片',
field: 'materialPhotourl',
},
{
title: '物料描述',
title: '描述',
field: 'materialDescribe',
},
{
title: '物料品牌',
title: '品牌',
field: 'materialBrand',
},
{
title: '物料单位',
title: '单位',
field: 'materialUnit',
},
{
title: '物料加工方式',
title: '加工方式',
field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
title: '检验数',
field: 'checkNum',
},
{
title: '合格数',
field: 'qualityQualifiedNum',
},
{
title: '不良数',
field: 'qualityUnqualifiedNum',
},
{
title: '实际到货数',
field: 'actualArriveNum',
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: '品质已合格数',
field: 'qualityHasqualifiedNum',
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: '本次到货数',
field: 'thisArrivedNum',
title: '数',
field: 'processBadNum',
editable:{
type:'text',
type: 'text',
mode:'inline',
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',
formatter: function(value, row, index) {
// 这里直接使用row对象获取supplierCode,假设它是存在的
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('');
}
},
{
title: '品质合格数',
field: 'qualityQualifiedNum',
},
{
title: '品质不合格数',
field: 'qualityUnqualifiedNum',
}]
});
}
]
};
$.table.init(unqualifiedOption);
});
function createTableForSupplier(supplierData) {
$tableWrapper.append($header).append($table);
$('#tablesContainer').append($tableWrapper);
}
//添加不合格分类
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}]];
var queryParams = new URLSearchParams();
queryParams.append('materialNo', materialNo);
queryParams.append('supplierCode', encodeURIComponent(supplierCode));
queryParams.append('qualityOrderCode',encodeURIComponent(qualityOrderCode));
//删除不良分类
function removeUnqualify(qualityOrderReportId){
$("#bootstrap-unqualified-table").bootstrapTable('remove',{
field: 'qualityOrderReportId',
values: qualityOrderReportId
})
}
// 自定义不良分类的初始化函数
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});
}
function submitHandler(){
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;
}, {});
var url = ctx + 'quality/qualityOrder/qualityReport?' + queryParams.toString();
$.modal.open("品质报告", url);
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>
</body>

Loading…
Cancel
Save