Examples of AltComponentVO


Examples of org.jallinone.production.billsofmaterial.java.AltComponentVO

            JOptionPane.showMessageDialog(
              MDIFrame.getInstance(),
              ClientSettings.getInstance().getResources().getResource("you cannot set the current item as alternative component"),
              ClientSettings.getInstance().getResources().getResource("Attention"),
              JOptionPane.WARNING_MESSAGE);
            AltComponentVO compVO = (AltComponentVO)parentVO;
            compVO.setItemCodeItm01ITM04(null);
            compVO.setDescriptionSYS10(null);
          }
        }

        public void beforeLookupAction(ValueObject parentVO) {
          DetailItemVO vo = (DetailItemVO)ProductPanel.this.frame.getFormPanel().getVOModel().getValueObject();
View Full Code Here

Examples of org.jallinone.production.billsofmaterial.java.AltComponentVO

    Connection conn = null;
    try {
      if (this.conn==null) conn = getConn(); else conn = this.conn;
      stmt = conn.createStatement();

      AltComponentVO vo = null;
      for(int i=0;i<list.size();i++) {
        // phisically delete records in ITM04...
        vo = (AltComponentVO)list.get(i);
        stmt.execute(
            "delete from ITM04_ALTERNATIVE_ITEMS where "+
            "COMPANY_CODE_SYS01='"+vo.getCompanyCodeSys01ITM04()+"' and "+
            "ITEM_CODE_ITM01='"+vo.getItemCodeItm01ITM04()+"' and "+
            "PROGRESSIVE="+vo.getProgressiveITM04()
        );
      }

      return new VOResponse(new Boolean(true));
    }
View Full Code Here

Examples of org.jallinone.production.billsofmaterial.java.AltComponentVO

      attribute2dbField.put("itemCodeItm01ITM04","ITEM_CODE_ITM01");
      attribute2dbField.put("progressiveITM04","PROGRESSIVE");

      // check if there already exist the specified components in some group (in some PROGRESSIVE...)
      String items = "";
      AltComponentVO vo = null;
      for(int i=0;i<list.size();i++) {
        vo = (AltComponentVO) list.get(i);
        items += "'"+vo.getItemCodeItm01ITM04()+"',";
      }
      if (items.length()>0)
        items = items.substring(0,items.length()-1);
      pstmt = conn.prepareStatement(
          "select PROGRESSIVE,ITEM_CODE_ITM01 from ITM04_ALTERNATIVE_ITEMS where COMPANY_CODE_SYS01=? and ITEM_CODE_ITM01 in ("+items+")"
      );
      pstmt.setString(1,vo.getCompanyCodeSys01ITM04());
      rset = pstmt.executeQuery();
      ArrayList progressives = new ArrayList();
      HashSet itms = new HashSet();
      while(rset.next()) {
        progressives.add(rset.getBigDecimal(1));
        itms.add(rset.getString(2));
      }
      rset.close();
      pstmt.close();

      // if progressives size = 0 then add all components to the current item group
      // if progressives size = 1 then add all components to the fetched group (fetched PROGRESSIVE)
      // if progressives size > 1 then join all groups found and add all components to the unique group just created
      BigDecimal progressiveITM04 = null;
      Response res = null;
      if (progressives.size()==0) {
        vo = (AltComponentVO) list.get(0);
        if (vo.getProgressiveITM04()==null) {

          // maybe there exists ONE record for the current item...
          pstmt = conn.prepareStatement(
              "select PROGRESSIVE from ITM04_ALTERNATIVE_ITEMS where COMPANY_CODE_SYS01=? and ITEM_CODE_ITM01=?"
          );
          pstmt.setString(1,vo.getCompanyCodeSys01ITM04());
          pstmt.setString(2,vo.getCurrentItemCodeItm01ITM04());
          rset = pstmt.executeQuery();
          if (rset.next())
            progressiveITM04 = rset.getBigDecimal(1);
          rset.close();
          pstmt.close();
          if (progressiveITM04==null) {
            // this is the first alternative component defined for this item: create a new progressive...
            progressiveITM04 = CompanyProgressiveUtils.getInternalProgressive(vo.getCompanyCodeSys01ITM04(),"ITM04_ALTERNATIVE_ITEMS", "PROGRESSIVE", conn);
            // insert current item into ITM04...
            AltComponentVO currVO = new AltComponentVO();
            currVO.setCompanyCodeSys01ITM04(vo.getCompanyCodeSys01ITM04());
            currVO.setCurrentItemCodeItm01ITM04(vo.getCurrentItemCodeItm01ITM04());
            currVO.setItemCodeItm01ITM04(vo.getCurrentItemCodeItm01ITM04());
            currVO.setProgressiveITM04(progressiveITM04);
            res = org.jallinone.commons.server.QueryUtilExtension.insertTable(
                conn,
                new UserSessionParameters(username),
                currVO,
                "ITM04_ALTERNATIVE_ITEMS",
                attribute2dbField,
                "Y",
                "N",
                null,
                true
            );
            if (res.isError()) {
              throw new Exception(res.getErrorMessage());
            }
          }
        }
        else
          progressiveITM04 = vo.getProgressiveITM04();
      }
      else if (progressives.size()==1) {
        // add all components to the fetched group (fetched PROGRESSIVE)
        progressiveITM04 = (BigDecimal)progressives.get(0);
        // insert current item into ITM04...
        AltComponentVO currVO = new AltComponentVO();
        currVO.setCompanyCodeSys01ITM04(vo.getCompanyCodeSys01ITM04());
        currVO.setCurrentItemCodeItm01ITM04(vo.getCurrentItemCodeItm01ITM04());
        currVO.setItemCodeItm01ITM04(vo.getCurrentItemCodeItm01ITM04());
        currVO.setProgressiveITM04(progressiveITM04);
        res = org.jallinone.commons.server.QueryUtilExtension.insertTable(
            conn,
            new UserSessionParameters(username),
            currVO,
            "ITM04_ALTERNATIVE_ITEMS",
            attribute2dbField,
            "Y",
            "N",
            null,
            true
        );
        if (res.isError()) {
          throw new Exception(res.getErrorMessage());
        }
      }
      else if (progressives.size()>1) {
        // join all groups found and add all components to the unique group just created
        String progrs = "";
        for(int i=0;i<progressives.size();i++)
          progrs += progressives.get(i)+",";
        progrs = progrs.substring(0,progrs.length()-1);
        pstmt = conn.prepareStatement(
            "select ITEM_CODE_ITM01 from ITM04_ALTERNATIVE_ITEMS where COMPANY_CODE_SYS01=? and PROGRESSIVE in ("+progrs+")"
        );
        pstmt.setString(1,vo.getCompanyCodeSys01ITM04());
        rset = pstmt.executeQuery();
        itms = new HashSet();
        while(rset.next())
          if (!rset.getString(1).equals(vo.getCurrentItemCodeItm01ITM04()))
            itms.add(rset.getString(1));
        rset.close();
        pstmt.close();

        // delete all items of all retrieved groups...
        pstmt = conn.prepareStatement(
            "delete from ITM04_ALTERNATIVE_ITEMS where COMPANY_CODE_SYS01=? and PROGRESSIVE in ("+progrs+")"
        );
        pstmt.execute();

        // insert all items in a single new group...
        progressiveITM04 = CompanyProgressiveUtils.getInternalProgressive(vo.getCompanyCodeSys01ITM04(),"ITM04_ALTERNATIVE_ITEMS", "PROGRESSIVE", conn);
        // insert current item into ITM04...
        AltComponentVO currVO = new AltComponentVO();
        currVO.setCompanyCodeSys01ITM04(vo.getCompanyCodeSys01ITM04());
        currVO.setCurrentItemCodeItm01ITM04(vo.getCurrentItemCodeItm01ITM04());
        currVO.setItemCodeItm01ITM04(vo.getCurrentItemCodeItm01ITM04());
        currVO.setProgressiveITM04(progressiveITM04);
        res = org.jallinone.commons.server.QueryUtilExtension.insertTable(
            conn,
            new UserSessionParameters(username),
            currVO,
            "ITM04_ALTERNATIVE_ITEMS",
            attribute2dbField,
            "Y",
            "N",
            null,
            true
        );
        if (res.isError()) {
          throw new Exception(res.getErrorMessage());
        }

        Iterator it = itms.iterator();
        while(it.hasNext()) {
          currVO = new AltComponentVO();
          currVO.setCompanyCodeSys01ITM04(vo.getCompanyCodeSys01ITM04());
          currVO.setCurrentItemCodeItm01ITM04(vo.getCurrentItemCodeItm01ITM04());
          currVO.setItemCodeItm01ITM04(it.next().toString());
          currVO.setProgressiveITM04(progressiveITM04);
          res = org.jallinone.commons.server.QueryUtilExtension.insertTable(
              conn,
              new UserSessionParameters(username),
              currVO,
              "ITM04_ALTERNATIVE_ITEMS",
View Full Code Here

Examples of org.jallinone.production.billsofmaterial.java.AltComponentVO

      if (res.isError())
        throw new Exception(res.getErrorMessage());

      java.util.List rows = ((VOListResponse)res).getRows();
      AltComponentVO vo = null;
      for(int i=0;i<rows.size();i++) {
        vo = (AltComponentVO)rows.get(i);
        vo.setCurrentItemCodeItm01ITM04(pk.getItemCodeITM01());
      }

      Response answer = res;

View Full Code Here

Examples of org.jallinone.production.billsofmaterial.java.AltComponentVO

  /**
   * Callback method invoked when the user has clicked on the insert button
   * @param valueObject empty value object just created: the user can manage it to fill some attribute values
   */
  public void createValueObject(ValueObject valueObject) throws Exception {
    AltComponentVO vo = (AltComponentVO)valueObject;
    DetailItemVO itemVO = (DetailItemVO)panel.getFrame().getFormPanel().getVOModel().getValueObject();
    vo.setCompanyCodeSys01ITM04(itemVO.getCompanyCodeSys01ITM01());
  }
View Full Code Here

Examples of org.jallinone.production.billsofmaterial.java.AltComponentVO

   * @param newValueObjects list of new value objects to save
   * @return an ErrorResponse value object in case of errors, VOListResponse if the operation is successfully completed
   */
  public Response insertRecords(int[] rowNumbers, ArrayList newValueObjects) throws Exception {
    // check if there exist alternative components previously defined...
    AltComponentVO vo = null;
    if (panel.getAltCompsGrid().getVOListTableModel().getRowCount()>newValueObjects.size()) {
      AltComponentVO prevVO = (AltComponentVO)panel.getAltCompsGrid().getVOListTableModel().getObjectForRow(newValueObjects.size());
      for(int i=0;i<newValueObjects.size();i++) {
        vo = (AltComponentVO)newValueObjects.get(i);
        vo.setProgressiveITM04(prevVO.getProgressiveITM04());
      }
    }
    DetailItemVO itemVO = (DetailItemVO)panel.getFrame().getFormPanel().getVOModel().getValueObject();
    for(int i=0;i<newValueObjects.size();i++) {
      vo = (AltComponentVO)newValueObjects.get(i);
View Full Code Here

Examples of org.jallinone.production.billsofmaterial.java.AltComponentVO

      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(),
                  altAvailability,
                  serverLanguageId,username
              );
              if (componentVO.getQtyDOC24().subtract(availability).doubleValue()>altQty.doubleValue()) {
                delta = altQty;
                altComponentVO.setQtyDOC24(altAvailability);
              }
              else {
                delta = componentVO.getQtyDOC24();
                altComponentVO.setQtyDOC24(
                    conv.convertQty(
                        componentVO.getMinSellingQtyUmCodeReg02ITM01(),
                        altVO.getMinSellingQtyUmCodeReg02ITM01(),
                        delta,
                        serverLanguageId,username
                    )
                );
              }
              componentVO.setQtyDOC24(componentVO.getQtyDOC24().subtract(delta));
              alternativeComps.add(altComponentVO);

              altCodes = (HashSet)compAltComps.get(itemCode);
              if (altCodes==null) {
                altCodes = new HashSet();
                compAltComps.put(itemCode,altCodes);
              }
              altCodes.add(altVO.getItemCodeItm01ITM04());

              if (componentVO.getQtyDOC24().doubleValue()==0) {
                compsToRemove.add(componentVO);
                break;
              }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.