lkMenu.html 18.6 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526
<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<style>
    .table-striped-left {
        width: 67%;
    }
    .table-striped-right {
        width: 32%;
        float: right;
    }

    .left,.right{
        height: 480px;
    }

    #stationInfo{
        font-size:20px;
        line-height:30px;
        color:rgb(28,132,198);
        font-weight:800;
        font-family:FangSong;
    }

    .select-list li{
        margin: 2px;
    }

    #Grids{
        width: 100%;
        margin-top: 45px;
        padding-left: 5%;
    }

    .grid{
        /*display: flex;*/
        display: -webkit-box;
        -webkit-box-pack:center;
        -webkit-box-align:center;
        -webkit-box-orient: vertical;
        width: 180px;
        height:60px;
        background-color: #4F94CD;
        margin: 2px 20px 0 0;
        border-radius: 5px;
        text-align: center;
        text-overflow:ellipsis;
        /*overflow-y: scroll;*/
    }
    .grid span{
        font-size:1vh;
    }
    .form-font label,.form-font input{
        font-size: 18px;
        font-weight: 800;
        padding-right: 0;
    }
    .toolbox-btn a{
        width: 16%;
    }
</style>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <!--<div class="col-sm-9 select-info table-striped-left "  style="padding-top: 20px">-->
            <div class="wrapper wrapper-content animated fadeInRight ibox-content">
                <form class="form-horizontal m form-font" id="form-inventoryTransaction-add" style="transform: scale(1.2);padding-top: 20px;">
                    <div class="form-group" style="display: none;">
                        <label class="col-sm-3 control-label">id:</label>
                        <div class="col-sm-8">
                            <input id="id" name="id" class="form-control" type="text" readonly>
                        </div>
                    </div>
                    <div class="form-group" style="display: none">
                        <label class="col-sm-3 control-label">taskId:</label>
                        <div class="col-sm-8">
                            <input id="taskId" name="taskId" class="form-control" type="text" readonly>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">容器编码:</label>
                        <div class="col-sm-2">
                            <input id="containerCode" name="containerCode" class="form-control" type="text" style="font-size: 16px">
                        </div>
                        <label class="col-sm-2 control-label">仓库:</label>
                        <div class="col-sm-4">
                            <input id="uWarehouseName" name="uWarehouseName" class="form-control" type="text" readonly>
                        </div>
                    </div>
                    <div class="form-group">
                    <label class="col-sm-2 control-label">单号:</label>
                        <div class="col-sm-8">
                            <input id="sourceCode" name="sourceCode" class="form-control" type="text" readonly>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">存货编码:</label>
                        <div class="col-sm-8">
                            <input id="materialCode" name="materialCode" class="form-control" type="text" readonly>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">存货代码:</label>
                        <div class="col-sm-8">
                            <input id="barCode" name="barCode" class="form-control" type="text" readonly>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">物料名称:</label>
                        <div class="col-sm-8">
                            <input id="materialName" name="materialName" class="form-control" type="text" readonly>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">规格型号:</label>
                        <div class="col-sm-8">
                            <input id="specification" name="specification" class="form-control" type="text" readonly>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">任务类型:</label>
                        <div class="col-sm-1">
                            <span id="type" name="type" class="form-control" type="text" readonly>
                        </span>
                        </div>
                        <label class="col-sm-1 control-label">数量:</label>
                        <div class="col-sm-2">
                            <input id="num" name="num" class="form-control" type="text" >
                        </div>
                        <label class="col-sm-2 control-label">剩余库存:</label>
                        <div class="col-sm-2">
                            <input id="remainder" name="remainder" class="form-control" type="text" readonly >
                        </div>
                    </div>
                    <div class="form-group" style="text-align: right">
                        <div class="col-sm-7 toolbox-btn" style="text-align: right">
                            <a class="btn btn-primary btn-success btn-sm" onclick="Complete()">上下料完成</a>
                            <a class="btn btn-primary btn-info btn-sm" onclick="replenIn()"  id="trans-btnss">补充入库</a>
                            <a class="btn btn-primary btn-info btn-sm" onclick="emptyIn()"  id="trans-btns">空托入库</a>
                            <a class="btn btn-primary btn-danger btn-sm" onclick="emptyOut()" id="cans-btn">空托出库</a>
<!--                            <a class="btn btn-primary btn-danger btn-sm" onclick="replaceClick()"  id="replace-btn">更换容器</a>-->
                        </div>
                    </div>
                </form>
            <!--</div>-->
        </div>
        <div class="col-sm-12 select-info bottom" >
            <table id="bootstrap-table1" data-mobile-responsive="true" class="table table-bordered  table-hover"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var prefix = ctx + "task/lkMenuTask";
    var prefixs = ctx + "inventory/inventoryHeader";
    var taskTypes=[[${@dict.getType('taskType')}]];
    var company =[[${@companyService.getCode()}]];
    var ID;

    $("#bootstrap-table").bootstrapTable({
        iconSize: "outline",
        toolbar: "#toolbar",
        showRefresh: true,//刷新
        showToggle:true, //视图切换
        clickToSelect: true,
        showColumns:true, //列选择
        showExport: true, //导出
        exportDataType: "all", //导出类型basic', 'all', 'selected'.当前页、所有数据、选中数据
        modalName: "入库组盘头",
        pagination: true,   // 是否显示分页(*)
        pageNumber: 1,                                      // 初始化加载第一页,默认第一页
        pageSize: 50,                                       // 每页的记录行数(*)
        pageList: [10, 25, 50,100],
        contentType: "application/x-www-form-urlencoded",
        onRefresh:function(){
            getGoodsShelfNo();
            getTable2();
        },
        onClickRow:function(row){
            $("#id").val(row.id);
            $("#taskId").val(row.taskId);
            $("#uWarehouseName").val(row.uWarehouseName);
            $("#sourceCode").val(row.referenceCode);
            $("#materialCode").val(row.materialCode);
            $("#barCode").val(row.materialOldCode);
            $("#materialName").val(row.materialName);
            $("#specification").val(row.materialSpec);
            $("#containerCode").val(row.containerCode);
            $("#warehouseQty").val(row.warehouseQty);
            $("#num").val(row.qty);
            $("#remainder").val(row.remainder);
        },
        columns: [
            {
                radio: true
            },
            {
                title: '操作',
                align: 'center',
                events:'operateEvents',
                formatter: function(value, row, index) {
                    var actions = [];
                    actions.push('<a id="cancel" class="btn btn-success btn-lg " href="#" onclick="Complete(\'' + row.id + '\',\'' + row.taskId + '\')"><i class="fa fa-edit"></i>完成</a> ');
                    return actions.join('');
                }
            },
            {
                field : 'lastUpdatedBy',
                title : '操作人',
                sortable: true
            },
            {
                field : 'materialCode',
                title : '存货编码',
                sortable: true
            },
            {
                field : 'materialOldCode',
                title : '存货代码',
                sortable: true
            },
            {
                field : 'materialName',
                title : '物料名称',
                sortable:true
            },
            {
                field : 'materialSpec',
                title : '规格',
                sortable: true
            },
            {
                field : 'containerCode',
                title : '容器编码',
                sortable:true
            },
            {
                field : 'qty',
                title : '数量'
            },
            {
                field : 'referenceCode',
                title : 'U8单据',
                sortable: true
            },
            {
                field : 'companyName',
                title : '货主',
                sortable: true
            },
            {
                field : 'uWarehouseName',
                title : 'u8仓库',
                sortable: true
            },
            {
                field : 'taskType',
                title : '任务类型' ,
                align: 'center',
                sortable: true,
                formatter: function(value, row, index) {
                    return $.table.selectDictLabel(taskTypes, value);
                }

            },

            {
                field : 'warehouseQty',
                title : '库存'
            },
        ]
    });

    $("#bootstrap-table1").bootstrapTable({
        iconSize: "outline",
        toolbar: "#toolbar",
        showRefresh: true,//刷新
        showToggle:true, //视图切换
        clickToSelect: true,
        showColumns:true, //列选择
        showExport: true, //导出
        exportDataType: "all", //导出类型basic', 'all', 'selected'.当前页、所有数据、选中数据
        modalName: "入库组盘头",
        pagination: true,   // 是否显示分页(*)
        pageNumber: 1,                                      // 初始化加载第一页,默认第一页
        pageSize: 50,                                       // 每页的记录行数(*)
        pageList: [10, 25, 50,100],
        contentType: "application/x-www-form-urlencoded",
        columns: [
            {
                radio: true
            },
            {
                field : 'lastUpdatedBy',
                title : '操作人',
                sortable: true
            },
            {
                field : 'materialCode',
                title : '存货编码',
                sortable: true
            },
            {
                field : 'materialOldCode',
                title : '存货代码',
                sortable: true
            },
            {
                field : 'materialName',
                title : '物料名称',
                sortable:true
            },
            {
                field : 'materialSpec',
                title : '规格',
                sortable: true
            },
            {
                field : 'containerCode',
                title : '容器编码',
                sortable:true
            },
            {
                field : 'qty',
                title : '数量'
            },
            {
                field : 'referenceCode',
                title : 'U8单据',
                sortable: true
            },
            {
                field : 'companyCode',
                title : '货主',
                sortable: true,
                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 : 'uWarehouseName',
                title : 'u8仓库',
                sortable: true
            },
            {
                field : 'taskType',
                title : '任务类型' ,
                align: 'center',
                sortable: true,
                formatter: function(value, row, index) {
                    return $.table.selectDictLabel(taskTypes, value);
                }

            },
            {
                field : 'warehouseQty',
                title : '库存'
            },
        ]
    });

    $(function () {
        //监听浏览器宽度的改变
        window.onresize = function(){
            resize();
        };
        resize();
        // getTable2();

        //货架input
        $("#containerCode").bind('input propertychange keypress',function (e) {
            let theEvent = e || window.event;
            let code = theEvent.keyCode || theEvent.which || theEvent.charCode;
            if (code === 13) {
                e.preventDefault();
                //回车执行查询
                getContainerCode();
                getTable2()
            }
        });
    });

    // 重新加载
    function reload(code, msg){
        debugger;
        $("#containerCode").val(code);
        getContainerCode();
        getTable2()
        $.modal.msgSuccess(msg);
    }

    //完成
    function Complete(id, taskId) {
        let url = ctx + 'task/lkMenuTask/completeTaskByLK',Id=id||$("#id").val(),TaskId=taskId||$("#taskId").val();
        let num=$("#num").val()||null,data = { "id" : Id ,"taskId":TaskId ,"num":num };
        // $.operate.post(url, data);
        $.ajax({
            url,
            data,
            type: 'post',
            success: function(res) {
                $.operate.ajaxSuccess(res);
                getContainerCode();
                getTable2();
            }
        });
        $("#containerCode").focus();
    }

    //表2
    function getTable2(){
        let containerCode=$("#containerCode").val();
        $.ajax({
            url:prefix+'/getLkTasks',
            type:'post',
            data:{
                containerCode:containerCode
            },
            success:function (res) {
                if(res.length){
                    $("#bootstrap-table1").bootstrapTable('load',res)
                }
                else {
                    $("#bootstrap-table1").bootstrapTable('removeAll');
                }
            }
        })
    }

    function resize(){
        $("#containerCode").focus();
    }

    //货架
    function getContainerCode() {
        $("#bootstrap-table1").bootstrapTable('removeAll');
        resize();
        let containerCode=$("#containerCode").val();
        if(containerCode){
            $.ajax({
                url:prefix+'/getLkTasks',
                type:'post',
                data:{
                    containerCode:containerCode,
                },
                success:function (res) {
                    if (res.length>0){
                        $("#id").val(res[0].id);
                        $("#taskId").val(res[0].taskId);
                        $("#uWarehouseName").val(res[0].uWarehouseName);
                        $("#sourceCode").val(res[0].referenceCode);
                        $("#materialCode").val(res[0].materialCode);
                        $("#barCode").val(res[0].materialOldCode);
                        $("#materialName").val(res[0].materialName);
                        $("#specification").val(res[0].materialSpec);
                        $("#warehouseQty").val(res[0].warehouseQty);
                        $("#type").html($.table.selectDictLabel(taskTypes, res[0].taskType));
                        $("#num").val(res[0].qty);
                        $("#remainder").val(res[0].remainder);
                    }
                    else{
                        $("#id").val('');
                        $("#taskId").val('');
                        $("#uWarehouseName").val('');
                        $("#sourceCode").val('');
                        $("#materialCode").val('');
                        $("#barCode").val('');
                        $("#materialName").val('');
                        $("#specification").val('');
                        $("#warehouseQty").val('');
                        $("#type").val('');
                        $("#num").val('');
                        $("#remainder").val('');
                        $("#bootstrap-table1").bootstrapTable('removeAll');
                    }
                    resize()
                }
            });
        }
        else{
            layer.tips('请输入容器号!','#containerCode',{tips:[1,"rgb(28,132,198)"],time:1000,area:'auto',maxWidth: '1000'})
        }
    }

    function emptyIn() {
        $.modal.open("空托盘入库",prefixs+"/emptyIn")
    }

    function replenIn() {
        $.modal.open("补充入库",prefix+"/replenIn")
    }



    function emptyOut() {
        $.modal.open("空托盘出库",prefixs+"/emptyOut")
    }

    function replaceClick(){
        var rows = $("#bootstrap-table1").bootstrapTable('getOptions').data;
        if (rows.length == 0) {
            $.modal.alertWarning("任务详情不存在!");
            return;
        }
        var ids = "";
        for(var i=0; i<rows.length; i++) {
            ids = ids + rows[i].id + ","
        }
        var code = $('#containerCode').val();
        var url = prefix+"/replaceContainer/"+ code+"/"+ids;
        $.modal.open("更换容器", url);
    }



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