1
wtt
2025-06-16 4833c912a263af12b1f4e32eac1f8da63f8dfd08
WebTM/views/ÖÊÁ¿¹ÜÀí/³µ¼ä×Լ쵥/QC_Add_Edit_WorkSelfCheckBill.html
@@ -47,13 +47,18 @@
        <div class="layui-card" style="padding: 2px;background-color: #efefef;">
            <div class="layui-card-body" style="padding: 1px;">
                <form class="layui-form" action="" lay-filter="formData" style="background-color:white;">
                    <div style="padding: 10px;">
                        <button type="button" class="layui-btn layui-btn-normal" style="margin-left: 0px" lay-submit="" lay-filter="btn-AddNew" id="btn-AddNew">新增</button>
                        <button type="button" class="layui-btn layui-btn-normal" style="margin-left: 0px" lay-submit="" lay-filter="btnSave" id="btnSave">保存</button>
                        <button type="button" class="layui-btn layui-btn-normal" style="margin-left: 0px" lay-submit="" lay-filter="btn-Exit" id="btn-Exit">退出</button>
                    <div style="position: relative; display: flex; align-items: center; padding: 10px;">
                        <!-- æŒ‰é’®ç»„ -->
                        <div style="z-index: 1;">
                            <button type="button" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="btn-AddNew" id="btn-AddNew">新增</button>
                            <button type="button" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="btnSave" id="btnSave">保存</button>
                            <button type="button" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="btn-Exit" id="btn-Exit">退出</button>
                            <button type="button" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="btn-SIP" id="btn-SIP">SIP查看</button>
                        </div>
                        <!-- æ ‡é¢˜ï¼Œä½¿ç”¨ç»å¯¹å®šä½ä½¿å…¶åœ¨çˆ¶å®¹å™¨å†…居中 -->
                        <h1 style="position: absolute; left: 50%; transform: translateX(-50%); z-index: 0; text-align: center; width: fit-content; margin: 0; padding: 0 10px;"><b>车间自检单</b></h1>
                    </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>
@@ -80,10 +85,20 @@
                                            <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="HSourceName" id="HSourceName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                                <input type="hidden" name="HSourceID" id="HSourceID" value="0">
                                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchSource" id="btnSearchSource" 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="HSourceID" id="HSourceID" 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>
                                                <input type="hidden" name="HShiftsID" id="HShiftsID" value="0">
                                                <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>
                                            </div>
                                        </div>
                                    </div>
@@ -92,6 +107,8 @@
                                            <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="HICMOBillNo" id="HICMOBillNo" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                                <input type="hidden" class="layui-input" name="HICMOInterID" id="HICMOInterID" value="0" style="background-color:#efefef4d;" readonly>
                                                <input type="hidden" name="HICMOEntryID" id="HICMOEntryID" value="0">
                                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchICMOBill" id="btnSearchICMOBill" style="padding: 0 10px;float: right;margin-right: 3px;">
                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                                </button>
@@ -100,44 +117,15 @@
                                        <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="HICMOQty" id="HICMOQty" style="background-color:#efefef4d;" readonly>
                                            </div>
                                        </div>
                                        <div class="layui-inline" style="display: none">
                                            <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="HICMOInterID" id="HICMOInterID" value="0" style="background-color:#efefef4d;" readonly>
                                                <input type="hidden" name="HICMOEntryID" id="HICMOEntryID" 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>
                                    <div class="layui-row">
                                        <div class="layui-inline" style="display: none">
                                            <label class="layui-form-label" style="width: 85px;">流转卡ID</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" name="HProcExchInterID" id="HProcExchInterID" value="0" style="background-color:#efefef4d;" readonly>
                                            </div>
                                        </div>
                                        <div class="layui-inline" style="display: none">
                                            <label class="layui-form-label" style="width: 85px;">流转卡子ID</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" name="HProcExchEntryID" id="HProcExchEntryID" value="0" style="background-color:#efefef4d;" readonly>
                                                <input type="text" class="layui-input" name="HICMOQty" id="HICMOQty" style="background-color:#efefef4d;" readonly value="0">
                                            </div>
                                        </div>
                                        <div class="layui-inline" id="hidediv2">
                                            <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="HProcExchBillNo" id="HProcExchBillNo" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                                <input type="hidden" class="layui-input" name="HProcExchInterID" id="HProcExchInterID" value="0" style="background-color:#efefef4d;" readonly>
                                                <input type="hidden" class="layui-input" name="HProcExchEntryID" id="HProcExchEntryID" value="0" style="background-color:#efefef4d;" readonly>
                                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchProcExch" id="btnSearchProcExch" style="padding: 0 10px;float: right;margin-right: 3px;">
                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                                </button>
@@ -146,18 +134,15 @@
                                        <div class="layui-inline" id="hidediv1">
                                            <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 value="1">
                                            </div>
                                        </div>
                                        <div class="layui-inline" id="hidediv1">
                                            <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="HProcName" id="HProcName" style="background-color:#efefef4d;" readonly value="1">
                                                <input type="text" class="layui-input" name="HProcExchQty" id="HProcExchQty" style="background-color:#efefef4d;" readonly value="0">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row">
                                    </div>
                                    <div class="layui-row">
                                        <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;">
@@ -190,29 +175,35 @@
                                        </div>
                                    </div>
                                    <div class="layui-row">
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline" style="width: 58%">
                                            <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>
                                    <div class="layui-row">
                                        <div class="layui-inline" style="width: 58%;">
                                            <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>
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">判断结论</label>
                                            <div class="layui-input-block">
                                                <input type="radio" name="HLastResult" id="HLastResult" value="true" title="合格" checked>
                                                <input type="radio" name="HLastResult" id="HLastResult" 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>
                                                <input type="hidden" name="HProcID" id="HProcID" value="0">
                                                <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>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row">
                                        <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>
@@ -352,13 +343,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>
@@ -382,14 +373,14 @@
                                        </div>
                                    </div>
                                    <!--<div class="layui-inline">
                                        <label class="layui-form-label">检验结果</label>
                                        <div class="layui-input-block">
                                            <select name="HResult" lay-filter="HResult" style="width:190px;">
                                                <option value="合格" selected="selected">合格</option>
                                                <option value="不合格">不合格</option>
                                            </select>
                                        </div>
                                    </div>-->
                        <label class="layui-form-label">检验结果</label>
                        <div class="layui-input-block">
                            <select name="HResult" lay-filter="HResult" style="width:190px;">
                                <option value="合格" selected="selected">合格</option>
                                <option value="不合格">不合格</option>
                            </select>
                        </div>
                    </div>-->
                                </div>
                                <div class="layui-row" style="margin-top:5px;">
                                    <div class="layui-inline">
@@ -401,15 +392,15 @@
                                    <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="HRejectQty" id="HRejectQty" style="background-color:#efefef4d;" readonly>
                                            <input type="text" class="layui-input" name="HRejectQty" id="HRejectQty" 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="checkbox" name="HKeyInspect" id="HKeyInspect" value="false" lay-skin="primary" lay-filter="HKeyInspect">
                                        </div>
                                    </div>-->
                        <label class="layui-form-label" style="width: 85px;">重点检查</label>
                        <div class="layui-input-block" style="margin-left: 120px;">
                            <input type="checkbox" name="HKeyInspect" id="HKeyInspect" value="false" lay-skin="primary" lay-filter="HKeyInspect">
                        </div>
                    </div>-->
                                </div>
                                <div class="layui-row" style="margin-top:5px;">
                                    <div class="layui-inline">
@@ -483,11 +474,11 @@
                                            </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="checkbox" name="HKeyInspect" id="HKeyInspect2" value="false" lay-skin="primary" lay-filter="HKeyInspect">
                                            </div>
                                        </div>-->
                            <label class="layui-form-label" style="width: 85px;">重点检查</label>
                            <div class="layui-input-block" style="margin-left: 120px;">
                                 <input type="checkbox" name="HKeyInspect" id="HKeyInspect2" value="false" lay-skin="primary" lay-filter="HKeyInspect">
                            </div>
                        </div>-->
                                    </div>
                                    <div class="layui-row" style="margin-top:5px;">
                                        <div class="layui-inline" style="border-bottom:2px solid #9C9C9C;width:290px;margin-left:10px">
@@ -498,14 +489,14 @@
                                    </div>
                                    <div class="layui-row" style="margin-top:5px;">
                                        <!--<div class="layui-inline">
                                            <label class="layui-form-label" style="width: 70px !important;">分析方法</label>
                                            <div class="layui-input-block" style="margin-left: 100px; width: 182px">
                                                <select name="HAnalysisMethod" lay-filter="HAnalysisMethod">
                                                    <option value="合格" selected="selected">合格</option>
                                                    <option value="不合格">不合格</option>
                                                </select>
                                            </div>
                                        </div>-->
                            <label class="layui-form-label" style="width: 70px !important;">分析方法</label>
                            <div class="layui-input-block" style="margin-left: 100px; width: 182px">
                                <select name="HAnalysisMethod" lay-filter="HAnalysisMethod">
                                    <option value="合格" selected="selected">合格</option>
                                    <option value="不合格">不合格</option>
                                </select>
                            </div>
                        </div>-->
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 70px !important;">状态</label>
                                            <div class="layui-input-block" style="margin-left: 100px; width: 182px">
@@ -670,6 +661,8 @@
            //公用变量
            var rowdata = [];
            var option = [];
            var HDeptID = "";//部门id èŽ·å–ç­æ¬¡
            var HCenterID = "";//工作中心id èŽ·å–ç­æ¬¡
            var rowdata_Value = [];
            var option_Value = [];
@@ -700,6 +693,7 @@
                var linterid = params[params[1]];//源单id
                var HSouceBillType = params[params[2]];//源单类型
                var HICMOEntryID = params[params[3]];//源单子id
                var HEntryID = params[params[4]];//源单子id
            }
            /*固定代码,每张单据都要begin*/
            //////测试用数据
@@ -707,6 +701,10 @@
            //var linterid = 11880;
            //var HSouceBillType = 3722;
            //var HICMOEntryID = 100027;
            //初始化表格
            set_InitGrid();
            //#region åˆ¤æ–­æ˜¯å¦æ–°å¢ž
            if (OperationType == 1) {
                $("#HInterID").val("");
@@ -714,6 +712,8 @@
                $("#HFirstCheckEmp").val(sessionStorage["HCheckEmpID"]); //根据登录用户带出检验员ID
                $("#HFirstCheckEmpName").val(sessionStorage["HCheckEmpName"]); //根据登录用户带出检验员
                HDeptID = sessionStorage["HDeptID"]; //根据登录用户带出部门ID
                HCenterID = sessionStorage["HWorkCenterID"]; //根据登录用户带出工作中心ID
                //获取最大单据号
                $.ajax({
@@ -728,18 +728,22 @@
                        $("#HMaker").val(sessionStorage["HUserName"]);
                    }
                });
                //获取班次
                get_HWorkShift();
            }
            else if (OperationType == 2) {
                $("#HInterID").val("");
                $("#HBillNo").val("");
                $('#btn-AddNew').addClass("layui-btn-disabled").attr("disabled", true);//有源单时新增按钮禁用
                $('#btnSearchSource').addClass("layui-btn-disabled").attr("disabled", true);//有源单时生产资源按钮禁用
                $('#btnSearchICMOBill').addClass("layui-btn-disabled").attr("disabled", true);//有源单时任务单号按钮禁用
                $('#btnSearchMater').addClass("layui-btn-disabled").attr("disabled", true);//有源单时产品内码按钮禁用
                $('#btnSearchProcExch').addClass("layui-btn-disabled").attr("disabled", true);//有源单时流转卡号按钮禁用
                $("#HFirstCheckEmp").val(sessionStorage["HEmpID"]);
                $("#HFirstCheckEmpName").val(sessionStorage["HEmpName"]);
                HDeptID = sessionStorage["HDeptID"]; //根据登录用户带出部门ID
                HCenterID = sessionStorage["HWorkCenterID"]; //根据登录用户带出工作中心ID
                //获取最大单据号
                $.ajax({
                    url: GetWEBURL() + "/Web/GetMAXNum",
@@ -757,30 +761,42 @@
                if (HSouceBillType == 3722 || HSouceBillType == 4610) {
                    //根据源单id获取源单信息
                    LoadingInformation2();
                    //自动带出检验方案
                    GetCheckItemID();
                }
                //工序进站接收单列表首检
                else if (HSouceBillType == 3790) {
                    //根据源单id获取源单信息
                    LoadingInformation_StationInBill();
                    //自动带出检验方案
                    GetCheckItemID();
                }
                //工序委外接收单列表首检
                else if (HSouceBillType == 3793) {
                    //根据源单id获取源单信息
                    LoadingInformation3();
                    //自动带出检验方案
                    GetCheckItemID();
                }
                //生产订单列表首检
                else if (HSouceBillType == 3710) {
                    //根据源单id获取源单信息
                    LoadingInformation_ICMO();
                    //自动带出检验方案
                    GetCheckItemID();
                }
                //工序流转卡列表首检
                else if (HSouceBillType == 3772) {
                    //根据源单id获取源单信息
                    LoadingInformation_ProcExchange();
                    //自动带出检验方案
                    GetCheckItemID();
                }
                else {
                    layer.alert("源单类型无效!", { icon: 5 });
                }
                //获取班次
                get_HWorkShift();
            }
            else if (OperationType == 3) {
                RoadBillMain(linterid);
@@ -798,6 +814,7 @@
                $.ajax({
                    url: GetWEBURL() + '/QC_WorkSelfCheckBill/get_StationInBill',
                    type: "GET",
                    async: false,
                    data: { "HInterID": linterid, "user": sessionStorage["HUserName"] },
                    success: function (result) {
                        var data = result.data[0];
@@ -839,7 +856,8 @@
                $.ajax({
                    url: GetWEBURL() + '/QC_WorkSelfCheckBill/get_ProcessExchangeBill',
                    type: "GET",
                    data: { "HInterID": linterid, "user": sessionStorage["HUserName"] },
                    async: false,
                    data: { "HInterID": linterid, "HEntryID": HEntryID,  "user": sessionStorage["HUserName"] },
                    success: function (result) {
                        var data = result.data[0];
                        if (result.count == 1) {
@@ -860,7 +878,10 @@
                            $("#HICMOEntryID").val(data.HICMOEntryID == null ? 0 : data.HICMOEntryID);//
                            $("#HQCSchemeName").val(data.检验方案名称);
                            $("#HQCSchemeID").val(data.检验方案ID);
                            $("#HProcID").val(data.HProcID);//
                            $("#HProcName").val(data.当前工序);//
                            HDeptID = data.HWorkShopID == null ? sessionStorage["HDeptID"] : data.HWorkShopID;//工作中心id
                            HCenterID = data.HCenterID == null ? sessionStorage["HWorkCenterID"] : data.HCenterID;//工作中心id
                            //获取表体检验项目信息
                            get_CheckItem();
                        } else {
@@ -883,6 +904,7 @@
                $.ajax({
                    url: GetWEBURL() + '/LEMS/MES_IF_ICMOBillList_Json',
                    type: "GET",
                    async: false,
                    data: { "sWhere": "and hmainid = " + linterid, "user": sessionStorage["HUserName"] },
                    success: function (result) {
                        var data = result.data[0];
@@ -915,6 +937,7 @@
                $.ajax({
                    url: GetWEBURL() + "/QC_WorkSelfCheckBill/get_ICMOBillStatus_Tmp",
                    type: "GET",
                    async: false,
                    data: { "HInterID": linterid, "HEntryID": HICMOEntryID, "HBillType": HSouceBillType },
                    success: function (result) {
                        var data = result.data[0];
@@ -956,6 +979,7 @@
                $.ajax({
                    url: GetWEBURL() + '/Cj_StationEntrustOutBill/list',
                    type: "GET",
                    async: false,
                    data: { "sWhere": "and HInterID = " + linterid },
                    success: function (result) {
                        var data = result.data[0];
@@ -996,8 +1020,8 @@
                    "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": '0',
                    "HSampleSchemeName": "", "HSampleQty": "", "HSampleDamageQty": "0", "HAcceptQty": "0", "HInspectionLevel": "", "HRejectQty": "",
                    "HStrictness": "", "HSampleUnRightQty": "", "HAQL": "", "HSamplingType": ""
                    "HSampleSchemeName": "", "HSampleQty": "", "HSampleDamageQty": "0", "HAcceptQty": "0", "HInspectionLevel": "", "HRejectQty": "0",
                    "HStrictness": "", "HSampleUnRightQty": "0", "HAQL": "", "HSamplingType": ""
                };
                switch (obj.event) {
@@ -1035,6 +1059,75 @@
                }
            });
            //#endregion
            //表头信息工序
            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();
                        GetCheckItemID();
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                    },
                    end: function () {
                    },
                    success: function (layero, index) {
                    }
                });
            });
            //SIP查看按钮
            form.on('submit(btn-SIP)', function () {
                var HProcID = $("#HProcID").val();
                var HMaterID = $("#HMaterID").val();
                if (HProcID == 0 && HMaterID == 0) {
                    layer.alert("物料名称与工序不能为空", { icon: 5 });
                }
                else {
                    layer.open({
                        type: 2
                        , area: ['100%', '100%']
                        , title: '查看作业指导书'
                        , closeBtn: 1
                        , shade: 0.6 //遮罩透明度
                        , maxmin: true //允许全屏最小化
                        , anim: 0 //0-6的动画形式,-1不开启
                        , content: '../../生产管理/作业指导书/Gy_SOPBill_Video.html?OperationType=5&HMaterID=' + HMaterID + '&HSourceNo=&HSourceEntryID=&HProcID=' + HProcID + '&HType=SIP'
                        , resize: false,
                        end: function () {
                        }
                        , cancel: function () {
                        }
                    })
                }
            });
            //退出按钮
            form.on('submit(btn-Exit)', function (data) {
@@ -1185,7 +1278,7 @@
                                shift: 2,
                                area: ['90%', '90%'],
                                maxmin: true,
                                content: ['../../基础资料/公用基础资料/Gy_CheckItem.html', 'yes'],
                                content: ['../../基础资料/公用基础资料/Gy_CheckItem.html?openType=2', 'yes'],
                                btn: ['确定', '取消']
                                , btn1: function (index, layero) {
@@ -1225,7 +1318,7 @@
                                shift: 2,
                                area: ['90%', '90%'],
                                maxmin: true,
                                content: ['../../基础资料/公用基础资料/Gy_InspectInstruMent.html', 'yes'],
                                content: ['../../基础资料/公用基础资料/Gy_InspectInstruMent.html?openType=2', 'yes'],
                                btn: ['确定', '取消']
                                , btn1: function (index, layero) {
@@ -1275,7 +1368,7 @@
                                shift: 2,
                                area: ['90%', '90%'],
                                maxmin: true,
                                content: ['../../基础资料/公用基础资料/Gy_InspectValue.html', 'yes'],
                                content: ['../../基础资料/公用基础资料/Gy_InspectValue.html?openType=2', 'yes'],
                                btn: ['确定', '取消']
                                , btn1: function (index, layero) {
@@ -1358,6 +1451,44 @@
                        }
                        form.render('select');
                        addUnRightQty();
                        break;
                }
            });
            table.on('edit(mainTable)', function (obj) {
                // å•元格编辑之前的值
                var oldText = $(this).prev().text();
                var value = obj.value //得到修改后的值
                    , data = obj.data //得到所在行所有键值
                    , field = obj.field; //得到字段
                var HInspectVal = $("#HInspectVal").val(); //检验值
                //var HTargetVal = $("#HTargetVal").val(); //目标值
                //var HComparator = $("#HComparator").val(); //比较符
                var HEntryID = $("#HEntryID").val() - 1;
                var HAnalysisMethod = table.cache["mainTable"][HEntryID].HAnalysisMethod; //分析方法
                var HUpLimit = table.cache["mainTable"][HEntryID].HUpLimit; //上限值
                var HDownLimit = table.cache["mainTable"][HEntryID].HDownLimit; //下限值
                switch (field) {
                    case "HInspectVal":  //检验值
                        value = isNaN(value) ? 0 : value;
                        if (HAnalysisMethod == "2") {
                            if (value <= HUpLimit && value >= HDownLimit) {
                                obj.update({
                                    "HResult": "1"
                                });
                                $('#HResult' + (HEntryID + 1)).find("option[value='1']").attr("selected", true);
                            } else {
                                obj.update({
                                    "HResult": "2"
                                });
                                $('#HResult' + (HEntryID + 1)).find("option[value='2']").attr("selected", true);
                            }
                            form.render('select');
                        }
                        break;
                }
            });
@@ -1448,7 +1579,7 @@
                var ajaxLoad = layer.load();
                var sWhere = " and hmainid=" + linterid;
                $.ajax({
                    url: GetWEBURL() + "/QC_WorkSelfCheckBill/QC_WorkSelfCheckBillList",
                    url: GetWEBURL() + "/QC_WorkSelfCheckBill/QC_WorkSelfCheckBillEdit",
                    type: "GET",
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                    success: function (result) {
@@ -1484,19 +1615,19 @@
                                , "HCloseDate": data.关闭日期
                                , "HUpDateDate": data.修改日期
                                , "HDeleteDate": data.作废日期
                                , "HSampleSchemeID": data.HSampleSchemeID
                                , "HSampleSchemeID": data.HSampleSchemeID == '' ? 0 : data.HSampleSchemeID
                                , "HSampleSchemeName": data.抽样方案名称
                                , "HSampleQty": data.样本量
                                , "HSampleQty2": data.样本量
                                , "HSampleDamageQty": data.样本破坏数
                                , "HSampleDamageQty": data.样本破坏数 == '' ? 0 : data.HSampleDamageQty
                                , "HSamplingType": data.抽样类型
                                , "HAcceptQty": data.允许数
                                , "HInspectResultToSee2":data.检验结果
                                , "HInspectionLevel": data.检验水平
                                , "HRejectQty": data.拒绝数
                                , "HRejectQty": data.拒绝数 == '' ? 0 : data.拒绝数
                                , "HStrictness": data.严格度
                                , "HSampleUnRightQty": data.样本不合格数
                                , "HSampleUnRightQty2": data.样本不合格数
                                , "HSampleUnRightQty": data.样本不合格数 == '' ? 0 : data.样本不合格数
                                , "HSampleUnRightQty2": data.样本不合格数 == '' ? 0 : data.样本不合格数
                                , "HAQL": data.AQL
                                , "HEntryID": data.hsubid
                                , "HQCCheckItemName": data.检验项目名称
@@ -1504,6 +1635,8 @@
                                , "HShiftsID": data.HShiftsID
                                , "HShiftsName": data.班次名称
                                , "HErrTreatment": data.异常临时处理方案
                                , "HProcID": data.HProcID
                                , "HProcName": data.HProcName
                            });
                            $("input[name=HLastResult][value=true]").prop("checked", data.判定结论 === "合格");
                            $("input[name=HLastResult][value=false]").prop("checked", data.判定结论 === "不合格");
@@ -1841,7 +1974,7 @@
                                rowdata.push(
                                    {
                                        "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]["默认结论"],
                                        "HMax": "", "HMin": "", "HAvg": "", "HRemark": "", "HKeyInspect": data[i]["重点检查"] == 1 ? true : false, "HStatus": 0, "HSampleSchemeID": data[i]["HSampleSchemeID"], "HUnitID": data[i]["HUnitID"],
                                        "HMax": "", "HMin": "", "HAvg": "", "HRemark": "", "HKeyInspect": data[i]["重点检查"] == 1 ? true : false, "HStatus": 0, "HSampleSchemeID": data[i]["HSampleSchemeID"] == null ? 0 : data[i]["HSampleSchemeID"], "HUnitID": data[i]["HUnitID"],
                                        "HInspectVal": '', "HTargetVal": '', "HUpLimit": '', "HDownLimit": '', "HUpOffSet": '', "HDownOffSet": '', "HSampleDamageQty": "0",
                                        "HSampleSchemeName": data[i].抽样方案名称, "HSampleQty": data[i].样本量, "HAcceptQty": data[i].允许数 == null ? 0 : data[i].允许数, "HInspectionLevel": data[i].检验水平, "HRejectQty": data[i].拒绝数 == null ? 0 : data[i].拒绝数,
                                        "HStrictness": data[i].严格度, "HSampleUnRightQty": "0", "HAQL": data[i].AQL, "HSamplingType": data[i].抽样类型
@@ -2019,7 +2152,7 @@
                    shift: 2,
                    area: ['90%', '90%'],
                    maxmin: true,
                    content: ['../../基础资料/生产基础资料/Gy_Source.html', 'yes'],
                    content: ['../../基础资料/生产基础资料/Gy_Source.html?Htype=&openType=2', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
@@ -2031,6 +2164,8 @@
                        }
                        $("#HSourceName").val(checkStatus.data[0].生产资源名称);
                        $("#HSourceID").val(checkStatus.data[0].HItemID);
                        get_ICMOBillStatusList();
                        GetCheckItemID();
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) {
@@ -2057,7 +2192,7 @@
                    shift: 2,
                    area: ['90%', '90%'],
                    maxmin: true,
                    content: ['../../基础资料/生产基础资料/Gy_ShiftsList.html?type=HShifts', 'yes'],
                    content: ['../../基础资料/生产基础资料/Gy_WorkShiftList.html?type=HWorkShifts', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
@@ -2068,7 +2203,7 @@
                            return layer.msg('请选择数据');
                        }
                        $("#HShiftsName").val(checkStatus.data[0].班次名称);
                        $("#HShiftsID").val(checkStatus.data[0].HItemID);
                        $("#HShiftsID").val(checkStatus.data[0].HInterID);
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) {
@@ -2095,7 +2230,7 @@
                    shift: 2,
                    area: ['90%', '90%'],
                    maxmin: true,
                    content: ['../../基础资料/公用基础资料/Gy_Material.html', 'yes'],
                    content: ['../../基础资料/公用基础资料/Gy_Material.html?openType=2', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
@@ -2109,6 +2244,7 @@
                        $("#HMaterNumber").val(checkStatus.data[0].物料代码);
                        $("#HMaterName").val(checkStatus.data[0].物料名称);
                        $("#HMaterID").val(checkStatus.data[0].HItemID);
                        GetCheckItemID();
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) {
@@ -2126,6 +2262,8 @@
            //表头信息检验方案弹窗
            form.on('submit(btnSearchQCScheme)', function () {
                var HName = $("#HMaterName").val();
                var HProcName = $("#HProcName").val();
                //页面层-自定义
                layer.open({
                    type: 2,
@@ -2135,7 +2273,7 @@
                    shift: 2,
                    area: ['90%', '90%'],
                    maxmin: true,
                    content: ['../../质量管理/检验方案单/QC_CheckProjectList.html', 'yes'],
                    content: ['../../质量管理/检验方案单/QC_CheckProjectList.html?OperationType=1&HName=' + HName + '&HProcName=' + HProcName + '', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
@@ -2167,9 +2305,7 @@
            //退出
            form.on('submit(Cancel)', function () {
                //sessionStorage["SourceFlag"] = false;
                parent.location.href = "../../../views/index.html"
                //window.close();//关闭当前页
            })
            //初始化表格
@@ -2181,7 +2317,7 @@
                    "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": '0',
                    "HSampleSchemeName": "", "HSampleQty": "", "HSampleDamageQty": "0", "HAcceptQty": "0", "HInspectionLevel": "", "HRejectQty": "",
                    "HSampleSchemeName": "", "HSampleQty": "0", "HSampleDamageQty": "0", "HAcceptQty": "0", "HInspectionLevel": "", "HRejectQty": "0",
                    "HStrictness": "", "HSampleUnRightQty": "0", "HAQL": "", "HSamplingType": ""
                }];
                option = {
@@ -2343,10 +2479,10 @@
                }
                if (HQty > 0) {
                    document.querySelectorAll("[name='HLastResult']")[0].removeAttribute('checked'); //删除选择属性
                    $("input:radio[name=HLastResult][value=" + false + "]").attr("checked", "true"); //添加选择属性
                    $("input:radio[name=HLastResult][value=" + false + "]").prop("checked", "true"); //添加选择属性
                } else {
                    document.querySelectorAll("[name='HLastResult']")[1].removeAttribute('checked'); //删除选择属性
                    $("input:radio[name=HLastResult][value=" + true + "]").attr("checked", "true"); //添加选择属性
                    $("input:radio[name=HLastResult][value=" + true + "]").prop("checked", "true"); //添加选择属性
                }
                form.render('radio');
            }           
@@ -2621,21 +2757,21 @@
                    $("#HDownLimit").val(0);
                    $("#HUpOffSet").val(0);
                    $("#HDownOffSet").val(0);
                    $("#HSampleDamageQty").val("")
                    $("#HSampleQty").val("")
                    $("#HSampleQty2").val("")
                    $("#HSampleDamageQty").val("0")
                    $("#HSampleQty").val("0")
                    $("#HSampleQty2").val("0")
                    $("#HAcceptQty").val("0")
                    $("#HInspectionLevel").val("")
                    $("#HRejectQty").val("")
                    $("#HRejectQty").val("0")
                    $("#HStrictness").val("")
                    $("#HSampleUnRightQty").val("")
                    $("#HSampleUnRightQty2").val("")
                    $("#HSampleUnRightQty").val("0")
                    $("#HSampleUnRightQty2").val("0")
                    $("#HAQL").val("")
                    $("#HSamplingType").val("")
                    $("#HSampleQty").val("")
                    $("#HSampleQty").val("0")
                    $("#HInspectResultToSee").val("")
                    $("#HInspectResultToSee2").val("")
                    $("#HSampleUnRightQty").val("")
                    $("#HSampleUnRightQty").val("0")
                    $("#HUnitID").val("0")
                    $("#HUnitName").val("")
                    $("#HInspectValB").val("0")
@@ -3535,6 +3671,45 @@
            }          
            //#endregion
            //根据生产资源或者 å·¥åº æŸ¥è¯¢ç”Ÿäº§å·¥å•信息
            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: "温馨提示" });
                    }
                })
            }
            //#region ã€éšè—æ£€æµ‹å€¼å­—段】
            function IsHide(HAnalysisMethod_Value) {
                if (HAnalysisMethod_Value == 1) { //如果选中【定性分析】,则隐藏定量、其他分析
@@ -3644,6 +3819,84 @@
            }
            //#endregion
            //自动带出检验方案
            function GetCheckItemID() {
                var HName = $("#HMaterName").val();
                var HProName = $("#HProcName").val();
                var HSourceID = $("#HSourceID").val();
                if (HName != '' && HName != undefined && HProName != '' && HProName != undefined) {
                    $.ajax({
                        url: GetWEBURL() + "/Web/GetCheckItemID",
                        type: "GET",
                        async: false,
                        data: { "HName": HName, "HProName": HProName, "HSourceID": HSourceID},
                        success: function (result) {
                            if (result.code == 1) {
                                $("#HQCSchemeID").val(result.data[0].hmainid);
                                $("#HQCSchemeName").val(result.data[0].检验方案名称);
                                get_CheckItem();
                            } else {
                                layer.msg(result.code + result.Message, { icon: 5 });
                            }
                        }
                    })
                }
            }
            //表头 èŽ·å–æ£€éªŒæ–¹æ¡ˆ
            function get_CheckItem()//加载表头
            {
                $.ajax({
                    url: GetWEBURL() + "/Gy_BaseInformation/Gy_EnvironmentTestSchemeBillMainEditList",
                    type: "GET",
                    async: false,
                    data: { "linterid": $("#HEnvironmentTestSchemeID").val() == "" ? 0 : $("#HEnvironmentTestSchemeID").val(), "user": sessionStorage["HUserName"] },
                    success: function (d) {
                        //子表  èµ‹å€¼
                        var rowdata = [];
                        for (var i = 0; i < d.data.length; i++) {
                            rowdata.push(
                                {
                                    "HEnvironmentItemID": d.data[i].HEnvironmentItemID, "HEnvironmentItemName": d.data[i].检测项目,
                                    "HMeasure": "0", "HTargetVal": d.data[i].目标值, "HUpLimit": d.data[i].上限值, "HDownLimit": d.data[i].下限值
                                }
                            )
                        }
                        option.data = rowdata;
                        table.render(option);
                    }
                })
            }
            //获取班次
            function get_HWorkShift() {
                $.ajax({
                    type: "GET",
                    url: GetWEBURL() + "/Gy_ShiftsController/Get_HWorkShift", //方法所在页面和方法名
                    data: {
                        "HDeptID": HDeptID,
                        "HCenterID": HCenterID
                    },
                    success: function (data) {
                        if (data.count == 1)// è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                        {
                            var LoadData = data.data;
                            $("#HShiftsID").val(LoadData[0].HInterID); //当前工序ID
                            $("#HShiftsName").val(LoadData[0].班次); //当前工序
                        }
                        else {
                            layer.alert(data.Message, { icon: 5 });
                        }
                    },
                    error: function (err) {
                        layer.alert(err, { icon: 5 });
                    }
                });
            }
            //以上为layui模块
        });
@@ -3669,6 +3922,7 @@
            $("#HMaterNumber").val(obj.物料代码);
            $("#HMaterName").val(obj.物料名称);
            $("#HMaterID").val(obj.HItemID);
            GetCheckItemID();
        }
        function GetHEmpValue(obj) {  //质检员
@@ -3681,9 +3935,10 @@
            $("#HQCSchemeName").val(obj[0].检验方案名称);
            get_CheckItem();
        }
        function GetHShiftsValue(obj) {    //生产班次
        //班次
        function GetHWorkShiftsValue(obj) {
            $("#HShiftsName").val(obj[0].班次名称);
            $("#HShiftsID").val(obj[0].HItemID);
            $("#HShiftsID").val(obj[0].HInterID);
        }
    </script>
</body>