availVO = (BookedItemQtyVO) availRows.get(0);
if (availVO.getAvailableQtyWAR03().doubleValue()>=vo.getQtyDOC02().doubleValue()) {
// unload item from the specified warehouse...
res = loadSaleDocRowBean.loadSaleDocRow(
variant1Descriptions,variant2Descriptions,variant3Descriptions,variant4Descriptions,variant5Descriptions,
new SaleDocRowPK(
vo.getCompanyCodeSys01DOC02(),
vo.getDocTypeDOC02(),
vo.getDocYearDOC02(),
vo.getDocNumberDOC02(),
vo.getItemCodeItm01DOC02(),
vo.getVariantTypeItm06DOC02(),
vo.getVariantCodeItm11DOC02(),
vo.getVariantTypeItm07DOC02(),
vo.getVariantCodeItm12DOC02(),
vo.getVariantTypeItm08DOC02(),
vo.getVariantCodeItm13DOC02(),
vo.getVariantTypeItm09DOC02(),
vo.getVariantCodeItm14DOC02(),
vo.getVariantTypeItm10DOC02(),
vo.getVariantCodeItm15DOC02()
),
serverLanguageId,
username
);
if (res.isError()) {
throw new Exception(res.getErrorMessage());
}
detailVO = (DetailSaleDocRowVO)((VOResponse)res).getVo();
WarehouseMovementVO movVO = new WarehouseMovementVO(
detailVO.getProgressiveHie01DOC02(),
vo.getQtyDOC02(),
vo.getCompanyCodeSys01DOC02(),
docVO.getWarehouseCodeWar01DOC01(),
vo.getItemCodeItm01DOC02(),
ApplicationConsts.WAREHOUSE_MOTIVE_DIRECTLY_UNLOAD,
ApplicationConsts.ITEM_GOOD,
t2+" "+docVO.getDocTypeDOC01()+"/"+docVO.getDocNumberDOC01()+"/"+docVO.getDocYearDOC01(),
detailVO.getSerialNumbers(),
vo.getVariantCodeItm11DOC02(),
vo.getVariantCodeItm12DOC02(),
vo.getVariantCodeItm13DOC02(),
vo.getVariantCodeItm14DOC02(),
vo.getVariantCodeItm15DOC02(),
vo.getVariantTypeItm06DOC02(),
vo.getVariantTypeItm07DOC02(),
vo.getVariantTypeItm08DOC02(),
vo.getVariantTypeItm09DOC02(),
vo.getVariantTypeItm10DOC02()
);
res = movBean.addWarehouseMovement(movVO,t15,serverLanguageId,username);
if (res.isError()) {
throw new Exception(res.getErrorMessage());
}
}
else {
throw new Exception(t1);
}
}
else {
throw new Exception(t1);
}
}
} // end if SALE_DESK_DOC_TYPE (check item availabilities...)
// check if this document is a sale invoice and has a linked sale document:
// if this is the case, then the linked document will be updated...
if ((docVO.getDocTypeDOC01().equals(ApplicationConsts.SALE_INVOICE_FROM_DN_DOC_TYPE) ||
docVO.getDocTypeDOC01().equals(ApplicationConsts.SALE_INVOICE_FROM_SD_DOC_TYPE)) &&
docVO.getDocNumberDoc01DOC01()!=null
) {
SaleDocPK refPK = new SaleDocPK(
docVO.getCompanyCodeSys01Doc01DOC01(),
docVO.getDocTypeDoc01DOC01(),
docVO.getDocYearDoc01DOC01(),
docVO.getDocNumberDoc01DOC01()
);
// retrieve ref. document item rows...
GridSaleDocRowVO vo = null;
DetailSaleDocRowVO refDetailVO = null;
BigDecimal qty = null;
BigDecimal invoiceQty = null;
String docType = null;
BigDecimal docYear = null;
BigDecimal docNumber = null;
BigDecimal rowNumber = null;
for(int i=0;i<rows.size();i++) {
vo = (GridSaleDocRowVO)rows.get(i);
res = loadSaleDocRowBean.loadSaleDocRow(
variant1Descriptions,variant2Descriptions,variant3Descriptions,variant4Descriptions,variant5Descriptions,
new SaleDocRowPK(
docVO.getCompanyCodeSys01Doc01DOC01(),
docVO.getDocTypeDoc01DOC01(),
docVO.getDocYearDoc01DOC01(),
docVO.getDocNumberDoc01DOC01(),
vo.getItemCodeItm01DOC02(),