|
|
@ -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,26 +58,115 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</form> |
|
|
|
|
|
|
|
<!--物料信息--> |
|
|
|
<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" /> |
|
|
|
<!--用于可以修改列表字段的插件--> |
|
|
|
<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); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '物料图片地址', |
|
|
|
field: 'materialModel', |
|
|
|
align: 'center', |
|
|
|
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 '本次到货数不能为空'; |
|
|
|
} |
|
|
|
title: '不良数', |
|
|
|
align: 'center', |
|
|
|
field: 'qualityUnqualifiedNum', |
|
|
|
}, |
|
|
|
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', |
|
|
|
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 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) { |
|
|
|
var qualityOrderCode = [[${qualityOrder.qualityOrderCode}]]; |
|
|
|
var queryParams = new URLSearchParams(); |
|
|
|
queryParams.append('materialNo', materialNo); |
|
|
|
queryParams.append('qualityOrderCode',encodeURIComponent(qualityOrderCode)); |
|
|
|
//删除session中保存的已选中标识 |
|
|
|
sessionStorage.removeItem(shippingDeviceId); |
|
|
|
|
|
|
|
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> |
|
|
|