Package org.jallinone.production.orders.java

Examples of org.jallinone.production.orders.java.ProdOrderProductVO


      }


      // fill in comps hashtable with the collection of required components...
      ItemPK pk = null;
      ProdOrderProductVO prodVO = null;
      ArrayList components = null;
      MaterialVO compVO = null;
      Response res = null;
      ProdOrderComponentVO componentVO = null;
      Hashtable comps = new Hashtable(); // collection of <component item code,ProdOrderComponentVO object>
      for(int i=0;i<products.size();i++) {
        // retrieve bill of materials for each product...
        prodVO = (ProdOrderProductVO)products.get(i);
        pk = new ItemPK(prodVO.getCompanyCodeSys01DOC23(),prodVO.getItemCodeItm01DOC23());
        res = BillOfMaterialsUtil.getBillOfMaterials(conn,compCurr,pk,serverLanguageId,username,new ArrayList());
        if (res.isError()) {
          throw new Exception(res.getErrorMessage());
        }

        // extract components only (leaf nodes)...
        components = getComponents((DefaultMutableTreeNode) ((TreeModel)((VOResponse)res).getVo()).getRoot() );
        for(int j=0;j<components.size();j++) {
          compVO = (MaterialVO)components.get(j);
          componentVO = (ProdOrderComponentVO)comps.get(compVO.getItemCodeItm01ITM03());
          if (componentVO==null) {
            componentVO = new ProdOrderComponentVO();
            comps.put(compVO.getItemCodeItm01ITM03(),componentVO);
            componentVO.setAvailableQty(new BigDecimal(0));
            componentVO.setCompanyCodeSys01DOC24(compVO.getCompanyCodeSys01ITM03());
            componentVO.setDescriptionSYS10(compVO.getDescriptionSYS10());
            componentVO.setDocNumberDOC24(prodVO.getDocNumberDOC23());
            componentVO.setDocYearDOC24(prodVO.getDocYearDOC23());
            componentVO.setItemCodeItm01DOC24(compVO.getItemCodeItm01ITM03());
            componentVO.setMinSellingQtyUmCodeReg02ITM01(compVO.getMinSellingQtyUmCodeReg02ITM01());
            componentVO.setQtyDOC24(new BigDecimal(0));
          }
          componentVO.setQtyDOC24(componentVO.getQtyDOC24().add(compVO.getQtyITM03().multiply(prodVO.getQtyDOC23())));
        }
      }


      // check components availability in the specified warehouse...
      Enumeration en = comps.keys();
      GridParams gridParams = new GridParams();
      gridParams.getOtherGridParams().put(ApplicationConsts.COMPANY_CODE_SYS01,prodVO.getCompanyCodeSys01DOC23());
      gridParams.getOtherGridParams().put(ApplicationConsts.WAREHOUSE_CODE,prodVO.getWarehouseCodeWar01DOC22());
      gridParams.getOtherGridParams().put(ApplicationConsts.LOAD_ALL,Boolean.TRUE);
      ItemAvailabilityVO availVO = null;
      BigDecimal availability,altAvailability,delta;
      String itemCode = null;
      ArrayList list,availList;
      AltComponentVO altVO = null;
      ArrayList alternativeComps = new ArrayList();
      ArrayList compsToRemove = new ArrayList();
      ProdOrderComponentVO altComponentVO = null;
      HashSet altCodes = null; // list of alternative component item codes...
      BigDecimal altQty = null;
      while(en.hasMoreElements()) {
        itemCode = en.nextElement().toString();
        componentVO = (ProdOrderComponentVO)comps.get(itemCode);

        gridParams.getOtherGridParams().put(ApplicationConsts.ITEM_PK,new ItemPK(prodVO.getCompanyCodeSys01DOC23(),itemCode));
        res = avail.loadItemAvailabilities(variant1Descriptions,variant2Descriptions,variant3Descriptions,variant4Descriptions,variant5Descriptions,gridParams,serverLanguageId,username,companiesList);
        if (res.isError())
          throw new Exception(res.getErrorMessage());

        availList = new ArrayList(((VOListResponse)res).getRows());
        componentVO.setAvailabilities(availList);
        availability = new BigDecimal(0);
        for(int i=0;i<availList.size();i++) {
          availVO = (ItemAvailabilityVO)availList.get(i);
          availability = availability.add(availVO.getAvailableQtyWAR03());
        }
        componentVO.setAvailableQty(availability);

        if (componentVO.getQtyDOC24().doubleValue()>componentVO.getAvailableQty().doubleValue()) {
          // check if there exist some alternative component...
          res = bean.loadAltComponents(gridParams,serverLanguageId,username);
          if (res.isError())
            throw new Exception(res.getErrorMessage());

          list = new ArrayList(((VOListResponse)res).getRows());
          for(int i=0;i<list.size();i++) {
            altVO = (AltComponentVO)list.get(i);
            gridParams.getOtherGridParams().put(ApplicationConsts.ITEM_PK,new ItemPK(prodVO.getCompanyCodeSys01DOC23(),altVO.getItemCodeItm01ITM04()));
            res = avail.loadItemAvailabilities(variant1Descriptions,variant2Descriptions,variant3Descriptions,variant4Descriptions,variant5Descriptions,gridParams,serverLanguageId,username,companiesList);
            if (res.isError())
              throw new Exception(res.getErrorMessage());

            availList = new ArrayList(((VOListResponse)res).getRows());
            altAvailability = new BigDecimal(0);
            for(int j=0;j<availList.size();j++) {
              availVO = (ItemAvailabilityVO)availList.get(j);
              altAvailability = altAvailability.add(availVO.getAvailableQtyWAR03());
            }
            if (altAvailability.doubleValue()>0) {
              altComponentVO = new ProdOrderComponentVO();
              altComponentVO.setAvailabilities(availList);
              altComponentVO.setAvailableQty(altAvailability);
              altComponentVO.setCompanyCodeSys01DOC24(altVO.getCompanyCodeSys01ITM04());
              altComponentVO.setDescriptionSYS10(altVO.getDescriptionSYS10());
              altComponentVO.setDocNumberDOC24(prodVO.getDocNumberDOC23());
              altComponentVO.setDocYearDOC24(prodVO.getDocYearDOC23());
              altComponentVO.setItemCodeItm01DOC24(altVO.getItemCodeItm01ITM04());
              altComponentVO.setMinSellingQtyUmCodeReg02ITM01(altVO.getMinSellingQtyUmCodeReg02ITM01());
              altQty = conv.convertQty(
                  altVO.getMinSellingQtyUmCodeReg02ITM01(),
                  componentVO.getMinSellingQtyUmCodeReg02ITM01(),
View Full Code Here


           "insert into DOC26_PRODUCTION_OPERATIONS(COMPANY_CODE_SYS01,DOC_YEAR,DOC_NUMBER,ITEM_CODE_ITM01,PHASE_NUMBER,"+
           "OPERATION_CODE,OPERATION_DESCRIPTION,VALUE,DURATION,MANUFACTURE_TYPE,COMPLETION_PERC,QTY,TASK_CODE,TASK_DESCRIPTION,"+
           "MACHINERY_CODE,MACHINERY_DESCRIPTION,SUBST_OPERATION_CODE,SUBST_OPERATION_DESCRIPTION,NOTE,CREATE_USER,CREATE_DATE) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
       );

       ProdOrderProductVO prodVO = null;
       Response res = null;
       TreeModel model = null;
       DefaultMutableTreeNode root;
       int sequence = 0;
       HashSet subProductsAlreadyAdded = new HashSet();
       for(int i=0;i<products.size();i++) {
         prodVO = (ProdOrderProductVO)products.get(i);
         // retrieve bill of materials for each product...
         res = BillOfMaterialsUtil.getBillOfMaterials(conn,compCurr,new ItemPK(prodVO.getCompanyCodeSys01DOC23(),prodVO.getItemCodeItm01DOC23()),serverLanguageId,username,new ArrayList());
         if (res.isError())
           throw new Exception(res.getErrorMessage());
         model = (TreeModel)((VOResponse)res).getVo();
         root = (DefaultMutableTreeNode)model.getRoot();
View Full Code Here

      java.util.List products = ((VOListResponse)res).getRows();


      // add created products to warehouse locations...
      ItemPK pk = null;
      ProdOrderProductVO prodVO = null;
      WarehouseMovementVO movVO = null;
      ArrayList serialNumbers = new ArrayList();
      for(int i=0;i<products.size();i++) {
        prodVO = (ProdOrderProductVO)products.get(i);

        // create a warehouse movement...
        movVO = new WarehouseMovementVO(
          prodVO.getProgressiveHie01DOC23(),
          prodVO.getQtyDOC23(),
          vo.getCompanyCodeSys01DOC22(),
          vo.getWarehouseCode2War01DOC22(),
          prodVO.getItemCodeItm01DOC23(),
          ApplicationConsts.WAREHOUSE_MOTIVE_LOAD_BY_PRODUCTION,
          ApplicationConsts.ITEM_GOOD,
          t1+" "+vo.getDocSequenceDOC22()+"/"+vo.getDocYearDOC22(),
          serialNumbers,
View Full Code Here


      CheckComponentsAvailability bean = (CheckComponentsAvailability)JAIOBeanFactory.getInstance().getBean(CheckComponentsAvailability.class);
      GridParams gridParams = (GridParams)inputPar;;
      ArrayList products = (ArrayList)gridParams.getOtherGridParams().get(ApplicationConsts.PRODUCTS);
        ProdOrderProductVO prodVO = (ProdOrderProductVO)products.get(0);
        VariantDescriptionsVO vo = (VariantDescriptionsVO)((JAIOUserSessionParameters)userSessionPars).getVariantDescriptionsVO().get(prodVO.getCompanyCodeSys01DOC23());
      Response answer = bean.checkComponentsAvailability(vo.getVariant1Descriptions(),vo.getVariant2Descriptions(),vo.getVariant3Descriptions(),vo.getVariant4Descriptions(),vo.getVariant5Descriptions(),new HashMap(),products,((JAIOUserSessionParameters)userSessionPars).getServerLanguageId(),userSessionPars.getUsername(),companiesList);

      return answer;
    }
    catch (Throwable ex) {
View Full Code Here

TOP

Related Classes of org.jallinone.production.orders.java.ProdOrderProductVO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.