wtt
2024-10-24 361ef22b987b45d97b88198b5c5370affbdaa434
WebTM/views/ÖÊÁ¿¹ÜÀí/ÖÊÁ¿±¨±í/QC_InspectionFormReport.html
@@ -97,8 +97,6 @@
                                            <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="HUpLimit" id="HUpLimit" style="background-color:#efefef4d;" readonly>
                                                <input type="hidden" class="layui-input" name="HControlUpperLimit" id="HControlUpperLimit" >
                                                <input type="hidden" class="layui-input" name="HControlLowerLimit" id="HControlLowerLimit" >
                                            </div>
                                        </div>
                                    </div>
@@ -132,31 +130,56 @@
                                            </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;">PPK</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>
@@ -168,6 +191,9 @@
                            </div>
                            <div id="histogram_Diff" style="width:99.5%;height:calc(100vh);margin-top:15px;">
                            </div>
                            <div id="histogram_SJZ" style="width:99.5%;height:calc(100vh);margin-top:15px;">
                            </div>
                        </div>
@@ -188,7 +214,7 @@
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index', //主入口模块
        }).use(['index', 'form', 'table', 'element', 'laypage', 'laydate','soulTable'], function () {
        }).use(['index', 'form', 'table', 'element', 'laypage', 'laydate', 'soulTable'], function () {
            //#region å…¬å…±å˜é‡
            var $ = layui.$
@@ -207,6 +233,8 @@
            var HModName = "QC_InspectionFormReport";
            var optionAVG = [];
            var optionS = [];
            var optionSJZ = [];
            var HQCCheckNum = [];
            //#endregion
            //#region è¿›å…¥é¡µé¢æ—¢åŠ è½½
@@ -216,7 +244,7 @@
            //#endregion
            //#region ç‚¹å‡»äº‹ä»¶åŒ…括on form事件等
            //头工具栏事件
@@ -236,13 +264,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) {
@@ -290,7 +319,7 @@
                    }
                });
            });
            //#endregion
            //#region æ­¤é¡µé¢æ‰€æœ‰çš„æ–¹æ³•
@@ -314,8 +343,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()));//结束时间
@@ -392,12 +421,15 @@
                                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_PPK();
                                set_CPK();
                                set_Line();
                            }
                        } else {
                            layer.close(wait);
                            layer.alert(data1.Message, { icon: 5 });
@@ -407,6 +439,216 @@
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            //PPK计算 x
            function set_PPK() {
                var x_AVG = 0;
                var x_SUM = 0;
                var x_PPK = 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), "/"));
                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, "*"), "-"))
                }
                //上限
                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, "*"))
                //上限
                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,ws2 ç”¨æ¥å­˜å‚¨ä¼ å…¥çš„num的小数点后的数字的位数
                    ws2 = 0,// èµ‹é»˜è®¤å€¼ï¼Œè§£å†³å½“整数和小数运算时倍数计算错误导致的结果误差
                    bigger,// bigger和smaller用于加,减,除法找出小的那个数字,给后面补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;
                }
                // å¦‚ws1 å’Œ 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; // ç­‰ä»·äºŽbeishu = 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;
            }
            //折线图
@@ -420,14 +662,17 @@
                let H_X = [];//x轴标题
                let HAvg = [];//平均值
                let HDifference = [];//差值
                let HSJZ = [];//实际值
                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);
                    }
                }
@@ -437,9 +682,9 @@
                option_ZXT_Avg = {
                    title: {
                        text: '平均值',
                        text: 'x̄管制图',
                        left: 'center'
                    },
                    },
                    grid: {
                        x: '3%', //相当于距离左边效果:padding-left
                        //y: '5%',  //相当于距离上边效果:padding-top
@@ -452,44 +697,37 @@
                    },
                    yAxis: {
                        type: 'value',
                        min: parseFloat($("#HDownLimit").val()) != 0 ? (parseFloat($("#HTargetVal").val()) + parseFloat($("#HDownLimit").val()) * 1.3) : 0, // è®¾ç½®æœ€å°å€¼
                        max: parseFloat($("#HTargetVal").val()) + parseFloat($("#HUpLimit").val()) * 1.3, // è®¾ç½®æœ€å¤§å€¼
                        interval: (parseFloat($("#HUpLimit").val()) - parseFloat($("#HDownLimit").val()))/10, // è®¾ç½®é—´è·
                        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: [
                                    { 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($("#HTargetVal").val()) + parseFloat($("#HControlUpperLimit").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($("#HTargetVal").val()) + parseFloat($("#HControlLowerLimit").val()), lineStyle: { color: '#2cb615' }, label: { color: '#2cb615', fontSize: 10 }
                                        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
                            },
                        }
                    ]
@@ -503,7 +741,7 @@
                option_ZXT_Diff = {
                    title: {
                        text: '差值',
                        text: 'R管制图',
                        left: 'center'
                    },
                    grid: {
@@ -517,42 +755,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' } },
                            //    ]
                            //},
                            markLine: {
                                symbol: 'none',//去掉箭头
                                data: [
                                    {
                                        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
            }
@@ -663,7 +944,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]  //获取弹框页面
@@ -675,8 +956,8 @@
                        $("#HQCCheckItemID").val(checkStatus.data[0].HItemID);
                        $("#HQCCheckItemNumber").val(checkStatus.data[0].代码);
                        btnCheckProjectList();
                        btnCheckProjectList(1);
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
@@ -684,8 +965,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() + "'";
                }
                if (Type == 2) {
                    sWheres = " and ç‰©æ–™ä»£ç ='" + $("#HMaterNumber").val() + "'";
                }
                var wait = layer.load();//遮罩
                $.ajax({
                    url: GetWEBURL() + '/QC_Management/MES_QC_CheckProjectListProjectDetaiList',
@@ -695,11 +986,19 @@
                    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].目标值);
                            $("#HControlUpperLimit").val(data1.data[0].控制上限);
                            $("#HControlLowerLimit").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]["检验项目ID"]);
                                }
                            }
                            //$("#HControlUpperLimit").val(data1.data[0].控制上限);
                            //$("#HControlLowerLimit").val(data1.data[0].控制下限);
                        } else {
                            layer.close(wait);
                            layer.alert(data1.Message, { icon: 5 });