* @throws ProTransException
*/
private void doPackage(final OrderLine orderLine, final String aColliName)
throws ProTransException {
String currentColliName = aColliName != null ? aColliName : colliName;
ColliManager colliManager = (ColliManager) ModelUtil
.getBean("colliManager");
OrderLineManager orderLineManager = (OrderLineManager) ModelUtil
.getBean("orderLineManager");
Colli colli;
if (orderLine.getPostShipment() != null) {
colli = colliManager.findByNameAndPostShipment(currentColliName,
orderLine.getPostShipment());
} else {
colli = colliManager.findByNameAndOrder(currentColliName, orderLine
.getOrder());
}
if (colli == null) {
if (orderLine.getPostShipment() != null) {
colli = new Colli(null, null, currentColliName, null, null,
null, orderLine.getPostShipment(), null, Util
.getCurrentDate());
} else {
colli = new Colli(null, orderLine.getOrder(), currentColliName,
null, null, null, null, null, Util.getCurrentDate());
}
} else {
colliManager.lazyLoad(colli, new LazyLoadEnum[][] { {
LazyLoadEnum.ORDER_LINES, LazyLoadEnum.NONE } });
}
colli.addOrderLine(orderLine);
colliManager.saveColli(colli);
orderLine.setColli(colli);
orderLineManager.saveOrderLine(orderLine);
checkCompleteness(colli, true);