From 3d240d150e6e1a4e2df1a9f87d00ddd03ace4ee5 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期五, 17 一月 2025 10:06:37 +0800
Subject: [PATCH] 增加 BOM层级展开报表,修复全程追溯报表 黑白标页签导出失败,工艺路线的表头查询优化页面排序

---
 WebTM/views/质量管理/质量报表/QC_InspectionFormReport.html |  651 +++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 543 insertions(+), 108 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 278e638..5e2b479 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"
@@ -132,13 +132,13 @@
                                     </div>
                                     <div class="layui-row" style="margin-top:5px;">
                                         <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" 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>
+                                            <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>
@@ -158,13 +158,13 @@
                                     </div>
                                     <div class="layui-row" style="margin-top:5px;">
                                         <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" 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>
+                                            <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>
@@ -185,17 +185,37 @@
                                 </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(100vh);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(100vh);margin-top:15px;">
+                                    </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>
@@ -211,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.$
@@ -227,9 +247,12 @@
             //鏌ヨ鏉′欢
             var sWhere = "";
             var option = [];
+            var ins;                //鐢ㄤ簬瀵煎嚭excel
             var HModName = "QC_InspectionFormReport";
             var optionAVG = [];
             var optionS = [];
+            var optionSJZ = [];
+            var HQCCheckNum = [];
             //#endregion
 
             //#region 杩涘叆椤甸潰鏃㈠姞杞�
@@ -239,7 +262,7 @@
 
             //#endregion
 
-          
+
 
             //#region 鐐瑰嚮浜嬩欢鍖呮嫭on form浜嬩欢绛�
             //澶村伐鍏锋爮浜嬩欢
@@ -252,6 +275,9 @@
                     case 'HideColumn':
                         get_HideColumn();
                         break;
+                    //瀵煎嚭鎸夐挳
+                    case 'btn_Export': btn_Export();
+                        break;
                 };
             });
 
@@ -259,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) {
@@ -313,7 +340,7 @@
                     }
                 });
             });
-          
+
             //#endregion
 
             //#region 姝ら〉闈㈡墍鏈夌殑鏂规硶
@@ -337,8 +364,8 @@
                 var columns = [];
 
                 //columns.push({ type: 'numbers', title: '搴忓彿' });
-                columns.push({ field:"Id", title: "搴忓彿", width: 70 });
-            
+                columns.push({ field: "Id", title: "搴忓彿", width: 70 });
+
                 //鑾峰彇涓や釜鏈堟湡涔嬮棿鐨勭浉宸�
                 var time1 = Date.parse(new Date($("#HBeginDate").val()));//寮�濮嬫椂闂�
                 var time2 = Date.parse(new Date($("#HEndDate").val()));//缁撴潫鏃堕棿
@@ -415,14 +442,16 @@
 
                                 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);
-                                set_Line();
+                                ins = table.render(option);
                                 set_PPK();
                                 set_CPK();
+                                set_Line();
                             }
-                          
+
                         } else {
                             layer.close(wait);
                             layer.alert(data1.Message, { icon: 5 });
@@ -436,9 +465,10 @@
 
             //PPK璁$畻 x
             function set_PPK() {
-                var x_AVG =0;
+                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];
 
@@ -449,46 +479,86 @@
                 }
                 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);
+                $("#HCenterline_X").val(x_AVG.toFixed(5));
 
                 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, "*"), "+").toFixed(5))
+                    $("#HControlLowerLimit_X").val(calc(x_AVG, calc(x_PPK, 3, "*"), "-").toFixed(5))
 
-                //涓婇檺
-                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));
+                    //璁$畻鏍锋湰閲忎负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 {
-                    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));
+                    //涓婇檺
+                    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
+            //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) {
@@ -511,28 +581,41 @@
                 }
                 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);
+                $("#HCenterline_X").val(x_AVG.toFixed(5));
 
                 s_CPK = calc(s_AVG, d2[option.data.length - 4], "/");
 
-                //涓婇檺
-                if ($("#HUpLimit").val() != "" && $("#HDownLimit").val() == "") {
-                    var HUpLimit = calc(calc(calc(parseFloat($("#HUpLimit").val()), parseFloat($("#HTargetVal").val()),"+"), s_AVG, "-"), (3 * s_CPK), "/");
-                    $("#HCPK").val(HUpLimit.toFixed(4));
+                //鍧囧�� 鎺у埗涓婇檺 鎺у埗涓嬮檺
+                if (limit > 1) {
+                    $("#HControlUpperLimit_X").val(calc(x_AVG, calc(A2[$("#limit").val() - 1], s_AVG, "*"), "+").toFixed(5))
+                    $("#HControlLowerLimit_X").val(calc(x_AVG, calc(A2[$("#limit").val() - 1], s_AVG, "*"), "-").toFixed(5))
                 }
-                //涓嬮檺
-                else if ($("#HDownLimit").val() != "" && $("#HUpLimit").val() == "") {
-                    var HDownLimit = calc(calc(s_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()), "+"), s_AVG, "-"), (3 * s_CPK), "/");
-                    var HDownLimit = calc(calc(s_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));
-                    }
+           
+                //宸�� 鎺у埗涓婇檺 鎺у埗涓嬮檺
+                $("#HControlUpperLimit_S").val(calc(D4[$("#limit").val() - 1], s_AVG, "*").toFixed(5));
+                $("#HControlLowerLimit_S").val(calc(D3[$("#limit").val() - 1], s_AVG, "*").toFixed(5));
+                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));
+                        }
+
+                    }
                 }
             }
 
@@ -540,7 +623,7 @@
                 var str1, // 杞崲涓哄瓧绗︿覆鐨勬暟瀛�
                     str2,
                     ws1 = 0,// ws1锛寃s2 鐢ㄦ潵瀛樺偍浼犲叆鐨刵um鐨勫皬鏁扮偣鍚庣殑鏁板瓧鐨勪綅鏁�
-                    ws2 = 0,// 璧嬮粯璁ゅ�硷紝瑙e喅褰撴暣鏁板拰灏忔暟杩愮畻鏃跺�嶆暟璁$畻閿欒瀵艰嚧鐨勭粨鏋滆宸� 
+                    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鐨勪釜鏁�
@@ -562,7 +645,7 @@
                 if (isExistDot2) {
                     ws2 = str2.split('.')[1].length;
                 }
-                // 濡倃s1 鍜� ws2 鏃犻粯璁ゅ�硷紝濡傛灉num1 鎴� num2 涓嶆槸灏忔暟鐨勮瘽鍒� ws1 鎴� ws2 鐨勫�煎皢涓� undefined 
+                // 濡倃s1 鍜� ws2 鏃犻粯璁ゅ�硷紝濡傛灉num1 鎴� num2 涓嶆槸灏忔暟鐨勮瘽鍒� ws1 鎴� ws2 鐨勫�煎皢涓� undefined
                 // bigger 鍜� smaller 鐨勫�间細鍜岄鏈熶笉绗�
                 bigger = ws1 > ws2 ? ws1 : ws2;
                 smaller = ws1 < ws2 ? ws1 : ws2;
@@ -625,6 +708,12 @@
                 return sum;
             }
 
+            //#region 瀵煎嚭Execel
+            function btn_Export() {
+                table.exportFile(ins.config.id, option.data, "xls");
+            }
+            //#endregion
+
             //鎶樼嚎鍥�
             function set_Line() {
                 //#region銆愭姌绾垮浘銆�
@@ -636,26 +725,49 @@
                 let H_X = [];//x杞存爣棰�
                 let HAvg = [];//骞冲潎鍊�
                 let HDifference = [];//宸��
+                let HSJZ = [];//瀹為檯鍊�
+
+                var judge = spc_judge();
 
                 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]);
+                        if ($.inArray(optionAVG[0][option.cols[0][j].field], judge) != -1) {
+                            var data = { value: optionAVG[0][option.cols[0][j].field], itemStyle: { color: 'red' } };
+                            HAvg.push(data);
+                        } else {
+                            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 i = 1; i < option.cols[0].length; i++) {
                     H_X.push(option.cols[0][i].field);
                 }
+                var max = Math.max.apply(null, HSJZ);
+                var min = Math.min.apply(null, HSJZ);
+
+                var sum = 0;
+                $.each(HSJZ, function (index, value) {
+                    sum += value;
+                });
+                var average = sum / HSJZ.length;
+
+                var HAreaValue = calc(calc(parseFloat($("#HControlUpperLimit_X").val()), parseFloat($("#HCenterline_X").val()), "-"), 3, "/").toFixed(5);
+                var HAreaValue_A = HAreaValue * 2;
+                var HAreaValue_B = HAreaValue * 1;
 
                 option_ZXT_Avg = {
                     title: {
-                        text: '骞冲潎鍊�',
+                        text: 'x虅绠″埗鍥�',
                         left: 'center'
-                    }, 
+                    },
                     grid: {
                         x: '3%', //鐩稿綋浜庤窛绂诲乏杈规晥鏋�:padding-left
                         //y: '5%',  //鐩稿綋浜庤窛绂讳笂杈规晥鏋�:padding-top
@@ -668,48 +780,58 @@
                     },
                     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, "*"), "+"), // 璁剧疆鏈�澶у��
+                        min: parseFloat($("#HDownLimit").val()) != 0 ? calc(parseFloat($("#HTargetVal").val()), calc(parseFloat($("#HDownLimit").val()), 1.1, "*"), "+") : 0, // 璁剧疆鏈�灏忓��
+                        max: calc(parseFloat($("#HTargetVal").val()), calc(parseFloat($("#HUpLimit").val()), 1.1, "*"), "+"), // 璁剧疆鏈�澶у��
                         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
+                                    }
                                 }
                             },
-                            itemStyle: { normal: { label: { show: true } } },
                             markLine: {
                                 symbol: 'none',//鍘绘帀绠ご
                                 data: [
-                                    { yAxis: parseFloat($("#HTargetVal").val()) + parseFloat($("#HUpLimit").val()), lineStyle: { color: '#FF1D00' }, label: { color: '#FF1D00', fontSize: 10 } },
                                     {
-                                        yAxis: parseFloat($("#HTargetVal").val()) + parseFloat($("#HDownLimit").val()), lineStyle: { color: '#FF1D00' }, label: { color: '#FF1D00', fontSize: 10 }
+                                        name: 'USL', yAxis: parseFloat($("#HTargetVal").val()) + parseFloat($("#HUpLimit").val()), lineStyle: { color: '#FF1D00' }, label: { color: '#FF1D00', fontSize: 10 }, label: { formatter: '{b}: {c}' }
                                     },
                                     {
-                                        yAxis: parseFloat($("#HControlUpperLimit_X").val()), lineStyle: { color: '#2cb615' }, label: { color: '#2cb615', fontSize: 10 }
+                                        name: 'LSL', yAxis: parseFloat($("#HTargetVal").val()) + parseFloat($("#HDownLimit").val()), lineStyle: { color: '#FF1D00' }, label: { color: '#FF1D00', fontSize: 10 }, label: { formatter: '{b}: {c}' }
                                     },
                                     {
-                                        yAxis: parseFloat($("#HControlLowerLimit_X").val()), lineStyle: { color: '#2cb615' }, label: { color: '#2cb615', fontSize: 10 }
+                                        name: 'UCL', yAxis: parseFloat($("#HControlUpperLimit_X").val()), lineStyle: { color: '#ff9145' }, label: { color: '#ff9145', fontSize: 10 }, label: { formatter: '{b}: {c}' }
+                                    },
+                                    {
+                                        name: 'LCL', yAxis: parseFloat($("#HControlLowerLimit_X").val()), lineStyle: { color: '#ff9145' }, label: { color: '#ff9145', fontSize: 10 }, label: { formatter: '{b}: {c}' }
                                     }
                                     ,
                                     {
-                                        yAxis: parseFloat($("#HCenterline_X").val()), lineStyle: { color: '#6dadf0' }, label: { color: '#6dadf0', fontSize: 10 }
+                                        name: 'CL', yAxis: parseFloat($("#HCenterline_X").val()), lineStyle: { color: '#000000' }, label: { color: '#000000', fontSize: 10 }, label: { formatter: '{b}: {c}' }
                                     }
-                                ]
+                                    ,
+                                    {
+                                        name: 'B', yAxis: parseFloat($("#HCenterline_X").val()) + HAreaValue_A, lineStyle: { color: '#6dadf0' }, label: { color: '#6dadf0', fontSize: 10 }, label: { formatter: '{b}: {c}' }
+                                    }
+                                    ,
+                                    {
+                                        name: '-B', yAxis: parseFloat($("#HCenterline_X").val()) - HAreaValue_A, lineStyle: { color: '#6dadf0' }, label: { color: '#6dadf0', fontSize: 10 }, label: { formatter: '{b}: {c}' }
+                                    }
+                                    ,
+                                    {
+                                        name: 'C', yAxis: parseFloat($("#HCenterline_X").val()) + HAreaValue_B, lineStyle: { color: '#2cb615' }, label: { color: '#2cb615', fontSize: 10 }, label: { formatter: '{b}: {c}' }
+                                    }
+                                    ,
+                                    {
+                                        name: '-C', yAxis: parseFloat($("#HCenterline_X").val()) - HAreaValue_B, lineStyle: { color: '#2cb615' }, label: { color: '#2cb615', fontSize: 10 }, label: { formatter: '{b}: {c}' }
+                                    }
+                                ],
+                                precision: 3
                             },
                         }
                     ]
@@ -723,7 +845,7 @@
 
                 option_ZXT_Diff = {
                     title: {
-                        text: '宸��',
+                        text: 'R绠″埗鍥�',
                         left: 'center'
                     },
                     grid: {
@@ -737,49 +859,344 @@
                         data: H_X
                     },
                     yAxis: {
-                        type: 'value'
+                        type: 'value',
+                        min: 0, // 璁剧疆鏈�灏忓��
+                        max: parseFloat($("#HControlUpperLimit_S").val()) != 0 ? calc(parseFloat($("#HControlUpperLimit_S").val()), 1.1, "*") : 0, // 璁剧疆鏈�澶у��
+                        interval: calc(parseFloat($("#HControlUpperLimit_S").val()).toFixed(5), 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: [
                                     {
-                                        yAxis: parseFloat($("#HControlUpperLimit_S").val()) , lineStyle: { color: '#2cb615' }, label: { color: '#2cb615', fontSize: 10 }
+                                        name: 'UCL', yAxis: parseFloat($("#HControlUpperLimit_S").val()), lineStyle: { color: '#2cb615' }, label: { color: '#2cb615', fontSize: 10 }, label: { formatter: '{b}: {c}' }
                                     },
                                     {
-                                        yAxis: parseFloat($("#HControlLowerLimit_S").val()), lineStyle: { color: '#2cb615' }, label: { color: '#2cb615', fontSize: 10 }
+                                        name: 'LCL', yAxis: parseFloat($("#HControlLowerLimit_S").val()), lineStyle: { color: '#2cb615' }, label: { color: '#2cb615', fontSize: 10 }, label: { formatter: '{b}: {c}' }
                                     }
                                     ,
                                     {
-                                        yAxis: parseFloat($("#HCenterline_S").val()), lineStyle: { color: '#6dadf0' }, label: { color: '#6dadf0', fontSize: 10 }
+                                        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.1, "*"), "+") : 0, // 璁剧疆鏈�灏忓��
+                        max: calc(parseFloat($("#HTargetVal").val()), calc(parseFloat($("#HUpLimit").val()), 1.1, "*"), "+"), // 璁剧疆鏈�澶у��
+                        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}' }
+                                    },
+                                    {
+                                        name: 'UCL', yAxis: max, lineStyle: { color: '#2cb615' }, label: { color: '#2cb615', fontSize: 10 }, label: { formatter: '{b}: {c}' }
+                                    },
+                                    {
+                                        name: 'LCL', yAxis: min, lineStyle: { color: '#2cb615' }, label: { color: '#2cb615', fontSize: 10 }, label: { formatter: '{b}: {c}' }
+                                    }
+                                    ,
+                                    {
+                                        name: 'CL', yAxis: average.toFixed(5), lineStyle: { color: '#6dadf0' }, label: { color: '#6dadf0', fontSize: 10 }, label: { formatter: '{b}: {c}' }
+                                    }
+                                ],
+                                precision: 3
+                            },
+                        }
+                    ]
+                };
+                option_ZXT_SJZ && myChart.setOption(option_ZXT_SJZ);
+
+                //#endregion
+
+            }
+
+            //璁$畻spc鍏ぇ鍒ゅ畾
+            function spc_judge() {
+                //鍧囧��
+                var HAreaValue = calc(calc(parseFloat($("#HControlUpperLimit_X").val()), parseFloat($("#HCenterline_X").val()), "-"), 3, "/").toFixed(5);
+                //涓婇檺閮ㄥ垎
+                var HAreaValue_A = parseFloat($("#HControlUpperLimit_X").val());
+                var HAreaValue_B = calc(calc(HAreaValue, 2, "*"), parseFloat($("#HCenterline_X").val()), "+").toFixed(5);
+                var HAreaValue_C = calc(calc(HAreaValue, 1, "*"), parseFloat($("#HCenterline_X").val()), "+").toFixed(5);
+                //涓嬮檺閮ㄥ垎
+                var HAreaValue_FA = parseFloat($("#HControlLowerLimit_X").val());
+                var HAreaValue_FB = calc(parseFloat($("#HCenterline_X").val()),calc(HAreaValue, 2, "*"), "-").toFixed(5);
+                var HAreaValue_FC = calc(parseFloat($("#HCenterline_X").val()),calc(HAreaValue, 1, "*"), "-").toFixed(5);
+
+
+                let HAvg = [];//骞冲潎鍊�
+
+                for (var j = 1; j < option.cols[0].length; j++) {
+                    if (optionAVG.length != 0) {
+                        HAvg.push(optionAVG[0][option.cols[0][j].field]);
+                    } 
+                }
+             
+                //杩炵画鍗佷簲涓偣鍦ㄤ腑蹇冪嚎涓や晶鐨凜鍖哄唴
+                var judge_return = [];
+                if (HAvg.length >= 15) {
+                    for (var i = 14; i < HAvg.length; i++) {
+                        if (HAvg[i] >= HAreaValue_FC && HAvg[i] <= HAreaValue_C) {
+                            for (var j = i - 14; j <= i; j++) {
+                                if (HAvg[j] >= HAreaValue_FC && HAvg[j] <= HAreaValue_C) {
+                                    if (i == j) {
+                                        for (var j1 = i; j1 >= i - 14; j1--) {
+                                            if ($.inArray(HAvg[j1], judge_return) == -1) {
+                                                judge_return.push(HAvg[j1]);
+                                            }
+                                        }
+                                    }
+                                } else {
+                                    break;
+                                }
+                            }
+                        }
+                    }
+                }
+                //杩炵画14涓偣涓浉閭荤偣浜ゆ浛涓婁笅
+                if (HAvg.length >= 14) {
+                    for (var i = 13; i < HAvg.length; i++) {
+                        var judge = [];
+                        for (var j = i - 13; j < i; j++) {
+                            if (HAvg[j] > HAvg[j + 1]) {
+                                judge.push(1);
+                            } else if (HAvg[j] < HAvg[j + 1]) {
+                                judge.push(-1);
+                            }
+                        }
+                        for (var k = 0; k < judge.length; k++) {
+                            if (judge[k] + judge[k + 1] == 0) {
+                                if ((k + 1) == judge.length) {
+                                    for (var j1 = i; j1 >= i - 13; j1--) {
+                                        if ($.inArray(HAvg[j1], judge_return) == -1) {
+                                            judge_return.push(HAvg[j1]);
+                                        }
+                                    }
+                                }
+                            } else {
+                                break;
+                            }
+                        }
+                    }
+                }
+
+                //杩炵画9涓偣钀藉湪涓績绾跨殑鍚屼竴渚�
+                if (HAvg.length >= 9) {
+                    for (var i = 8; i < HAvg.length; i++) {
+                        var judge = [];
+                        for (var j = i - 8; j <= i; j++) {
+                            if (HAvg[j] > parseFloat($("#HCenterline_X").val())) {
+                                judge.push(1);
+                            } else if (HAvg[j] < parseFloat($("#HCenterline_X").val())) {
+                                judge.push(-1);
+                            }
+                        }
+                        var sum = 0;
+                        for (var k = 0; k < judge.length; k++) {
+                            sum += judge[k];
+                        }
+                        if (sum == 9 || sum == -9) {
+                            for (var j1 = i; j1 >= i - 8; j1--) {
+                                if ($.inArray(HAvg[j1], judge_return) == -1) {
+                                    judge_return.push(HAvg[j1]);
+                                }
+                            }
+                        }
+                    }
+                }
+
+                //杩炵画8鐐硅惤鍦ㄤ腑蹇冪嚎涓や晶涓旀棤涓�鍦–鍖轰互鍐�(鍗冲湪C鍖轰互澶�)
+                if (HAvg.length >= 8) {
+                    for (var i = 7; i < HAvg.length; i++) {
+                        if (HAvg[i] < HAreaValue_FC || HAvg[i] > HAreaValue_C) {
+                            for (var j = i - 7; j <= i; j++) {
+                                if (HAvg[j] < HAreaValue_FC || HAvg[j] > HAreaValue_C) {
+                                    if (j == i) {
+                                        for (var j1 = i; j1 >= i - 7; j1--) {
+                                            if ($.inArray(HAvg[j1], judge_return) == -1) {
+                                                judge_return.push(HAvg[j1]);
+                                            }
+                                        }
+                                    }
+                                } else {
+                                    break;
+                                }
+                            }
+                        }
+                    }
+                }
+
+                //杩炵画6鐐归�掑鎴栭�掑噺
+                if (HAvg.length >= 6) {
+                    for (var i = 5; i < HAvg.length; i++) {
+                        var judge = [];
+                        for (var j = i - 5; j < i; j++) {
+                            if (HAvg[j] > HAvg[j + 1]) {
+                                judge.push(1);
+                            } else if (HAvg[j] < HAvg[j + 1]) {
+                                judge.push(-1);
+                            }
+                        }
+                        var sum = 0;
+                        for (var k = 0; k < judge.length; k++) {
+                            sum += judge[k];
+                        }
+                        if (sum == 5 || sum == -5) {
+                            for (var j1 = i; j1 >= i - 5; j1--) {
+                                if ($.inArray(HAvg[j1], judge_return) == -1) {
+                                    judge_return.push(HAvg[j1]);
+                                }
+                            }
+                        }
+                    }
+                }
+
+                //杩炵画5鐐逛腑鏈�4鐐硅惤鍦ㄤ腑蹇冪嚎鍚屼竴渚х殑C鍖哄
+                if (HAvg.length >= 5) {
+                    for (var i = 4; i < HAvg.length; i++) {
+                        var judge = [];
+                        if (HAvg[i] > parseFloat($("#HCenterline_X").val()) && HAvg[i] > HAreaValue_C) {
+                            for (var j = i - 4; j <= i; j++) {
+                                var record = [];
+                                if (HAvg[j] > parseFloat($("#HCenterline_X").val()) && HAvg[j] > HAreaValue_C) {
+                                    record.push(HAvg[j]);
+                                    if (record.length >= 4) {
+                                        for (var j1 = i; j1 >= i - 4; j1--) {
+                                            if ($.inArray(HAvg[j1], judge_return) == -1) {
+                                                judge_return.push(HAvg[j1]);
+                                            }
+                                        }
+                                    }
+                                }
+                                
+                            }
+                        }
+                        else if (HAvg[i] < parseFloat($("#HCenterline_X").val()) && HAvg[i] < HAreaValue_FC) {
+                            for (var j = i - 4; j <= i; j++) {
+                                var record = [];
+                                if (HAvg[j] < parseFloat($("#HCenterline_X").val()) && HAvg[j] < HAreaValue_FC) {
+                                    record.push(HAvg[j]);
+                                    if (record.length >= 4) {
+                                        for (var j1 = i; j1 >= i - 4; j1--) {
+                                            if ($.inArray(HAvg[j1], judge_return) == -1) {
+                                                judge_return.push(HAvg[j1]);
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+
+                    }
+                }
+
+
+                //杩炵画3鐐逛腑鏈�2鐐硅惤鍦ㄤ腑蹇冪嚎鍚屼竴渚х殑B鍖哄
+                if (HAvg.length >= 3) {
+                    for (var i = 2; i < HAvg.length; i++) {
+                        var judge = [];
+                        if (HAvg[i] > parseFloat($("#HCenterline_X").val()) && HAvg[i] > HAreaValue_B) {
+                            for (var j = i - 2; j <= i; j++) {
+                                var record = [];
+                                if (HAvg[j] > parseFloat($("#HCenterline_X").val()) && HAvg[j] > HAreaValue_B) {
+                                    record.push(HAvg[j]);
+                                    if (record.length >= 2) {
+                                        for (var j1 = i; j1 >= i - 2; j1--) {
+                                            if ($.inArray(HAvg[j1], judge_return) == -1) {
+                                                judge_return.push(HAvg[j1]);
+                                            }
+                                        }
+                                    }
+                                }
+
+                            }
+                        }
+                        else if (HAvg[i] < parseFloat($("#HCenterline_X").val()) && HAvg[i] < HAreaValue_FB) {
+                            for (var j = i - 2; j <= i; j++) {
+                                var record = [];
+                                if (HAvg[j] < parseFloat($("#HCenterline_X").val()) && HAvg[j] < HAreaValue_FB) {
+                                    record.push(HAvg[j]);
+                                    if (record.length >= 2) {
+                                        for (var j1 = i; j1 >= i - 2; j1--) {
+                                            if ($.inArray(HAvg[j1], judge_return) == -1) {
+                                                judge_return.push(HAvg[j1]);
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+
+                    }
+                }
+
+
+                //1涓偣钀藉湪A鍖轰互澶�
+                if (HAvg.length >= 0) {
+                    for (var i = 0; i < HAvg.length; i++) {
+                        var judge = [];
+                        if (HAvg[i] > HAreaValue_A) {
+                            if ($.inArray(HAvg[i], judge_return) == -1) {
+                                judge_return.push(HAvg[i]);
+                            }
+                        }
+                        else if (HAvg[i] < HAreaValue_FA) {
+                            if ($.inArray(HAvg[i], judge_return) == -1) {
+                                judge_return.push(HAvg[i]);
+                            }
+                        }
+                    }
+                }
+
+                return judge_return;
 
             }
 
@@ -890,7 +1307,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]  //鑾峰彇寮规椤甸潰
@@ -902,8 +1319,8 @@
                         $("#HQCCheckItemID").val(checkStatus.data[0].HItemID);
                         $("#HQCCheckItemNumber").val(checkStatus.data[0].浠g爜);
 
-                        btnCheckProjectList();
-                     
+                        btnCheckProjectList(1);
+
                         layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                     }
                     , btn2: function (index, layero) { }
@@ -911,8 +1328,18 @@
             }
 
             //妫�楠屾柟妗�
-            function btnCheckProjectList() {
-                var sWheres = " and 妫�楠岄」鐩唬鐮�='" + $("#HQCCheckItemNumber").val() + "'";
+            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',
@@ -922,9 +1349,17 @@
                     success: function (data1) {
                         if (data1.count == 1) {
                             layer.close(wait);
-                            $("#HUpLimit").val(data1.data[0].涓婇檺鍊�);
-                            $("#HDownLimit").val(data1.data[0].涓嬮檺鍊�);
-                            $("#HTargetVal").val(data1.data[0].鐩爣鍊�);
+
+                            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 {

--
Gitblit v1.9.1