}
calculateHeader();
}
public void setQty(String itemSkuCd, int qty) throws Exception {
ShipDetail shipDetail = null;
boolean found = false;
Iterator<?> iterator = shipHeader.getShipDetails().iterator();
while (iterator.hasNext()) {
shipDetail = (ShipDetail) iterator.next();
if (shipDetail.getOrderItemDetail().getItemSkuCd().equals(itemSkuCd)) {
found = true;
break;
}
}
if (!found) {
shipDetail = new ShipDetail();
shipDetail.setRecCreateBy(user.getUserId());
shipDetail.setRecCreateDatetime(new Date());
iterator = orderHeader.getOrderItemDetails().iterator();
found = false;
while (iterator.hasNext()) {
OrderItemDetail orderItemDetail = (OrderItemDetail) iterator.next();
if (orderItemDetail.getItemSkuCd().equals(itemSkuCd)) {
shipDetail.setOrderItemDetail(orderItemDetail);
// orderItemDetail.getShipDetails().add(shipDetail);
found = true;
break;
}
}
if (!found) {
throw new OrderItemNotFoundException("");
}
shipDetail.setShipHeader(shipHeader);
iterator = shipHeader.getShipDetails().iterator();
int seqNum = 0;
while (iterator.hasNext()) {
ShipDetail s = (ShipDetail) iterator.next();
if (s.getSeqNum() > seqNum) {
seqNum = s.getSeqNum();
}
}
shipDetail.setSeqNum(seqNum);
shipHeader.getShipDetails().add(shipDetail);
}