1
cwjbxqmz
2024-01-26 b742f00aac8e1e1bb628232383c35e67f4a41e4e
WebTM/views/Éú²ú¹¤Ðò¹ÜÀí/Ôö¼Ó²»Á¼ÆÀÉóµ¥/QC_NoPassProdCheckBillList.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>不合格评审列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@@ -9,7 +9,12 @@
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/Scripts/json2.js"></script>
    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
    <script src="../../../layuiadmin/PubCustom.js"></script>
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <script src="../../../layuiadmin/soulTable.slim.js"></script>
</head>
<body>
    <div class="layui-fluid">
@@ -27,49 +32,86 @@
                                <div class="layui-inline">
                                    <label class="layui-form-label">开始日期</label>
                                    <div class="layui-input-block">
                                        <input type="date" class="layui-input" id="HDate">
                                        <input type="date" class="layui-input" id="HBeginDate" style="width:190px;">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">结束日期</label>
                                    <div class="layui-input-block">
                                        <input type="date" class="layui-input" id="HDate1">
                                        <input type="date" class="layui-input" id="HEndDate" style="width:190px;">
                                    </div>
                                </div>
                                <!--<div class="layui-inline">
                                    <label class="layui-form-label">订单跟踪号</label>
                                <div class="layui-inline">
                                    <label class="layui-form-label">单据号</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" name="HOrderProcNO" id="HOrderProcNO">
                                        <input type="text" class="layui-input" name="HBillNo" id="HBillNo" style="width:190px;">
                                    </div>
                                </div>-->
                                </div>
                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearch" id="btnSearch">
                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                </button>
                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnReSearch" id="btnReSearch" style="padding:0 5px">重置</button>
                                <!--<div class="layui-colla-content">
                                <div class="layui-colla-content">
                                    <div class="layui-inline">
                                        <div class="layui-inline">
                                            <span>其他条件></span>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">单据号</label>
                                        <label class="layui-form-label">部门</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="WorkCenter" id="WorkCenter">
                                            <input type="text" class="layui-input" name="HDeptID" id="HDeptID" style="width:190px;">
                                        </div>
                                    </div>
                                </div>-->
                                    <div class="layui-inline">
                                        <label class="layui-form-label">物料代码</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="MaterialCode" id="MaterialCode" style="width:190px;">
                                        </div>
                                    </div>
                                    <!--<hr />-->
                                    <div class="layui-inline">
                                        <label class="layui-form-label">物料名称</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="MaterialName" id="MaterialName" style="width:190px;">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">规格型号</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="SpecificationModel" id="SpecificationModel" style="width:190px;">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">源单单号</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="HSourceBillNo" id="HSourceBillNo" style="width:190px;">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">仓库</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="Warehouse" id="Warehouse" style="width:190px;">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">制单人</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="Hmaker" id="Hmaker" style="width:190px;">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <table class="" id="mainTable" lay-filter="mainTable"></table>
                        <script type="text/html" id="toolbarDemo">
                            <div class="layui-btn-container">
                                <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-getCheckData"><i class="layui-icon layui-icon-tips"></i>预览</button>-->
                                <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-reload"><i class="layui-icon layui-icon-refresh"></i>刷新</button>-->
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Add"><i class="layui-icon layui-icon-form"></i>添加</button>
                                <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon">&#xe608;</i>添加</button>-->
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Edit"><i class="layui-icon layui-icon-form"></i>编辑</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Delete"><i class="layui-icon layui-icon-delete"></i>删除</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Audit"><i class="layui-icon layui-icon-radio"></i>审核</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-DeAudit"><i class="layui-icon layui-icon-circle"></i>反审核</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="set_CloseBill" id="set_CloseBill"><i class="layui-icon layui-icon-form"></i>关闭</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="set_CancelCloseBill" id="set_CancelCloseBill"><i class="layui-icon layui-icon-form"></i>反关闭</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-view"><i class="layui-icon layui-icon-tips"></i>预览</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-print"><i class="layui-icon layui-icon-print"></i>打印</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn"><i class="layui-icon layui-icon-form"></i>列设置</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-exit"><i class="layui-icon layui-icon-return"></i>退出</button>
                            </div>
                        </script>
                    </form>
@@ -78,72 +120,528 @@
        </div>
    </div>
    <script type="text/html" id="barDemo">
    <!--<script type="text/html" id="barDemo">
  <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/Scripts/json2.js"></script>
    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
</script>-->
    <script>
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index', //主入口模块
        }).use(['index', 'form', 'table', 'element', 'laypage','laydate'], function () {
        }).use(['index', 'form', 'table', 'element', 'laypage', 'laydate','soulTable'], function () {
             //#region å…¬å…±å˜é‡
            var $ = layui.$
            , admin = layui.admin
            , layer = layui.layer
            , table = layui.table
            , form = layui.form
            , element = layui.element
            , laypage = layui.laypage
            , laydate = layui.laydate
                , admin = layui.admin
                , layer = layui.layer
                , table = layui.table
                , form = layui.form
                , element = layui.element
                , laypage = layui.laypage
                , laydate = layui.laydate
                , soulTable = layui.soulTable
            //var sWhere = " äº§å“ä»£ç  = 'BX0002'";
            var sWhere = "";
            var option = [];
            var option = {
                elem: '#mainTable'
                , toolbar: '#toolbarDemo'
                ,height: 'full-50'
                , page: true
                ,cellMinWidth: 90
                , cols: [[
                    //{ type: 'checkbox' }
                      { field: 'hmainid', title: 'hmainid', sort: true, fixed: true, hide: true }
                    , { field: '日期', title: '日期', sort: true, width: 120 }
                    , { field: '单据号', title: '单据号', sort: true, width: 170 }
                    , { field: '表头备注', title: '表头备注' }
                    , { field: '生产资源名称 ', title: '生产资源名称 ', width: 115 }
                    , { field: '生产资源代码', title: '生产资源代码' }
                    , { field: '物料内码', title: '物料内码', width: 100 }
                    , { field: '物料名称', title: '物料名称' }
                    , { field: '检验员代码', title: '检验员代码' }
                    , { field: '检验员名称', title: '检验员名称' }
                    , { field: '单位代码', title: '单位代码' }
                    , { field: '单位名称', title: '单位名称' }
                    , { field: '不良原因代码 ', title: '不良原因代码' }
                    , { field: '不良原因', title: '不良原因' }
                    , { field: '制单人', title: '制单人' }
                    , { field: '制单日期', title: '制单日期' }
                    , { field: '审核人', title: '审核人' }
                    , { field: '审核日期', title: '审核日期' }
                    , { field: '修改人', title: '修改人' }
                    , { field: '修改日期', title: '修改日期' }
                    , { field: '关闭人', title: '关闭人' }
                    , { field: '关闭日期', title: '关闭日期' }
                    , { field: '作废人', title: '作废人' }
                    , { field: '作废日期', title: '作废日期' }
                    , { field: '单据类型', title: '单据类型' }
                    , { field: 'hsubid', title: 'hsubid', fixed: true, hide: true }
              //#endregion
                     //,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
                ]]
            };
            //#region è¿›å…¥é¡µé¢åŠ è½½
            var HModName = "QC_NoPassProdCheckBillList";
             //#region åˆå§‹åŒ–界面
            set_ClearBill();
              //#endregion
             //#region è§¦å‘事件:包括form.on(){}格式的所有点击事件、选择事件等
            //头工具栏事件
            table.on('toolbar(mainTable)', function (obj) {
                var checkStatus = table.checkStatus(obj.config.id);
                switch (obj.event) {
                    case 'btn-Add':
                        layer.open({
                            type: 2 //Page层类型
                            , area: ['100%', '100%']
                            , title: '新增派工单'
                            , shade: 0.6 //遮罩透明度
                            , maxmin: false //允许全屏最小化
                            , anim: 0 //0-6的动画形式,-1不开启
                            , content: ['../增加不良评审单/QC_Add_NoPassProdCheckBill.html', 'yes']
                            , resize: false
                            , cancel: function () {
                                //$(".layui-btn").removeClass("layui-btn-disabled");
                            }
                        });
                        break;
                    //删除
                    case 'btn-Delete':
                        set_DeleteBill();
                        break;
                    //审核
                    case 'btn-Audit': set_AuditBill();
                        break;
                    //反审核
                    case 'btn-DeAudit': set_DeAuditBill();
                        break;
                    //关闭
                    case 'set_CloseBill': set_CloseBill(1);
                        break;
                    //反关闭
                    case 'set_CancelCloseBill': set_CloseBill(2);
                        break;
                    //列设置
                    case 'set_HideColumn': get_HideColumn();
                        break;
                };
            });
            //重置按钮
            form.on('submit(btnReSearch)', function (data) {
                //清空过滤条件
                set_ClearQuery();
            });
            //查询按钮
            form.on('submit(btnSearch)', function (data) {//选择仓位
                get_FastQuery();
            });
              //#endregion
             //#region æ­¤é¡µé¢æ‰€æœ‰çš„æ–¹æ³•
            // åˆå§‹åŒ–界面
            function set_ClearBill() {
                //初始化表格
                set_InitGrid();
                //查询
                get_Display(sWhere);
                //初始化日期
                $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd"));
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
            }
            //表格数据
            function set_InitGrid() {
                option = {
                    elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , height: 'full-50'
                    , page: true
                    , cellMinWidth: 90
                    , limit: 50
                    , limits: [50, 500, 5000, 20000]
                    , done: function (res, curr, count) {
                        soulTable.render(this);
                    }
                    , cols: [[
                        { type: 'checkbox' }
                        , { field: 'hmainid', title: 'hmainid', sort: true, fixed: true, hide: true }
                        , { field: '日期', title: '日期', sort: true, width: 120, templet: "<div>{{d.日期 ==null ?'':layui.util.toDateString(d.日期, 'yyyy-MM-dd')}}</div>" }
                        , { field: '单据号', title: '单据号', sort: true, width: 170 }
                        , { field: '表头备注', title: '表头备注', sort: true }
                        , { field: '生产资源名称 ', title: '生产资源名称 ', width: 115, sort: true }
                        , { field: '生产资源代码', title: '生产资源代码', sort: true }
                        , { field: '物料内码', title: '物料内码', width: 100, sort: true }
                        , { field: '物料名称', title: '物料名称', sort: true }
                        , { field: '源单单号', title: '源单单号', sort: true }
                        , { field: '规格型号', title: '规格型号', sort: true }
                        , { field: '检验员代码', title: '检验员代码', sort: true }
                        , { field: '检验员名称', title: '检验员名称', sort: true }
                        , { field: '单位代码', title: '单位代码', sort: true }
                        , { field: '单位名称', title: '单位名称', sort: true }
                        , { field: '不良原因代码 ', title: '不良原因代码', sort: true }
                        , { field: '不良原因', title: '不良原因', sort: true }
                        , { field: '制单人', title: '制单人', sort: true }
                        , { field: '制单日期', title: '制单日期', width: 120, templet: "<div>{{d.制单日期 ==null ?'':layui.util.toDateString(d.制单日期, 'yyyy-MM-dd')}}</div>", sort: true }
                        , { field: '审核人', title: '审核人', sort: true }
                        , { field: '审核日期', title: '审核日期', sort: true }
                        , { field: '修改人', title: '修改人', sort: true }
                        , { field: '修改日期', title: '修改日期', width: 120, templet: "<div>{{d.修改日期 ==null ?'':layui.util.toDateString(d.修改日期, 'yyyy-MM-dd')}}</div>", sort: true }
                        , { field: '关闭人', title: '关闭人', sort: true }
                        , { field: '关闭日期', title: '关闭日期', sort: true }
                        , { field: '作废人', title: '作废人', sort: true }
                        , { field: '作废日期', title: '作废日期', sort: true }
                        , { field: '单据类型', title: '单据类型', sort: true }
                        , { field: 'hsubid', title: 'hsubid', fixed: true, hide: true, sort: true }
                        //,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
                    ]]
                };
            }
            //进入页面显示的缓存列表
            function get_Display(sWhere) {
                var index0 = layer.load(0, { shade: false });
                $.ajax({
                    //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
                    url: GetWEBURL() + '/Sc_ProcessMangement/MES_QC_NoPassProdCheckBill_Json',
                    type: "GET",
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                    success: function (data1) {
                        if (data1.count == 1) {
                            option.data = data1.data;
                            table.render(option);
                            layer.close(index0);
                        } else {
                            layer.close(index0);
                            layer.msg(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(index0);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
                DisPlay_HideColumn();
            }
            //隐藏列设置
            function get_HideColumn() {
                var colName = "";
                for (var i = 1; i < option.cols[0].length - 1; i++) {
                    colName += option.cols[0][i]["title"] + ",";
                }
                colName = encodeURI(colName.substring(0, colName.length - 1));//对 URI è¿›è¡Œç¼–码
                layer.open({
                    type: 2
                    , skin: "layui-layer-rim" //加上边框
                    , title: "隐藏列设置"  //标题
                    , closeBtn: 1  //窗体右上角关闭 çš„ æ ·å¼
                    , shift: 2 //弹出动画
                    , area: ["50%", "90%"] //窗体大小
                    , maxmin: true //设置最大最小按钮是否显示
                    , content: ['../../基础资料/隐藏列设置/Gy_GridView_Hide.html?HModName=' + HModName + '&colName=' + colName, "yes"]
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //刷新表格数据
                        DisPlay_HideColumn();
                        //更新表格缓存的数据
                        layer.close(index);//关闭弹窗
                    }
                })
            }
            //显示列数据
            function DisPlay_HideColumn() {
                $.ajax({
                    url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
                    type: "GET",
                    data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
                    success: function (data1) {
                        if (data1.data.length != 0) {
                            var dataCol = [];//数据库查询出的列数据
                            var titleData = ["HMaterID", "HUnitID", "HICMOEmpID"];//不需要显示的字段 å¯æ‰©å±•
                            dataCol = data1.data[0].HGridString.split(',');
                            for (var i = 0; i < option.cols[0].length - 2; i++) {
                                var dataCols = dataCol[i].split('|');
                                //隐藏列
                                if (dataCols[1] == 1) {
                                    option.cols[0][i + 1]["hide"] = true;
                                }
                                //设置列宽
                                if (dataCols[3] > 0) {
                                    option.cols[0][i + 1]["width"] = dataCols[3];
                                }
                                //设置内容字体大小
                                if (data1.data[0].HFontSize != 0) {
                                    option.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;";
                                } else {
                                    option.cols[0][i + 1]["style"] = "font-size:100%";
                                }
                                //设置列宽
                                //if (data1.data[0].HColumnWidth != 0) {
                                //    option.cols[0][i + 1]["width"] = data1.data[0].HColumnWidth + "px;";
                                //} else {
                                //    option.cols[0][i + 1]["width"] = "";
                                //}
                                //显示列
                                if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
                                    option.cols[0][i + 1]["hide"] = false;
                                }
                                //字体所在位置(å·¦ å±…中 å³)
                                switch (dataCols[2]) {
                                    case "L":
                                        option.cols[0][i + 1]["align"] = "left";
                                        break;
                                    case "M":
                                        option.cols[0][i + 1]["align"] = "center";
                                        break;
                                    case "R":
                                        option.cols[0][i + 1]["align"] = "right";
                                        break;
                                }
                            }
                            //取消冻结列
                            for (var i = 1; i < option.cols[0].length - 1; i++) {
                                if (option.cols[0][i]["fixed"] != null) {
                                    option.cols[0][i]["fixed"] = null;
                                }
                                else {
                                    break;
                                }
                            }
                            //冻结列
                            if (data1.data[0].HFixCols != 0) {
                                for (var i = 0; i < data1.data[0].HFixCols; i++) {
                                    if ($.inArray(option.cols[0][i + 1]["title"], titleData) != -1) {
                                        data1.data[0].HFixCols += 1;
                                    }
                                    option.cols[0][i + 1]["fixed"] = "left";
                                }
                            }
                            table.render(option);
                        } else {
                            table.render(option);
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
            }
            // å¿«é€Ÿè¿‡æ»¤
            function get_FastQuery() {
                var HDate = $("#HBeginDate").val();//开始日期
                var HDate1 = $("#HEndDate").val();//结束日期
                var HBillNo = $("#HBillNo").val();//单据号
                var HDeptID = $("#HDeptID").val();//部门
                var MaterialCode = $("#MaterialCode").val();//物料代码
                var MaterialName = $("#MaterialName").val();//物料名称
                var SpecificationModel = $("#SpecificationModel").val();//规格型号
                var HSourceBillNo = $("#HSourceBillNo").val();//源单单号
                var Warehouse = $("#Warehouse").val();//仓库
                var Hmaker = $("#Hmaker").val();//制单人
                if (HDate) {
                    sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + HDate + "'";
                }
                if (HDate1) {
                    sWhere += " and CONVERT(varchar(100),日期, 23) <= '" + HDate1 + "'";
                }
                if (HBillNo) {
                    sWhere += " and å•据号 like '%" + HBillNo + "%'";
                }
                if (HDeptID) {
                    sWhere += " and éƒ¨é—¨ like '%" + HDeptID + "%'";
                }
                if (MaterialCode) {
                    sWhere += " and ç‰©æ–™ä»£ç  like '%" + MaterialCode + "%'";
                }
                if (MaterialName) {
                    sWhere += " and ç‰©æ–™åç§° like '%" + MaterialName + "%'";
                }
                if (SpecificationModel) {
                    sWhere += " and è§„格型号 like '%" + SpecificationModel + "%'";
                }
                if (HSourceBillNo) {
                    sWhere += " and æºå•单号 like '%" + HSourceBillNo + "%'";
                }
                if (Warehouse) {
                    sWhere += " and å‘货仓库 like '%" + Warehouse + "%'";
                }
                if (Hmaker) {
                    sWhere += " and åˆ¶å•人 like '%" + Hmaker + "%'";
                }
                get_Display(sWhere);
                sWhere = "";//调用接口后清空sWhere缓存
            }
            // é‡ç½®è¿‡æ»¤æ¡ä»¶
            function set_ClearQuery() {
                $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd"));
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
                $("#HBillNo").val("");//单据号
                $("#HDeptID").val("");//部门
                $("#MaterialCode").val("");//物料代码
                $("#MaterialName").val("");//物料名称
                $("#SpecificationModel").val("");//规格型号
                $("#HSourceBillNo").val("");//源单单号
                $("#Warehouse").val("");//仓库
                $("#Hmaker").val("");//制单人
                sWhere = "";
            }
            //删除
            function set_DeleteBill() {
                var checkStatus = table.checkStatus("mainTable");
                //判断是否选中数据
                if (checkStatus.data.length != 1) {
                    return layer.msg("请选择一条数据");
                }
                layer.confirm('您确定要删除吗?', {
                    btn: ['确定', '取消'] //按钮
                    , btn1: function () {
                        var HInterID = checkStatus.data[0].hmainid;
                        $.ajax({
                            url: GetWEBURL() + '/Sc_ProcessMangement/ProcessMangementDeleteBill'
                            , type: "GET"
                            , data: { "HInterID": HInterID, "user": sessionStorage["HUserName"] }
                            , 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);
                                        //修改为功后刷新界面
                                        window.location.reload();
                                        ////重载tree
                                        //tree.reload('treeDepartment', {});
                                    });
                                } else {
                                    layer.alert(result.code + result.Message, { icon: 5 });
                                }
                            }
                        })
                    }
                })
            }
            //审核
            function set_AuditBill() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var InterID = data[0].hmainid.toString();
                    var HBillStatus = data[0].HBillStatus.toString();
                    if (HBillStatus == 1) {
                        layer.mes("单据已审核,不能再次审核!");
                        return false;
                    }
                    //逻辑审核方法
                    $.ajax({
                        type: "GET",
                        url: GetWEBURL() + "/Sc_ProcessMangement/AuditProcessMangement", //方法所在页面和方法名
                        data: { "HInterID": InterID, "IsAudit": 1, "CurUserName": sessionStorage["HUserName"] },
                        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);
                                    //修改为功后刷新界面
                                    window.location.reload();
                                });
                            } else {
                                layer.alert(result.code + result.Message, { icon: 5 });
                            }
                        }, error: function () {
                            layer.alert("接口请求失败!", { icon: 5 });
                        }
                    });
                }
                else {
                    layer.msg('请选择一行数据审核!');
                }
            }
            //反审核
            function set_DeAuditBill() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var InterID = data[0].hmainid.toString();
                    var HBillStatus = data[0].HBillStatus.toString();
                    if (HBillStatus == 0) {
                        layer.msg("单据未审核,不能反审核!");
                        return false;
                    }
                    //逻辑审核方法
                    $.ajax({
                        type: "GET",
                        url: GetWEBURL() + "/Sc_ProcessMangement/AuditProcessMangement", //方法所在页面和方法名
                        data: { "HInterID": InterID, "IsAudit": 2, "CurUserName": sessionStorage["HUserName"] },
                        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);
                                    //修改为功后刷新界面
                                    window.location.reload();
                                });
                            } else {
                                layer.alert(result.code + result.Message, { icon: 5 });
                            }
                        }, error: function () {
                            layer.alert("接口请求失败!", { icon: 5 });
                        }
                    });
                }
                else {
                    layer.msg('请选择一行数据反审核!');
                }
            }
            //关闭  [1 å…³é—­ã€2 åå…³é—­]
            function set_CloseBill(num) {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (data.length == 1) {
                    layer.confirm("确认要关闭吗?", function (index) {
                        var wait = layer.load();
                        var HInterID = data[0].hmainid;
                        $.ajax({
                            url: GetWEBURL() + '/Sc_ProcessMangement/CloseSc_ProcessMangement',
                            type: "GET",
                            data: { "HInterID": HInterID, "Type": num, "user": sessionStorage["HUserName"] },
                            success: function (result) {
                                if (result.count == 1) {
                                    layer.msg(result.Message, { icon: 1 });
                                    layer.close(wait);
                                } else {
                                    layer.alert(result.code + result.Message, { icon: 5 });
                                    layer.close(wait);
                                }
                            }, error: function () {
                                layer.alert("接口请求失败!", { icon: 5 });
                                layer.close(wait);
                            }
                        });
                    })
                }
                else {
                    layer.msg("请选择一条数据!");
                }
            }
              //#endregion
            //以上是layui模块
        });
//监听行工具事件
  //table.on('tool(mainTable)', function(obj){
  //  var data = obj.data;
@@ -166,154 +664,6 @@
  //      //layer.alert('我是编辑上');
  //  }
  //});
            //头工具栏事件
            table.on('toolbar(mainTable)', function (obj) {
                var checkStatus = table.checkStatus(obj.config.id);
                switch (obj.event) {
                    case 'btn-Pushdown':
    //                    var checkStatus = table.checkStatus('mainTable')
    //                    , data = checkStatus.data;
    //                    ajaxLabelData = data;
    //                    var rows = '';
    //                    var HEntry = '';
    //                      for (var i = 0; i < data.length; i++) {
    //                            rows += data[i].hmainid.toString() + ',' ;
    //                    }
    //                    if (checkStatus.data.length < 1)
    //                    {
    //                        layer.msg('请选择一行数据下推');
    //                    } else
    //                    {
            ////页面层
            //layer.open({
            //               type: 2 //Page层类型
            //               ,area: ['100%', '100%']
            //               ,title: '新增派工单'
            //               ,shade: 0.6 //遮罩透明度
            //               ,maxmin: false //允许全屏最小化
    //                , anim: 0 //0-6的动画形式,-1不开启
    //                , content: ['../工序派工单/Sc_Add_ProcessSendWork.html?HInterID=' + data[0].hmainid.toString() + '&lentryid=' + rows.toString().substring(0, rows.length - 1), '&PlanBeginDate=' + data[0].计划开工日期.toString(), '&PlanEndDate=' + data[0].计划完工日期.toString(), 'yes']
    //                           , resize: false
    //                         , cancel: function () {
    //                            //$(".layui-btn").removeClass("layui-btn-disabled");
    //                        }
            //           });
    //                    }
                          layer.msg('哇咔咔!!!!!!');
                        break;
                    case 'btn-Add':
                        layer.open({
                           type: 2 //Page层类型
                           ,area: ['100%', '100%']
                           ,title: '新增派工单'
                           ,shade: 0.6 //遮罩透明度
                           ,maxmin: false //允许全屏最小化
                    , anim: 0 //0-6的动画形式,-1不开启
                    , content: ['../增加不良评审单/QC_Add_NoPassProdCheckBill.html' , 'yes']
                               , resize: false
                             , cancel: function () {
                                //$(".layui-btn").removeClass("layui-btn-disabled");
                            }
                       });
                        break;
                    case '':
                        layer.msg('');
                        break;
                };
            });
            //进入页面显示的缓存列表
            var index0 = layer.load(0, { shade: false });
            $.ajax({
                //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
                url: GetWEBURL() + '/Sc_ProcessMangement/MES_QC_NoPassProdCheckBill_Json',
                type: "GET",
                data: { "sWhere": sWhere },
                success: function (data1) {
                    if (data1.count == 1) {
                        option.data = data1.data;
                        table.render(option);
                        layer.close(index0);
                    } else {
                        layer.close(index0);
                        layer.alert(data1.code + data1.Message, { icon: 5 });
                    }
                }, error: function () {
                    layer.close(index0);
                    layer.alert("接口请求失败!", { icon: 5 });
                }
            });
            //重置按钮
            form.on('submit(btnReSearch)', function (data) {
                $("#HDate").val("");//开始日期
                $("#HDate1").val("");//结束日期
                //$("#HOrderProcNO").val("");//订单跟踪号
                //$("#WorkCenter").val("");//单据号
                $("#btnSearch").click();
            });
            //查询按钮
            form.on('submit(btnSearch)', function (data) {//选择仓位
                var HDate = $("#HDate").val();//开始日期
                var HDate1 = $("#HDate1").val();//结束日期
                //var HOrderProcNO = $("#HOrderProcNO").val();//订单跟踪号
                //var WorkCenter = $("#WorkCenter").val();//单据号
                if (HDate) {
                    sWhere += " and æ—¥æœŸ >= '" + HDate + "'";
                }
                if (HDate1) {
                    sWhere += " and æ—¥æœŸ <= '" + HDate1 + "'";
                }
                //if (HOrderProcNO) {
                //    sWhere += " and è®¢å•跟踪号 like '%" + HOrderProcNO + "%'";
                //}
                //if (WorkCenter) {
                //    sWhere += " and HBillNo like '%" + WorkCenter + "%'";
                //}
                var index = layer.load(0, { shade: false });
                $.ajax({
                    url: GetWEBURL() + '/Sc_ProcessMangement/MES_QC_NoPassProdCheckBill_Json',
                    type: "GET",
                    data: { "sWhere": sWhere },
                    success: function (data1) {
                        if (data1.count == 1) {
                            option.data = data1.data;
                            table.render(option);
                            layer.close(index);
                            layer.alert("查询成功", { icon: 1 });
                        } else {
                            layer.close(index);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(index);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
                sWhere = "";//调用接口后清空sWhere缓存
            });
            //laydate.render({
            //    elem: '#HDate'
            //    , type: 'datetime'
            //    , trigger: 'click'
            //    , format:'yyyy-MM-dd HH:mm'
            //});
            //以上是layui模块
        });
    </script>