开发DOE分析功能

This commit is contained in:
kingsfighter 2020-09-17 22:14:45 +08:00
parent f1c70f4cb1
commit 98b55bbcab
5 changed files with 3097 additions and 23 deletions

View File

@ -40,6 +40,9 @@ public class DoeAnalysisController extends BaseController {
@Value("${api.doe.GetDataByRework}") @Value("${api.doe.GetDataByRework}")
private String getDataByReworkUrl; private String getDataByReworkUrl;
@Value("${api.doe.Calculate}")
private String calculateUrl;
/** /**
* 获取分析页面 * 获取分析页面
* *
@ -56,7 +59,7 @@ public class DoeAnalysisController extends BaseController {
* *
* @return * @return
*/ */
@PostMapping("/list") @RequestMapping("/list")
@ResponseBody @ResponseBody
public TableDataInfo list(@RequestParam("productname") String productname, @RequestParam("version") String version, @RequestParam("dataType") String dataType) { public TableDataInfo list(@RequestParam("productname") String productname, @RequestParam("version") String version, @RequestParam("dataType") String dataType) {
String apiUrl = apiRootUrl; String apiUrl = apiRootUrl;
@ -68,11 +71,9 @@ public class DoeAnalysisController extends BaseController {
} }
log.info("request remote api, url={}, param={}", apiUrl, param); log.info("request remote api, url={}, param={}", apiUrl, param);
String result = HttpUtils.sendGet(apiUrl, param); String result = HttpUtils.sendGet(apiUrl, param);
log.info("response remote api, url={}, param={}, result={}", apiUrl, param, result); log.info("response remote api, url={}, param={}, result={}", apiUrl, param, result);
if(StringUtils.isBlank(result)) { result = StringUtils.replace(result, "\\\"", "\"");
log.error("reponse result is null. url={}, param={}", apiUrl, param);
return getDataTable(Collections.emptyList());
}
JSONObject resultObj = JSON.parseObject(result); JSONObject resultObj = JSON.parseObject(result);
if(null != resultObj && SUCCESS_CODE.equals(resultObj.getInteger("code"))) { if(null != resultObj && SUCCESS_CODE.equals(resultObj.getInteger("code"))) {
JSONArray data = resultObj.getJSONArray("data"); JSONArray data = resultObj.getJSONArray("data");
@ -83,4 +84,13 @@ public class DoeAnalysisController extends BaseController {
return getDataTable(Collections.emptyList()); return getDataTable(Collections.emptyList());
} }
@RequestMapping("/calculate")
@ResponseBody
public TableDataInfo calculate(@RequestParam("productname") String productname, @RequestParam("version") String version, @RequestParam("dataType") String dataType) {
String url = apiRootUrl + calculateUrl;
// HttpUtils.sendPost();
return null;
}
} }

File diff suppressed because one or more lines are too long

View File

@ -2,54 +2,84 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head> <head>
<th:block th:include="include :: header('用户列表')" /> <th:block th:include="include :: header('用户列表')" />
<!--<link href="https://unpkg.com/bootstrap-table@1.17.1/dist/bootstrap-table.min.css" rel="stylesheet">-->
<!--<script src="https://unpkg.com/bootstrap-table@1.17.1/dist/bootstrap-table.min.js"></script>-->
<!--<script src="https://unpkg.com/bootstrap-table@1.17.1/dist/extensions/filter-control/bootstrap-table-filter-control.min.js"></script>-->
</head> </head>
<body class="gray-bg"> <body class="gray-bg">
<div class="container-div"> <div class="container-div">
<div class="row"> <div class="row">
<div class="col-sm-12 search-collapse"> <div class="col-sm-12 search-collapse">
<form id="role-form"> <form id="search-form">
<div class="select-list"> <div class="select-list">
<ul> <ul>
<li> <li>
板名:<input type="text" name="productname"/> 板名:<input type="text" name="productname" required/>
</li> </li>
<li> <li>
版本:<input type="text" name="version"/> 版本:<input type="text" name="version" required/>
</li> </li>
<li> <li>
筛选: 筛选:
<select name="dataType" required> <select name="dataType" id="dataType" required>
<option value="keyParam" selected>关键工艺参数</option> <option value="keyParam" selected>关键工艺参数</option>
<option value="rework">维修不良</option> <option value="rework">维修不良</option>
</select> </select>
</li> </li>
<li> <li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;检索</a> <a class="btn btn-primary btn-rounded btn-sm" onclick="javascript:doeSearch()"><i class="fa fa-search"></i>&nbsp;检索</a>
</li> </li>
</ul> </ul>
</div> </div>
</form> </form>
</div> </div>
<div class="col-sm-12 select-table table-striped" style="overflow: scroll;height: 500px;"> <div id="search-result-div" class="col-sm-12 select-table table-striped" style="overflow: scroll;height: 300px;">
<table id="bootstrap-table"></table> <table id="search-result-keyparam-table">
</table>
<table id="search-result-rework-table" style="display: none"></table>
</div> </div>
<div class="col-sm-12 search-collapse">
<form id="calculate-form">
<div class="select-list">
<ul>
<li>
数量:<input type="text" name="quantity" id="quantity" required/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="javascript:doeCalculate()"><i class="fa fa-play-circle"></i>&nbsp;计算</a>
<a class="btn btn-primary btn-rounded btn-sm" onclick="javascript:doeSave()"><i class="fa fa-save"></i>&nbsp;结果入库</a>
</li>
</ul>
</div>
</form>
</div>
<div id="calculate-result-div" class="col-sm-12 select-table table-striped" style="overflow: scroll;height: 200px;">
<table id="calculate-result-table"></table>
</div>
</div> </div>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "doeAnalysis.do"; var prefix = ctx + "doeAnalysis.do";
//当前表格检索结果使用的dataType
var currentDataType = "";
$(function() { $(document).ready(function(){
initKeyParamTable();
initReworkTable();
$("#search-result-rework-table").hide();
});
function initKeyParamTable() {
var options = { var options = {
// url: prefix + "/getUserList",
// createUrl: prefix + "/add",
// updateUrl: prefix + "/edit?uid={id}",
// removeUrl: prefix + "/remove",
// exportUrl: prefix + "/export",
// pauseUrl: prefix + "/changeUserState",
sortName: "roleSort", sortName: "roleSort",
modalName: "DOE分析-关键工艺参数", pagination: false,
modalName: "DOE分析-关键工艺参数",
columns: [ columns: [
{ {
checkbox: true checkbox: true
@ -99,13 +129,114 @@
title: '维修类型关联', title: '维修类型关联',
sortable: false, sortable: false,
formatter: function (value, row, index) { formatter: function (value, row, index) {
var html="";
html += "<select name=\"status\" class=\"form-control m-b\" multiple>";
if($.trim(value) != "") {
var defecttypes = value.split(",");
for (var i = 0; i < defecttypes.length; i++) {
html += "<option value=\""+defecttypes[i]+"\">"+defecttypes[i]+"</option>";
}
}
html += "</select>";
return html;
} }
} }
] ]
}; };
$.table.init(options); $.table.init(options);
}); $("#search-result-keyparam-table").bootstrapTable(options);
}
function initReworkTable() {
var options = {
sortName: "roleSort",
pagination: false,
modalName: "DOE分析-关键工艺参数",
columns: [
{
checkbox: true
},
{
field: 'refdes',
title: '位号',
sortable: false
},
{
field: 'defecttype',
title: '维修类型',
sortable: false
},
{
field: 'isRelativeKeyParam',
title: '是否关联关键工艺参数',
sortable: false
},
{
field: 'keyparamtype',
title: '规则名',
sortable: false
},
{
field: 'measurementvalue',
title: '测量值',
sortable: false
},
{
field: 'checkvalue',
title: '规则值',
sortable: false
}
]
};
$.table.init(options);
$("#search-result-rework-table").bootstrapTable(options);
}
function fillKeyParamTable(data) {
$("#search-result-keyparam-table").bootstrapTable('load', data);
}
function fillReworkTable(data) {
$("#search-result-rework-table").bootstrapTable('load', data);
}
function doeSearch() {
var data = $("#search-form").serialize();
$.ajax({
url: prefix + "/list",
data: data,
cache:false,
dataType:"json",
success: function(json){
//销毁表格
$("#search-result-table").html("");
var dataType = $("#dataType").val();
currentDataType = dataType;
if("keyParam"== dataType) {
fillKeyParamTable(json);
$("#search-result-rework-table").hide();
$("#search-result-keyparam-table").show();
} else {
fillReworkTable(json);
$("#search-result-keyparam-table").hide();
$("#search-result-rework-table").show();
}
}
});
}
function doeCalculate() {
}
function doeSave() {
}
</script> </script>
</body> </body>

View File

@ -25,6 +25,7 @@
<script th:src="@{/ajax/libs/bootstrap-table/bootstrap-table.min.js?v=20200727}"></script> <script th:src="@{/ajax/libs/bootstrap-table/bootstrap-table.min.js?v=20200727}"></script>
<script th:src="@{/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js?v=20200727}"></script> <script th:src="@{/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js?v=20200727}"></script>
<script th:src="@{/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js?v=20200727}"></script> <script th:src="@{/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js?v=20200727}"></script>
<!--<script th:src="@{/ajax/libs/bootstrap-table/extensions/filter-control/bootstrap-table-filter-control.min.js?v=20200727"></script>-->
<!-- jquery-validate 表单验证插件 --> <!-- jquery-validate 表单验证插件 -->
<script th:src="@{/ajax/libs/validate/jquery.validate.min.js}"></script> <script th:src="@{/ajax/libs/validate/jquery.validate.min.js}"></script>
<script th:src="@{/ajax/libs/validate/messages_zh.min.js}"></script> <script th:src="@{/ajax/libs/validate/messages_zh.min.js}"></script>