Exemplo n.º 1
0
 /** 检查判断BOM头是否存在,存在返回1,不存在返回0 */
 @Override
 public <ModelType> int checkEntityBom(ModelType record) throws ServiceException {
   try {
     return basBomListDao.checkEntityBom(record);
   } catch (Exception e) {
     throw new ServiceException(e.getMessage(), e);
   }
 }
Exemplo n.º 2
0
  private <ModelType, SizeType> void getAllBomList(
      List<ModelType> allList,
      List<SizeType> sizeList,
      List<ModelType> list,
      ModelType parentModel,
      ModelType root,
      BasBomListOrderIndex orderIndex) {
    short rootOrderNo = 0;
    short maxOrderNo = 0;
    String rootBrandNo = "";
    String rootMaterialNo = "0";
    String rootBomPurpose = "";
    if (root != null) {
      BasBomList basBomList = (BasBomList) root;
      rootOrderNo = basBomList.getOrderNo();
      maxOrderNo = basBomList.getMaxOrderNo();
      rootBrandNo = basBomList.getBrandNo();
      rootMaterialNo = basBomList.getMaterialNo();
      rootBomPurpose = basBomList.getBomPurpose();
    }
    for (ModelType model : list) {
      BasBomList bomList = (BasBomList) model;
      BasBomList parentBomList = (BasBomList) parentModel;

      List<SizeType> bomListSize = null;
      if (sizeList != null) {
        bomListSize = basBomListSizeDao.findBomListSize(bomList);
      }
      orderIndex.setOrderNo((short) (orderIndex.getOrderNo() + 1));
      bomList.setOrderNo((short) (orderIndex.getOrderNo() + maxOrderNo));

      bomList.setParentOrderNo(
          orderIndex.getOrderNo() > 1 ? parentBomList.getOrderNo() : rootOrderNo);
      bomList.setParentBrandNo(
          orderIndex.getOrderNo() > 1 ? parentBomList.getBrandNo() : rootBrandNo);
      bomList.setParentMaterialNo(
          (orderIndex.getOrderNo() > 1 ? parentBomList.getMaterialNo() : rootMaterialNo));
      bomList.setParentBomPurpose(
          orderIndex.getOrderNo() > 1 ? parentBomList.getBomPurpose() : rootBomPurpose);

      if (bomListSize != null) {
        for (SizeType type : bomListSize) {
          BasBomListSize size = (BasBomListSize) type;
          size.setOrderNo(bomList.getOrderNo());
          sizeList.add(type);
        }
      }

      allList.add(model);
      List<ModelType> temp = basBomListDao.findBomList(model);
      if (temp.size() > 0) {
        bomList.setLeaf("false");
        getAllBomList(allList, sizeList, temp, model, root, orderIndex);
      } else {
        bomList.setLeaf("true");
      }
    }
  }