1
duhe
2024-08-15 40cd70d9a9d13001c1b6c2269334e8a363c562c3
WebTM/views/ÖÊÁ¿¹ÜÀí/¹¤Ðò¼ìÑéµ¥/QC_ProcessCheckBill.html
@@ -9,6 +9,7 @@
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <script src="../../../layuiadmin/PageTitle.js"></script>
    <style>
        .main-btn { /*头部主按钮*/
            padding: 0 2px; /*调整按钮左右空隙大小*/
@@ -53,6 +54,7 @@
                        <button type="button" class="layui-btn layui-btn-normal" style="margin-left: 0px" lay-submit="" lay-filter="btn-Exit" id="btn-Exit">退出</button>
                    </div>
                    <div class="layui-tab" lay-filter="tab-POStockInBill">
                        <h1 style="text-align: center; padding: 10px 0;"><b>工序检验单</b></h1>
                        <ul class="layui-tab-title" lay-filter="tab-all">
                            <li lay-id="1" style="padding:1px;" class="layui-this">基本信息</li>
                            <li lay-id="2" style="padding:1px;">制单信息</li>
@@ -72,7 +74,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="date" class="layui-input" name="HDate" id="HDate" style="padding-left: 47px;">
                                                <input type="date" class="layui-input" name="HDate" id="HDate" style="padding-left: 68px;">
                                            </div>
                                        </div>
                                        <div class="layui-inline">
@@ -84,7 +86,7 @@
                                                </button>
                                                <input type="hidden" name="HSourceID" id="HSourceID" value="0">
                                            </div>
                                        </div>
                                        </div>
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline">
@@ -123,7 +125,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="HProcExchQty" id="HProcExchQty" style="background-color:#efefef4d;" readonly>
                                                <input type="text" class="layui-input" name="HProcExchQty" id="HProcExchQty" value="1" style="background-color:#efefef4d;" readonly>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
@@ -171,12 +173,34 @@
                                                <input type="hidden" name="HQCSchemeID" id="HQCSchemeID" value="0">
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">生产班次</label>
                                            <div class="layui-input-block" style="margin-left: 77px;">
                                                <input type="text" class="layui-input" name="HShiftsName" id="HShiftsName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHShifts" id="btnHShifts" style="padding: 0 10px;float: right;margin-right: 3px;">
                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                                </button>
                                                <input type="hidden" name="HShiftsID" id="HShiftsID" value="0">
                                            </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" name="HBatchNo" id="HBatchNo" style="">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline" style="width: 50%;">
                                        <div class="layui-inline" style="width: 45%;">
                                            <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="HRemark" id="HRemark" placeholder="请输入内容" onmouseover="this.title=this.value">
                                            </div>
                                        </div>
                                        <div class="layui-inline" style="width: 45%">
                                            <label class="layui-form-label" style="width: 85px;">异常临时<br />处理方案</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" name="HErrTreatment" id="HErrTreatment" placeholder="请输入内容" onmouseover="this.title=this.value" style="margin-top:10px;">
                                            </div>
                                        </div>
                                    </div>
@@ -186,6 +210,23 @@
                                            <div class="layui-input-block">
                                                <input type="radio" name="HCheckerResult" id="HCheckerResult" value="true" title="合格" checked>
                                                <input type="radio" name="HCheckerResult" id="HCheckerResult" value="false" title="不合格">
                                            </div>
                                        </div>
                                        <div class="layui-inline" id="hidediv1">
                                            <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">工序</label>
                                            <div class="layui-input-block" style="margin-left: 77px;">
                                                <input type="text" class="layui-input" name="HProcName" id="HProcName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHProc" id="btnHProc" style="padding: 0 10px;float: right;margin-right: 3px;">
                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                                </button>
                                                <input type="hidden" name="HProcID" id="HProcID" value="0">
                                            </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" name="HTakeSampleCheckBillNo" id="HTakeSampleCheckBillNo" style="background-color:#efefef4d;" readonly>
                                                <input type="hidden" name="HTakeSampleCheckBillID" id="HTakeSampleCheckBillID" value="0">
                                            </div>
                                        </div>
                                    </div>
@@ -330,13 +371,13 @@
                                    <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="HSampleQty" id="HSampleQty" style="background-color:#efefef4d;" readonly>
                                            <input type="text" class="layui-input" name="HSampleQty" id="HSampleQty" value="0" style="background-color:#efefef4d;" readonly>
                                        </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" name="HSampleDamageQty" id="HSampleDamageQty" style="">
                                            <input type="text" class="layui-input" name="HSampleDamageQty" id="HSampleDamageQty" value="0" style="">
                                        </div>
                                    </div>
                                </div>
@@ -687,6 +728,14 @@
            //    }, function () { window.location.href = "../../user/login.html"; });
            //}
            //#region ã€åŠ¨æ€èŽ·å–æ¨¡å—åç§°ã€‘
            var HModuleType = "7507";
            //通过单据类型,从数据库动态获取单据模块命名,引用js文件 PageTitle.js
            var HPageTitle = get_PageTitle(HModuleType) == "" ? $("h1").html() : get_PageTitle(HModuleType);
            $("h1").html('<b>' + HPageTitle + '</b>');
            //#endregion
            /*固定代码,每张单据都要begin*/
            /* 1.无源单新增
             * 2.有源单新增
@@ -728,8 +777,8 @@
                $("#HBillNo").val("");
                $('#btnSave').addClass("layui-btn-disabled").attr("disabled", true);//有源单时保存按钮禁用
                $("#HFirstCheckEmp").val(sessionStorage["HEmpID"]); //根据登录用户带出检验员ID
                $("#HFirstCheckEmpName").val(sessionStorage["HEmpName"]); //根据登录用户带出检验员
                $("#HFirstCheckEmp").val(sessionStorage["HCheckEmpID"]); //根据登录用户带出检验员ID
                $("#HFirstCheckEmpName").val(sessionStorage["HCheckEmpName"]); //根据登录用户带出检验员
                //获取最大单据号
                $.ajax({
                    url: GetWEBURL() + "/Web/GetMAXNum",
@@ -745,8 +794,8 @@
                });
            }
            else if (OperationType == 2) {
                $("#HFirstCheckEmp").val(sessionStorage["HEmpID"]);
                $("#HFirstCheckEmpName").val(sessionStorage["HEmpName"]);
                $("#HFirstCheckEmp").val(sessionStorage["HCheckEmpID"]);
                $("#HFirstCheckEmpName").val(sessionStorage["HCheckEmpName"]);
                if (HICMOEntryID < 0 || HICMOEntryID == "") {
                    layer.alert("生产任务单子内码错误,无法工序检!", { icon: 5 });
@@ -780,7 +829,13 @@
                    } else if (HSouceBillType == 3791) {
                        //根据源单id获取源单信息
                        LoadingInformation_StationOutBill();
                    } else {
                    }
                    //工序流转卡列表首检
                    else if (HSouceBillType == 3772) {
                        //根据源单id获取源单信息
                        LoadingInformation_ProcExchange();
                    }
                    else {
                        layer.alert("源单类型无效!", { icon: 5 });
                    }
                }
@@ -822,6 +877,8 @@
                                $("#HICMOEntryID").val(HICMOEntryID);
                                $("#HQCSchemeName").val(data.检验方案名称);
                                $("#HQCSchemeID").val(data.检验方案ID);
                                $("#HTakeSampleCheckBillNo").val(data.HProcExchBillNo);
                                $("#HTakeSampleCheckBillID").val(data.HProcExchInterID);
                                //获取表体检验项目信息
                                get_CheckItem();
                            } else {
@@ -876,6 +933,52 @@
                    }
                });
            }
            //根据源单id获取源单信息(工序流转卡)
            function LoadingInformation_ProcExchange() {
                $('#btnSearchSource').removeClass("layui-btn-disabled").attr("disabled", false);//生产资源按钮启用
                var wait = layer.load();
                $.ajax({
                    url: GetWEBURL() + '/CheckBill/get_ProcessExchangeBill',
                    type: "GET",
                    data: { "HInterID": linterid, "user": sessionStorage["HUserName"] },
                    success: function (result) {
                        var data = result.data[0];
                        if (result.count == 1) {
                            $("#HProcExchBillNo").val(data.单据号);
                            $("#HProcExchInterID").val(data.HInterID);
                            $("#HProcExchEntryID").val(data.HProcExchEntryID == null ? 0 : data.HProcExchEntryID);//
                            $("#HProcExchQty").val(data.流转卡数量);
                            $("#HICMOBillNo").val(data.任务单);
                            $("#HICMOInterID").val(data.HICMOInterID);
                            $("#HICMOQty").val(data.HICMOQty == null ? 0 : data.HICMOQty);//
                            $("#HSourceName").val(data.生产资源);//
                            $("#HSourceID").val(data.HSourceID == null ? 0 : data.HSourceID);//
                            $("#HMaterID").val(data.HMaterID);
                            $("#HMaterName").val(data.产品名称);
                            $("#HMainSourceBillNo").val(data.单据号);
                            $("#HMainSourceBillType").val(data.HBillType);
                            $("#HMainSourceInterID").val(data.HInterID);
                            $("#HICMOEntryID").val(data.HICMOEntryID == null ? 0 : data.HICMOEntryID);//
                            $("#HQCSchemeName").val(data.检验方案名称);
                            $("#HQCSchemeID").val(data.检验方案ID);
                            $("#HProcName").val(data.当前工序);//
                            $("#HBatchNo").val(data.批号);
                            $("#HTakeSampleCheckBillNo").val(data.单据号);
                            $("#HTakeSampleCheckBillID").val(data.HInterID);
                            //获取表体检验项目信息
                            get_CheckItem();
                        } else {
                            layer.alert(result.Message, { icon: 5 });
                        }
                        layer.close(wait);
                    }, error: function () {
                        layer.close(wait);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            //头工具栏事件
            table.on('toolbar(mainTable)', function (obj) {
                var checkStatus = table.checkStatus('mainTable')
@@ -884,8 +987,8 @@
                var NewRow = {
                     "HQCCheckItemID": "", "检验项目": "", "HInspectInstruMentID": 0, "检验仪器": "", "HQCStd": "", "HUnit": "", "HQCNote": "", "HAnalysisMethod": "", "HResult": "",
                    "HMax": "", "HMin": "", "HAvg": "", "HRemark": "", "HKeyInspect": false, "HStatus": 0, "HSampleSchemeID": 0, "HUnitID": 0,
                    "HInspectVal": '', "HTargetVal": '', "HUpLimit": '', "HDownLimit": '', "HUpOffSet": '', "HDownOffSet": '', "HSampleDamageQty": '',
                    "HSampleSchemeName": "", "HSampleQty": "", "HSampleDamageQty": "", "HAcceptQty": "", "HInspectionLevel": "", "HRejectQty": "",
                    "HInspectVal": '', "HTargetVal": '', "HUpLimit": '', "HDownLimit": '', "HUpOffSet": '', "HDownOffSet": '', "HSampleDamageQty": '0',
                    "HSampleSchemeName": "", "HSampleQty": "0", "HSampleDamageQty": "0", "HAcceptQty": "", "HInspectionLevel": "", "HRejectQty": "",
                    "HStrictness": "", "HSampleUnRightQty": "", "HAQL": "", "HSamplingType": ""
                };
                switch (obj.event) {
@@ -1023,7 +1126,7 @@
                                shift: 2,
                                area: ['90%', '90%'],
                                maxmin: true,
                                content: ['../../../views/Baseset/基础资料/Gy_QCCheckItemListView.html', 'yes'],
                                content: ['../../基础资料/公用基础资料/Gy_CheckItem.html', 'yes'],
                                btn: ['确定', '取消']
                                , btn1: function (index, layero) {
@@ -1065,7 +1168,7 @@
                                shift: 2,
                                area: ['90%', '90%'],
                                maxmin: true,
                                content: ['../../../views/Baseset/基础资料/Gy_InspectInstruMentList.html', 'yes'],
                                content: ['../../基础资料/公用基础资料/Gy_InspectInstruMent.html', 'yes'],
                                btn: ['确定', '取消']
                                , btn1: function (index, layero) {
@@ -1114,7 +1217,7 @@
                                shift: 2,
                                area: ['90%', '90%'],
                                maxmin: true,
                                content: ['../../../views/Baseset/基础资料/Gy_InspectValueList.html', 'yes'],
                                content: ['../../基础资料/公用基础资料/Gy_InspectValue.html', 'yes'],
                                btn: ['确定', '取消']
                                , btn1: function (index, layero) {
@@ -1127,10 +1230,10 @@
                                    //同步更新表格和缓存对应的值
                                    obj.update({
                                        HInSpectValueB: checkStatus.data[0].检验值名称
                                        HInSpectValueB: checkStatus.data[0].检测值名称
                                    });
                                    layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                                    var DXValue = checkStatus.data[0].检验值名称; //定性检测值
                                    var DXValue = checkStatus.data[0].检测值名称; //定性检测值
                                    var MBValue = $("#HTargetVal").val(); //目标值
                                    if (Number(DXValue) == Number(MBValue)) { //定性检测值 = ç›®æ ‡å€¼ï¼Œåˆ¤å®šåˆæ ¼
@@ -1209,7 +1312,7 @@
            //保存
            function set_SaveBill(data) {
                //赋值最后一个选中行的数据给option.data
                Assignment(LastIndex, LastIndex);
                //Assignment(LastIndex, LastIndex);
                //保存最后一次点击行的检验值
                set_SaveValue($("#HEntryID").val());
@@ -1259,6 +1362,7 @@
                var sSubStr = JSON.stringify(table.cache['mainTable']);
                var sSubValue = JSON.stringify(table.cache['ValueTable']);
                var sMainSub = sMainStr + ';' + sSubStr + ';' + OperationType + ";" + sessionStorage["HUserName"] + ';' + sSubValue;
                var index = layer.load();
                $.ajax({
                    type: "POST",
@@ -1308,7 +1412,7 @@
                var ajaxLoad = layer.load();
                var sWhere = " and hmainid=" + linterid;
                $.ajax({
                    url: GetWEBURL() + "/QC_ProcessCheckBill/QC_ProcessCheckBillList",
                    url: GetWEBURL() + "/QC_ProcessCheckBill/QC_ProcessCheckBill_Edit",
                    type: "GET",
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                    success: function (result) {
@@ -1375,15 +1479,20 @@
                                , "HEntryID": data.hsubid
                                , "HQCCheckItemName": data.检验项目名称
                                , "HQCCheckItemID": data.HQCCheckItemID
                                , "HShiftsID": data.HShiftsID
                                , "HShiftsName": data.班次名称
                                , "HErrTreatment": data.异常临时处理方案
                                , "HBatchNo": data.批号
                                , "HTakeSampleCheckBillID": data.HTakeSampleCheckBillID
                                , "HTakeSampleCheckBillNo": data.HTakeSampleCheckBillNo
                            });
                            data = result.data;
                            //data = result.data.h_v_QC_Edit_FirstPieceCheckBillList;
                            //子表  èµ‹å€¼
                            var rowdata = [];
                            for (var i = 0; i < data.length; i++) {
                                rowdata.push(
                                    {
                                        "HQCCheckItemID": data[i].HQCCheckItemID, "检验项目": data[i].检验项目名称, "HInspectInstruMentID": data[i].HInspectInstruMentID, "检验仪器": data[i].检验仪器, "HQCStd": data[i].检验标准,
                                        "HQCCheckItemID": data[i].HQCCheckItemID, "检验项目代码": data[i].检验项目代码, "检验项目": data[i].检验项目名称, "HInspectInstruMentID": data[i].HInspectInstruMentID, "检验仪器": data[i].检验仪器, "HQCStd": data[i].检验标准,
                                        "HUnit": data[i].单位名称, "HQCNote": data[i].检验记录, "HResult": data[i].结论 == "合格" ? 1 : 2,
                                        "HMax": data[i].最大值, "HMin": data[i].最小值, "HAvg": data[i].平均值, "HRemark": data[i].表体备注,
                                        "HAnalysisMethod": data[i].分析方法 == "定性分析" ? 1 : (data[i].分析方法 == "定量分析" ? 2 : 3), "HKeyInspect": data[i].重点检查 == "否" ? false : true,
@@ -1452,7 +1561,7 @@
                    shift: 2,
                    area: ['90%', '90%'],
                    maxmin: true,
                    content: ['../../../views/Baseset/基础资料/Gy_QCCheckProjectListView.html', 'yes'],
                    content: ['../../质量管理/检验方案单/QC_CheckProjectList.html', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
@@ -1462,9 +1571,47 @@
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        $("#HQCSchemeID").val(checkStatus.data[0].HItemID);
                        $("#HQCSchemeName").val(checkStatus.data[0].方案名称);
                        $("#HQCSchemeID").val(checkStatus.data[0].hmainid);
                        $("#HQCSchemeName").val(checkStatus.data[0].检验方案名称);
                        get_CheckItem();
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                    },
                    end: function () {
                    },
                    success: function (layero, index) {
                    }
                });
            });
            //表头信息生产班次弹窗
            form.on('submit(btnHShifts)', function () {
                //页面层-自定义
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: '生产班次列表',
                    closeBtn: 1,
                    shift: 2,
                    area: ['90%', '90%'],
                    maxmin: true,
                    content: ['../../基础资料/生产基础资料/Gy_ShiftsList.html', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
                        //按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        $("#HShiftsName").val(checkStatus.data[0].班次名称);
                        $("#HShiftsID").val(checkStatus.data[0].HItemID);
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) {
@@ -1529,7 +1676,7 @@
                    shift: 2,
                    area: ['90%', '90%'],
                    maxmin: true,
                    content: ['../../../views/Baseset/基础资料/Gy_UnitList.html', 'yes'],
                    content: ['../../../views/基础资料/公用基础资料/Gy_Unit.html', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
@@ -1540,7 +1687,7 @@
                            return layer.msg('请选择数据');
                        }
                        $("#HUnitID").val(checkStatus.data[0].HItemID);
                        $("#HUnit").val(checkStatus.data[0].HName);
                        $("#HUnit").val(checkStatus.data[0].计量单位名称);
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) {
@@ -1567,7 +1714,7 @@
                    shift: 2,
                    area: ['90%', '90%'],
                    maxmin: true,
                    content: ['../../../views/Baseset/基础资料/Gy_InspectValueList.html', 'yes'],
                    content: ['../../基础资料/公用基础资料/Gy_InspectValue.html', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
@@ -1577,8 +1724,8 @@
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        $("#HInspectValB").val(checkStatus.data[0].hmainid);
                        $("#HInspectVal").val(checkStatus.data[0].检验值名称);
                        $("#HInspectValB").val(checkStatus.data[0].HItemID);
                        $("#HInspectVal").val(checkStatus.data[0].检测值名称);
                        //==================================判定是否合格,只有定性分析可以选择检验值、目标值==================================
                        var HComparator = $("#HComparator").val(); //比较符
@@ -1614,7 +1761,7 @@
                    shift: 2,
                    area: ['90%', '90%'],
                    maxmin: true,
                    content: ['../../../views/Baseset/基础资料/Gy_InspectValueList.html', 'yes'],
                    content: ['../../基础资料/公用基础资料/Gy_InspectValue.html', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
@@ -1624,10 +1771,10 @@
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        $("#HTargetValB").val(checkStatus.data[0].hmainid);
                        $("#HTargetVal").val(checkStatus.data[0].检验值名称);
                        $("#HUpLimit").val(checkStatus.data[0].检验值名称);
                        $("#HDownLimit").val(checkStatus.data[0].检验值名称);
                        $("#HTargetValB").val(checkStatus.data[0].HItemID);
                        $("#HTargetVal").val(checkStatus.data[0].检测值名称);
                        $("#HUpLimit").val(checkStatus.data[0].检测值名称);
                        $("#HDownLimit").val(checkStatus.data[0].检测值名称);
                        //==================================判定是否合格,只有定性分析可以选择检验值、目标值==================================
                        var HComparator = $("#HComparator").val(); //比较符
@@ -1686,18 +1833,21 @@
                        $("#HRejectQty").val(checkStatus.data[0].拒绝数);
                        $("#HUpLimit").val(checkStatus.data[0].上限值);
                        $("#HDownLimit").val(checkStatus.data[0].下限值);
                        option.data[$("#HEntryID").val() - 1].HSampleSchemeID = checkStatus.data[0].hmainid;
                        option.data[$("#HEntryID").val() - 1].HSampleSchemeName = checkStatus.data[0].抽样方案名称;
                        option.data[$("#HEntryID").val() - 1].HSamplingType = checkStatus.data[0].抽样类型;
                        option.data[$("#HEntryID").val() - 1].HInspectionLevel = checkStatus.data[0].检验水平;
                        option.data[$("#HEntryID").val() - 1].HStrictness = checkStatus.data[0].严格度;
                        option.data[$("#HEntryID").val() - 1].HAQL = checkStatus.data[0].AQL;
                        option.data[$("#HEntryID").val() - 1].HSampleQty = checkStatus.data[0].样本量;
                        option.data[$("#HEntryID").val() - 1].HSampleQty2 = checkStatus.data[0].样本量;
                        option.data[$("#HEntryID").val() - 1].HAcceptQty = checkStatus.data[0].允许数;
                        option.data[$("#HEntryID").val() - 1].HRejectQty = checkStatus.data[0].拒绝数;
                        option.data[$("#HEntryID").val() - 1].HUpLimit = checkStatus.data[0].上限值;
                        option.data[$("#HEntryID").val() - 1].HDownLimit = checkStatus.data[0].下限值;
                        if ($("#HEntryID").val() - 1 >= 0) {
                            option.data[$("#HEntryID").val() - 1].HSampleSchemeID = checkStatus.data[0].hmainid;
                            option.data[$("#HEntryID").val() - 1].HSampleSchemeName = checkStatus.data[0].抽样方案名称;
                            option.data[$("#HEntryID").val() - 1].HSamplingType = checkStatus.data[0].抽样类型;
                            option.data[$("#HEntryID").val() - 1].HInspectionLevel = checkStatus.data[0].检验水平;
                            option.data[$("#HEntryID").val() - 1].HStrictness = checkStatus.data[0].严格度;
                            option.data[$("#HEntryID").val() - 1].HAQL = checkStatus.data[0].AQL;
                            option.data[$("#HEntryID").val() - 1].HSampleQty = checkStatus.data[0].样本量;
                            option.data[$("#HEntryID").val() - 1].HSampleQty2 = checkStatus.data[0].样本量;
                            option.data[$("#HEntryID").val() - 1].HAcceptQty = checkStatus.data[0].允许数;
                            option.data[$("#HEntryID").val() - 1].HRejectQty = checkStatus.data[0].拒绝数;
                            option.data[$("#HEntryID").val() - 1].HUpLimit = checkStatus.data[0].上限值;
                            option.data[$("#HEntryID").val() - 1].HDownLimit = checkStatus.data[0].下限值;
                        }
                        rowdata_Value = [];
                        for (let i = 1; i <= checkStatus.data[0].样本量; i++) {
@@ -1724,7 +1874,7 @@
            });
            //#endregion
            function get_CheckItem() {
            window.get_CheckItem = function() {
                var HBatchQty = $("#HProcExchQty").val();
                $.ajax({
                    url: GetWEBURL() + "/Web/GetCheckItemByCheckProjectID",
@@ -1746,9 +1896,9 @@
                                    //"HStrictness": "", "HSampleUnRightQty": "", "HAQL": "", "HSamplingType": ""
                                    //}
                                    {
                                        "HQCCheckItemID": data[i]["HQCCheckItemID"], "检验项目": data[i]["检验项目"], "HInspectInstruMentID": data[i]["HInspectInstruMentID"], "检验仪器": data[i]["检验仪器"], "HQCStd": data[i]["HQCStd"], "HUnit": data[i]["单位名称"], "HQCNote": "", "HAnalysisMethod": data[i]["分析方法"], "HResult": data[i]["默认结论"],
                                        "HQCCheckItemID": data[i]["HQCCheckItemID"], "检验项目代码": data[i].检验项目代码, "检验项目": data[i]["检验项目"], "HInspectInstruMentID": data[i]["HInspectInstruMentID"], "检验仪器": data[i]["检验仪器"], "HQCStd": data[i]["HQCStd"], "HUnit": data[i]["单位名称"], "HQCNote": "", "HAnalysisMethod": data[i]["分析方法"], "HResult": data[i]["默认结论"],
                                        "HMax": "", "HMin": "", "HAvg": "", "HRemark": "", "HKeyInspect": data[i]["重点检查"] == 1 ? true : false, "HStatus": 0, "HSampleSchemeID": data[i]["HSampleSchemeID"], "HUnitID": data[i]["HUnitID"],
                                        "HInspectVal": '', "HTargetVal": '', "HUpLimit": '', "HDownLimit": '', "HUpOffSet": '', "HDownOffSet": '', "HSampleDamageQty": "",
                                        "HInspectVal": '', "HTargetVal": '', "HUpLimit": '', "HDownLimit": '', "HUpOffSet": '', "HDownOffSet": '', "HSampleDamageQty": "0",
                                        "HSampleSchemeName": data[i].抽样方案名称, "HSampleQty": data[i].样本量, "HAcceptQty": data[i].允许数, "HInspectionLevel": data[i].检验水平, "HRejectQty": data[i].拒绝数,
                                        "HStrictness": data[i].严格度, "HSampleUnRightQty": "", "HAQL": data[i].AQL, "HSamplingType": data[i].抽样类型
                                    }
@@ -1843,7 +1993,7 @@
                    shift: 2,
                    area: ['90%', '90%'],
                    maxmin: true,
                    content: ['../../../views/Baseset/基础资料/Sc_ICMOBillListView2.html', 'yes'],
                    content: ['../../生产管理/生产任务单/Sc_ICMOBillList.html', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
@@ -1854,7 +2004,7 @@
                            return layer.msg('请选择数据');
                        }
                        $("#HICMOInterID").val(checkStatus.data[0].hmainid);
                        $("#HICMOEntryID").val(checkStatus.data[0].hsubid);
                        $("#HICMOEntryID").val(checkStatus.data[0].HEntryID);
                        $("#HICMOBillNo").val(checkStatus.data[0].单据号);
                        $("#HICMOQty").val(checkStatus.data[0].计划生产数量);
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
@@ -1883,7 +2033,7 @@
                    shift: 2,
                    area: ['90%', '90%'],
                    maxmin: true,
                    content: ['../../PublicPage/UserInformation.html', 'yes'],
                    content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?Type=HEmp', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
@@ -1893,7 +2043,7 @@
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        $("#HFirstCheckEmpName").val(checkStatus.data[0].HName);
                        $("#HFirstCheckEmpName").val(checkStatus.data[0].职员名称);
                        $("#HFirstCheckEmp").val(checkStatus.data[0].HItemID);
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
@@ -1921,7 +2071,7 @@
                    shift: 2,
                    area: ['90%', '90%'],
                    maxmin: true,
                    content: ['../../PublicPage/SourceInformation.html', 'yes'],
                    content: ['../../基础资料/生产基础资料/Gy_Source.html', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
@@ -1931,9 +2081,51 @@
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        $("#HSourceName").val(checkStatus.data[0].HName);
                        $("#HSourceName").val(checkStatus.data[0].生产资源名称);
                        $("#HSourceID").val(checkStatus.data[0].HItemID);
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                        get_ICMOBillStatusList();
                        get_QC_TakeSampleCheckBillList();
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                    },
                    end: function () {
                    },
                    success: function (layero, index) {
                    }
                });
            });
            //表头信息工序
            form.on('submit(btnHProc)', function () {
                //页面层-自定义
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: '工序列表',
                    closeBtn: 1,
                    shift: 2,
                    area: ['90%', '90%'],
                    maxmin: true,
                    content: ['../../基础资料/生产基础资料/Gy_Process.html', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
                        //按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        $("#HProcName").val(checkStatus.data[0].工序名称);
                        $("#HProcID").val(checkStatus.data[0].HItemID);
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                        get_ICMOBillStatusList();
                        get_QC_TakeSampleCheckBillList();
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
@@ -1959,7 +2151,7 @@
                    shift: 2,
                    area: ['90%', '90%'],
                    maxmin: true,
                    content: ['../../Baseset/基础资料/Gy_MaterialList.html', 'yes'],
                    content: ['../../基础资料/公用基础资料/Gy_Material.html', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
@@ -1969,7 +2161,7 @@
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        $("#HMaterNumber").val(checkStatus.data[0].HNumber);
                        $("#HMaterNumber").val(checkStatus.data[0].物料代码);
                        $("#HMaterID").val(checkStatus.data[0].HItemID);
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
@@ -2001,8 +2193,8 @@
                rowdata = [{
                    "HQCCheckItemID": "", "检验项目": "", "HInspectInstruMentID": 0, "检验仪器": "","HQCStd": "", "HUnit": "", "HQCNote": "", "HAnalysisMethod": "", "HResult": "",
                    "HMax": "", "HMin": "", "HAvg": "", "HRemark": "", "HKeyInspect": false, "HStatus": 0, "HSampleSchemeID": 0, "HUnitID": 0,
                    "HInspectVal": '', "HTargetVal": '', "HUpLimit": '', "HDownLimit": '', "HUpOffSet": '', "HDownOffSet": '', "HSampleDamageQty": '',
                    "HSampleSchemeName": "", "HSampleQty": "", "HSampleDamageQty": "", "HAcceptQty": "", "HInspectionLevel": "", "HRejectQty": "",
                    "HInspectVal": '', "HTargetVal": '', "HUpLimit": '', "HDownLimit": '', "HUpOffSet": '', "HDownOffSet": '', "HSampleDamageQty": '0',
                    "HSampleSchemeName": "", "HSampleQty": "0", "HSampleDamageQty": "0", "HAcceptQty": "", "HInspectionLevel": "", "HRejectQty": "",
                    "HStrictness": "", "HSampleUnRightQty": "", "HAQL": "", "HSamplingType": ""
                }];
                option = {
@@ -2016,6 +2208,7 @@
                        { type: 'checkbox', totalRowText: '合计行' }
                        , { type: 'numbers', title: '序号', totalRow: true }
                        , { field: 'HQCCheckItemID', title: 'HQCCheckItemID', hide: true }
                        , { field: '检验项目代码', title: '检验项目代码' }
                        , { field: '检验项目', title: '检验项目', edit: 'text', event: 'HQCCheckItemID' }
                        , { field: 'HInspectInstruMentID', title: 'HInspectInstruMentID', hide: true }
                        , { field: '检验仪器', title: '检验仪器', edit: 'text', event: 'HInspectInstruMentID' }
@@ -2026,6 +2219,9 @@
                        //, { field: 'HQCStd', title: '检验标准', edit: 'text' }
                        , { field: 'HUnit', title: '单位', edit: 'text' }
                        , { field: 'HQCNote', title: '检验记录', edit: 'text' }
                        , { field: 'HInspectVal', title: '检验值' }
                        , { field: 'HUpLimit', title: '上限值' }
                        , { field: 'HDownLimit', title: '下限值' }
                        , { field: 'HMax', title: '最大值', edit: 'text', totalRow: true}
                        , { field: 'HMin', title: '最小值', edit: 'text', totalRow: true }
                        , { field: 'HAvg', title: '平均值', edit: 'text', totalRow: true }
@@ -2046,10 +2242,7 @@
                        , { field: 'xxx', title: '比较符', edit: 'text', hide: true }
                        , { field: 'HUnitID', title: '单位ID', edit: 'text', hide: true }
                        , { field: 'HUnit', title: '单位', edit: 'text', hide: true }
                        , { field: 'HInspectVal', title: '检验值', edit: 'text', hide: true }
                        , { field: 'HTargetVal', title: '目标值', edit: 'text', hide: true }
                        , { field: 'HUpLimit', title: '上限值', edit: 'text', hide: true }
                        , { field: 'HDownLimit', title: '下限值', edit: 'text', hide: true }
                        , { field: 'HUpOffSet', title: '上偏差', edit: 'text', hide: true }
                        , { field: 'HDownOffSet', title: '下偏差', edit: 'text', hide: true }
                        , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 85  }
@@ -2843,8 +3036,8 @@
                    $("#HDownLimit").val(0);
                    $("#HUpOffSet").val(0);
                    $("#HDownOffSet").val(0);
                    $("#HSampleDamageQty").val("")
                    $("#HSampleQty").val("")
                    $("#HSampleDamageQty").val("0")
                    $("#HSampleQty").val("0")
                    $("#HSampleQty2").val("")
                    $("#HAcceptQty").val("0")
                    $("#HInspectionLevel").val("")
@@ -2854,7 +3047,7 @@
                    $("#HSampleUnRightQty2").val("")
                    $("#HAQL").val("")
                    $("#HSamplingType").val("")
                    $("#HSampleQty").val("")
                    $("#HSampleQty").val("0")
                    $("#HInspectResultToSee").val("")
                    $("#HInspectResultToSee2").val("")
                    $("#HSampleUnRightQty").val("")
@@ -3133,6 +3326,71 @@
                })
            }
            //根据生产资源或者 å·¥åº æŸ¥è¯¢ç”Ÿäº§å·¥å•信息
            function get_ICMOBillStatusList() {
                var sWhere = "";
                var HProcID = $("#HProcID").val();
                var HSourceID = $("#HSourceID").val();
                var HProcExchInterID = $("#HProcExchInterID").val();
                if (HProcID != "0") {
                    sWhere += " and HProcID=" + HProcID;
                }
                if (HSourceID != "0") {
                    sWhere += " and HSourceID=" + HSourceID
                }
                sWhere += " and HSourceInterID=" + HProcExchInterID;
                $.ajax({
                    url: GetWEBURL() + "/CheckBill/GetICMOBillStatusList",
                    type: "GET",
                    async: false,
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                    success: function (result) {
                        if (result.count == 1) {
                            $("#HProcID").val(result.data[0]["HProcID"]);
                            $("#HProcName").val(result.data[0]["工序"]);
                            $("#HSourceID").val(result.data[0]["HSourceID"]);
                            $("#HSourceName").val(result.data[0]["生产资源"]);
                        } else {
                            layer.msg(result.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        }
                    },
                    error: function (err) {
                        layer.msg("接口请求失败!" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    }
                })
            }
            //取样单查询
            function get_QC_TakeSampleCheckBillList() {
                var HProcID = $("#HProcID").val();
                var HProcExchInterID = $("#HProcExchInterID").val();
                var sWhere = "";
                if (HProcID == "0" || HProcID == "") {
                    return layer.msg("请选择工序!");
                }
                sWhere = " and å·¥åºæµè½¬å¡ä¸»å†…码='" + HProcExchInterID + "' and HProcID=" + HProcID;
                $.ajax({
                    url: GetWEBURL() + "/QC_TakeSampleCheckBill/QC_TakeSampleCheckBillMainList",
                    type: "GET",
                    async: false,
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                    success: function (result) {
                        if (result.count == 1) {
                            $("#HTakeSampleCheckBillID").val(result.data[0]["hmainid"]);
                            $("#HTakeSampleCheckBillNo").val(result.data[0]["单据号"]);
                        }
                    },
                    error: function (err) {
                        layer.msg("接口请求失败!" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    }
                })
            }
            //获取不合格数总数
            function addUnRightQty() {
                //循环检验值表格数据,获取不合格数量
@@ -3368,49 +3626,49 @@
            //检验值保存
            function set_SaveValue(dataindex) {
                //if (OperationType == 3) {
                //    EchoValue();
                //}
                if (OperationType == 3) {
                    EchoValue();
                }
                //for (let i = 0; i < table.cache['ValueTable'].length; i++) {
                //    if (table.cache['ValueTable'][i].HInSpectValueB == "" || table.cache['ValueTable'][i].HInSpectValueB == null) {
                //        table.cache['ValueTable'][i].HInSpectValueB = 0
                //    }
                //    if (table.cache['ValueTable'][i].HInSpectValueT == "" || table.cache['ValueTable'][i].HInSpectValueT == null) {
                //        table.cache['ValueTable'][i].HInSpectValueT = 0
                //    }
                //    if (table.cache['ValueTable'][i].HInSpectValue == "" || table.cache['ValueTable'][i].HInSpectValue == null) {
                //        table.cache['ValueTable'][i].HInSpectValue = 0
                //    }
                //}
                //var sValueTable = JSON.stringify(table.cache['ValueTable']);
                //var HInterID = $("#HInterID").val();
                //var HEntryID = dataindex;
                for (let i = 0; i < table.cache['ValueTable'].length; i++) {
                    if (table.cache['ValueTable'][i].HInSpectValueB == "" || table.cache['ValueTable'][i].HInSpectValueB == null) {
                        table.cache['ValueTable'][i].HInSpectValueB = 0
                    }
                    if (table.cache['ValueTable'][i].HInSpectValueT == "" || table.cache['ValueTable'][i].HInSpectValueT == null) {
                        table.cache['ValueTable'][i].HInSpectValueT = 0
                    }
                    if (table.cache['ValueTable'][i].HInSpectValue == "" || table.cache['ValueTable'][i].HInSpectValue == null) {
                        table.cache['ValueTable'][i].HInSpectValue = 0
                    }
                }
                var sValueTable = JSON.stringify(table.cache['ValueTable']);
                var HInterID = $("#HInterID").val();
                var HEntryID = dataindex;
                //var msg = sValueTable + ";" + HInterID + ";" + HEntryID
                var msg = sValueTable + ";" + HInterID + ";" + HEntryID
                //var index = layer.load();
                //$.ajax({
                //    type: "POST",
                //    url: GetWEBURL() + "/QC_ProcessCheckBill/set_SaveValue",
                //    async: true,
                //    data: { "msg": msg },
                //    dataType: "json",
                //    success: function (data) {
                //        if (data.count == 1) {
                //            layer.close(index);
                //            //$('#btnSave').addClass("layui-btn-disabled").attr("disabled", true);//保存按钮
                //        }
                //        else {
                //            layer.close(index);
                //            layer.msg("检验值保存错误!" + data.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                //        }
                //    },
                //    error: function (err) {
                //        layer.close(index);
                //        layer.msg("检验值保存错误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                //    }
                //});
                var index = layer.load();
                $.ajax({
                    type: "POST",
                    url: GetWEBURL() + "/QC_ProcessCheckBill/set_SaveValue",
                    async: true,
                    data: { "msg": msg },
                    dataType: "json",
                    success: function (data) {
                        if (data.count == 1) {
                            layer.close(index);
                            //$('#btnSave').addClass("layui-btn-disabled").attr("disabled", true);//保存按钮
                        }
                        else {
                            layer.close(index);
                            layer.msg("检验值保存错误!" + data.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        }
                    },
                    error: function (err) {
                        layer.close(index);
                        layer.msg("检验值保存错误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    }
                });
            }
            //#region【隐藏检测值字段】
@@ -3531,7 +3789,40 @@
            HReasonName, ReasonID, EmpName,
            ZRProcName, QRName;
        function GetGySource(obj) {  //生产资源
            $("#HSourceName").val(obj.生产资源名称);
            $("#HSourceID").val(obj.HItemID);
        }
        function GetICMOBillValue(obj) {  //生产订单
            $("#HICMOInterID").val(obj[0].hmainid);
            $("#HICMOEntryID").val(obj[0].HEntryID);
            $("#HICMOBillNo").val(obj[0].单据号);
            $("#HICMOQty").val(obj[0].计划生产数量);
        }
        function GetProcExValue(obj) {  //流转卡
            $("#HProcExchInterID").val(obj[0].hmainid);
            $("#HProcExchEntryID").val(obj[0].hsubid);
            $("#HProcExchBillNo").val(obj[0].单据号);
        }
        function GetMaterValue(obj) {  //物料
            $("#HMaterNumber").val(obj[0].物料代码);
            $("#HMaterName").val(obj[0].物料名称);
            $("#HMaterID").val(obj[0].HItemID);
        }
        function GetHEmpValue(obj) {  //质检员
            $("#HFirstCheckEmpName").val(obj[0].职员名称);
            $("#HFirstCheckEmp").val(obj[0].HItemID);
        }
        function GetCheckProjectValue(obj) {  //质检方案
            $("#HQCSchemeID").val(obj[0].hmainid);
            $("#HQCSchemeName").val(obj[0].检验方案名称);
            get_CheckItem();
        }
    </script>
</body>