conformContainer.html 9.73 KB
<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-task-emptyIn">
        <span style="color:red;">*如果不勾选明细,则默认该库位明细全部转移到目的容器</span>
        <div class="form-group">
            <span style="font-size: 12px;font-weight:bolder;">货主:</span>
            <select id="companyCode" name="companyCode" th:with="companyList=${@companyService.selectCompanyByCurrentUserId()}" style="padding: 5px; font-size: 12px;
            font-weight:bolder;">
            <option th:each="company : ${companyList}" th:text="${company['name']}" th:value="${company['code']}" th:attr=" code = ${company['code']}"></option>
            </select>
            <span style="font-size: 12px;font-weight:bolder;">u8仓:</span>
            <select name="uWarehouseCode" id="uWarehouseCode" th:with="warehouse=${@warehouseWu.selectList()}" style="padding: 5px;font-size: 12px;
            font-weight:bolder;">
            <option value="">所有</option>
            <option th:each="e : ${warehouse}" th:text="${e['uWarehouseName']}" th:value="${e['uWarehouseCode']}" th:attr=" code = ${e['uWarehouseCode']}"></option>
            </select>
            <span style="font-size: 12px;font-weight:bolder;">物料号:</span>
            <input type="text" id="materialCode" name="materialCode"/>
            <span style="font-size: 12px;font-weight:bolder;">托盘:</span>
            <input type="text" id="containerCode" name="containerCode"/>
<!--            <input type="hidden" id="detailIdList" name="detailIdList">-->
        </div>
        <div class="form-group">
            <label class="col-sm-9 control-label"></label>
            <button type="button" class="btn btn-primary" onclick="selectMaterial()">选取明细</button>
            <button type="button" class="btn btn-primary" onclick="clearSelect()">清空明细</button>
        </div>
        <div class="form-group">
<!--            <label class="col-sm-3 control-label">目的库位:</label>-->
            <span style="font-size: 12px;font-weight:bolder;">目的托盘:</span>
            <input id="destContainerCode" name="destContainerCode" type="text">
        </div>
        <div class="col-sm-12 select-info" id="selecttable" >
            <div class="btn-group hidden-xs" id="toolbar1" role="group">
                <span style="color:red;">*下面只查询出虚拟库存</span>
            </div>
            <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
        </div>
        <div class="form-group">
            <div class="form-control-static col-sm-offset-9">
                <button type="submit" class="btn btn-primary">提交</button>
                <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
            </div>
        </div>
    </form>
</div>
<div th:include="include::footer"></div>
<script th:inline="javascript">
    var prefix = ctx + "inventory/inventoryDetail";
    var prefix_header = ctx + "inventory/inventoryHeader";
    var inventoryStatus = [[${@dict.getType('inventorySts')}]];
    var inventoryLock = [[${@dict.getType('inventoryLock')}]];
    var company =[[${@companyService.getCode()}]];
    function clearSelect(){
        $("#bootstrap-table").bootstrapTable('removeAll');
    }
    function selectMaterial(){
        var companyCode=$("#companyCode").val();
        var uWarehouseCode=$("#uWarehouseCode").val();
        var materialCode=$("#materialCode").val();
        var containerCode=$("#containerCode").val();
        $.ajax({
            url:prefix + '/inventoryDetailLook',
            type:"post",
            data:{
                "companyCode":companyCode,
                "uWarehouseCode":uWarehouseCode,
                "materialCode":materialCode,
                "containerCode":containerCode,
                "zoneCode":"XN"
            },
            success:function (value) {
                console.log(value)
                if(value.data!=""){
                    $("#bootstrap-table").bootstrapTable('load',value.data);
                }else {
                    $("#bootstrap-table").bootstrapTable('removeAll');
                    $.modal.msgError("没查询出来库存哦!");
                }

            }
        });
    }
    $("#bootstrap-table").bootstrapTable({
        // url: detailPrefix + "/list",
        // search: true, //搜索
        sortable: true, //排序
        showRefresh: true, //刷新
        showToggle:true, //视图切换
        clickToSelect: true,
        showColumns:true, //列选择
        // detailView:true,
        showExport: true, //导出
        exportDataType: "all",  //导出类型basic', 'all', 'selected'.当前页、所有数据、选中数据
        modalName: "入库明细",
        sortName: "lastUpdated",
        sortOrder: "desc",
        iconSize: "outline",
        toolbar: "#toolbar1",
        contentType: "application/x-www-form-urlencoded",
        pagination: true,   // 是否显示分页(*)
        pageNumber: 1,                                      // 初始化加载第一页,默认第一页
        pageSize: 10,                                       // 每页的记录行数(*)
        pageList: [10, 25, 50],                             // 可供选择的每页的行数(*)
        onRefresh: function(){
            loadDetail();
        },
        columns: [{
            checkbox: true
        },
            /*{
                title: '操作',
                align: 'center',
                events:'operateEvents',
                formatter: function(value, row, index) {
                    var actions = [];
                    actions.push('<a class="btn btn-success btn-xs" href="#" onclick="select(\'' + row.id+'\')"><i class="fa fa-edit"></i>选取</a> ');
                    return actions.join('');
                }
            },*/
            {
                field: 'id',
                title: '明细ID',
                sortable: false
            },
            {
                field: 'inventoryHeaderId',
                title: '库存头ID',
                sortable: true
            },
            {
                field: 'companyCode',
                title: '货主',
                align: 'center',
                formatter: function(value, row, index) {
                    var actions = [];
                    $.each(company, function(index, dict) {
                        if (dict.code == value) {
                            actions.push("<span class='badge badge-info'>" + dict.name + "</span>");
                            return false;
                        }
                    });
                    return actions.join('');
                }
            },
            // {
            //     field : 'batteryPackageWeight',
            //     title : '电池包重量',
            // },
            {
                field: 'locationCode',
                title: '库位编号'
            },
            {
                field: 'containerCode',
                title: '容器编号'
            },
            {
                field: 'materialCode',
                title: '物料编码'
            },

            {
                field: 'materialName',
                title: '物料名称'
            },
            {
                field: 'qty',
                title: '库存数量'
            },
            {
                field: 'taskQty',
                title: '预定执行数量'
            },
            {
                field: 'materialSpec',
                title: '物料规格'
            },
            {
                field: 'materialUnit',
                title: '物料单位'
            },
            {
                field: 'inventorySts',
                title: '库存状态',
                align: 'center',
                formatter: function (value, row, index) {
                    return $.table.selectDictLabel(inventoryStatus, value);
                }
            }]
    });

    $("#form-task-emptyIn").validate({
        submitHandler: function(form) {
            var destContainerCode=$("#destContainerCode").val();
            if(destContainerCode==''){
                $.modal.alertError("请填写目的托盘编号");
                return;
            }
            let rows =  $("#bootstrap-table").bootstrapTable('getSelections');
            //console.log(rows);
            var ids = "";
            for (var i = 0; i<rows.length; i++){
                ids += rows[i].id;
                ids += ",";
            }
            ids= ids.substring(0, ids.length-1);
            $.ajax({
                url:prefix_header + "/conformContainerSave",
                type:"post",
                data:{
                    "destContainerCode":destContainerCode,
                    "detailIdList":ids,
                },
                success:function (result) {
                    console.log(result)
                    if (result.code == web_status.SUCCESS) {
                        //layer.close()
                        //layer.close(index);
                        $.modal.close();
                        $.modal.alertSuccess(result.msg);
                    } else if (result.code == web_status.WARNING) {
                        //layer.close(index);
                        $.modal.enable();
                        $.modal.alertWarning(result.msg)
                    } else {
                        //layer.close(index);
                        $.modal.enable();
                        $.modal.alertError(result.msg);
                    }
                }
            });
        }
    });

</script>
</body>
</html>