Пример #1
0
  protected List<ModelWrapper<?>> search() throws Exception {
    List<ModelWrapper<?>> wrappers = new ArrayList<ModelWrapper<?>>();
    if (radioWaybill.getSelection()) {
      wrappers.addAll(
          OriginInfoWrapper.getShipmentsByWaybill(
              SessionManager.getAppService(), treeText.getText().trim()));
      wrappers.addAll(
          DispatchWrapper.getDispatchesByWaybill(
              SessionManager.getAppService(), treeText.getText().trim()));
      return wrappers;

    } else if (radioDateReceived.getSelection()) {
      Date date = dateWidget.getDate();
      if (date != null) {
        wrappers.addAll(
            OriginInfoWrapper.getShipmentsByDateReceived(
                SessionManager.getAppService(),
                date,
                SessionManager.getUser().getCurrentWorkingCenter()));
        wrappers.addAll(
            DispatchWrapper.getDispatchesByDateReceived(
                SessionManager.getAppService(),
                date,
                SessionManager.getUser().getCurrentWorkingCenter()));
        return wrappers;
      }
    } else {
      Date date = dateWidget.getDate();
      if (date != null) {
        wrappers.addAll(
            OriginInfoWrapper.getShipmentsByDateSent(
                SessionManager.getAppService(),
                date,
                SessionManager.getUser().getCurrentWorkingCenter()));
        wrappers.addAll(
            DispatchWrapper.getDispatchesByDateSent(
                SessionManager.getAppService(),
                date,
                SessionManager.getUser().getCurrentWorkingCenter()));
        return wrappers;
      }
    }
    return null;
  }
Пример #2
0
 @Override
 protected void internalSearch() {
   try {
     List<? extends ModelWrapper<?>> searchedObject = search();
     if (searchedObject == null || searchedObject.size() == 0) {
       String msg;
       if (radioWaybill.getSelection()) {
         msg =
             NLS.bind(Messages.SpecimenTransitView_notfound_waybill_error_msg, treeText.getText());
       } else {
         msg =
             NLS.bind(
                 Messages.SpecimenTransitView_notfound_date_error_msg,
                 DateFormatter.formatAsDate(dateWidget.getDate()));
       }
       BgcPlugin.openMessage(Messages.SpecimenTransitView_notfound_error_title, msg);
     } else {
       showSearchedObjectsInTree(searchedObject, true);
       getTreeViewer().expandToLevel(searchedNode, 2);
     }
   } catch (Exception e) {
     BgcPlugin.openError(Messages.SpecimenTransitView_search_error_msg, e);
   }
 }