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

<style>
      .form {
        margin: 55px -25px;
    }


</style>
<script>
    debugger;
    var ID = $.request("ID");

    debugger;
    var WorkPoints = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location'
    $(function () {
        $("#minPackQty").keyup(function () {
            $(this).val($(this).val().replace(/[^0-9.]/g, ''));
        }).bind("paste", function () {  //CTR+V事件处理
            $(this).val($(this).val().replace(/[^0-9.]/g, ''));
        }).css("ime-mode", "disabled"); //CSS设置输入法不可用
        $("#thisCreateQty").keyup(function () {
            $(this).val($(this).val().replace(/[^0-9.]/g, ''));
        }).bind("paste", function () {  //CTR+V事件处理
            $(this).val($(this).val().replace(/[^0-9.]/g, ''));
        }).css("ime-mode", "disabled"); //CSS设置输入法不可用
        $("#cretePageCount").keyup(function () {
            $(this).val($(this).val().replace(/[^0-9.]/g, ''));
        }).bind("paste", function () {  //CTR+V事件处理
            $(this).val($(this).val().replace(/[^0-9.]/g, ''));
        }).css("ime-mode", "disabled"); //CSS设置输入法不可用

        if (!!ID) {
            InitControl();
        }
    });


    function InitControl() {
        debugger;
        var $LotNo = $("#sel_LotNo");
        $LotNo.select2({
            allowClear: true,
            escapeMarkup: function (m) {
                return m;
            }
        });
        $.ajax({
            url: "/WMS/Deciliter/GetLotNoByID?ID=" + ID + "&" + Math.random(),
            dataType: "json",
            async: false,
            success: function (data) {
                $.each(data, function (index, item) {
                    $LotNo.append("<option value='" + item.ID + "'>" + item.LotNo + "</option>");
                });
            }
        });
    }





    function submitForm() {
        debugger;
        if (!$('#form1').formValid()) {
            return false;
        }
        var LotNo= $("#sel_LotNo").find("option:selected").text();
       // var LotNo = $("#sel_LotNo").text();
        if (LotNo=="") {
            $.modalAlert("请选择条码!");
            return;
        }
        $.modalConfirm("合批后不能恢复,确定合批吗?", function (r) {
            if (r) {
                $.submitForm({
                    url: "/WMS/Deciliter/Combine?LotNo=" + LotNo + "&ID=" + ID +"&" + Math.random(),
                   // param: { keyValue: IDlist },
                    success: function () {
                        $.currentWindow().$("#gridList").trigger("reloadGrid");
                    }
                })
            }
        });
    }







</script>

<form id="form1">
    <div style="padding-top: 20px; margin-right: 20px;">
        <table class="form">
            <tr >
                <th class="formTitle">料品条码:</th>
                <td style="width:100px">
                    <select id="sel_LotNo" name="sel_LotNo" class="form-control select2" style="width: 500px" placeholder="料品条码"></select>
                    <input type="hidden" id="hidetext" />
                </td>
            </tr>

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