From 727ee25aeb5fcaf84e2cf009b2eacd3a86bcb3ca Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期四, 28 十一月 2024 12:55:23 +0800
Subject: [PATCH] 新增 环境检测方案,环境检测单
---
WebTM/views/质量管理/质量报表/QC_InspectionFormReport.html | 640 ++++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 534 insertions(+), 106 deletions(-)
diff --git "a/WebTM/views/\350\264\250\351\207\217\347\256\241\347\220\206/\350\264\250\351\207\217\346\212\245\350\241\250/QC_InspectionFormReport.html" "b/WebTM/views/\350\264\250\351\207\217\347\256\241\347\220\206/\350\264\250\351\207\217\346\212\245\350\241\250/QC_InspectionFormReport.html"
index 043c41e..a2676c7 100644
--- "a/WebTM/views/\350\264\250\351\207\217\347\256\241\347\220\206/\350\264\250\351\207\217\346\212\245\350\241\250/QC_InspectionFormReport.html"
+++ "b/WebTM/views/\350\264\250\351\207\217\347\256\241\347\220\206/\350\264\250\351\207\217\346\212\245\350\241\250/QC_InspectionFormReport.html"
@@ -96,7 +96,7 @@
<div class="layui-inline">
<label class="layui-form-label" style="width: 85px;">涓婇檺</label>
<div class="layui-input-block" style="margin-left: 120px;">
- <input type="text" class="layui-input" name="HUpLoad" id="HUpLoad">
+ <input type="text" class="layui-input" name="HUpLimit" id="HUpLimit" style="background-color:#efefef4d;" readonly>
</div>
</div>
</div>
@@ -112,65 +112,110 @@
</div>
</div>
<div class="layui-inline">
- <label class="layui-form-label" style="width: 85px;">娴嬮噺鍗曚綅</label>
+ <label class="layui-form-label" style="width: 85px;">绌村彿</label>
<div class="layui-input-block" style="margin-left: 120px;">
- <input type="text" class="layui-input" id="HUnitName">
+ <input type="text" class="layui-input" id="HMouldNum" name="HMouldNum">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 85px;">鏍囧噯鍊�</label>
<div class="layui-input-block" style="margin-left: 120px;">
- <input type="text" class="layui-input" id="HStandard">
+ <input type="text" class="layui-input" name="HTargetVal" id="HTargetVal">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 85px;">涓嬮檺</label>
<div class="layui-input-block" style="margin-left: 120px;">
- <input type="text" class="layui-input" id="HDownLoad">
+ <input type="text" class="layui-input" name="HDownLimit" id="HDownLimit" style="background-color:#efefef4d;" readonly>
</div>
</div>
</div>
- <div class="layui-row" style="margin: 10px 0 10px;display:none;">
+ <div class="layui-row" style="margin-top:5px;">
<div class="layui-inline">
- <label class="layui-form-label">杩囨护</label>
- <div class="layui-input-block">
- <select name="ColName" id="ColName" lay-filter="ColName" style="width:190px;">
- </select>
+ <label class="layui-form-label" style="width: 85px;">鍧囧�兼帶鍒朵笂闄�</label>
+ <div class="layui-input-block" style="margin-left: 120px;">
+ <input type="text" class="layui-input" name="HControlUpperLimit_X" id="HControlUpperLimit_X">
+ </div>
+ </div>
+ <div class="layui-inline" style="margin-left: 48px;">
+ <label class="layui-form-label" style="width: 85px;">鍧囧�兼帶鍒朵笅闄�</label>
+ <div class="layui-input-block" style="margin-left: 120px;">
+ <input type="text" class="layui-input" name="HControlLowerLimit_X" id="HControlLowerLimit_X">
</div>
</div>
<div class="layui-inline">
- <select name="Comparator" id="Comparator" lay-filter="Comparator" style="width:190px;">
- <option value="0" selected="selected"></option>
- <option value="=">=</option>
- <option value=">=">>=</option>
- <option value=">">></option>
- <option value="<="><=</option>
- <option value="<"><</option>
- <option value="<>"><></option>
- <option value="7">鍖呭惈</option>
- <option value="8">宸﹀寘鍚�</option>
- <option value="9">鍙冲寘鍚�</option>
- <option value="10">涓嶅寘鍚�</option>
- </select>
+ <label class="layui-form-label" style="width: 85px;">X涓績绾�</label>
+ <div class="layui-input-block" style="margin-left: 120px;">
+ <input type="text" class="layui-input" name="HCenterline_X" id="HCenterline_X">
+ </div>
</div>
<div class="layui-inline">
- <input type="text" class="layui-input" value="" name="ColContent" id="ColContent">
+ <label class="layui-form-label" style="width: 85px;">锛帮及锛�</label>
+ <div class="layui-input-block" style="margin-left: 120px;">
+ <input type="text" class="layui-input" name="HPPK" id="HPPK" style="background-color:#efefef4d;" readonly>
+ </div>
+ </div>
+ </div>
+ <div class="layui-row" style="margin-top:5px;">
+ <div class="layui-inline">
+ <label class="layui-form-label" style="width: 85px;">鏋佸樊鎺у埗涓婇檺</label>
+ <div class="layui-input-block" style="margin-left: 120px;">
+ <input type="text" class="layui-input" name="HControlUpperLimit_S" id="HControlUpperLimit_S">
+ </div>
+ </div>
+ <div class="layui-inline" style="margin-left: 48px;">
+ <label class="layui-form-label" style="width: 85px;">鏋佸樊鎺у埗涓嬮檺</label>
+ <div class="layui-input-block" style="margin-left: 120px;">
+ <input type="text" class="layui-input" name="HControlLowerLimit_S" id="HControlLowerLimit_S">
+ </div>
+ </div>
+ <div class="layui-inline">
+ <label class="layui-form-label" style="width: 85px;">S涓績绾�</label>
+ <div class="layui-input-block" style="margin-left: 120px;">
+ <input type="text" class="layui-input" name="HCenterline_S" id="HCenterline_S">
+ </div>
+ </div>
+ <div class="layui-inline">
+ <label class="layui-form-label" style="width: 85px;">C P K</label>
+ <div class="layui-input-block" style="margin-left: 120px;">
+ <input type="text" class="layui-input" id="HCPK" name="HCPK" style="background-color:#efefef4d;" readonly>
+ </div>
</div>
</div>
</div>
</div>
</div>
- <div>
+ <div class="layui-tab layui-tab-card">
<table class="" id="mainTable" lay-filter="mainTable"></table>
- <div id="histogram_Avg" style="width:99.5%;height:calc(35vh);margin-top:5px;">
+ <ul class="layui-tab-title">
+ <li class="layui-this">x虅绠″埗鍥�</li>
+ <li>R绠″埗鍥�</li>
+ <li>妫�娴嬪��</li>
+ </ul>
+ <div class="layui-tab-content">
+ <div class="layui-tab-item layui-show">
+ <!--x虅绠″埗鍥�-->
+ <div id="histogram_Avg" style="width: 99.5%; height: calc(100vh);">
- </div>
- <div id="histogram_Diff" style="width:99.5%;height:calc(35vh);margin-top:5px;">
+ </div>
+ </div>
+ <div class="layui-tab-item layui-show">
+ <!--R绠″埗鍥�-->
+ <div id="histogram_Diff" style="width: 99.5%; height: calc(100vh);">
+ </div>
+ </div>
+ <div class="layui-tab-item layui-show">
+ <!--妫�娴嬪��-->
+ <div id="histogram_SJZ" style="width: 99.5%; height: calc(100vh);">
+
+ </div>
+ </div>
</div>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
+ <button type="button" class="layui-btn layui-btn-sm" lay-event="btn_Export" id="btn_Export"><i class="layui-icon layui-icon-export"></i>瀵煎嚭</button>
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-exit"><i class="layui-icon layui-icon-return"></i>閫�鍑�</button>
<button type="button" class="layui-btn layui-btn-sm" lay-event="HideColumn"><i class="layui-icon layui-icon-form"></i>闅愯棌鍒楄缃�</button>
</div>
@@ -186,7 +231,7 @@
base: '../../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
}).extend({
index: 'lib/index', //涓诲叆鍙fā鍧�
- }).use(['index', 'form', 'table', 'element', 'laypage', 'laydate','soulTable'], function () {
+ }).use(['index', 'form', 'table', 'element', 'laypage', 'laydate', 'soulTable'], function () {
//#region 鍏叡鍙橀噺
var $ = layui.$
@@ -202,7 +247,12 @@
//鏌ヨ鏉′欢
var sWhere = "";
var option = [];
+ var ins; //鐢ㄤ簬瀵煎嚭excel
var HModName = "QC_InspectionFormReport";
+ var optionAVG = [];
+ var optionS = [];
+ var optionSJZ = [];
+ var HQCCheckNum = [];
//#endregion
//#region 杩涘叆椤甸潰鏃㈠姞杞�
@@ -212,7 +262,7 @@
//#endregion
-
+
//#region 鐐瑰嚮浜嬩欢鍖呮嫭on form浜嬩欢绛�
//澶村伐鍏锋爮浜嬩欢
@@ -225,6 +275,9 @@
case 'HideColumn':
get_HideColumn();
break;
+ //瀵煎嚭鎸夐挳
+ case 'btn_Export': btn_Export();
+ break;
};
});
@@ -232,13 +285,14 @@
form.on('submit(btnHMaterID)', function (data) {
btnHMaterID();
});
- //#endregion
+ //#endregion
//#region 妫�楠岄」鐩�
form.on('submit(btnHQCCheckItemID)', function (data) {
+ btnCheckProjectList(2);
btnHQCCheckItemID();
});
- //#endregion
+ //#endregion
//閲嶇疆鎸夐挳
form.on('submit(btnReSearch)', function (data) {
@@ -286,7 +340,7 @@
}
});
});
-
+
//#endregion
//#region 姝ら〉闈㈡墍鏈夌殑鏂规硶
@@ -302,15 +356,16 @@
set_InitGrid();
//get_FastQuery();
DisPlay_HideColumn();
- //set_Line();
+ set_Line();
}
//鍒濆鍖栬〃鏍�
function set_InitGrid() {
var columns = [];
- columns.push({ type: 'numbers', title: '搴忓彿' });
-
+ //columns.push({ type: 'numbers', title: '搴忓彿' });
+ columns.push({ field: "Id", title: "搴忓彿", width: 70 });
+
//鑾峰彇涓や釜鏈堟湡涔嬮棿鐨勭浉宸�
var time1 = Date.parse(new Date($("#HBeginDate").val()));//寮�濮嬫椂闂�
var time2 = Date.parse(new Date($("#HEndDate").val()));//缁撴潫鏃堕棿
@@ -326,7 +381,7 @@
var k = 0;//鏀堕泦寰幆娆℃暟
for (var j = 0; j <= (Days - k); j++) {
- columns.push({ field: Format(yyyy + '/' + MM + '/' + (HBEGINDATE + j), 'yyyy-MM-dd'), title: Format(yyyy + '/' + MM + '/' + (HBEGINDATE + j), 'MM.dd'), width: 70, totalRow: true })
+ columns.push({ field: Format(yyyy + '/' + MM + '/' + (HBEGINDATE + j), 'yyyy-MM-dd'), title: Format(yyyy + '/' + MM + '/' + (HBEGINDATE + j), 'MM.dd'), width: 120 })
//璺ㄥ勾鐨勮瘽 浼氫粠涓�鏈堜竴鍙峰紑濮�
if (MM == 12 && (HBEGINDATE + j) == 31) {
yyyy += 1;
@@ -350,7 +405,6 @@
, height: 'full-50'
, cellMinWidth: 90
, limit: 500
- , totalRow: true
, loading: false
, cols: [columns]
, done: function (res, curr, count) {
@@ -370,9 +424,34 @@
data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
success: function (data1) {
if (data1.count == 1) {
- option.data = data1.data;
- table.render(option);
layer.close(wait);
+ var limit = parseInt($("#limit").val());//鏍锋湰鏁�
+ if (limit > data1.data.length - 3) {
+ layer.msg("鍙栨牱鏁伴噺瓒呰繃瀹為檯鏁伴噺!", { icon: 5 });
+ } else {
+ var data = [];//鍒楀瓧娈垫暟鎹�
+ var col = [];
+ var totalArray = [];
+ //缁欑┖鐨勬暟缁勮祴鍊�
+ for (var key in data1.list) {//寰簭閬嶅巻鏁扮粍
+ data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });//浠庢瘡涓璞′腑鎻愬彇鏁版嵁
+ }
+ for (var i = 0; i < data.length; i++) {//閬嶅巻data鏁扮粍閲嶇殑鏁版嵁
+ col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 120 });
+ }
+
+ option.cols = [col];
+ option.data = data1.data;
+ optionSJZ[0] = data1.data[0];
+ optionAVG[0] = data1.data[limit + 1];
+ optionS[0] = data1.data[limit + 2];
+ table.render(option);
+ ins = table.render(option);
+ set_PPK();
+ set_CPK();
+ set_Line();
+ }
+
} else {
layer.close(wait);
layer.alert(data1.Message, { icon: 5 });
@@ -384,6 +463,257 @@
});
}
+ //PPK璁$畻 x
+ function set_PPK() {
+ var x_AVG = 0;
+ var x_SUM = 0;
+ var x_PPK = 0;
+ var x_CPK = 0;
+ var numCount = 0
+ var c4 = [0.7979, 0.8862, 0.9213, 0.9400, 0.9515, 0.9594, 0.9650, 0.9693, 0.9727, 0.9754, 0.9776, 0.9794, 0.9810, 0.9823, 0.9835, 0.9845, 0.9854, 0.9862, 0.9869, 0.9876, 0.9882, 0.9887, 0.9892, 0.9896];
+
+ for (var j = 1; j < option.cols[0].length; j++) {
+ if (optionAVG.length != 0 || optionS.length != 0) {
+ x_AVG = calc(x_AVG, parseFloat(optionAVG[0][option.cols[0][j].field]), "+");
+ }
+ }
+ x_AVG = calc(x_AVG, (option.cols[0].length - 1), "/");
+ x_AVG = $("#HCenterline_X").val() == "" ? x_AVG : parseFloat($("#HCenterline_X").val());
+ $("#HCenterline_X").val(x_AVG);
+
+ for (var i = 1; i < option.cols[0].length; i++) {
+ for (var j = 0; j < option.data.length - 3; j++) {
+ numCount += 1;
+ x_SUM = calc(x_SUM, parseFloat(((parseFloat(option.data[j][option.cols[0][i].field]) - x_AVG) ** 2).toFixed(6)), "+")
+
+ }
+ }
+
+ x_PPK = Math.sqrt(calc(x_SUM, (numCount - 1), "/"));
+ x_CPK = Math.sqrt(calc(x_SUM, numCount, "/"));
+ var limit = $("#limit").val();
+ if (parseInt(limit) >= 9) {
+ $("#HCenterline_S").val(x_PPK.toFixed(4));
+ }
+
+ //鍧囧�� 鎺у埗涓婇檺 鎺у埗涓嬮檺
+ if (limit == 1) {
+ $("#HControlUpperLimit_X").val(calc(x_AVG, calc(x_PPK, 3, "*"), "+"))
+ $("#HControlLowerLimit_X").val(calc(x_AVG, calc(x_PPK, 3, "*"), "-"))
+
+ //璁$畻鏍锋湰閲忎负1 鐨� ppk
+ var min = calc(calc(x_AVG, calc(parseFloat($("#HDownLimit").val()), parseFloat($("#HTargetVal").val()), "+"), "-"), calc(3, x_PPK, "*"), "/");
+ var max = calc(calc(calc(parseFloat($("#HUpLimit").val()), parseFloat($("#HTargetVal").val()), "+"), x_AVG, "-"), calc(3, x_PPK, "*"), "/");
+ var DataHCPK = min > max ? max : min;
+ $("#HPPK").val(DataHCPK);
+
+ //璁$畻鏍锋湰閲忎负1 鐨� cpk
+
+ var cpkSum = 0;
+ var CPK_U = 0;
+ var CPK_N = 0;
+ for (var i = 1; i < option.cols[0].length; i++) {
+ for (var j = 0; j < option.data.length - 3; j++) {
+ if (i == 1) {
+ CPK_U = option.data[j][option.cols[0][i].field];
+ } else {
+ CPK_N = option.data[j][option.cols[0][i].field];
+ var data_un = CPK_U > CPK_N ? calc(CPK_U, CPK_N, "-") : calc(CPK_N, CPK_U, "-");
+ cpkSum = calc(cpkSum, data_un, "+");
+ CPK_U = CPK_N;
+ }
+ }
+ }
+ cpkSum = calc(cpkSum, option.cols[0].length - 2, "/");
+ var HAVG_CPK = calc(cpkSum, 1.128, "/");
+
+ min = calc(calc(x_AVG, calc(parseFloat($("#HDownLimit").val()), parseFloat($("#HTargetVal").val()), "+"), "-"), calc(3, HAVG_CPK, "*"), "/");
+ max = calc(calc(calc(parseFloat($("#HUpLimit").val()), parseFloat($("#HTargetVal").val()), "+"), x_AVG, "-"), calc(3, HAVG_CPK, "*"), "/");
+ DataHCPK = min > max ? max : min;
+
+ $("#HCPK").val(DataHCPK);
+ } else {
+ //涓婇檺
+ if ($("#HUpLimit").val() != "" && $("#HDownLimit").val() == "") {
+ var HUpLimit = calc(calc(calc(parseFloat($("#HUpLimit").val()), parseFloat($("#HTargetVal").val()), "+"), x_AVG, "-"), calc(calc(3, x_PPK, "*"), c4[option.data.length - 4], "/"), "/");
+ $("#HPPK").val(HUpLimit.toFixed(4));
+ }
+ //涓嬮檺
+ else if ($("#HDownLimit").val() != "" && $("#HUpLimit").val() == "") {
+ var HDownLimit = calc(calc(x_AVG, calc(parseFloat($("#HDownLimit").val()), parseFloat($("#HTargetVal").val()), "+"), "-"), calc(calc(3, x_PPK, "*"), c4[option.data.length - 4], "/"), "/");
+ $("#HPPK").val(HDownLimit.toFixed(4));
+ } else {
+ var HUpLimit = calc(calc(calc(parseFloat($("#HUpLimit").val()), parseFloat($("#HTargetVal").val()), "+"), x_AVG, "-"), calc(calc(3, x_PPK, "*"), c4[option.data.length - 4], "/"), "/");
+ var HDownLimit = (x_AVG - calc(parseFloat($("#HDownLimit").val()), parseFloat($("#HTargetVal").val()), "+")) / ((3 * x_PPK) / c4[option.data.length - 4]);
+ $("#HPPK").val(HUpLimit > HDownLimit ? HDownLimit.toFixed(4) : HUpLimit.toFixed(4));
+ }
+ }
+ }
+
+ //CPK璁$畻 s
+ function set_CPK() {
+ var x_AVG = 0;
+ var s_AVG = 0;
+ var s_CPK = 0;
+ var d2 = [1.128, 1.693, 2.059, 2.326, 2.534, 2.704, 2.847, 3.078, 3.173, 3.258, 3.336, 3.407, 3.472, 3.532, 3.588, 3.640, 3.689, 3.735, 3.778, 3.819, 3.858, 3.895, 3.931];
+ var A2 = [0,1.880, 1.023, 0.729, 0.577, 0.483, 0.419, 0.373, 0.337, 0.308];
+ var D3 = [0,0.000, 0.000, 0.000, 0.000, 0.000, 0.076, 0.136, 0.184, 0.223];
+ var D4 = [0,3.267, 2.574, 2.282, 2.114, 2.004, 1.924, 1.864, 1.816, 1.777];
+
+ for (var j = 1; j < option.cols[0].length; j++) {
+ if (optionAVG.length != 0 || optionS.length != 0) {
+ s_AVG = calc(s_AVG, parseFloat(optionS[0][option.cols[0][j].field]), "+");
+ }
+ }
+ s_AVG = calc(s_AVG, (option.cols[0].length - 1), "/")
+ s_AVG = $("#HCenterline_S").val() == "" || "0" ? s_AVG : parseFloat($("#HCenterline_S").val());
+ $("#HCenterline_S").val(s_AVG);
+
+ var limit = $("#limit").val();
+ if (parseInt(limit) < 9) {
+ $("#HCenterline_S").val(s_AVG.toFixed(4));
+ }
+
+ for (var j = 1; j < option.cols[0].length; j++) {
+ if (optionAVG.length != 0 || optionS.length != 0) {
+ x_AVG = calc(x_AVG, parseFloat(optionAVG[0][option.cols[0][j].field]), "+");
+ }
+ }
+ x_AVG = calc(x_AVG, (option.cols[0].length - 1), "/");
+ x_AVG = $("#HCenterline_X").val() == "" ? x_AVG : parseFloat($("#HCenterline_X").val());
+ $("#HCenterline_X").val(x_AVG);
+
+ s_CPK = calc(s_AVG, d2[option.data.length - 4], "/");
+
+ //鍧囧�� 鎺у埗涓婇檺 鎺у埗涓嬮檺
+ if (limit > 1) {
+ $("#HControlUpperLimit_X").val(calc(x_AVG, calc(A2[$("#limit").val() - 1], s_AVG, "*"), "+"))
+ $("#HControlLowerLimit_X").val(calc(x_AVG, calc(A2[$("#limit").val() - 1], s_AVG, "*"), "-"))
+ }
+
+ //宸�� 鎺у埗涓婇檺 鎺у埗涓嬮檺
+ $("#HControlUpperLimit_S").val(calc(D4[$("#limit").val() - 1], s_AVG, "*"));
+ $("#HControlLowerLimit_S").val(calc(D3[$("#limit").val() - 1], s_AVG, "*"));
+ var limit = $("#limit").val();
+
+ if (limit > 1) {
+ //涓婇檺
+ if ($("#HUpLimit").val() != "" && $("#HDownLimit").val() == "") {
+ var HUpLimit = calc(calc(calc(parseFloat($("#HUpLimit").val()), parseFloat($("#HTargetVal").val()), "+"), x_AVG, "-"), (3 * s_CPK), "/");
+ $("#HCPK").val(HUpLimit.toFixed(4));
+ }
+ //涓嬮檺
+ else if ($("#HDownLimit").val() != "" && $("#HUpLimit").val() == "") {
+ var HDownLimit = calc(calc(x_AVG, calc(parseFloat($("#HDownLimit").val()), parseFloat($("#HTargetVal").val()), "+"), "-"), (3 * s_CPK), "/");
+ $("#HCPK").val(HDownLimit.toFixed(4));
+ } else {
+ var HUpLimit = calc(calc(calc(parseFloat($("#HUpLimit").val()), parseFloat($("#HTargetVal").val()), "+"), x_AVG, "-"), (3 * s_CPK), "/");
+ var HDownLimit = calc(calc(x_AVG, calc(parseFloat($("#HDownLimit").val()), parseFloat($("#HTargetVal").val()), "+"), "-"), (3 * s_CPK), "/");
+ if (s_CPK == 0) {
+ $("#HCPK").val(0);
+ } else {
+ $("#HCPK").val(HUpLimit > HDownLimit ? HDownLimit.toFixed(4) : HUpLimit.toFixed(4));
+ }
+
+ }
+ }
+ }
+
+ function calc(num1, num2, calcStr) {
+ var str1, // 杞崲涓哄瓧绗︿覆鐨勬暟瀛�
+ str2,
+ ws1 = 0,// ws1锛寃s2 鐢ㄦ潵瀛樺偍浼犲叆鐨刵um鐨勫皬鏁扮偣鍚庣殑鏁板瓧鐨勪綅鏁�
+ ws2 = 0,// 璧嬮粯璁ゅ�硷紝瑙e喅褰撴暣鏁板拰灏忔暟杩愮畻鏃跺�嶆暟璁$畻閿欒瀵艰嚧鐨勭粨鏋滆宸�
+ bigger,// bigger鍜宻maller鐢ㄤ簬鍔狅紝鍑忥紝闄ゆ硶鎵惧嚭灏忕殑閭d釜鏁板瓧锛岀粰鍚庨潰琛�0锛岃В鍐充綅鏁颁笉瀵逛粠鑰岄�犳垚鐨勮绠楅敊璇殑闂锛涗箻娉曢渶瑕佸皢缁撴灉闄や袱涓暟瀛楃殑鍊嶆暟涔嬪拰
+ smaller,// 渚嬪锛氬姞鍑忛櫎娉曚腑1.001 + 2.03 锛屽鏋滀笉缁�2.03杩涜琛�0锛屾渶鍚庝細鍙樻垚1001+203锛屾暟瀛楅敊浣嶅鑷寸粨鏋滈敊璇紱涔樻硶涓�1.12*1.1浼氭斁澶т负112*11锛屾墍浠ョ粨鏋滈渶瑕侀櫎浠�1000鎵嶄細鏄纭殑缁撴灉锛�112*11/1000=1.232
+ zeroCount, // 闇�瑕佽ˉ鍏�0鐨勪釜鏁�
+ isExistDot1, // 浼犲叆鐨勬暟瀛楁槸鍚﹀瓨鍦ㄥ皬鏁扮偣
+ isExistDot2,
+ sum,
+ beishu = 1;
+ // 灏嗘暟瀛楄浆鎹负瀛楃涓�
+ str1 = num1.toString();
+ str2 = num2.toString();
+ // 鏄惁瀛樺湪灏忔暟鐐癸紙鍒ゆ柇闇�瑕佽绠楃殑鏁板瓧鏄笉鏄寘鍚皬鏁帮級
+ isExistDot1 = str1.indexOf('.') != -1 ? true : false;
+ isExistDot2 = str2.indexOf('.') != -1 ? true : false;
+ // 鍙栧皬鏁扮偣鍚庨潰鐨勪綅鏁�
+ if (isExistDot1) {
+ ws1 = str1.split('.')[1].length;
+ }
+
+ if (isExistDot2) {
+ ws2 = str2.split('.')[1].length;
+ }
+ // 濡倃s1 鍜� ws2 鏃犻粯璁ゅ�硷紝濡傛灉num1 鎴� num2 涓嶆槸灏忔暟鐨勮瘽鍒� ws1 鎴� ws2 鐨勫�煎皢涓� undefined
+ // bigger 鍜� smaller 鐨勫�间細鍜岄鏈熶笉绗�
+ bigger = ws1 > ws2 ? ws1 : ws2;
+ smaller = ws1 < ws2 ? ws1 : ws2;
+
+ switch (calcStr) {
+ // 鍔犲噺娉曟壘鍑哄皬鐨勯偅涓暟瀛楋紝缁欏悗闈㈣ˉ0锛岃В鍐充綅鏁颁笉瀵逛粠鑰岄�犳垚鐨勮绠楅敊璇殑闂
+ // 渚嬪锛�1.001 + 2.03 锛屽鏋滀笉缁�2.03杩涜琛�0锛屾渶鍚庝細鍙樻垚1001+203锛屾暟瀛楅敊浣嶅鑷寸粨鏋滈敊璇�
+ case "+":
+ case "-":
+ case "/":
+ zeroCount = bigger - smaller;
+ for (var i = 0; i < zeroCount; i++) {
+ if (ws1 == smaller) {
+ str1 += "0";
+ }
+ else {
+ str2 += "0";
+ }
+ }
+ break;
+ case "*":
+ // 涔樻硶闇�瑕佸皢缁撴灉闄や袱涓暟瀛楃殑鍊嶆暟涔嬪拰
+ bigger = bigger + smaller;
+ break;
+ default:
+ return "鏆備笉鏀寔鐨勮绠楃被鍨嬶紝鐜板凡鏀寔鐨勬湁鍔犳硶銆佸噺娉曘�佷箻娉曘�侀櫎娉�";
+ break;
+ }
+
+ // 鍘婚櫎鏁板瓧涓殑灏忔暟鐐�
+ str1 = str1.replace('.', '');
+ str2 = str2.replace('.', '');
+
+ // 璁$畻鍊嶆暟锛屼緥濡傦細1.001灏忔暟鐐瑰悗鏈変笁浣嶏紝鍒欓渶瑕佷箻 1000 鍙樻垚 1001锛屽彉鎴愭暣鏁板悗绮惧害涓㈠け闂鍒欎笉浼氬瓨鍦�
+ for (var i = 0; i < bigger; i++) {
+ beishu *= 10; // 绛変环浜巄eishu = beishu * 10;
+ }
+ num1 = parseInt(str1);
+ num2 = parseInt(str2);
+ // 杩涜鏈�缁堣绠楀苟闄ょ浉搴斿�嶆暟
+ switch (calcStr) {
+ case "+":
+ sum = (num1 + num2) / beishu;
+ break;
+ case "-":
+ sum = (num1 - num2) / beishu;
+ break;
+ case "*":
+ sum = (num1 * num2) / beishu;
+ break;
+ case "/":
+ sum = num1 / num2;
+ /* 闄ゆ暟涓庤闄ゆ暟鍚屾椂鏀惧ぇ涓�瀹氬�嶆暟锛屼笉褰卞搷缁撴灉锛�
+ 鎵�浠ュ鏁板瓧杩涜鏀惧ぇ瀵瑰簲鍊嶆暟骞惰繘琛岃ˉ0鎿嶄綔鍚庝笉鐢ㄥ彟瀵瑰�嶆暟鍋氬鐞� */
+ break;
+ default:
+ return "鏆備笉鏀寔鐨勮绠楃被鍨嬶紝鐜板凡鏀寔鐨勬湁鍔犳硶銆佸噺娉曘�佷箻娉曘�侀櫎娉�";
+ }
+
+ return sum;
+ }
+
+ //#region 瀵煎嚭Execel
+ function btn_Export() {
+ table.exportFile(ins.config.id, option.data, "xls");
+ }
+ //#endregion
+
//鎶樼嚎鍥�
function set_Line() {
//#region銆愭姌绾垮浘銆�
@@ -394,21 +724,30 @@
let H_X = [];//x杞存爣棰�
let HAvg = [];//骞冲潎鍊�
+ let HDifference = [];//宸��
+ let HSJZ = [];//瀹為檯鍊�
- for (let i = 1; i <= 25; i++) {
- H_X.push(i);
+ for (var j = 1; j < option.cols[0].length; j++) {
+ if (optionAVG.length != 0 || optionS.length != 0) {
+ HAvg.push(optionAVG[0][option.cols[0][j].field]);
+ HDifference.push(optionS[0][option.cols[0][j].field]);
+ HSJZ.push(optionSJZ[0][option.cols[0][j].field]);
+ } else {
+ HAvg.push(0);
+ HDifference.push(0);
+ HSJZ.push(0);
+ }
}
- for (let j = 1; j <= 25; j++) {
- var avg = 0;
- for (let i = 0; i < option.data.length; i++) {
- avg += Number(option.data[i][j]);
- }
- avg = avg / option.data.length;
- HAvg.push(avg.toFixed(2));
+ for (let i = 1; i < option.cols[0].length; i++) {
+ H_X.push(option.cols[0][i].field);
}
option_ZXT_Avg = {
+ title: {
+ text: 'x虅绠″埗鍥�',
+ left: 'center'
+ },
grid: {
x: '3%', //鐩稿綋浜庤窛绂诲乏杈规晥鏋�:padding-left
//y: '5%', //鐩稿綋浜庤窛绂讳笂杈规晥鏋�:padding-top
@@ -420,34 +759,38 @@
data: H_X
},
yAxis: {
- type: 'value'
+ type: 'value',
+ min: parseFloat($("#HDownLimit").val()) != 0 ? calc(parseFloat($("#HTargetVal").val()), calc(parseFloat($("#HDownLimit").val()), 1.3, "*"), "+") : 0, // 璁剧疆鏈�灏忓��
+ max: calc(parseFloat($("#HTargetVal").val()), calc(parseFloat($("#HUpLimit").val()), 1.3, "*"), "+"), // 璁剧疆鏈�澶у��
+ interval: calc(calc(parseFloat($("#HUpLimit").val()), parseFloat($("#HDownLimit").val()), "-"), 10, "/"), // 璁剧疆闂磋窛
},
series: [
{
data: HAvg,
type: 'line',
- areaStyle: {//濉厖鐨勯鑹�
- color: {//绾挎�ф笎鍙樺墠鍥涗釜鍙傛暟鍒嗗埆鏄� x0, y0, x2, y2, 鑼冨洿浠� 0 - 1锛岀浉褰撲簬鍦ㄥ浘褰㈠寘鍥寸洅涓殑鐧惧垎姣旓紝濡傛灉 globalCoord 涓� `true`锛屽垯璇ュ洓涓�兼槸缁濆鐨勫儚绱犱綅缃�
- type: 'linear',
- x: 0,
- y: 1,
- x2: 0,
- y2: 0,
- colorStops: [{
- offset: 0, color: 'rgba(232,247,247)' // 0% 澶勭殑棰滆壊
- }, {
- offset: 1, color: 'rgba(183,252,252)' // 100% 澶勭殑棰滆壊
- }],
- globalCoord: false// 缂虹渷涓� false
- }
- },
+
+ itemStyle: { normal: { label: { show: true } } },
markLine: {
symbol: 'none',//鍘绘帀绠ご
data: [
- { type: 'max', name: 'Max', lineStyle: { color: 'red' } },
- { type: 'average', name: 'Avg', lineStyle: { color: 'blue' } },
- { type: 'min', name: 'Min', lineStyle: { color: 'green' } },
- ]
+ {
+ name: 'USL', yAxis: parseFloat($("#HTargetVal").val()) + parseFloat($("#HUpLimit").val()), lineStyle: { color: '#FF1D00' }, label: { color: '#FF1D00', fontSize: 10 }, label: { formatter: '{b}: {c}' }
+ },
+ {
+ name: 'LSL', yAxis: parseFloat($("#HTargetVal").val()) + parseFloat($("#HDownLimit").val()), lineStyle: { color: '#FF1D00' }, label: { color: '#FF1D00', fontSize: 10 }, label: { formatter: '{b}: {c}' }
+ },
+ {
+ name: 'UCL', yAxis: parseFloat($("#HControlUpperLimit_X").val()), lineStyle: { color: '#2cb615' }, label: { color: '#2cb615', fontSize: 10 }, label: { formatter: '{b}: {c}' }
+ },
+ {
+ name: 'LCL', yAxis: parseFloat($("#HControlLowerLimit_X").val()), lineStyle: { color: '#2cb615' }, label: { color: '#2cb615', fontSize: 10 }, label: { formatter: '{b}: {c}' }
+ }
+ ,
+ {
+ name: 'CL', yAxis: parseFloat($("#HCenterline_X").val()), lineStyle: { color: '#6dadf0' }, label: { color: '#6dadf0', fontSize: 10 }, label: { formatter: '{b}: {c}' }
+ }
+ ],
+ precision: 3
},
}
]
@@ -459,21 +802,11 @@
var myChart = echarts.init(chartDom);
var option_ZXT_Diff;
- let HDifference = [];//宸��
- var HArr = []; //瑁呮楠屽��
-
- for (let j = 1; j <= 25; j++) {
- HArr = [];
- for (let i = 0; i < option.data.length; i++) {
- HArr.push(option.data[i][j]);
- }
- var HMaxValue = Math.max(...HArr);//鑾峰彇鏁扮粍涓殑鏈�澶у��
- var HMinValue = Math.min(...HArr);//鑾峰彇鏁扮粍涓殑鏈�灏忓��
- HDifference.push(Number(HMaxValue) - Number(HMinValue));
- }
-
-
option_ZXT_Diff = {
+ title: {
+ text: 'R绠″埗鍥�',
+ left: 'center'
+ },
grid: {
x: '3%', //鐩稿綋浜庤窛绂诲乏杈规晥鏋�:padding-left
//y: '5%', //鐩稿綋浜庤窛绂讳笂杈规晥鏋�:padding-top
@@ -485,41 +818,85 @@
data: H_X
},
yAxis: {
- type: 'value'
+ type: 'value',
+ min: 0, // 璁剧疆鏈�灏忓��
+ max: parseFloat($("#HControlUpperLimit_S").val()) != 0 ? calc(parseFloat($("#HControlUpperLimit_S").val()), 0.01, "+") : 0, // 璁剧疆鏈�澶у��
+ interval: calc(parseFloat($("#HControlUpperLimit_S").val()), 10, "/"), // 璁剧疆闂磋窛
},
series: [
{
data: HDifference,
type: 'line',
- areaStyle: {//濉厖鐨勯鑹�
- color: {//绾挎�ф笎鍙樺墠鍥涗釜鍙傛暟鍒嗗埆鏄� x0, y0, x2, y2, 鑼冨洿浠� 0 - 1锛岀浉褰撲簬鍦ㄥ浘褰㈠寘鍥寸洅涓殑鐧惧垎姣旓紝濡傛灉 globalCoord 涓� `true`锛屽垯璇ュ洓涓�兼槸缁濆鐨勫儚绱犱綅缃�
- type: 'linear',
- x: 0,
- y: 1,
- x2: 0,
- y2: 0,
- colorStops: [{
- offset: 0, color: 'rgba(255,240,170,0)' // 0% 澶勭殑棰滆壊
- }, {
- offset: 1, color: 'rgba(255,240,170,1)' // 100% 澶勭殑棰滆壊
- }],
- globalCoord: false// 缂虹渷涓� false
- }
- },
+
+ itemStyle: { normal: { label: { show: true } } },
markLine: {
symbol: 'none',//鍘绘帀绠ご
data: [
- { type: 'max', name: 'Max', lineStyle: { color: 'red' } },
- { type: 'average', name: 'Avg', lineStyle: { color: 'blue' } },
- { type: 'min', name: 'Min', lineStyle: { color: 'green' } },
- ]
+ {
+ name: 'UCL', yAxis: parseFloat($("#HControlUpperLimit_S").val()), lineStyle: { color: '#2cb615' }, label: { color: '#2cb615', fontSize: 10 }, label: { formatter: '{b}: {c}' }
+ },
+ {
+ name: 'LCL', yAxis: parseFloat($("#HControlLowerLimit_S").val()), lineStyle: { color: '#2cb615' }, label: { color: '#2cb615', fontSize: 10 }, label: { formatter: '{b}: {c}' }
+ }
+ ,
+ {
+ name: 'CL', yAxis: parseFloat($("#HCenterline_S").val()), lineStyle: { color: '#6dadf0' }, label: { color: '#6dadf0', fontSize: 10 }, label: { formatter: '{b}: {c}' }
+ }
+ ],
+ precision: 3
},
}
]
};
option_ZXT_Diff && myChart.setOption(option_ZXT_Diff);
- //#endregion
+ //瀹為檯鍊�
+ var chartDom = document.getElementById('histogram_SJZ');
+ var myChart = echarts.init(chartDom);
+ var option_ZXT_SJZ;
+
+ option_ZXT_SJZ = {
+ title: {
+ text: '妫�娴嬪��',
+ left: 'center'
+ },
+ grid: {
+ x: '3%', //鐩稿綋浜庤窛绂诲乏杈规晥鏋�:padding-left
+ //y: '5%', //鐩稿綋浜庤窛绂讳笂杈规晥鏋�:padding-top
+ bottom: '5%',
+ containLabel: true
+ },
+ xAxis: {
+ type: 'category',
+ data: H_X
+ },
+ yAxis: {
+ type: 'value',
+ min: parseFloat($("#HDownLimit").val()) != 0 ? calc(parseFloat($("#HTargetVal").val()), calc(parseFloat($("#HDownLimit").val()), 1.3, "*"), "+") : 0, // 璁剧疆鏈�灏忓��
+ max: calc(parseFloat($("#HTargetVal").val()), calc(parseFloat($("#HUpLimit").val()), 1.3, "*"), "+"), // 璁剧疆鏈�澶у��
+ interval: calc(calc(parseFloat($("#HUpLimit").val()), parseFloat($("#HDownLimit").val()), "-"), 10, "/"), // 璁剧疆闂磋窛
+ },
+ series: [
+ {
+ data: HSJZ,
+ type: 'line',
+ itemStyle: { normal: { label: { show: true } } },
+ markLine: {
+ symbol: 'none',//鍘绘帀绠ご
+ data: [
+ { name: 'USL', yAxis: parseFloat($("#HTargetVal").val()) + parseFloat($("#HUpLimit").val()), lineStyle: { color: '#FF1D00' }, label: { color: '#FF1D00', fontSize: 10 }, label: { formatter: '{b}: {c}' } },
+ {
+ name: 'LSL', yAxis: parseFloat($("#HTargetVal").val()) + parseFloat($("#HDownLimit").val()), lineStyle: { color: '#FF1D00' }, label: { color: '#FF1D00', fontSize: 10 }, label: { formatter: '{b}: {c}' }
+ }
+ ],
+ precision: 3
+ },
+ }
+ ]
+ };
+ option_ZXT_SJZ && myChart.setOption(option_ZXT_SJZ);
+
+ //#endregion
}
@@ -565,6 +942,7 @@
var limit = $("#limit").val();//鏍锋湰鏁�
var HMaterID = $("#HMaterID").val();//鐗╂枡
var HQCCheckItemID = $("#HQCCheckItemID").val();//妫�楠岄」鐩�
+ var HMouldNum = $("#HMouldNum").val();//绌村彿
if (limit == 0) {
return layer.msg("鏍锋湰鏁伴噺涓嶈兘涓�0!");
@@ -585,8 +963,10 @@
, limit: limit
, HMaterID: HMaterID
, HQCCheckItemID: HQCCheckItemID
+ , HMouldNum: HMouldNum
}
-
+ //鍒濆鍖栬〃鏍�
+ set_InitGrid();
get_Display(JSON.stringify(sWhere));
//璋冪敤鎺ュ彛鍚庢竻绌簊Where缂撳瓨
sWhere = "";
@@ -627,7 +1007,7 @@
, area: ['90%', '90%']//澶у皬
, title: '妫�楠岄」鐩垪琛�'//鏍囬
, shift: 2//寮瑰嚭鍔ㄧ敾
- , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_CheckItem.html', 'yes']
+ , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_CheckItem.html?Type=SPC&ID=' + HQCCheckNum.toString(), 'yes']
, btn: ['纭畾', '鍙栨秷']
, btn1: function (index, layero) {//鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
var iframeWindow = window['layui-layer-iframe' + index] //鑾峰彇寮规椤甸潰
@@ -638,12 +1018,60 @@
//鑾峰彇鏁版嵁
$("#HQCCheckItemID").val(checkStatus.data[0].HItemID);
$("#HQCCheckItemNumber").val(checkStatus.data[0].浠g爜);
+
+ btnCheckProjectList(1);
+
layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
}
, btn2: function (index, layero) { }
})
}
+ //妫�楠屾柟妗�
+ function btnCheckProjectList(Type) {
+ HQCCheckNum = [];
+ //Type 1 鏍规嵁閫変腑鐨勬楠岄」鐩幓鏌ヨ鏁版嵁
+ //Type 2 鏍规嵁閫変腑鐨勭墿鏂欏幓鏌ヨ鏁版嵁
+ var sWheres = "";
+ if (Type == 1) {
+ sWheres = " and 妫�楠岄」鐩唬鐮�='" + $("#HQCCheckItemNumber").val() + "' and 鐗╂枡浠g爜='" + $("#HMaterNumber").val() + "'";
+ }
+ if (Type == 2) {
+ sWheres = " and 鐗╂枡浠g爜='" + $("#HMaterNumber").val() + "'";
+ }
+
+ var wait = layer.load();//閬僵
+ $.ajax({
+ url: GetWEBURL() + '/QC_Management/MES_QC_CheckProjectListProjectDetaiList',
+ type: "GET",
+ async: false,
+ data: { "sWhere": sWheres, "user": sessionStorage["HUserName"] },
+ success: function (data1) {
+ if (data1.count == 1) {
+ layer.close(wait);
+
+ if (Type == 1) {
+ $("#HUpLimit").val(data1.data[0].涓婇檺鍊�);
+ $("#HDownLimit").val(data1.data[0].涓嬮檺鍊�);
+ $("#HTargetVal").val(data1.data[0].鐩爣鍊�);
+ }
+ if (Type == 2) {
+ for (var i = 0; i < data1.data.length; i++) {
+ HQCCheckNum.push(data1.data[i]["妫�楠岄」鐩甀D"]);
+ }
+ }
+ //$("#HControlUpperLimit").val(data1.data[0].鎺у埗涓婇檺);
+ //$("#HControlLowerLimit").val(data1.data[0].鎺у埗涓嬮檺);
+ } else {
+ layer.close(wait);
+ layer.alert(data1.Message, { icon: 5 });
+ }
+ }, error: function () {
+ layer.close(wait);
+ layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+ }
+ });
+ }
//閲嶇疆杩囨护鏉′欢
function set_ClearQuery() {
--
Gitblit v1.9.1