WebTM/views/³µ¼ä¹ÜÀí/²úÏß/MES_ProductionLinePackagingList.html
@@ -8,8 +8,13 @@
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <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/grwebapp.js"></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 src="../../../layuiadmin/MESLanguage.js"></script>
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <style>
        .layui-form-select .layui-input {
            padding-right: 0px;
@@ -26,29 +31,36 @@
                            <div class="layui-colla-item">
                                <div class="layui-colla-title layui-inline">
                                    <div class="layui-inline">
                                        <span>更多</span>
                                        <span id="BT_GD">更多</span>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">唯一条码</label>
                                    <label class="layui-form-label" id="BT_HBarCode_Pack">唯一条码</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" name="HBarCode_Pack" id="HBarCode_Pack">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">单据号</label>
                                    <label class="layui-form-label" id="BT_HBillNo">单据号</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" name="单据号" id="单据号">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">条码类型</label>
                                    <label class="layui-form-label" id="BT_HBardcodeType">条码类型</label>
                                    <div class="layui-input-block">
                                        <!--<input type="text" class="layui-input" name="tmlx" id="tmlx">-->
                                        <select name=" tmlx" id="tmlx">
                                            <option value="">全部</option>
                                            <option value="流转卡号">流转卡号</option>
                                            <option value="镭雕条码">镭雕条码</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label" style="width: 85px;" id="BT_HOrgName">组织名称</label>
                                    <div class="layui-input-block" style="margin-left: 120px; width: 185px;">
                                        <select name="HOrgID" id="HOrgID" lay-verify="HOrgID" class="ForFilteringSchemes">
                                            <!--动态渲染组织-->
                                        </select>
                                    </div>
                                </div>
@@ -58,53 +70,51 @@
                                <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-inline">
                                    <div class="layui-row" style="margin-top: 5px; margin-left: 4%;">
                                        <div class="layui-inline">
                                            <span>其他条件></span>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">生产任务单</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="HBillNo" id="HBillNo">
                                        </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">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">条码</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="HICMOBillNo" id="HICMOBillNo">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">日期间隔</label>
                                        <div class="layui-input-block">
                                            <select name="HInitTimeCycle" id="HInitTimeCycle" class="ForFilteringSchemes" lay-filter="HInitTimeCycle" style="width:190px;">
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-row" style="padding: 10px 0; margin-left: 4%;">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">日期</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="date" class="layui-input" lay-verify="HBeginDate" name="HBeginDate" id="HBeginDate" style="padding-left: 75px;">
                                            <label class="layui-form-label" id="BT_HBillNo">生产任务单</label>
                                            <div class="layui-input-block">
                                                <input type="text" class="layui-input" name="HBillNo" id="HBillNo">
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label">-</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="date" class="layui-input" lay-verify="HEndDate" name="HEndDate" id="HEndDate" style="padding-left: 75px;">
                                            <label class="layui-form-label" id="BT_HMaker">制单人</label>
                                            <div class="layui-input-block">
                                                <input type="text" class="layui-input" name="HMaker" id="HMaker">
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" id="BT_HICMOBillNo">条码</label>
                                            <div class="layui-input-block">
                                                <input type="text" class="layui-input" name="HICMOBillNo" id="HICMOBillNo">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row" style="margin-top: 5px; margin-left: 4%;">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">过滤</label>
                                            <label class="layui-form-label" id="BT_HInitTimeCycle">日期间隔</label>
                                            <div class="layui-input-block">
                                                <select name="HInitTimeCycle" id="HInitTimeCycle" class="ForFilteringSchemes" lay-filter="HInitTimeCycle" style="width:190px;">
                                                </select>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" id="BT_HBeginDate">开始日期</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="date" class="layui-input" lay-verify="HBeginDate" name="HBeginDate" id="HBeginDate" style="padding-left: 75px;">
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label">结束日期</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="date" class="layui-input" lay-verify="HEndDate" name="HEndDate" id="HEndDate" style="padding-left: 75px;">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row" style="margin-top: 5px; margin-left: 4%;">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" id="BT_ColName">过滤</label>
                                            <div class="layui-input-block">
                                                <select name="ColName" id="ColName" lay-filter="ColName" style="width:190px;">
                                                </select>
@@ -131,7 +141,7 @@
                                    </div>
                                    <div class="layui-row" style=" margin-top: 10px; margin-left: 70px;">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">过滤</label>
                                            <label class="layui-form-label" id="BT_ColName1">过滤</label>
                                            <div class="layui-input-block">
                                                <select name="ColName1" id="ColName1" class="ForFilteringSchemes" lay-filter="ColName1" style="width:190px;">
                                                </select>
@@ -159,7 +169,7 @@
                                    <div class="layui-row" style=" margin-top: 10px; margin-left: 70px;">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">过滤</label>
                                            <label class="layui-form-label" id="BT_ColName2">过滤</label>
                                            <div class="layui-input-block">
                                                <select name="ColName2" id="ColName2" class="ForFilteringSchemes" lay-filter="ColName2" style="width:190px;">
                                                </select>
@@ -185,32 +195,6 @@
                                        </div>
                                    </div>
                                </div>
                                <!--<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>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="hname" id="hname">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">产品代码</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="hnumber" id="hnumber">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">规格型号</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="hmodel" id="hmodel">
            </div>
        </div>
    </div>-->
                            </div>
                        </div>
                        <table class="layui-form-item" id="mainTable" lay-filter="mainTable"></table>
@@ -222,8 +206,14 @@
                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="Print1" id="Print1">
                                    <i class="layui-icon layui-icon-file"></i>普菲特打印
                                </button>
                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="WhiteSave" id="WhiteSave">
                                    <i class="layui-icon layui-icon-file"></i>白标生成
                                </button>
                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="BtnDel" id="BtnDel">
                                    <i class="layui-icon layui-icon-file"></i>删除
                                </button>
                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="BtnGX" id="BtnGX">
                                    <i class="layui-icon layui-icon-file"></i>数据更新
                                </button>
                            </div>
                        </script>
@@ -232,10 +222,8 @@
            </div>
        </div>
    </div>
    <!--<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/webConfig2.js"></script>
    <script>
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
@@ -253,19 +241,22 @@
            , util = layui.util;
            //var sWhere = " äº§å“ä»£ç  = 'BX0002'";
            var sWhere = "";
            var HModName = "MES_ProductionLinePackagingList";
            initFunction(1, HModName, sessionStorage["HTranSlate"]);
            form.render('select');
            var option = {
                elem: '#mainTable'
                , toolbar: '#toolbarDemo'
                ,height: 'full-50'
                , height: 'full-50'
                , page: true
                , limit: 50
                , limits: [50, 500, 5000, 20000]
                , cols: [[
                    {type:'radio'}
                    { type: 'radio' }
                    , { field: 'HInterID', title: 'ID', sort: true, width: 100 }
                    , { field: '项目号', title: '项目号', sort: true, width: 100 }
                    ,{ field: '唯一条码', title: '唯一条码', sort: true, width: 170 }
                    , { field: '唯一条码', title: '唯一条码', sort: true, width: 170 }
                    //, { field: '扫码日期', title: '扫码日期', sort: true, width: 200, templet: "<div>{{layui.util.toDateString(this.扫码日期, 'yyyy-MM-dd')}}</div> " }
                    , {
                        field: '扫码日期', title: '包装日期', sort: true, width: 110, templet: function (d) {
@@ -305,80 +296,37 @@
                }
            };
            table.render(option);
            //进入页面显示的缓存列表
            layer.load(3);
            $.ajax({
                //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
                url: GetWEBURL1() + '/LEMS/MES_ProductionLinePackagingList_Json',
                type: "GET",
                data: { "sWhere": sWhere },
                success: function (data1) {
                    if (data1.count == 1) {
                        option.data = data1.data;
                        table.render(option);
                        if ($("#HInitTimeCycle").val() == 0 && $("#HInitTimeCycle").val() == "") {
                            setSelect_HInitTimeCycle();
                        }
                        if ($("#Comparator").val() == 0 && $("#ColContent").val() == "") {
                            ColFilter();
                        }
                        layer.closeAll("loading");
                    } else {
                        layer.closeAll("loading");
                        layer.alert(data1.code + data1.Message, { icon: 5 });
                    }
                }, error: function () {
                    layer.alert("接口失效!", { icon: 5 });
                }
            });
            //日期间隔下拉列表监听
            form.on('select(HInitTimeCycle)', function (data) {
                var HInitTimeCycle = $("#HInitTimeCycle").val() * 1;
            set_ClearBill();
            // åˆå§‹åŒ–界面
            function set_ClearBill() {
                //初始化组织
                Organ();
                //初始化日期间隔、开始日期、结束日期
                setSelect_HInitTimeCycle();
                //若日期间隔不为 ä»»æ„é—´éš”,则禁用开始日期与结束日期的选择
                var HInitTimeCycle = $("#HInitTimeCycle").val() * 1;
                if (HInitTimeCycle != -1) {
                    $('#HBeginDate').prop('disabled', true);
                    $('#HEndDate').prop('disabled', true);
                    $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * HInitTimeCycle), "yyyy-MM-dd"));
                    $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
                    //执行查询方法
                    $("#btnSearch").click;
                } else {
                    $('#HBeginDate').prop('disabled', false);
                    $('#HEndDate').prop('disabled', false);
                }
            });
            //重置按钮
            form.on('submit(btnReSearch)', function (data) {
                var HInitTimeCycle = $("#HInitTimeCycle").val() * 1;
                $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * HInitTimeCycle), "yyyy-MM-dd"));//开始日期
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));//结束日期
                $("#HBarCode_Pack").val("");//唯一条码
                $("#HICMOBillNo").val("");//条码
                $("#tmlx").val("");//条码类型
                $("#HBillNo").val("");//生产任务单单号
                $("#HMaker").val("");//数量制单人
                $("#单据号").val("");//单据号
                $("#ColContent").val("");
                $("#ColName").val("0");
                $("#Comparator").val("0");
                $("#ColContent1").val("");
                $("#ColName1").val("0");
                $("#Comparator1").val("0");
                $("#ColContent2").val("");
                $("#ColName2").val("0");
                $("#Comparator2").val("0");
                //根据日期间隔设置开始时间与结束时间
                $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * HInitTimeCycle), "yyyy-MM-dd"));
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
                //查询
                get_FastQuery();
            }
                form.render('select');
                $("#btnSearch").click();
            });
            //查询按钮
            form.on('submit(btnSearch)', function (data) {//选择仓位
            //快速查询
            function get_FastQuery() {
                var HBarCode_Pack = $("#HBarCode_Pack").val();//唯一条码
                var HICMOBillNo = $("#HICMOBillNo").val();//条码
                var tmlx = $("#tmlx").val();//条码类型
@@ -387,16 +335,17 @@
                var å•据号 = $("#单据号").val();//数量制单人
                var HBeginDate = $("#HBeginDate").val();//开始日期
                var HEndDate = $("#HEndDate").val();//结束日期
                var ColName = $("#ColName").val();//复选框
                var Comparator = $("#Comparator").val()
                var ColContent = $("#ColContent").val();
                var ColName1 = $("#ColName1").val();//复选框
                var Comparator1 = $("#Comparator1").val()
                var ColContent1 = $("#ColContent1").val();
                var ColName2 = $("#ColName2").val();//复选框
                var Comparator2 = $("#Comparator2").val()
                var ColContent2 = $("#ColContent2").val();
                if (ColName != 0 && Comparator != 0) {
                    var com = "";
                    switch (Comparator) {
@@ -417,7 +366,8 @@
                            break;
                    }
                    sWhere += " and " + ColName + " " + com;
                } if (ColName1 != 0 && Comparator1 != 0) {
                }
                if (ColName1 != 0 && Comparator1 != 0) {
                    var com1 = "";
                    switch (Comparator1) {
                        case "7":
@@ -479,15 +429,23 @@
                    sWhere += " and å•据号 like '%" + å•据号 + "%'";
                }
                if (HBeginDate != "") {
                    sWhere += " and åˆ¶å•日期 >= '" + HBeginDate + "'";
                    sWhere += " and convert(varchar(10),制单日期,120) >= '" + HBeginDate + "'";
                }
                if (HEndDate != "") {
                    sWhere += " and åˆ¶å•日期 <= '" + HEndDate + "'";
                    sWhere += " and convert(varchar(10),制单日期,120) <= '" + HEndDate + "'";
                }
                sWhere += getOrgIDByUser();//用户关联组织查询过滤
                get_Display(sWhere);
                sWhere = "";//调用接口后清空sWhere缓存
            }
            function get_Display(sWhere) {
                $.ajax({
                    //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
                    url: GetWEBURL1() + '/LEMS/MES_ProductionLinePackagingList_Json',
                    url: GetWEBURL() + '/LEMS/MES_ProductionLinePackagingList_Json',
                    type: "GET",
                    async: false,
                    data: { "sWhere": sWhere },
                    success: function (data1) {
                        if (data1.count == 1) {
@@ -497,144 +455,117 @@
                            if ($("#Comparator").val() == 0 && $("#ColContent").val() == "") {
                                ColFilter();
                            }
                            layer.alert("查询成功", { icon: 1 });
                            layer.alert(get_MessageError("[0000-1-037]查询成功", sessionStorage["HTranSlate"]), { icon: 1 });
                        } else {
                            option.data = [];
                            table.render(option);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                            layer.alert(get_MessageError(data1.code + data1.Message, sessionStorage["HTranSlate"]), { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口失效!", { icon: 5 });
                        layer.alert(get_MessageError("[0000-1-002]接口请求失败!", sessionStorage["HTranSlate"]), { icon: 5 });
                    }
                });
                sWhere = "";//调用接口后清空sWhere缓存
                initFunction(1, HModName, sessionStorage["HTranSlate"]);
            }
            //日期间隔下拉列表监听
            form.on('select(HInitTimeCycle)', function (data) {
                var HInitTimeCycle = $("#HInitTimeCycle").val() * 1;
                //若日期间隔不为 ä»»æ„é—´éš”,则禁用开始日期与结束日期的选择
                if (HInitTimeCycle != -1) {
                    $('#HBeginDate').prop('disabled', true);
                    $('#HEndDate').prop('disabled', true);
                    $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * HInitTimeCycle), "yyyy-MM-dd"));
                    $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
                    //执行查询方法
                    $("#btnSearch").click;
                } else {
                    $('#HBeginDate').prop('disabled', false);
                    $('#HEndDate').prop('disabled', false);
                }
            });
            //重置按钮
            form.on('submit(btnReSearch)', function (data) {
                $("#HOrgID").val(sessionStorage["Organization"])
                var HInitTimeCycle = $("#HInitTimeCycle").val() * 1;
                $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * HInitTimeCycle), "yyyy-MM-dd"));//开始日期
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));//结束日期
                $("#HBarCode_Pack").val("");//唯一条码
                $("#HICMOBillNo").val("");//条码
                $("#tmlx").val("");//条码类型
                $("#HBillNo").val("");//生产任务单单号
                $("#HMaker").val("");//数量制单人
                $("#单据号").val("");//单据号
                $("#ColContent").val("");
                $("#ColName").val("0");
                $("#Comparator").val("0");
                $("#ColContent1").val("");
                $("#ColName1").val("0");
                $("#Comparator1").val("0");
                $("#ColContent2").val("");
                $("#ColName2").val("0");
                $("#Comparator2").val("0");
                form.render('select');
                $("#btnSearch").click();
            });
            //查询按钮
            form.on('submit(btnSearch)', function (data) {//选择仓位
                get_FastQuery();
            });
            //获取选中行数据
            table.on('row(mainTable)', function (obj) {
                //标注选中样式
                obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
            });
            //打印按钮
            //form.on('submit(Print)', function (obj) {//退出
            //    var checkStatus = table.checkStatus("mainTable"); //获取选中行状态
            //    var linterid = checkStatus.data[0].HInterID;
            //    ////打开打印模板
            //    ////var linterid = $("#HInterID").val();
            //    ////var linterid = "28973";
            //    //var Type = "HBarCodePrint";
            //    //var OpenTmp = "包装单物料标识卡(网页版)";
            //    ////var ReportViewer = document.getElementById("ReportViewer");
            //    //window.open("../../views/BaseSet/HBarPlanPrint.html?linterid=" + linterid.toString() + "&Type=" + Type.toString() + "&OpenTmp=" + OpenTmp.toString());
            //白标生成保存
            form.on('submit(WhiteSave)', function (obj) {//退出
                var checkStatus = table.checkStatus("mainTable"); //获取选中行状态
                if (checkStatus.data.length == 1) {
                    var HBarCode_Pack = checkStatus.data[0].唯一条码;
                    layer.open({                //使用 layer的open打开弹出 å±‚
                        type: 2                         //表示弹出层的内容是一个 iframe
                        , area: ['100%', '100%']
                        , title: '白标打印'  //设置弹出层的名字和变量
                        , closeBtn: 1//显示关闭按钮
                        , shade: 0.6 //遮罩透明度
                        , maxmin: true //允许全屏最小化
                        , anim: 0 //0-6的动画形式,-1不开启
                        , content: '../../车间管理/产线/MES_WhiteLabelGeneration.html?OperationType=1&HBarCode_Pack=' + HBarCode_Pack //设置 iframe çš„ URL,URL ä¸­åŒ…含了查询参数,来调用所需要的值
                        , resize: false,  //是否允许用户调整弹出大小
                    })
                } else {
                    layer.msg(get_MessageError("[3748-2-006]请选择一行进行白标生成!", sessionStorage["HTranSlate"]));
                }
            });
            //    var sWhere = "select * from h_v_SRM_BarCodeBillList where HItemID in(" + linterid + ") order by ç‰©æ–™ä»£ç ";
            //    $.ajax({
            //        type: "GET",
            //        url: GetWEBURL() + "/Gy_SOPBillList/WindowPrintList", //方法所在页面和方法名
            //        async: true,
            //        data: { "sWhere": sWhere },
            //        success: function (data) {
            //            if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
            //                if (data.data.length != 0) {
            //                    var dataPrint = [];
            //                    dataPrint.push({ "产品名称": data.data[0]["产品名称"], "条码编号": data.data[0]["条码编号"], "数量": data.data[0]["数量"], "日期": data.data[0]["日期"], "生产任务单": data.data[0]["生产任务单"], "流转卡编号": data.data[0]["流转卡编号"], "自定义字段": data.data[0]["自定义字段"], "项目编号": data.data[0]["项目编号"] }
            //                    );
            //                    var Customer = {
            //                        "Table": dataPrint
            //                    }
            //                    var args = {
            //                        type: "print",
            //                        showOptionDlg: false, //如果不显示打印对话框而直接打印,将此行注释去掉即可
            //                        report: urlAddRandomNo("../../views/grf/包装单物料标识卡(网页版).grf"),
            //                        data: Customer
            //                    };
            //                    //var args = {
            //                    //    report: urlAddRandomNo("../../views/grf/包装单物料标识卡(网页版).grf"),
            //                    //    data: Customer
            //                    //};
            //                    webapp_ws_ajax_run(args);
            //                } else {
            //                    layer.msg("查无数据!");
            //                }
            //            }
            //            else {
            //                layer.msg(data.Message, { icon: 5 });
            //            }
            //            layer.closeAll("loading");
            //        },
            //        error: function (err) {
            //            layer.msg("错误:" + err, { icon: 5 });
            //        }
            //    })
            //});
            //斯莫尔打印
            form.on('submit(Print)', function (obj) {//退出
                var checkStatus = table.checkStatus("mainTable"); //获取选中行状态
                var linterid = checkStatus.data[0].HInterID;
                ////打开打印模板
                ////var linterid = $("#HInterID").val();
                ////var linterid = "28973";
                //var Type = "HBarCodePrint";
                //var OpenTmp = "包装单物料标识卡(网页版)";
                ////var ReportViewer = document.getElementById("ReportViewer");
                //window.open("../../views/BaseSet/HBarPlanPrint.html?linterid=" + linterid.toString() + "&Type=" + Type.toString() + "&OpenTmp=" + OpenTmp.toString());
                var sWhere = "select  a.HBarCode_White HBarCode_White,temp.HSupPartName HSupPartName,temp.HSupBarCodeNumber MFGPartNumber,temp.HCountryType CountryofOrigin,(select REPLACE(item, 'Q', '') from split(a.HBarCode_White, ':') where id = 6) Quantity, temp.HGrossWeight GrossWeight, temp.HPARTNAME PartName , (select item from split(a.HBarCode_White, ':') where id = 2) ContentLabelID , temp.HSupNumber Supplier, REPLACE(convert(varchar(10), GETDATE(), 20), '-', '') + ' ' + convert(varchar(5), GETDATE(), 24) MFGDate , REPLACE(convert(varchar(10), GETDATE(), 20), '-', '') SupplierLotCode , (select REPLACE(item, 'P', '') from split(a.HBarCode_White, ':') where id = 4) BBM   from Sc_PackUnionBillMain a left join  Gy_Material m on a.HMaterID = m.HItemID left join Sc_PackUnionBillBarCode_temp temp on m.HNumber = temp.HMaterNumber where a.HInterID=" + linterid;
                $.ajax({
                    type: "GET",
                    url: GetWEBURL() + "/Gy_SOPBillList/WindowPrintList", //方法所在页面和方法名
                    async: true,
                    data: { "sWhere": sWhere },
                    success: function (data) {
                        if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            if (data.data.length != 0) {
                                var dataPrint = [];
                                dataPrint.push(data.data[0]
                                    //{ "产品名称": data.data[0]["产品名称"], "条码编号": data.data[0]["条码编号"], "数量": data.data[0]["数量"], "日期": data.data[0]["日期"], "生产任务单": data.data[0]["生产任务单"], "流转卡编号": data.data[0]["流转卡编号"], "自定义字段": data.data[0]["自定义字段"], "项目编号": data.data[0]["项目编号"] }
                                );
                                var Customer = {
                                    "Table": dataPrint
                                }
                                var args = {
                                    type: "print",
                                    showOptionDlg: false, //如果不显示打印对话框而直接打印,将此行注释去掉即可
                                    report: urlAddRandomNo("../../views/grf/白标打印.grf"),
                                    data: Customer
                                };
                                //var args = {
                                //    report: urlAddRandomNo("../../views/grf/包装单物料标识卡(网页版).grf"),
                                //    data: Customer
                                //};
                                webapp_ws_ajax_run(args);
                            } else {
                                layer.msg("查无数据!");
                            }
                        }
                        else {
                            layer.msg(data.Message, { icon: 5 });
                        }
                        layer.closeAll("loading");
                    },
                    error: function (err) {
                        layer.msg("错误:" + err, { icon: 5 });
                    }
                })
                var HOrgID = $("#HOrgID").val();
                layer.open({
                    type: 2
                    , area: ['80%', '80%']
                    , title: '打印模版选择'
                    , shade: 0.6 //遮罩透明度
                    , maxmin: false //允许全屏最小化
                    , anim: 0 //0-6的动画形式,-1不开启
                    , content: ['../../BaseSet/SRM_OpenTmpList.html?linterid='+ linterid.toString() + '|' + HOrgID +  '&MyMsg=&Type=' + HModName, 'yes']
                    , resize: false
                })
            });
            //打印按钮
            //打印按钮  æ™®è²ç‰¹æ‰“印
            form.on('submit(Print1)', function (obj) {//退出
                var checkStatus = table.checkStatus("mainTable"); //获取选中行状态
                var linterid = checkStatus.data[0].HInterID;
@@ -645,7 +576,7 @@
                $.ajax({
                    type: "GET",
                    url: GetWEBURL() + "/Gy_SOPBillList/WindowPrintList", //方法所在页面和方法名
                    async: true,
                    async: false,
                    data: { "sWhere": sWhere },
                    success: function (data) {
                        if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
@@ -671,17 +602,17 @@
                                //};
                                webapp_ws_ajax_run(args);
                            } else {
                                layer.msg("查无数据!");
                                layer.msg(get_MessageError("[0000-1-045]查无数据!", sessionStorage["HTranSlate"]));
                            }
                        }
                        else {
                            layer.msg(data.Message, { icon: 5 });
                            layer.msg(get_MessageError(data.Message, sessionStorage["HTranSlate"]), { icon: 5 });
                        }
                        layer.closeAll("loading");
                    },
                    error: function (err) {
                        layer.msg("错误:" + err, { icon: 5 });
                        layer.msg(get_MessageError("错误:" + err, sessionStorage["HTranSlate"]), { icon: 5 });
                    }
                })
@@ -693,27 +624,58 @@
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var HInterID = data[0].HInterID.toString();
                    layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
                    layer.confirm(get_MessageError("[0000-1-003]确认要删除吗,删除后不能恢复", sessionStorage["HTranSlate"]), { title: get_MessageError("[0000-2-009]删除确认", sessionStorage["HTranSlate"])}, function (index) {
                        $.ajax({
                            //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
                            url: GetWEBURL1() + '/LEMS/DelMES_ProductionLinePackagingList',
                            type: "GET",
                            async: false,
                            data: { "HInterID": HInterID },
                            success: function (data1) {
                                if (data1.count == 1) {
                                    layer.msg(data1.Message);
                                    layer.msg(get_MessageError(data1.Message, sessionStorage["HTranSlate"]));
                                } else {
                                    layer.alert(data1.code + data1.Message, { icon: 5 });
                                    layer.alert(get_MessageError(data1.code + data1.Message, sessionStorage["HTranSlate"]), { icon: 5 });
                                }
                            }, error: function () {
                                layer.alert("接口失效!", { icon: 5 });
                                layer.alert(get_MessageError("[0000-1-002]接口请求失败!", sessionStorage["HTranSlate"]), { icon: 5 });
                            }
                        });
                    })
                } else {
                    layer.msg('请选择一行数据删除!');
                    layer.msg(get_MessageError('[0000-1-014]请选择一行数据删除!', sessionStorage["HTranSlate"]));
                }
            });
            //更新
            form.on('submit(BtnGX)', function (data) {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var HInterID = data[0].HInterID.toString();
                    var HRemark = "无";
                    $.ajax({
                        url: GetWEBURL1() + '/LEMS/SaveToSc_PackUnionBillSub_Back',
                        type: "GET",
                        async: false,
                        data: { "HInterID": HInterID, "HRemark": HRemark },
                        success: function (data1) {
                            if (data1.count == 1) {
                                layer.msg(get_MessageError(data1.Message, sessionStorage["HTranSlate"]));
                            } else {
                                layer.alert(get_MessageError(data1.code + data1.Message, sessionStorage["HTranSlate"]), { icon: 5 });
                            }
                        }, error: function () {
                            layer.alert(get_MessageError("[0000-1-002]接口请求失败!", sessionStorage["HTranSlate"]), { icon: 5 });
                        }
                    });
                } else {
                    layer.msg(get_MessageError('[0000-1-020]请选择一行数据更新!', sessionStorage["HTranSlate"]));
                }
            });
            //#region åˆå§‹æ—¥æœŸé—´éš” ä¸‹æ‹‰åˆ—表
            function setSelect_HInitTimeCycle() {
                var valueList = [0, 1, 2, 3, 4, 5, 6, 29]; //valuelist数组包含与时间相关的整数值
@@ -725,12 +687,13 @@
                }
                $("#HInitTimeCycle").empty();           //使用jquery的empty方法清空HInitTimeCycle_ArrayList <select>元素的值
                $("#HInitTimeCycle").append(HInitTimeCycle_ArrayList);  //使用append方法构建之前HInitTimeCycle_ArrayList字符串 çš„内容传入HInitTimeCycle
                $("#HInitTimeCycle").append(HInitTimeCycle_ArrayList);  //使用append方法构建之前HInitTimeCycle_ArrayList字符串 çš„内容传入HInitTimeCycle
                form.render('select');       //调用 é‡æ–°æ¸²æŸ“select元素
                $("#HInitTimeCycle").val("29");   //使用jQuery的val()方法将下拉列表的选中值设置为"29   ï¼Œä¸”显示《近三時天》
                $("#HInitTimeCycle").val("1");   //使用jQuery的val()方法将下拉列表的选中值设置为"29   ï¼Œä¸”显示《近三時天》
            }
            //#endregion
            //#region åˆ—明显示下拉框
            function ColFilter() {
                var Organization = '<option  value="0" selected="selected" ></option>';
@@ -748,13 +711,55 @@
                form.render('select');
            }
        //#endregion
            //laydate.render({
            //    elem: '#HDate'
            //    , type: 'datetime'
            //    , trigger: 'click'
            //    , format:'yyyy-MM-dd HH:mm'
            //});
            //获取组织
            function Organ() {
                //获取登录页组织列
                $.ajax({
                    type: "get",
                    async: false,
                    url: GetWEBURL() + "/Web/GetOrganizations",
                    success: function (result) {
                        var Organization = "";
                        if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            var data = result.data;
                            for (var i = 0; i < data.length; i++) {
                                Organization += '<option  style="color:blue;" value="' + data[i].Name + '">' + data[i].Name + '</option>';
                            }
                            $("#HOrgID").append(Organization);
                            $("#HOrgID").val(sessionStorage["Organization"])
                            form.render('select');
                        }
                        layer.closeAll("loading");
                    }
                })
            }
            //#region æ ¹æ®ç”¨æˆ·èŽ·å–ç”¨æˆ·å…³è”ç»„ç»‡çš„è¿‡æ»¤æ¡ä»¶
            function getOrgIDByUser() {
                var res = "";
                $.ajax({
                    type: "GET",
                    async: false,
                    url: GetWEBURL() + "/Xt_User/getOrgIDListByUser", //方法所在页面和方法名       ä¼ å‚ ç»„织必须是列表头部查询的组织  ä¸èƒ½ä½¿ç”¨ç”¨æˆ·é»˜è®¤
                    data: { "UserID": sessionStorage["Czybm"], "UserName": sessionStorage["HUserName"], HOrgID: $("#HOrgID").val() },
                    success: function (result) {
                        if (result.count == 1) {
                            if (result.data[0].sWhere == "1") {
                                res = " and ç”Ÿäº§ç»„织 = '" + $("#HOrgID").val() + "'";
                            } else {
                                res = result.data[0].sWhere;
                            }
                        }
                    }, error: function (err) {
                        res = " and 1 = 0";
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
                return res;
            }
        //#endregion
            //以上是layui模块
        });