WebTM/views/É豸¹ÜÀí/É豸¹¤ÒÕ²ÎÊý¶©µ¥µã¼ì±í/SB_EquipICMOTechParamBillEdit.html
@@ -351,6 +351,13 @@
        </select>
    </script>
    <!--复选框 æ˜¯å¦å¿…录控制-->
    <script type="text/html" id="HIsRequired">
        <div class="layui-input-block" style="margin-left: 20px;">
            <input type="checkbox" name="HIsRequired" lay-filter="HIsRequired" id="HIsRequired{{d.LAY_TABLE_INDEX+1}}" lay-skin="primary">
        </div>
    </script>
    <script>
        //获取参数
        var OptionData = [];
@@ -371,19 +378,19 @@
        }
        var edit = function (data) {
        var edit = function (data) {
            HSourceInterID = data[0].HSourceInterID;
            HSourceEntryID = data[0].HSourceEntryID;
            HSourceBillNo = data[0].HSourceBillNo;
            HSourceBillType = data[0].HSourceBillType;
        }
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element','upload'], function () {
        }).use(['index', 'form', 'laydate', 'table', 'element', 'upload'], function () {
            //#region å…¬å…±å˜é‡
            var $ = layui.$
                , admin = layui.admin
@@ -397,7 +404,7 @@
            var HMaker = sessionStorage["HUserName"]
            var HStockOrgID = sessionStorage["OrganizationID"]  //组织ID
            var option = {};
            //#endregion
            //判断是否登录 æœªç™»å½•则跳到登录页
@@ -453,9 +460,35 @@
                //初始化日期、创建人、创建时间
                $("#HDate").val(Pub_Format(new Date(), "yyyy-MM-dd"));
                $("#HMaker").val(HMaker);
                $("#HMakeDate").val(Pub_Format(new Date(), "yyyy-MM-dd"));
                $("#HMakeDate").val(Pub_Format(new Date(), "yyyy-MM-dd"));
                $("#HEmpID").val(sessionStorage["HEmpID"]); //根据登录用户带出操作员ID
                $("#HEmpName").val(sessionStorage["HEmpName"]); //根据登录用户带出操作员
                $("#HDeptID").val(sessionStorage["HDeptID"]); //根据登录用户带出车间ID
                $("#HDeptName").val(sessionStorage["HDept"]); //根据登录用户带出车间
                $("#HGroupID").val(sessionStorage["HGroupID"]); //根据登录用户带出班组ID
                $("#HGroupName").val(sessionStorage["HGroup"]); //根据登录用户带出班组
            }
            else if (OperationType == 2) {  //编辑
            else if (OperationType == 2) {  //复制
                //编辑状态时,根据内码,获取信息并写入界面
                RoadBillMain(HInterID);
                //文件选择初始化
                PicUpload();
                getFile();
                //获取最大单据号
                get_MAXNum();
                $("#HDate").val(Pub_Format(new Date(), "yyyy-MM-dd"));
                $("#HMaker").val(HMaker);
                $("#HMakeDate").val(Pub_Format(new Date(), "yyyy-MM-dd"));
                $("#HEmpID").val(sessionStorage["HEmpID"]); //根据登录用户带出操作员ID
                $("#HEmpName").val(sessionStorage["HEmpName"]); //根据登录用户带出操作员
                $("#HDeptID").val(sessionStorage["HDeptID"]); //根据登录用户带出车间ID
                $("#HDeptName").val(sessionStorage["HDept"]); //根据登录用户带出车间
                $("#HGroupID").val(sessionStorage["HGroupID"]); //根据登录用户带出班组ID
                $("#HGroupName").val(sessionStorage["HGroup"]); //根据登录用户带出班组
                OperationType = 1;
            }
            else if (OperationType == 3) {  //编辑
                $("#HInterID").val(HInterID);//修改时主表ID
                //编辑状态时,根据内码,获取信息并写入界面
                RoadBillMain(HInterID);
@@ -472,15 +505,21 @@
                $("#HDate").val(Pub_Format(new Date(), "yyyy-MM-dd"));
                $("#HMaker").val(HMaker);
                $("#HMakeDate").val(Pub_Format(new Date(), "yyyy-MM-dd"));
                $("#HEmpID").val(sessionStorage["HEmpID"]); //根据登录用户带出操作员ID
                $("#HEmpName").val(sessionStorage["HEmpName"]); //根据登录用户带出操作员
                $("#HDeptID").val(sessionStorage["HDeptID"]); //根据登录用户带出车间ID
                $("#HDeptName").val(sessionStorage["HDept"]); //根据登录用户带出车间
                $("#HGroupID").val(sessionStorage["HGroupID"]); //根据登录用户带出班组ID
                $("#HGroupName").val(sessionStorage["HGroup"]); //根据登录用户带出班组
                //工序流转卡页面下推
                if (HInterID == "") {    //报工台下推
                    set_ProcessBill(HSourceInterID, HSourceEntryID);
                } else {
                    set_ProcessBill(HInterID, HEntry);
                }
                OperationType = 1;
            }
            }
            else {
                layer.alert("未知操作类型!", { icon: 5 });
            }
@@ -521,7 +560,7 @@
                                $('#btn_Save').addClass("layui-btn-disabled").attr("disabled", true);
                            }
                            form.val("component-form-group", { //formTest å³ class="layui-form" æ‰€åœ¨å…ƒç´ å±žæ€§ lay-filter="" å¯¹åº”的值
                                "HBillNo": data.单据号
                                "HBillNo": OperationType == 2 ? '' : data.单据号
                                , "HDate": formatDate(data.日期)
                                , "HICMOInterID": data.HICMOInterID
                                , "HICMOEntryID": data.HICMOEntryID
@@ -570,7 +609,7 @@
                            for (let i = 0; i < result.data.length; i++) {
                                rowdata.push(
                                    {
                                        "HTechParamID": result.data[i].HTechParamID
                                        "HTechParamID": result.data[i].HTechParamID
                                        , "HTechParamNumber": result.data[i].HTechParamNumber
                                        , "HTechParamName": result.data[i].HTechParamName
                                        , 'HTechParamUnitID': result.data[i].HTechParamUnitID
@@ -589,6 +628,7 @@
                                        , 'HMax': result.data[i].HMax
                                        , 'HMin': result.data[i].HMin
                                        , 'HResult': result.data[i].HResult
                                        , 'HIsRequired': result.data[i].HIsRequired
                                        , 'HRemark': result.data[i].HRemark
                                    }
                                )
@@ -636,14 +676,15 @@
                        , { field: 'HTechParamIDStd', title: 'HTechParamIDStd', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HTechParamIDStdName', title: '设备设定值工艺参数', hide: true, width: 130, edit: 'text', event: "HTechParamIDStdName" }
                        , { field: 'HResultStd', title: '设备设定值', hide: true, width: 130, edit: 'text' }
                        , { field: 'HVaule', title: '工艺参数值', width: 100, edit: false, event: "HVaule"  }
                        , { field: 'HVaule', title: '工艺参数值', width: 100, edit: false, event: "HVaule" }
                        , { field: 'HStd', title: '标准值', width: 100, edit: 'text' }
                        , { field: 'HMax', title: '上限', width: 100, edit: 'text' }
                        , { field: 'HMin', title: '下限', width: 100, edit: 'text' }
                        , { field: 'HResult', title: '检测结果', width: 100, templet: "#HResult" }
                        , { field: 'HIsRequired', title: '是否必录', width: 100, templet: "#HIsRequired" }
                        , { field: 'HRemark', title: '备注', width: 100, edit: 'text' }
                       // , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 70 }
                    ]]
                        // , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 70 }
                    ]]
                }
                var rowdata = [{
@@ -653,18 +694,19 @@
                    , "HTechParamID": "0"
                    , "HTechParamNumber": ""
                    , "HTechParamName": ""
                    ,"HSNO":"0"
                    , "HSNO": "0"
                    , "HTechParamUnitID": "0"
                    , "HTechParamUnitNumber": ""
                    , "HTechParamUnitName": ""
                    , "HTechParamIDStd": "0"
                    , "HTechParamIDStdName": ""
                    ,"HResultStd":""
                    , "HResultStd": ""
                    , "HVaule": ""
                    , "HStd": ""
                    , "HMax": ""
                    , "HMin": ""
                    , "HResult": "OK"
                    , "HIsRequired": false
                    , "HRemark": ""
                }];
@@ -729,7 +771,7 @@
                    , shift: 2                  //弹出动画
                    , area: ["90%", "90%"]      //窗体大小
                    , maxmin: true              //设置最大最小按钮是否显示
                    , content: ['../../基础资料/生产基础资料/Gy_Process.html', 'yes']
                    , content: ['../../基础资料/生产基础资料/Gy_Process.html?openType=2', 'yes']
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //按钮一  çš„回调
@@ -787,7 +829,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, laero) {
                        //按钮一  çš„回调
@@ -845,7 +887,7 @@
                    , shift: 2                  //弹出动画
                    , area: ["90%", "90%"]      //窗体大小
                    , maxmin: true              //设置最大最小按钮是否显示
                    , content: ['../../基础资料/公用基础资料/Gy_DepartmentList.html', 'yes']
                    , content: ['../../基础资料/公用基础资料/Gy_DepartmentList.html?openType=2&HOrgName=' + sessionStorage["Organization"], 'yes']
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //按钮一  çš„回调
@@ -874,7 +916,7 @@
                    , shift: 2                  //弹出动画
                    , area: ["90%", "90%"]      //窗体大小
                    , maxmin: true              //设置最大最小按钮是否显示
                    , content: ['../../设备管理/设备档案/Gy_EquipFileMainList.html', 'yes']
                    , content: ['../../设备管理/设备档案/Gy_EquipFileMainList.html?openType=2', 'yes']
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //按钮一  çš„回调
@@ -990,6 +1032,7 @@
                    , "HMax": ""
                    , "HMin": ""
                    , "HResult": "OK"
                    , "HIsRequired": false
                    , "HRemark": ""
                };
@@ -1321,7 +1364,7 @@
                //        item.HResult = hResult; // æ›´æ–°æ£€æµ‹ç»“æžœ
                //    }
                //    return item;
                //});
                //});
                //layui.table.reload('mainTable', {
                //    data: updatedData
                //});
@@ -1443,13 +1486,29 @@
                });
            });
            //是否 å¿…录控制
            form.on('checkbox(HIsRequired)', function (data) {
                //获取下拉框选中的值
                var elem = data.othis.parents('tr');
                var dataindex = elem.attr("data-index");
                $.each(option.data, function (index, value) {
                    if (value.LAY_TABLE_INDEX == dataindex) {
                        value.HIsRequired = data.elem.checked;//把选中下拉框id值赋值给表格缓存
                    }
                });
            });
            //行数据 ä¸‹æ‹‰å¤é€‰æ¡†  åˆ·æ–°è¡¨æ ¼
            function checkRefresh() {
                for (var i = 1; i <= option.data.length; i++) {
                    //状态
                    $('#HResult' + i + '').find("option[value='" + option.data[i - 1].HResult + "']").prop("selected", true);
                    if (option.data[i - 1].HIsRequired) {
                        $('#HIsRequired' + i + '').attr("checked", true);
                    }
                }
                form.render('select');
                form.render('select');
                form.render('checkbox');
            }
            //#endregion
@@ -1520,7 +1579,7 @@
                                        "HTechParamName": result.data[i]["工艺参数名称"],
                                        "HTechParamUnitID": result.data[i]["HTechParamUnitID"] == null ? 0 : result.data[i]["HTechParamUnitID"],
                                        "HTechParamUnitNumber": result.data[i]["工艺参数单位代码"],
                                        "HTechParamUnitName": result.data[i]["工艺参数单位名称"] ,
                                        "HTechParamUnitName": result.data[i]["工艺参数单位名称"],
                                        "HSNO": result.data[i]["工艺次序"] == null ? 0 : result.data[i]["工艺次序"],
                                        "HTechParamIDStd": result.data[i]["HTechParamIDStd"] == null ? 0 : result.data[i]["HTechParamIDStd"],
                                        "HTechParamIDStdName": result.data[i]["对应设定值工艺参数"],
@@ -1530,7 +1589,8 @@
                                        "HMax": result.data[i]["上限值"],
                                        "HMin": result.data[i]["下限值"],
                                        "HRemark": result.data[i]["采集来源"],
                                        "HResult": hResult
                                        "HResult": hResult,
                                        "HIsRequired": result.data[i]["HIsRequired"]
                                    }
                                );
                            }
@@ -1549,7 +1609,7 @@
                })
            }
            //#endregion
            //#region åŠŸèƒ½æŽ§ä»¶
            //#region æäº¤
@@ -1593,6 +1653,12 @@
                        if (data.count == 1) {
                            layer.msg(data.Message, { icon: 1 });
                            $('#btn_Save').addClass("layui-btn-disabled").attr("disabled", true);
                            if (data.Verify == "Y") //自动审核
                            {
                                $("#HInterID").val(data.HInterID);//获取提交成功返回的单据主ID
                                set_CheckBill(1); //审核
                            }
                            layer.close(index);
                            layer.close(index);
                        }
                        else {
@@ -1609,6 +1675,34 @@
            }
            //#endregion
            //#endregion
            //#region  å®¡æ ¸ï¼ˆnum=1)/反审核(num=2)
            function set_CheckBill(num) {
                $.ajax({
                    type: "GET",
                    url: GetWEBURL() + "/SB_EquipICMOTechParamBillController/GetSB_EquipICMOTechParamBill_Check_Json",
                    async: false,    //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
                    data: { "HInterID": HInterID, "Type": num, "HMaker": HMaker },
                    success: function (result) {
                        if (result.count == 1) {
                            layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
                                // å¾—到frame索引
                                var index = layer.getFrameIndex(window.name);
                                //关闭当前frame
                                layer.close(index);
                                //修改为功后刷新界面
                                $("#btnSearch").trigger('click');
                            });
                        } else {
                            layer.msg(result.Message, { icon: 2, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        }
                    }, error: function () {
                        layer.msg('错误' + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    }
                });
            }
            //#endregion
            //#region é€€å‡º
@@ -1728,7 +1822,7 @@
                    }
                });
            }
            //#endregion
            //#endregion
        });
@@ -1815,8 +1909,12 @@
                        layer.msg("明细记录第" + (i + 1) + "行,工艺参数代码/名称不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        return Result = false;
                    }
                    if (sSubStr[i].HRemark == "手动输入" && (sSubStr[i].HVaule == "" || sSubStr[i].HVaule == null)) {
                        layer.msg("明细记录第" + (i + 1) + "行,手术输入的工艺参数值不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    //if (sSubStr[i].HRemark == "手动输入" && (sSubStr[i].HVaule == "" || sSubStr[i].HVaule == null)) {
                    //    layer.msg("明细记录第" + (i + 1) + "行,手术输入的工艺参数值不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    //    return Result = false;
                    //}
                    if (sSubStr[i].HIsRequired == "true" && (sSubStr[i].HVaule == "" || sSubStr[i].HVaule == null)) {
                        layer.msg("明细记录第" + (i + 1) + "行,工艺参数值不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        return Result = false;
                    }
                }
@@ -1891,7 +1989,7 @@
                });
            })
        }
        //#endregion
            //#endregion
    </script>
</body>
</html>