19 package org.turro.erp.task;
21 import java.util.Comparator;
22 import java.util.HashSet;
23 import org.turro.erp.entity.OrderItem;
24 import org.turro.erp.entity.OrderReference;
25 import org.turro.erp.entity.ReceiptItem;
26 import org.turro.erp.entity.RequiredUsage;
27 import org.turro.erp.entity.Task;
28 import org.turro.erp.entity.WorkOrder;
29 import org.turro.util.CompareUtil;
35 public class ReceiptItemAdapter extends HashSet<ReceiptItem> implements Comparator<ReceiptItem> {
43 for(
Task task : or.getTasks()) {
49 private void addReceipts(
Task task) {
51 double units = ru.getEstimatedUnits(),
52 expected = ru.getExpectedUnits();
56 if(units > expected) {
57 OrderItem oi = ru.startOrder(ru.convertToReal(units - expected));
58 ru.getOrderItems().add(oi);
65 private void generateReceipts(OrderItem oi) {
66 double oexpected = oi.getExpectedUnits(),
67 oreal = oi.getRealUnits();
68 if(oexpected > oreal) {
69 ReceiptItem ri = oi.startReceipt(
null, oi.convertToReal(oexpected - oreal));
70 oi.getReceiptItems().add(ri);
72 addAll(oi.getReceiptItems());
77 return CompareUtil.compare(getStringId(o1), getStringId(o2));
RequiredUsage getOwnerRequiredUsage()
OrderReference getOrderReference()
Set< RequiredUsage > getRequiredUsages()
Set< OrderReference > getOrderReferences()
int compare(ReceiptItem o1, ReceiptItem o2)
ReceiptItemAdapter(Task task)
ReceiptItemAdapter(WorkOrder workOrder)