lkReceiving.html 5.01 KB
<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<style>
    #form-lk-receiving {
        padding: 10px 15px;
    }
    #form-lk-receiving .select-list ul li {
        margin-right: 25px;
    }
    #form-lk-receiving .select-list ul li input {
        width: 200px;
    }
    #form-lk-receiving .table-section {
        display: block;
        width: 100%;
        clear: both;
        margin-top: 10px;
    }
    #form-lk-receiving .table-title {
        display: block;
        width: 100%;
        clear: both;
        margin: 0 0 8px;
        font-weight: bold;
    }
    #form-lk-receiving .btn-group-bottom {
        margin-top: 15px;
        text-align: right;
    }
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form id="form-lk-receiving">
        <input type="hidden" id="receiptId" name="receiptId" th:value="${receiptId}">
        <input type="hidden" id="receiptCode" name="receiptCode" th:value="${receiptCode}">
        <div class="select-list">
            <ul>
                <li>托盘号:<input id="containerCode" name="containerCode" type="text" placeholder="请输入托盘号"></li>
                <li>materialId:<input id="materialId" name="materialId" type="text" placeholder="请输入materialId"></li>
            </ul>
        </div>
        <div class="table-section">
            <div class="table-title">入库明细</div>
            <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover text-nowrap"></table>
        </div>
        <div class="btn-group-bottom">
            <button onclick="$.modal.close()" class="btn btn-default" type="button">取消</button>
            <button type="button" class="btn btn-primary" onclick="lkSubmit()">立库收货</button>
        </div>
    </form>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var prefix = ctx + "receipt/receiptHeader";
    var detailPrefix = ctx + "receipt/receiptDetail";
    var receiptId = [[${receiptId}]];

    $(function () {
        $("#bootstrap-table").bootstrapTable({
            url: detailPrefix + "/list",
            method: "post",
            contentType: "application/x-www-form-urlencoded",
            pagination: true,
            pageSize: 10,
            pageList: [10, 25, 50],
            clickToSelect: true,
            queryParams: function (params) {
                return {
                    pageSize: params.limit,
                    pageNum: params.offset / params.limit + 1,
                    receiptId: receiptId
                };
            },
            columns: [
                {
                    radio: true
                },
                {
                    field: 'id',
                    title: '详情id'
                },
                {
                    field: 'materialCode',
                    title: '物料编码'
                },
                {
                    field: 'materialName',
                    title: '物料名称'
                },
                {
                    field: 'materialSpec',
                    title: '物料规格'
                },
                {
                    field: 'materialID',
                    title: '物料条码'
                },
                {
                    field: 'batch',
                    title: '批次'
                },
                {
                    field: 'lot',
                    title: '批号'
                },
                {
                    field: 'qty',
                    title: '单据数量'
                },
                {
                    field: 'taskQty',
                    title: '已收数量'
                },
                {
                    field: 'ctn',
                    title: 'ctn号'
                }
            ]
        });
    });

    function lkSubmit() {
        var containerCode = $("#containerCode").val();
        var materialId = $("#materialId").val();
        if (!containerCode) {
            $.modal.alertWarning("请输入托盘号");
            return;
        }
        if (!materialId) {
            $.modal.alertWarning("请输入materialId");
            return;
        }
        var rows = $("#bootstrap-table").bootstrapTable('getSelections');
        if (rows.length === 0) {
            $.modal.alertWarning("请选择一条入库明细");
            return;
        }
        $.ajax({
            cache: true,
            type: "POST",
            url: prefix + "/lkAdd",
            data: {
                receiptCode: $("#receiptCode").val(),
                receiptDetailId: rows[0].id,
                containerCode: containerCode,
                materialId: materialId
            },
            error: function () {
                $.modal.alertError("请求失败!");
            },
            success: function (data) {
                $.operate.saveSuccess(data);
            }
        });
    }
</script>
</body>
</html>