@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}


<link href="~/Content/css/CommonReport/CommonReport.css" rel="stylesheet" />
<script src="~/Content/js/CommonReport/CommonReport.js"></script>
<link href="~/Content/css/bootstrap/bootstrap-select.css" rel="stylesheet" />
<script src="~/Content/js/bootstrap/bootstrap-select.min.js"></script>
<style>
    * {
        box-sizing: border-box;
    }
</style>
<script>
    var ID = $.request("ID");

    $(function () {
        $("#txtLableCode").attr("disabled", "disabled");
        InitControl();
        InitContro2();
        if (ID != "") {
            GetTXT();
        }
    });

    function GetTXT() {
        if (!!ID) {
            $.ajax({
                url: "/WMS/BasicSettings/GetLabelTXT?ID=" + ID + "&" + Math.random(),
                dataType: "json",
                async: false,
                success: function (data) {
                    debugger;
                    $("#txtLableCode").val(data.rows[0].LableCode);
                    $("#txtLableName").val(data.rows[0].LableName);
                    $("#sel_LableType").val(data.rows[0].LableType).trigger("change");
                    $("#sel_LableSourceID").val(data.rows[0].LableSourceID).trigger("change");
                }
            });
        }
    };


    function InitControl() {
        var $VenCode = $("#sel_LableType");
        $VenCode.select2({
            allowClear: true,
            escapeMarkup: function (m) {
                return m;
            }
        });
        $.ajax({
            url: "/WMS/BasicSettings/GetLableType" + "?" + Math.random(),
            dataType: "json",
            async: false,
            success: function (data) {
                $.each(data, function (index, item) {
                    $VenCode.append("<option value='" + item.F_ItemCode + "'>&nbsp;" + item.F_ItemName + "</option>");
                });
            }
        });
    }

    function InitContro2() {
        var $VenCode = $("#sel_LableSourceID");
        $VenCode.select2({
            allowClear: true,
            escapeMarkup: function (m) {
                return m;
            }
        });
        $.ajax({
            url: "/WMS/BasicSettings/GetLableSourceID" + "?" + Math.random(),
            dataType: "json",
            async: false,
            success: function (data) {
                $.each(data, function (index, item) {
                    $VenCode.append("<option value='" + item.ID + "'>&nbsp;" + item.SourceName + "</option>");
                });
            }
        });
    }



    function submitForm() {
      
        var strPrintData;
        var bIsInstallPrintControl;
        var strPrintControlCookie;
        var objArr = {



        };
        $.ajax({
            url: "/WMS/WMSCreateItemLot/PrintItemLot?Type=" + Type,
            type: "post",
            data: { keyValue: JSON.stringify(objArr) },
            dataType: "json",
            async: false,
            success: function (data) {
                strPrintData = data.strPrintData_1;
                bIsInstallPrintControl = data.bIsInstallPrintControl_1;
                strPrintControlCookie = data.strPrintControlCookie_1;
            }
        });
        if (strPrintData != '') {
            var test = "ChuLinPrint:" + strPrintData;
            $("#ifrm")[0].src = "ChuLinPrint:" + strPrintData;
        }
        if (bIsInstallPrintControl == 'False') {
            if (confirm("检测到打印控件未安装,您是否下载安装?")) {
                $("#downPrintControl").click();
            }
        }
        if (bIsInstallPrintControl == 'True') {
            var strPrintControlCookie = strPrintControlCookie;
            if (strPrintControlCookie != '') { //延时3秒后再次检测打印控件是否安装
                setTimeout("checkPrintControlInstall()", 8000);
                function checkPrintControlInstall() {
                    $.ajax({
                        url: "/WMS/WMSCreateItemLot/IsCheckInstall?checkInstall=" + strPrintControlCookie,
                        dataType: "json",
                        async: false,
                        success: function (strResult) {
                            if (strResult.indexOf("PrintControlInstall") == -1) {
                                if (confirm("检测到打印控件未安装,您是否下载安装?")) {
                                    $("#downPrintControl").click();
                                }
                            }
                        }
                    });
                }
            }
        }
     

    }








</script>
<div class="btn-group" style="display:block;padding-left:2px;">
    <a class="btn btn-primary" id="downPrintControl" href="~/PrintActivex.exe" style="display:none">点击下载打印组件</a>
</div>
<form id="form1">
    <div class="widget-body">

        <div style="padding-top: 5px;  ">
            <div class="step-content" id="wizard-steps" style="border-left: none; border-bottom: none; border-right: none;">
                <div class="step-pane active" id="step-1" style="padding-left: 5px; padding-top: 20px; margin-right: 20px;">

                    <table class="form">
                        <tr>
                            <th class="formTitle">打印模板: </th>
                            <td class="formValue">
                                <select id="sel_LableType" name="sel_LableType" class="form-control select2" style="width: 230px" placeholder="请选择标签类型..."></select>
                                <input type="hidden" id="hidetext" />
                            </td>
                        </tr>

                    </table>
                </div>
            </div>
        </div>
    </div>
</form>