18 package org.turro.erp.workorder;
20 import java.util.Collection;
21 import java.util.Collections;
22 import java.util.List;
23 import javax.persistence.Query;
24 import org.turro.string.Strings;
25 import org.turro.elephant.db.WhereClause;
26 import org.turro.erp.db.ErpPU;
27 import org.turro.erp.entity.WorkOrder;
28 import org.turro.jpa.Dao;
29 import org.turro.plugin.filter.IFilterValue;
30 import org.turro.zkoss.grid.GroupExtended;
31 import org.zkoss.zul.Grid;
32 import org.zkoss.zul.Group;
40 private long lastId = 0;
53 return q.getResultList();
55 return Collections.EMPTY_LIST;
63 if(lastId == 0 || lastId != getGroupId(workOrder)) {
64 lastId = getGroupId(workOrder);
68 grid.getRows().appendChild(group);
72 grid.getRows().appendChild(group);
77 private WhereClause createCriteria(List<IFilterValue> values) {
79 wc.
addClause(
"select distinct wo from WorkOrder as wo");
80 wc.
addClause(
"left join wo.orderReferences as r");
85 wc.
addClause(
"order by wo.productId, wo.contractId, wo.workOrderDate, wo.workOrderId");
89 private long getGroupId(WorkOrder workOrder) {
90 if(workOrder.getProductId() > 0) {
91 return -workOrder.getProductId();
92 }
else if(workOrder.getContractId() > 0) {
93 return workOrder.getContractId();
void setNamedParameters(Query q)
void addClause(String clause)
void checkGroup(Grid grid, WorkOrder workOrder, boolean open)
Collection< WorkOrder > getWorkOrders(List< IFilterValue > values)
String getFullDescription()
String getProductString()
Query createQuery(String query)