AGVconfirm.html 5.02 KB
<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<style>
    .grid{
        display: inline-block;
        width: 40px;
        height: 40px;
        border: 1px solid #0e9aef;
        margin: 1px 2px;
        font-size: 10px;
    }
</style>
<body>
<div class="wrapper wrapper-content animated fadeInRight ibox-content" style="text-align: center">
    <!--<form class="form-horizontal m">-->
        <!--<div class="form-group">-->
            <!--<label class="col-sm-3 control-label">X轴:</label>-->
            <!--<div class="col-sm-8">-->
                <!--<select id="row" name="row" class="form-control">-->
                    <!--<option value="">自动</option>-->
                <!--</select>-->
            <!--</div>-->
        <!--</div>-->
        <!--<div class="form-group">-->
            <!--<label class="col-sm-3 control-label">Y轴:</label>-->
            <!--<div class="col-sm-8">-->
                <!--<select id="line" name="line" class="form-control">-->
                    <!--<option value="">自动</option>-->
                <!--</select>-->
            <!--</div>-->
        <!--</div>-->
        <!--<div class="col-sm-12 select-info">-->
            <!--style="width: 100%;overflow-x: scroll;white-space:nowrap"-->
            <div id="borderCol">
                <div class="location" id="location">
                    <!--<div class="grid"></div>-->
                </div>
            </div>
            <div class="form-group">
                <div class="form-control-static col-sm-offset-9">
                    <input type="button"  onclick="removeSubmit()" class="btn btn-primary" value="自动回库">
                    <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
                </div>
            </div>
        <!--</div>-->
    <!--</form>-->
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
    var prefix = ctx + "receipt/AgvReceiving";
    var station=window.parent.station;
    var row=0,line=0;
    var stationCode=window.parent.$("#stationInfo").attr("data-station");
    function removeSubmit() {
        $.ajax({
                url:prefix+'/TaskAssigns',
                type:'post',
                data:{
                    taskType:1,
                    station:stationCode
                    // row:row,
                    // line:line
                },
                success:function(res){
                    if(res.code===200){
                        $.modal.msgSuccess(res.msg);
                    }
                    else{
                        $.modal.msgError(res.msg);
                    }
                }
            })
    }
    function changeMargin(){
        let box_width=document.getElementById("location").offsetWidth;
        box_width=box_width-80;
        let grid_width=box_width/line;
        $(".grid").css({"width":grid_width,"height":grid_width});
    }
    function gridMsg(msg){
        let $j=$(msg);
        let row=$j.attr("data-row");
        let line=$j.attr("data-line");
        row=parseInt(row);
        line=parseInt(line);
        $.ajax({
                url:prefix+'/TaskAssigns',
                type:'post',
                data:{
                    taskType:1,
                    row:row,
                    line:line,
                    station:stationCode

                },
                success:function(res){
                    if(res.code===200){
                        $.modal.msgSuccess(res.msg);
                    }
                    else{
                        $.modal.msgError(res.msg);
                    }
                }
            })
    }
    $(function () {
        window.onresize = function(){
            changeMargin();
        };
        changeMargin();
        $.ajax({
            url:prefix+'/address',
            type:'post',
            success:function(res){
                if(res){
                    row=res.data.row;
                    line=res.data.line;
                    for (let j = row; j > 0; j--) {
                        $(".location").append("<br>");
                        for (let k = line; k > 0; k--) {
                            $(".location").append("<div data-row="+ j +" data-line="+k+" class='grid' onclick='gridMsg(this)'>"+ j +","+ k +"</div>");
                        }
                    }
                    $.ajax({
                        url:prefix+'/EmptyAddress' ,
                        type:'post' ,
                        success:function(res){
                            if(res){
                                for (let i = 0; i < res.data.length; i++) {
                                    let dom=$("[data-row="+res.data[i].row+"][data-line="+res.data[i].line+"]");
                                    dom.attr("style","background-color:rgb(100,168,24)");
                                }
                            }
                        }
                    })
                }
            }
        })
    })
</script>
</body>
</html>