for(i=0;i<list.size();i++) {
availVO = (ItemAvailabilityVO)list.get(i);
availability = availability.add(availVO.getAvailableQtyWAR03());
}
if (availability.doubleValue()<qty.doubleValue()) {
return new VOResponse(
compVO.getItemCodeItm01DOC24()+" "+
t1+".\n"+
t2+": "+availability.doubleValue()+" "+
t3+": "+qty.doubleValue()
);
}
// the current component is available: it will be removed...
i=0;
while(qty.doubleValue()>0) {
availVO = (ItemAvailabilityVO)list.get(i);
if (qty.doubleValue()>availVO.getAvailableQtyWAR03().doubleValue()) {
delta = availVO.getAvailableQtyWAR03();
qty = qty.subtract(delta);
}
else {
delta = qty;
qty = new BigDecimal(0);
}
// insert record in DOC24...
compVO.setProgressiveHie01DOC24(availVO.getProgressiveHie01WAR03());
compVO.setLocationDescriptionSYS10(availVO.getLocationDescriptionSYS10());
pstmt2.setString(1, vo.getCompanyCodeSys01DOC22());
pstmt2.setBigDecimal(2, vo.getDocYearDOC22());
pstmt2.setBigDecimal(3, vo.getDocNumberDOC22());
pstmt2.setString(4, compVO.getItemCodeItm01DOC24());
pstmt2.setBigDecimal(5, delta);
pstmt2.setBigDecimal(6, compVO.getProgressiveHie01DOC24());
pstmt2.setString(7,username);
pstmt2.setTimestamp(8,new java.sql.Timestamp(System.currentTimeMillis()));
pstmt2.execute();
// create a warehouse movement...
movVO = new WarehouseMovementVO(
availVO.getProgressiveHie01WAR03(),
delta,
vo.getCompanyCodeSys01DOC22(),
vo.getWarehouseCodeWar01DOC22(),
compVO.getItemCodeItm01DOC24(),
ApplicationConsts.WAREHOUSE_MOTIVE_UNLOAD_BY_PRODUCTION,
ApplicationConsts.ITEM_GOOD,
t4+" "+vo.getDocSequenceDOC22()+"/"+vo.getDocYearDOC22(),
serialNumbers,
compVO.getVariantCodeItm11DOC24(),
compVO.getVariantCodeItm12DOC24(),
compVO.getVariantCodeItm13DOC24(),
compVO.getVariantCodeItm14DOC24(),
compVO.getVariantCodeItm15DOC24(),
compVO.getVariantTypeItm06DOC24(),
compVO.getVariantTypeItm07DOC24(),
compVO.getVariantTypeItm08DOC24(),
compVO.getVariantTypeItm09DOC24(),
compVO.getVariantTypeItm10DOC24()
);
res = mov.addWarehouseMovement(movVO,t5,serverLanguageId,username);
if (res.isError()) {
throw new Exception(res.getErrorMessage());
}
i++;
}
}
rset.close();
pstmt2.close();
Hashtable usedComponents = new Hashtable();
Hashtable usedComponentsVO = new Hashtable();
for(int j=0;j<components.size();j++) {
compVO = (ProdOrderComponentVO)components.get(j);
usedComponents.put(compVO.getItemCodeItm01DOC24(),compVO.getQtyDOC24());
usedComponentsVO.put(compVO.getItemCodeItm01DOC24(),compVO);
}
res = insertProductComponents(conn,vo,products,usedComponents,usedComponentsVO,compAltCodes,serverLanguageId,username,imagePath);
if (res.isError()) {
throw new Exception(res.getErrorMessage());
}
return new VOResponse(new BigDecimal(docSequenceDOC22));
}
catch (Throwable ex) {
Logger.error(username,this.getClass().getName(),"executeCommand","Error while confirming a production order",ex);
try {
if (this.conn==null && conn!=null)