outInfoSearch.jsp 20.2 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

<%@ include file="/common/taglibs.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>

<style type="text/css">

    .modal-body {
        position: relative;
        padding: 15px;
        height: 360px;
        overflow-y: scroll;
    }

    .td-item{
        display: block;
    }

</style>

    <!-- BEGIN PAGE HEADER-->
    <h3 class="page-title">
        <fmt:message key="需求单"/>
    </h3>


    <!-- BEGIN PAGE CONTENT-->
    <div class="row">
        <div class="col-md-12">
            <!-- BEGIN EXAMPLE TABLE PORTLET-->
            <div class="portlet box blue">
                <div class="portlet-title">
                    <div class="caption">
                        <i class="fa fa-list-alt"></i>
                    </div>
                    <div class="actions">

                        <a onclick="executeMergeOut()" class="btn btn-default btn-sm">
                            <i class="fa fa-sign-out"></i> <fmt:message key="合并出库"/> </a>
                    </div>
                </div>
                <div class="portlet-body">
                    <form id="searchCriteria" class="form-horizontal form-bordered" action="${ctx}/qisda/outInfoSearch.html" method="post">
                        <div class="form-group">

                            <label class="control-label col-md-1"><fmt:message key="需求单号"/></label>

                            <div class="col-md-2">
                                <div style="text-align:left" class="input-group">
                                    <input type="text" name="hSerial" class="form-control" value="${hSerial}"/>
                                </div>
                            </div>

                            <label class="control-label col-md-1"><fmt:message key="工单号"/></label>

                            <div class="col-md-2">
                                <div style="text-align:left" class="input-group">
                                    <input type="text" name="so" class="form-control" value="${so}"/>
                                </div>
                            </div>

                            <label class="control-label col-md-1"><fmt:message key="线别"/></label>
                            <div class="col-md-1">
                                <select class="form-control" name="line">
                                    <option value="">所有</option>
                                    <option value="NONE" <c:if test='${line=="NONE"}'>selected</c:if>>未定义</option>
                                    <c:forEach begin="1" end="30" var="lineStr">
                                        <c:set var="lineValue" value="SMT${lineStr}"/>
                                        <option value="${lineValue}" <c:if test='${line == lineValue}'>selected</c:if>>${lineValue}</option>
                                    </c:forEach>
                                </select>
                            </div>

                            <label class="control-label col-md-1"><fmt:message key="PN"/></label>

                            <div class="col-md-2">
                                <div style="text-align:left" class="input-group">
                                    <input type="text" name="reelId" class="form-control" value="${pn}"/>
                                </div>
                            </div>

                            <div class="col-md-1">
                                <button class="btn purple" type="submit"><i class="fa fa-search"></i>
                                    <fmt:message key="button.search"/>
                                </button>
                            </div>
                        </div>

                    </form>
                    <display:table name="searchCriteria.pageList" requestURI=""
                                   sort="external"
                                   defaultsort="1" class="table table-striped table-bordered table-hover" export="true" id="outInfo">
                        <display:setProperty name="export.csv.filename" value="outInfo.csv" />
                        <c:set var="endOutInfoClass" value=""/>
                        <c:if test="${outInfo.endOutInfo}">
                            <c:set var="endOutInfoClass" value="bg-yellow"/>
                        </c:if>
                        <c:set var="closedClass" value=""/>
                        <c:if test="${outInfo.closed}">
                            <c:set var="closedClass" value="closed"/>
                        </c:if>
                        <display:column titleKey="选择" sortable="true" sortProperty="hSerial" media="html">
                            <c:if test="${empty outInfo.mergehSerials && not empty outInfo.line  && (!outInfo.executing && !outInfo.sendEnd && !outInfo.closed)  }">
                            <input type="checkbox" name="checkbox2" value="${outInfo.hSerial} "/>
                            </c:if>
                        </display:column>
                        <display:column titleKey="需求单号" sortable="true" sortProperty="hSerial" media="html">
                            <a href="#" onclick="showDetail('${outInfo.hSerial}')">${outInfo.hSerial}</a>
                        </display:column>
                        <display:column titleKey="需求单号" property="hSerial" sortable="false" media="csv"/>
                        <display:column titleKey="动作" property="action" sortable="true" sortProperty="action" class="${endOutInfoClass}"/>
                        <display:column titleKey="工单" sortable="true" sortProperty="so">
                            ${outInfo.so}<c:if test="${outInfo.soseq != null}">(${outInfo.soseq})</c:if>
                        </display:column>
                        <display:column titleKey="线别" sortable="true" sortProperty="line" media="html">
                            <span id="${outInfo.hSerial}Line">${outInfo.line}</span>
                            <c:if test="${outInfo.firstExecuteTime <=0}">
                                <a href="#" onclick="changeLine('${outInfo.hSerial}')">[编辑]</a>
                            </c:if>

                        </display:column>
                        <%--<display:column titleKey="备料单号" property="refno" sortable="true" sortProperty="refno"/>--%>
                        <display:column titleKey="建议出仓时间" sortable="true" sortProperty="sdate">
                            <fmt:formatDate value="${outInfo.sdate}" pattern="yyyy-MM-dd HH:mm"/>
                        </display:column>
                        <display:column titleKey="必须出仓日期" sortable="true" sortProperty="mdate">
                            <fmt:formatDate value="${outInfo.mdate}" pattern="yyyy-MM-dd HH:mm"/>
                        </display:column>

                        <display:column titleKey="任务" sortable="true" sortProperty="taskNum">
                            ${outInfo.taskFinishNum}/${outInfo.taskNum}
                        </display:column>

                        <display:column titleKey="绑定数量" sortable="true" sortProperty="totalBindNum" class="${closedClass}">
                            ${outInfo.totalBindNum}
                            <c:if test="${!outInfo.closed}">
                                <a href="#" class="right" onclick="closeOut('${outInfo.hSerial}')" id="${outInfo.hSerial}Btn">
                                    [<fmt:message key="关闭"/>]
                                </a>
                            </c:if>
                        </display:column>

                        <display:column titleKey="创建时间" sortable="true" sortProperty="createDate" >
                            <fmt:formatDate value="${outInfo.createDate}" pattern="yyyy-MM-dd HH:mm"/>
                        </display:column>
                        <%--<display:column titleKey="更新时间" sortable="true" sortProperty="updateDate">--%>
                            <%--<fmt:formatDate value="${outInfo.updateDate}" pattern="yyyy-MM-dd HH:mm"/>--%>
                        <%--</display:column>--%>

                        <display:column titleKey="需求时间" sortable="true" sortProperty="taskNeedOutDate">
                            <fmt:formatDate value="${outInfo.taskNeedOutDate}" pattern="yyyy-MM-dd HH:mm"/>
                        </display:column>
<%--                        <display:column titleKey="状态" sortable="true" sortProperty="sendStatus" class="${closedClass}">--%>
<%--                            ${ outInfo.sendStatus  }--%>
<%--                        </display:column>--%>
                        <display:column titleKey="checkOut.operate" media="html" sortProperty="sendStatus" sortable="true">
                            <c:if test="${!outInfo.executing && stopJob}">
                                <c:if test="${(outInfo.urgentAction && outInfo.taskFinishNum != outInfo.taskNum) || (!outInfo.sendEnd && !outInfo.closed)}">
                                    <button class="btn yellow" id="btn${outInfo.hSerial}" onclick="executeOut('${outInfo.hSerial}')">
                                        <i class="fa fa-sign-out"></i><fmt:message key="button.checkout"/>
                                    </button>
                                </c:if>
                            </c:if>
                        </display:column>

                    </display:table>

                </div>
            </div>
            <!-- END EXAMPLE TABLE PORTLET-->
        </div>
    </div>

<div id="detail" class="modal fade" tabindex="-1" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog" style="margin-top: 10%;width:80%;margin-left:10%;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title"  style="margin:10px;">
                    <span id="detailTitle">&nbsp</span>
                </h4>
                <h7 class="modal-title"  style="margin:10px;">
                <span id="detailMergeInfo">&nbsp</span>
                 </h7>
                <input type="text" class="form-control filterInput" id="filterStr"/>
            </div>
            <div class="modal-body">
                <table class="table table-striped table-hover" id="itemsTable">
                    <thead>
                    <tr>
                        <th>
                            <fmt:message key="料站序号"/>
                        </th>
                        <th>
                            <fmt:message key="料站"/>
                        </th>
                        <th>
                            <fmt:message key="barcode.partNumber"/>
                        </th>
                        <th>
                            <fmt:message key="Facility"/>
                        </th>

                        <th>
                            <fmt:message key="reelID"/>
                        </th>
                        <th>
                            <fmt:message key="分盘料"/>
                        </th>

                        <th>
                            <fmt:message key="数量"/>
                        </th>
                        <th>
                            <fmt:message key="已绑定"/>
                        </th>
                        <th>
                            <fmt:message key="已出库"/>
                        </th>
                        <th>
                            <fmt:message key="已发料"/>
                        </th>
                        <th>
                            <fmt:message key="合并出库"/>
                        </th>
                    </tr>
                    </thead>
                    <tbody class="theItems">
                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <%--<button type="button" data-dismiss="modal" class="btn default" id="cancelAuthBtn">取消</button>--%>
            </div>
        </div>
    </div>
</div>

<div id="lineModifyWindow" class="modal fade" tabindex="-1" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog" style="margin-top: 10%;width:50%;margin-left:25%;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" style="font-weight: 500;">线别修改</h4>
            </div>
            <div class="modal-body" style="height:80px;overflow-y:hidden;">
                <div class="row">

                    <label class="control-label col-md-2"><fmt:message key="线别:"/></label>
                    <div class="input-group">
                        <input type="hidden" id="hSerialToModify" value=""/>
                        <select class="form-control" id="lineToModify">
                            <option value="">--</option>
                            <c:forEach begin="1" end="30" var="line">
                                <option value="SMT${line}">SMT${line}</option>
                            </c:forEach>
                        </select>
                    </div>
                    <h4>
                        <span id="lineErrorMsg" style="font-weight: 500;color:red;"></span>
                    </h4>

                </div>
            </div>
            <div class="modal-footer">
                <div>
                    <%--<a href="" class="btn yellow left" id="findAndOut"><i class="fa fa-sign-out"></i><fmt:message key="allBoxView.findAndOut"/></a>--%>

                    <button type="button" class="btn green" onclick="lineModifyOkClick();" >
                        <fmt:message key="button.save"/></button>
                    <button type="button" data-dismiss="modal" class="btn default" id="cancelAuthBtn"><fmt:message key="button.cancel"/></button>
                </div>
            </div>
        </div>
    </div>
</div>

<c:set var="scripts" scope="request">
    <script type="text/javascript">
        $(document).ready(function(){
            showDetail = function(hSerial){
                $(".filterInput").val("");
                $("#detailTitle").html(hSerial);
                $('#detailMergeInfo').html("");
                $("#theItems").html("");
                $.post("${ctx}/service/store/qisda/outDetail", {hSerial: hSerial}, function (outInfo) {

                    $("#detailTitle").html("需求单: "+ outInfo.hSerial + "  工单: " + outInfo.so + "  ["+outInfo.action+"]");
                    if(outInfo.mergehSerials+""==""){
                        $('#detailMergeInfo').hidden=true;
                    }else{
                        $('#detailMergeInfo').hidden=false;
                        $('#detailMergeInfo').html("    合并出库工单:"+outInfo.mergehSerials);
                    }
                    var data = outInfo.outItems;
                    var table = $('#itemsTable').DataTable();
                    table.clear();

                    for(var i in data){
                        //var index = parseInt(i) + 1;
                        var isFirstReelAction = data[i].firstReelAction;
                        var outColor = "bg-red";
                        if(data[i].outOk){
                            outColor = "bg-green";
                        }
                        var outQty = "<span class='"+outColor+" td-item'>"+data[i].outQty+"</span>";

                        var sendColor = "bg-red";
                        if(data[i].itemEnd){
                            sendColor = "bg-green";
                        }
                        var sendQty = "<span class='"+sendColor+" td-item'>"+data[i].sendQty+"</span>";

                        var realLockColor = "bg-red";
                        if(data[i].bindOk){
                            realLockColor = "bg-green";
                        }
                        var lockQty = data[i].realLockQty;
                        if(data[i].reelCutAction){
                            //分盘料,展示绑定/预绑定
                            lockQty = lockQty + "/" + data[i].lockQty;
                        }
                        var realLockQty = "<span class='"+realLockColor+" td-item'>"+lockQty+"</span>";

                        var isMergeOut=data[i].isMergeOut;
                        var noMergeStr="";
                        if(data[i].isMergeOut){
                            noMergeStr="已合并";
                        }

                        table.row.add( [ /*index,*/ data[i].slotlocation, data[i].slotStr, data[i].pn, data[i].facility,data[i].reelID,data[i].reelcut,data[i].qty,realLockQty,outQty,sendQty,noMergeStr] );
                    }
                    table.order( [ 0, 'asc' ] ).draw();

                });
                $("#detail").modal("show");
            }

            $('#itemsTable').dataTable( {
                "searching": false,
                "info": false,
                paging: false,
                "order": [[ 3, "asc" ]]
            } );

            executeOut = function (hSerial){
                $("#btn"+hSerial).attr("disabled","true");
                $.post("${ctx}/rest/api/dcs/executeOut", {hSerial: hSerial}, function (data) {
                    alert(data);
                });
            }

            executeMergeOut=function(){
                var hSerials="";
                var msgH="";
                var i=0;
                $("input[name='checkbox2']:checked").each(function(){
                    // alert("checkbox2组选中项的值:"+$(this).val());//遍历选中项的值
                    hSerials+=$(this).val()+",";
                    msgH+="\r\n"+$(this).val();
                    i++;
                });
                if(i>=2){
                    if(confirm("合并出库后不能取消,确定设置如下需求单为合并出库?"+msgH.toString()+"")){
                    // var hSerials=$("input[name='checkbox2']:checked");
                    $.post("${ctx}/rest/api/dcs/mergerOut", {hSerials: hSerials}, function (data) {
                        alert(data);
                    });

                    }
                }else{
                    alert("请选择至少两个需求单");
                }
            }

            closeOut = function(hSerial){
                Lobibox.confirm({
                    title: "确认",
                    msg: "确定要关闭并解绑需求单["+hSerial+"]吗?",
                    callback: function ($this, type, ev) {
                        if(type == 'yes'){
                            $.post("${ctx}/service/store/qisda/closeHSerial", {hSerial: hSerial}, function (data) {
                                if(data){
                                    Lobibox.alert("success",
                                            {
                                                msg: data
                                            });
                                    var btnId = "#" +hSerial + "Btn";
                                    $(btnId).hide();
                                }
                            });
                        }
                    }
                });
            }

            changeLine = function (hSerial){
                $("#hSerialToModify").val(hSerial);
                var oldLine = $("#lineToModify").text();
                $("#lineToModify").val(oldLine);
                $("#lineModifyWindow").modal("show");
            }

            lineModifyOkClick = function(){
                var line = $("#lineToModify").val();
                var hSerial = $("#hSerialToModify").val();
                $.post("${ctx}/rest/api/dcs/updateLine", {hSerial: hSerial, line: line}, function (data) {
                    $("#"+hSerial+"Line").html(line);
                    $("#lineModifyWindow").modal("hide");
                });
            }


            $(".filterInput").on('input propertychange',function(){
                var searchStr = $(this).val();
                $(".theItems").children().each(function(){
                    if(!searchStr || $(this).text().indexOf(searchStr) >= 0){
                        $(this).show();
                    }else{
                        $(this).hide();
                    }
                });
            });

            $(".closed").each(function(){
                var oldClass = $(this).parent().attr("class");
                $(this).parents("tr").attr("class",oldClass + " font-grey");
            });

        });
    </script>
</c:set>