<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header">
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 select-info">
            <form id="inventory-form">
                <div class="select-list">
                    <ul>
                        <li>
                            入库单编码:<input type="text" name="receiptCode" id="receiptCode"/>
                        </li>
                        <div id="tips" style="position: absolute;left: 280px;top: 40px;"></div>
                        <li>
                            出库单编码:<input type="text" name="shipmentCode" id="shipmentCode"/>
                        </li>
                        <li>
                            物料编码:<input type="text" name="materialCode"/>
                        </li>
                        <li>
                            物料名称:<input type="text" name="materialName"/>
                        </li>
                        <li>
                            物料规格:<input type="text" name="materialSpec"/>
                        </li>
                        </li>
                        <li class="time">
                            <label>创建时间: </label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="createdBegin"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="createdEnd"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" id="btn"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('inventory-form')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <!--   入库详情     -->
        <div class="col-sm-12 select-info">
            <div id="toolbar1">入库详情</div>
            <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover text-nowrap table-primary" ></table>
        </div>
        <!--   入库组盘详情     -->
        <div class="col-sm-12 select-info">
            <div id="toolbar2">入库组盘详情</div>
            <table id="bootstrap-table2" data-mobile-responsive="true" class="table table-bordered table-hover text-nowrap table-success" ></table>
        </div>
        <!--   入库任务详情     -->
        <div class="col-sm-12 select-info">
            <div id="toolbar3">入库任务详情</div>
            <table id="bootstrap-table3" data-mobile-responsive="true" class="table table-bordered table-hover text-nowrap table-danger" ></table>
        </div>
        <!--   库存交易     -->
        <div class="col-sm-12 select-info">
            <div id="toolbar7">库存交易</div>
            <table id="bootstrap-table7" data-mobile-responsive="true" class="table table-bordered table-hover text-nowrap table-danger" ></table>
        </div>
        <!--   出库详情     -->
        <div class="col-sm-12 select-info">
            <div id="toolbar4">出库详情</div>
            <table id="bootstrap-table4" data-mobile-responsive="true" class="table table-bordered table-hover text-nowrap table-info" ></table>
        </div>
        <!--   出库组盘详情     -->
        <div class="col-sm-12 select-info">
            <div id="toolbar5">出库组盘详情</div>
            <table id="bootstrap-table5" data-mobile-responsive="true" class="table table-bordered table-hover text-nowrap table-dark" ></table>
        </div>
        <!--   出库任务详情     -->
        <div class="col-sm-12 select-info">
            <div id="toolbar6">出库任务详情</div>
            <table id="bootstrap-table6" data-mobile-responsive="true" class="table table-bordered table-hover text-nowrap table-warning" ></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var prefix = ctx + "inventoryAll";
    var inventoryStatus=[[${@dict.getType('inventorySts')}]];
    var receiptHeaderStatus=[[${@dict.getType('receiptHeaderStatus')}]];
    var shipmentHeaderStatus=[[${@dict.getType('shipmentHeaderStatus')}]];
    var receiptContainerHeaderStatus=[[${@dict.getType('receiptContainerHeaderStatus')}]];
    var shipmentContainerHeaderStatus=[[${@dict.getType('shipmentContainerHeaderStatus')}]];
    var taskStatus=[[${@dict.getType('taskStatus')}]];
    $("#bootstrap-table").bootstrapTable({
        url: prefix + "/receiptDetail",
        showRefresh: true, //刷新
        showToggle:true, //视图切换
        showColumns:true, //列选择
        clickToSelect: true,
        sortName: "id",
        sortOrder: "desc",
        showExport: true,
        exportDataType: "all",
        pageNumber: 1,
        pageSize: 10,
        pageList: [10, 25, 50],
        toolbar: '#toolbar1',
        toolBarAlign:'left',
        columns: [
            {
                field : 'id',
                title : '单据明细id'
            },
            {
                field : 'receiptCode',
                title : '入库单编码'
            },
            {
                field : 'referCode',
                title : 'ERP单号',
                visible: false
            },
            {
                field : 'totalQty',
                title : '总数'
            },
            {
                field : 'openQty',
                title : '已收数量'
            },
            {
                field : 'materialCode',
                title : '物料编码'
            },
            {
                field : 'materialName',
                title : '物料名称'
            },
            {
                field : 'materialSpec',
                title : '物料规格',
                visible: false
            },
            {
                field : 'materialUnit',
                title : '物料单位',
                visible: false
            },
           
            {
                field : 'lot',
                title : '批次',
                visible: false
            },
            {
                field : 'batch',
                title : '批号',
                visible: false
            },
            {
                field : 'warehouseCode',
                title : '仓库编码',
                visible: false
            },
            {
                field : 'companyCode',
                title : '货主编码',
                visible: false
            },
            {
                field : 'processStamp',
                title : '状态' ,
                align: 'center',
                formatter: function(value, row, index) {
                    return $.table.selectDictLabel(receiptHeaderStatus, value);
                }
            },
            {
                field : 'created',
                title : '创建时间'
            },
            {
                field : 'createdBy',
                title : '创建人'
            }
        ],
        theadClasses: "thead-light"
    });
    $("#bootstrap-table2").bootstrapTable({
        url: prefix + "/receiptContainerDetail",
        showRefresh: true, //刷新
        showToggle:true, //视图切换
        showColumns:true, //列选择
        clickToSelect: true,
        sortName: "id",
        sortOrder: "desc",
        showExport: true,
        exportDataType: "all",
        pageNumber: 1,
        pageSize: 10,
        pageList: [10, 25, 50],
        toolbar: '#toolbar2',
        toolBarAlign:'left',
        columns: [
            {
                field : 'id',
                title : '组盘明细id'
            },
            {
                field : 'receiptContainerId',
                title : '组盘头id'
            },
            {
                field : 'receiptDetailId',
                title : '单明细id'
            },
            {
                field : 'receiptCode',
                title : '入库单编码'
            },
            {
                field : 'qty',
                title : '组盘数'
            },
            {
                field : 'materialCode',
                title : '物料编码'
            },
            {
                field : 'materialName',
                title : '物料名称'
            },
            {
                field : 'materialSpec',
                title : '物料规格',
                visible: false
            },
            {
                field : 'materialUnit',
                title : '物料单位',
                visible: false
            },
           
            {
                field : 'locationCode',
                title : '库位号'
            },
            {
                field : 'containerCode',
                title : '托盘号'
            },
            {
                field : 'warehouseCode',
                title : '仓库编码',
                visible: false
            },
            {
                field : 'companyCode',
                title : '货主编码',
                visible: false
            },
            {
                field : 'status',
                title : '状态' ,
                align: 'center',
                formatter: function(value, row, index) {
                    return $.table.selectDictLabel(receiptContainerHeaderStatus, value);
                }
            },
            {
                field : 'created',
                title : '创建时间'
            },
            {
                field : 'createdBy',
                title : '创建人'
            }
        ],
        theadClasses: "thead-blue"
    });
    $("#bootstrap-table3").bootstrapTable({
        url: prefix + "/receiptTaskDetail",
        showRefresh: true, //刷新
        showToggle:true, //视图切换
        showColumns:true, //列选择
        clickToSelect: true,
        sortName: "id",
        sortOrder: "desc",
        showExport: true,
        exportDataType: "all",
        pageNumber: 1,
        pageSize: 10,
        pageList: [10, 25, 50],
        toolbar: '#toolbar3',
        toolBarAlign:'left',
        columns: [
            {
                field : 'id',
                title : '任务明细id'
            },
            {
                field : 'taskId',
                title : '任务id'
            },
            {
                field : 'billCode',
                title : '入库单编码'
            },
            {
                field : 'qty',
                title : '任务数量'
            },
            {
                field : 'materialCode',
                title : '物料编码'
            },
            {
                field : 'materialName',
                title : '物料名称'
            },
            {
                field : 'materialSpec',
                title : '物料规格',
                visible: false
            },
            {
                field : 'materialUnit',
                title : '物料单位',
                visible: false
            },
           
            {
                field : 'fromLocation',
                title : '源库位'
            },
            {
                field : 'toLocation',
                title : '终库位'
            },
            {
                field : 'containerCode',
                title : '托盘号'
            },
            {
                field : 'warehouseCode',
                title : '仓库编码',
                visible: false
            },
            {
                field : 'companyCode',
                title : '货主编码',
                visible: false
            },
            {
                field : 'status',
                title : '状态' ,
                align: 'center',
                formatter: function(value, row, index) {
                    return $.table.selectDictLabel(taskStatus, value);
                }
            },
            {
                field : 'created',
                title : '创建时间'
            },
            {
                field : 'createdBy',
                title : '创建人'
            }
        ]
    });
    $("#bootstrap-table4").bootstrapTable({
        url: prefix + "/shipmentDetail",
        showRefresh: true, //刷新
        showToggle:true, //视图切换
        showColumns:true, //列选择
        clickToSelect: true,
        sortName: "id",
        sortOrder: "desc",
        showExport: true,
        exportDataType: "all",
        pageNumber: 1,
        pageSize: 10,
        pageList: [10, 25, 50],
        toolbar: '#toolbar4',
        toolBarAlign:'left',
        columns: [
            {
                field : 'id',
                title : '单据明细id'
            },
            {
                field : 'shipmentCode',
                title : '出库单编码'
            },
            {
                field : 'referCode',
                title : 'ERP单号',
                visible: false
            },
            {
                field : 'shipQty',
                title : '总数'
            },
            {
                field : 'requestQty',
                title : '已出数量'
            },
            {
                field : 'materialCode',
                title : '物料编码'
            },
            {
                field : 'materialName',
                title : '物料名称'
            },
            {
                field : 'materialSpec',
                title : '物料规格',
                visible: false
            },
            {
                field : 'materialUnit',
                title : '物料单位',
                visible: false
            },
           
            {
                field : 'lot',
                title : '批次',
                visible: false
            },
            {
                field : 'batch',
                title : '批号',
                visible: false
            },
            {
                field : 'warehouseCode',
                title : '仓库编码',
                visible: false
            },
            {
                field : 'companyCode',
                title : '货主编码',
                visible: false
            },
            {
                field : 'status',
                title : '状态' ,
                align: 'center',
                formatter: function(value, row, index) {
                    return $.table.selectDictLabel(shipmentHeaderStatus, value);
                }
            },
            {
                field : 'created',
                title : '创建时间'
            },
            {
                field : 'createdBy',
                title : '创建人'
            }
        ]
    });
    $("#bootstrap-table5").bootstrapTable({
        url: prefix + "/shipmentContainerDetail",
        showRefresh: true, //刷新
        showToggle:true, //视图切换
        showColumns:true, //列选择
        clickToSelect: true,
        sortName: "id",
        sortOrder: "desc",
        showExport: true,
        exportDataType: "all",
        pageNumber: 1,
        pageSize: 10,
        pageList: [10, 25, 50],
        toolbar: '#toolbar5',
        toolBarAlign:'left',
        columns: [
            {
                field : 'id',
                title : '组盘明细id'
            },
            {
                field : 'shippingContainerId',
                title : '组盘头id'
            },
            {
                field : 'shipmentDetailId',
                title : '单明细id'
            },
            {
                field : 'shipmentCode',
                title : '出库单编码'
            },
            {
                field : 'qty',
                title : '组盘数'
            },
            {
                field : 'materialCode',
                title : '物料编码'
            },
            {
                field : 'materialName',
                title : '物料名称'
            },
            {
                field : 'materialSpec',
                title : '物料规格',
                visible: false
            },
            {
                field : 'materialUnit',
                title : '物料单位',
                visible: false
            },
           
            {
                field : 'locationCode',
                title : '库位号'
            },
            {
                field : 'containerCode',
                title : '托盘号'
            },
            {
                field : 'warehouseCode',
                title : '仓库编码',
                visible: false
            },
            {
                field : 'companyCode',
                title : '货主编码',
                visible: false
            },
            {
                field : 'status',
                title : '状态' ,
                align: 'center',
                formatter: function(value, row, index) {
                    return $.table.selectDictLabel(shipmentContainerHeaderStatus, value);
                }
            },
            {
                field : 'created',
                title : '创建时间'
            },
            {
                field : 'createdBy',
                title : '创建人'
            }
        ]
    });
    $("#bootstrap-table6").bootstrapTable({
        url: prefix + "/shipmentTaskDetail",
        showRefresh: true, //刷新
        showToggle:true, //视图切换
        showColumns:true, //列选择
        clickToSelect: true,
        sortName: "id",
        sortOrder: "desc",
        showExport: true,
        exportDataType: "all",
        pageNumber: 1,
        pageSize: 10,
        pageList: [10, 25, 50],
        toolbar: '#toolbar6',
        toolBarAlign:'left',
        columns: [
            {
                field : 'id',
                title : '任务明细id'
            },
            {
                field : 'taskId',
                title : '任务id'
            },
            {
                field : 'billCode',
                title : '出库单编码'
            },
            {
                field : 'qty',
                title : '任务数量'
            },
            {
                field : 'materialCode',
                title : '物料编码'
            },
            {
                field : 'materialName',
                title : '物料名称'
            },
            {
                field : 'materialSpec',
                title : '物料规格',
                visible: false
            },
            {
                field : 'materialUnit',
                title : '物料单位',
                visible: false
            },
           
            {
                field : 'fromLocation',
                title : '源库位'
            },
            {
                field : 'toLocation',
                title : '终库位'
            },
            {
                field : 'containerCode',
                title : '托盘号'
            },
            {
                field : 'warehouseCode',
                title : '仓库编码',
                visible: false
            },
            {
                field : 'companyCode',
                title : '货主编码',
                visible: false
            },
            {
                field : 'status',
                title : '状态' ,
                align: 'center',
                formatter: function(value, row, index) {
                    return $.table.selectDictLabel(taskStatus, value);
                }
            },
            {
                field : 'created',
                title : '创建时间'
            },
            {
                field : 'createdBy',
                title : '创建人'
            }
        ]
    });
    $("#bootstrap-table7").bootstrapTable({
        showRefresh: true, //刷新
        showToggle:true, //视图切换
        showColumns:true, //列选择
        clickToSelect: true,
        sortName: "id",
        sortOrder: "desc",
        showExport: true,
        exportDataType: "all",
        pageNumber: 1,
        pageSize: 10,
        pageList: [10, 25, 50],
        toolbar: '#toolbar7',
        toolBarAlign:'left',
        columns: [
            {
                field : 'billDetailId',
                title : '出入库单明细id'
            },
            {
                field : 'billCode',
                title : '出入库单编码'
            },
            {
                field : 'taskQty',
                title : '任务数量'
            },
            {
                field : 'materialCode',
                title : '物料编码'
            },
            {
                field : 'materialName',
                title : '物料名称'
            },
            {
                field : 'materialSpec',
                title : '物料规格',
                visible: false
            },
            {
                field : 'materialUnit',
                title : '物料单位',
                visible: false
            },
            {
                field : 'locationCode',
                title : '库位'
            },
            {
                field : 'containerCode',
                title : '托盘号'
            },
            {
                field : 'warehouseCode',
                title : '仓库编码',
                visible: false
            },
            {
                field : 'companyCode',
                title : '货主编码',
                visible: false
            },
            {
                field : 'created',
                title : '创建时间'
            },
            {
                field : 'createdBy',
                title : '创建人'
            }
        ]
    });

    function sousuo(){
        debugger;
        if(!$("input[name='receiptCode']").val()&&!$("input[name='shipmentCode']").val()){
            layer.tips("输入入库单或出库单号!","#tips",{tips:[3,"rgb(28,132,198)"],time:1000,area:'auto'})
        }
        if($("input[name='receiptCode']").val()&&$("input[name='shipmentCode']").val()){
            $.modal.msg("暂时不支持关系查询,请只输入一项!");
            // layer.tips("或输入入库单号!","#receiptCode",{tips:[3,"rgb(28,132,198)"],time:1000,area:'auto'})
            layer.tips("输入入库单或出库单号!","#tips",{tips:[3,"rgb(28,132,198)"],time:1000,area:'auto'})
        }
        $("#bootstrap-table").bootstrapTable('removeAll');
        $("#bootstrap-table2").bootstrapTable('removeAll');
        $("#bootstrap-table3").bootstrapTable('removeAll');
        $("#bootstrap-table4").bootstrapTable('removeAll');
        $("#bootstrap-table5").bootstrapTable('removeAll');
        $("#bootstrap-table6").bootstrapTable('removeAll');
        $("#bootstrap-table7").bootstrapTable('removeAll');
        $.ajax({
            url: prefix+"/getData",
            type:'post',
            data:{
                "receiptCode":$("input[name='receiptCode']").val(),
                "shipmentCode":$("input[name='shipmentCode']").val(),
                // "referCode":$("input[name='referCode']").val(),
                "materialCode":$("input[name='materialCode']").val(),
                "materialName":$("input[name='materialName']").val(),
                "materialSpec":$("input[name='materialSpec']").val(),
                "createdBegin":$("input[name='createdBegin']").val(),
                "createdEnd":$("input[name='createdEnd']").val()
            },
            success : function(value) {
                debugger;
                if(value.receiptDetails.length==0){
                    $.modal.msgError("没有查到数据,请重试...");
                }
                $("#bootstrap-table").bootstrapTable('load',value.receiptDetails);
                $("#bootstrap-table2").bootstrapTable('load',value.receiptContainerDetails);
                $("#bootstrap-table3").bootstrapTable('load',value.receiptTaskDetails);
                $("#bootstrap-table4").bootstrapTable('load',value.shipmentDetails);
                $("#bootstrap-table5").bootstrapTable('load',value.shipmentContainerDetails);
                $("#bootstrap-table6").bootstrapTable('load',value.shipmentTaskDetails);
                $("#bootstrap-table7").bootstrapTable('load',value.inventoryTranactions);
                lanse();
            },
            error : function (value) {
                $.modal.msg("服务器错误,请重试...");
            }
        })
    }

    function hongse() {
        //鼠鼻红 合欢红 春梅红 香叶红 艳红 玉红
        $(".table-primary th").css({backgroundColor:"rgb(227,180,184)"});
        $(".table-success th").css({backgroundColor:"rgb(240,161,168)"});
        $(".table-danger th").css({backgroundColor:"rgb(241,147,156)"});
        $(".table-info th").css({backgroundColor:"rgb(240,124,130)"});
        $(".table-dark th").css({backgroundColor:"rgb(237,90,101)"});
        $(".table-warning th").css({backgroundColor:"rgb(192,72,81)"});
        $(".th-inner").css({color:"black"});
    }

    function lanse() {
        //秋波蓝 碧青 涧石蓝 鸢尾蓝 釉蓝 潮蓝
        $(".table-primary th").css({backgroundColor:"rgb(138,188,209)"});
        $(".table-success th").css({backgroundColor:"rgb(92,179,204)"});
        $(".table-danger th").css({backgroundColor:"rgb(102,169,201)"});
        $(".table-info th").css({backgroundColor:"rgb(21,139,184)"});
        $(".table-dark th").css({backgroundColor:"rgb(23,129,181)"});
        $(".table-warning th").css({backgroundColor:"rgb(41,131,187)"});
        $(".th-inner").css({color:"black"});
    }

    $("#btn").click(function() {
        if($("#btn").hasClass("btn-primary")){
            $("#btn").removeClass("btn-primary").css({backgroundColor : "rgb(128,128,128)" });
            sousuo();
            setTimeout(function(){
                $("#btn").addClass("btn-primary").removeAttr("style");
            },1000);
        }
    });

    window.onload=hongse;
</script>
</body>
</html>