storagePosFind.jsp 18.6 KB
<%@ page import="com.myproject.webapp.controller.webService.DataCache" %>
<%@ page import="java.util.Date" %><%--
  Created by IntelliJ IDEA.
  User: kangmor
  Date: 2015/12/4
  Time: 9:28
  To change this template use File | Settings | File Templates.
--%>
<%@ include file="/common/taglibs.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>

<c:if test="${screen != 'tablet'}">
    <!-- BEGIN PAGE HEADER-->
    <h3 class="page-title">
        <fmt:message key="menu.findout"/>
    </h3>
</c:if>

<!-- BEGIN PAGE CONTENT-->
<div class="row">
    <div class="col-md-12">
    <div class="portlet box blue">
        <c:if test="${screen != 'tablet'}">
            <div class="portlet-title">
                <div class="caption">
                        <%--<i class="fa fa-list-alt"></i><fmt:message key="component.list"/>--%>
                </div>
                <div class="tools">

                </div>
            </div>
        </c:if>
        <div class="portlet-body">
<!-- 正常展示-->
<c:if test='<%=!DataCache.isProductionFor("ChengDuKaiTian") %>'>

            <form:form commandName="searchCriteria" class="form-horizontal form-bordered" id="searchCriteria"
                       action="storagePosFind.html">
                <div class="form-group">
                    <label class="control-label col-md-1"><fmt:message key="inOutList.type"/></label>

                    <div class="col-md-2">
                        <form:select path="type" class="form-control">
                            <form:option value="-1"><fmt:message key="select.all"/></form:option>
                            <form:option value="0"><fmt:message key="inOutList.type.component"/></form:option>
                            <form:option value="1"><fmt:message key="inOutList.type.solder"/></form:option>
                            <form:option value="2"><fmt:message key="inOutList.type.pcb"/></form:option>
                            <form:option value="3"><fmt:message key="inOutList.type.others"/></form:option>
                            <form:option value="41"><fmt:message key="inOutList.type.solderFixture"/></form:option>
                            <form:option value="42"><fmt:message key="inOutList.type.pcbFixture"/></form:option>
                        </form:select>
                    </div>
                    <label class="control-label col-md-2"><fmt:message key="component.partNumber"/></label>

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

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

                    <div class="col-md-2">
                        <div style="text-align:left">
                            <form:input id="barcode" path="barcode" class="form-control"/>
                        </div>
                    </div>

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

            </form:form>

            <div class="table-toolbar">
                <div class="col-md-4">
                    <div class="btn-group">
                        <button class="btn yellow" id="checkoutBtn">
                            <i class="fa fa-sign-out"></i><fmt:message key="storagePosFind.outSelect"/></button>
                    </div>
                </div>
                <div class="col-md-5">
                    <c:if test="${screen != 'tablet'}">
                        <div class="input-inline input-medium right">
                            <div class="input-group">
                                <input id="day" type="text" value="3" class="form-control" style="display: block;text-align:right;">
                                <span class="input-group-addon"><fmt:message key="storagePosFind.daysAgo"/></span>
                                <span class="input-group-btn">
                                    <button class="btn green" type="button" id="inactionCheckOut"><i class="fa fa-check"></i><fmt:message key="storagePosFind.outInaction"/></button>
                                </span>
                            </div>
                        </div>
                    </c:if>
                </div>
            </div>
            <div class="table-scrollable">
                <c:set var="today" value="<%= new Date()%>"/>
                <display:table name="searchCriteria.pageList" requestURI="storagePosFind.html" sort="external"
                               defaultsort="1" class="table table-striped table-bordered table-hover" export="true"
                               id="pos" >
                    <display:setProperty name="export.csv.filename" value="export.csv" />
                    <c:set var="alarmClass" value=""/>
                    <c:if test="${pos.barcode.type == 1 && pos.barcode.maxStorageTime != 0 && pos.inStoreHour >= pos.barcode.maxStorageTime}">
                        <c:set var="alarmClass" value="alarmItem"/>
                    </c:if>
                    <c:if test="${pos.barcode.type == 2 && today >= pos.barcode.expireDate}">
                        <c:set var="alarmClass" value="alarmItem"/>
                    </c:if>
                    <c:set var="limitCheckOut" value="${pos.locked || (pos.barcode.maxStorageTime != 0 && pos.inStoreHour * 60 + pos.inStoreMiniute <= pos.barcode.warmTime * 60)}"/>
                    <display:column title="<input type='checkbox' id='allCheck'/>" media="html">
                        <c:if test="${!limitCheckOut}">
                            <input type="checkbox" name="posIds" value="${pos.id}" id="check${pos.id}" class="limit${pos.barcode.inFixture}"/>
                        </c:if>
                    </display:column>

                    <display:column titleKey="storagePosFind.index">${pos_rowNum}</display:column>
                    <display:column titleKey="component.partNumber" style="width: 15%;" sortProperty="barcode.partNumber" sortable="true" class="${alarmClass}">
                        ${pos.barcode.partNumber}
                    </display:column>

                    <display:column titleKey="inOutList.type">
                        <c:if test="${pos.barcode.type == 0 || empty pos.barcode.type}"><fmt:message key="inOutList.type.component"/></c:if>
                        <c:if test="${pos.barcode.type == 1}"><fmt:message key="inOutList.type.solder"/></c:if>
                        <c:if test="${pos.barcode.type == 2}"><fmt:message key="inOutList.type.pcb"/></c:if>
                        <c:if test="${pos.barcode.type == 3}"><fmt:message key="inOutList.type.others"/></c:if>
                        <c:if test="${pos.barcode.type == 4}"><fmt:message key="inOutList.type.fixture"/></c:if>
                    </display:column>
                    <c:if test="${screen != 'tablet'}">
                        <display:column property="barcode.barcode" titleKey="barcode.barcode"/>
                        <display:column property="barcode.inFixture" titleKey="storagePosFind.inFixture"/>
                        <display:column property="barcode.providerNumber" titleKey="component.providerNumber"/>
                        <%--<display:column property="barcode.amount" titleKey="数量"/>--%>
                        <display:column property="barcode.lockName" titleKey="menu.inRule"/>
                        <display:column property="posName" titleKey="checkOut.pos" sortProperty="posName" sortable="true"/>
                    </c:if>
                    <display:column titleKey="barcode.inStoreRemainTime" sortProperty="barcode.putInTime" sortable="true">
                        <c:if test="${pos.inStoreHour >= 1}">${pos.inStoreHour}<fmt:message key="solder.hour"/></c:if><c:if test="${pos.inStoreMiniute != 0}">${pos.inStoreMiniute}<fmt:message key="runStatus.minutes"/>
                        <c:if test="${pos.barcode.maxStorageTime != 0 }">
                            /${pos.barcode.maxStorageTime}<fmt:message key="solder.hour"/></c:if>
                    </c:if>
                    </display:column>

                    <display:column titleKey="component.amount">
                        <c:if test="${pos.barcode.type == 1 || pos.barcode.type == 4}">-</c:if>
                        <c:if test="${pos.barcode.type != 1 &&  pos.barcode.type != 4}">${pos.barcode.amount}</c:if>
                    </display:column>

                    <display:column titleKey="barcode.produceDate" sortProperty="barcode.produceDate" sortable="true">
                        <c:if test="${pos.barcode.type != 2}">-</c:if>
                        <c:if test="${pos.barcode.type == 2}"><fmt:formatDate value="${pos.barcode.produceDate}" pattern="yyyy-MM-dd"/></c:if>
                    </display:column>
                    <display:column titleKey="barcode.expireDate" sortProperty="barcode.expireDate" sortable="true">
                        <c:if test="${pos.barcode.type != 2}">-</c:if>
                        <c:if test="${pos.barcode.type == 2}"><fmt:formatDate value="${pos.barcode.expireDate}" pattern="yyyy-MM-dd"/></c:if>
                        <%--<fmt:formatDate value="${pos.barcode.expireDate}" pattern="yyyy-MM-dd"/>--%>
                    </display:column>
                    <display:column titleKey="checkOut.operate" media="html">
                        <c:if test="${!limitCheckOut}">
                            <button class="btn yellow limit${pos.barcode.inFixture}" id="btn${pos.id}"
                                    onclick="checkoutStorage('${pos.id}')">
                                <i class="fa fa-sign-out"></i><fmt:message key="button.checkout"/></button>
                        </c:if>
                    </display:column>
                    <c:if test="${limitCheckOut}">
                        <c:set var="limitCodes" value="${pos.barcode.inFixture},${limitCodes}"/>
                    </c:if>
                </display:table>
            </div>
</c:if>
            <!-- 成都凯天-->
<c:if test='<%=DataCache.isProductionFor("ChengDuKaiTian") %>'>
    <form:form commandName="searchCriteria" class="form-horizontal form-bordered" id="searchCriteria"
               action="storagePosFind.html">
        <div class="form-group">
            <label class="control-label col-md-1"><fmt:message key="产品型号"/></label>

            <div class="col-md-2">
                <input type="text" name="otherField2" class="form-control" value="${otherField2}"/>
            </div>

            <label class="control-label col-md-1"><fmt:message key="组件型号"/></label>

            <div class="col-md-2">
                <input type="text" name="otherField3" class="form-control" value="${otherField3}"/>
            </div>
            <label class="control-label col-md-1"><fmt:message key="配套单号"/></label>

            <div class="col-md-2">
                <input type="text" name="otherField1" class="form-control" value="${otherField1}"/>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-1"><fmt:message key="元件型号"/></label>

            <div class="col-md-2">
                <input type="text" name="otherField4" class="form-control" value="${otherField4}"/>
            </div>
            <label class="control-label col-md-1"><fmt:message key="检验编号"/></label>

            <div class="col-md-2">
                <input type="text" name="otherField5" class="form-control" value="${otherField5}"/>
            </div>

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

        </div>

    </form:form>

    <div class="table-toolbar">
        <div class="col-md-6">
            <div class="btn-group">
                <button class="btn yellow" id="checkoutBtn">
                    <i class="fa fa-sign-out"></i><fmt:message key="出库所选仓位"/></button>
            </div>
        </div>
        <div class="col-md-6">
            <c:if test="${screen != 'tablet'}">
                <div class="input-inline input-medium right">
                    <div class="input-group">
                        <input id="day" type="text" value="3" class="form-control" style="display: block;text-align:right;">
                        <span class="input-group-addon">天前</span>
                                <span class="input-group-btn">
                                    <button class="btn green" type="button" id="inactionCheckOut"><i class="fa fa-check"></i>呆滞料出库</button>
                                </span>
                    </div>
                </div>
            </c:if>
        </div>
    </div>
    <div class="table-scrollable">
        <display:table name="searchCriteria.pageList" requestURI="storagePosFind.html" sort="external"
                       defaultsort="1" class="table table-striped table-bordered table-hover" export="false"
                       id="pos">
            <c:set var="alarmClass" value=""/>
            <c:if test="${pos.barcode.type == 1 && pos.barcode.maxStorageTime != 0 && pos.inStoreHour >= pos.barcode.maxStorageTime}">
                <c:set var="alarmClass" value="alarmItem"/>
            </c:if>
            <c:set var="limitCheckOut" value="${pos.locked || (pos.barcode.maxStorageTime != 0 && pos.inStoreHour * 60 + pos.inStoreMiniute <= pos.barcode.warmTime * 60)}"/>
            <display:column title="<input type='checkbox' id='allCheck'/>">
                <c:if test="${!limitCheckOut}">
                    <input type="checkbox" name="posIds" value="${pos.id}" id="check${pos.id}" class="limit${pos.barcode.inFixture}"/>
                </c:if>
            </display:column>

            <display:column titleKey="序号">${pos_rowNum}</display:column>
            <display:column property="barcode.barcode" sortProperty="barcode.barcode" sortable="true" titleKey="条码"/>
            <display:column property="barcode.otherField2" sortProperty="barcode.otherField2" sortable="true" titleKey="产品型号"/>
            <display:column property="barcode.otherField3" sortProperty="barcode.otherField3" sortable="true" titleKey="组件型号"/>
            <display:column property="barcode.otherField1" sortProperty="barcode.otherField1" sortable="true" titleKey="配套单号"/>
            <display:column property="barcode.otherField4" sortProperty="barcode.otherField4" sortable="true" titleKey="元件型号"/>
            <display:column property="barcode.otherField5" sortProperty="barcode.otherField5" sortable="true" titleKey="检验编号"/>
            <display:column property="barcode.otherField6" titleKey="备注"/>
            <display:column property="barcode.amount" titleKey="数量"/>
            <display:column property="barcode.lockName" titleKey="入库策略"/>
            <display:column titleKey="在库/剩余时间" sortProperty="barcode.putInTime" sortable="true">
                <c:if test="${pos.inStoreHour >= 1}">${pos.inStoreHour}小时</c:if><c:if test="${pos.inStoreMiniute != 0}">${pos.inStoreMiniute}分钟
                <c:if test="${pos.barcode.maxStorageTime != 0 }">
                    /${pos.barcode.maxStorageTime}小时</c:if>
            </c:if>
            </display:column>

            <display:column titleKey="checkOut.operate">
                <c:if test="${!limitCheckOut}">
                    <button class="btn yellow limit${pos.barcode.inFixture}" id="btn${pos.id}"
                            onclick="checkoutStorage('${pos.id}')">
                        <i class="fa fa-sign-out"></i><fmt:message key="button.checkout"/></button>
                </c:if>
            </display:column>
            <c:if test="${limitCheckOut}">
                <c:set var="limitCodes" value="${pos.barcode.inFixture},${limitCodes}"/>
            </c:if>
        </display:table>
    </div>

</c:if>
        </div>
    </div>
    <!-- END EXAMPLE TABLE PORTLET-->
    </div>
    </div>






    <!-- END PAGE CONTENT-->
    <form method="get" action="${ctx}/service/store/checkout.html" id="checkoutForm">
        <input type="hidden" name="pid" id="pid"/>
    </form>

    <c:set var="scripts" scope="request">
        <script>

            var limitCodes = "${limitCodes}".split(",");
            for (i=0;i<limitCodes.length ;i++ ) {
                var limitClass = ".limit"+limitCodes[i];
                if(limitClass != ".limit"){
                    $(limitClass).remove();
                }
            }

            $('#allCheck').change(function () {
                var set = $("input[name=posIds]");
                var checked = jQuery(this).is(":checked");
                jQuery(set).each(function () {
                    if (checked) {
                        $(this).attr("checked", true);

                    } else {
                        $(this).attr("checked", false);
                    }
                });
                jQuery.uniform.update(set);
            });

            $("#checkoutBtn").click(function(){
                var str= "";
                $("[name=posIds]").each(function(){
                    if($(this).attr("checked")){
                        str+=$(this).val()+";";
                    }
                });
                if(str != "") {
                    checkoutStorage(str);
                }
            });

            $("#inactionCheckOut").click(function(){
                var dayStr = $("#day").val();
                var day = parseInt(dayStr);
                if (isNaN(day))
                {
                    alert("天数必须为数字");
                    return;
                }
                var result = confirm("确定要出库"+day+"天前(0天表示清空所有未指定批次的库存)的呆滞物料吗?");
                if(result){
                    $.post("${ctx}/service/store/inactionCheckOut", {aid: "1",day:day}, function (data) {
                        alert(data);
                    });
                }

            });

            function checkoutStorage(posId) {
                var ids = posId.split(";");
                for (var i=0;i<ids.length;i++)
                {
                    $("#btn"+ids[i]).attr("disabled","true");
                    $("#check"+ids[i]).parent().attr("class","hide");
                }
                $.post("${ctx}/service/store/checkout.html", {pids: posId}, function (data) {
                    alert(data);
                });
            }

            jQuery(".alarmItem").pulsate({
                color: "#bf1c56"
            });

        </script>
    </c:set>