this.coreManager = coreManager;
}
@Get("json")
public SgwtRestResponseBase getRepresent(){
SgwtRestFetchResponseBase resp = null;
Integer roId = RequestUtil.getInteger(getRequestAttributes().get("roId"));
List<ReceivingOrderDetail> details = coreManager.getReceivingOrderDetails(roId);
List<DisplayReceivingOrderDetail> resultList = new ArrayList<DisplayReceivingOrderDetail>();
for (ReceivingOrderDetail receivingOrderDetail : details) {
ProductMeasurement productMeasurement = null;
if(receivingOrderDetail.getPoDetail().getProduct().getProductMeasurement() != null && !receivingOrderDetail.getPoDetail().getProduct().getProductMeasurement().isEmpty()){
productMeasurement = receivingOrderDetail.getPoDetail().getProduct().getProductMeasurement().iterator().next();
}
DisplayReceivingOrderDetail det = mapper.map(receivingOrderDetail, DisplayReceivingOrderDetail.class);
det.setCostPrice(receivingOrderDetail.getPoDetail().getProduct().getBuying().getCostPrice());
if(productMeasurement != null){
det.getPoDetail().getProduct().setProductMeasurement(mapper.map(productMeasurement, DisplayProductMeasurement.class));
}
resultList.add(det);
}
resp = new SgwtRestFetchResponseBase(resultList);
return resp;
}