コード例 #1
0
 public static JsonResponse addProduceRecord(
     ProduceRecords data, MaterialRecords[] materialRecord) {
   for (MaterialRecords mr : materialRecord) {
     Materials material = mr.material;
     if (material.id == null && material.name != null) {
       Materials temp = Materials.find("name=?", material.name).first();
       if (temp != null) {
         mr.material = temp;
       } else {
         material.createAt = DateUtils.getNowDate();
         material.save();
       }
     }
     mr.produceRecord = data;
     mr.save();
   }
   if (data.batch.id == null) {
     if (data.batch.product.productId != null) {
       Batchs batch =
           Batchs.find("product_id=? and batchNo is null", data.batch.product.productId).first();
       if (batch == null) {
         data.batch.orderSource = 1; // 内销
         data.batch.save();
       } else {
         data.batch = batch;
       }
     }
   }
   if (data.batch.id != null && data.batch.product.productId != null) {
     data.batch.save();
   }
   data.save();
   return new JsonResponse(0, "生产记录已更新成功");
 }
コード例 #2
0
 @Test(enabled = true)
 public void createNewSupplierArticle() {
   String supplierArticleNumber = "Article N" + DateUtils.getFullDateRestrictedYear();
   SupplierArticle supplierArticle =
       StaticFactorySupplierArticle.createFullFilledDefaultSupplierArticle(supplierArticleNumber);
   LogisticsAndSettingsPage logisticsAndSettingsPage = new LogisticsAndSettingsPage(driver);
   ArticleWeightsAndMeasuresOverviewPage articleWeightsAndMeasuresOverview =
       logisticsAndSettingsPage.openArticleWeightsAndMeasuresOverview();
   ArticleDetailsPage articleDetailsPage =
       articleWeightsAndMeasuresOverview.startToCreateArticleViaCreateButton();
   articleDetailsPage.enterDataFromObject(supplierArticle);
   articleDetailsPage.saveSupplierArticle();
   articleDetailsPage.backFromSupplierArticle();
   Assert.assertTrue(
       articleWeightsAndMeasuresOverview.isSupplierArticleByNumber(supplierArticleNumber),
       "Article is not found");
 }
コード例 #3
0
  @Override
  public void run() {

    putToSleep();

    while (count <= MAX_RUN) {
      System.out.println("Running");
      int cityIndex = (int) (1 + Math.random() * Constants.CITIES.length);
      String city =
          count == MAX_RUN
              ? packageTable.getPackage(packageId).getDestinationCity()
              : Constants.CITIES[cityIndex];
      String status = count == MAX_RUN ? Constants.STATUS_RECEIVED : Constants.STATUS_IN_PROGRESS;
      routeTable.updateRoute(packageId, DateUtils.getCurrentTimeStamp(), city, status);
      count++;
      putToSleep();
    }
  }
コード例 #4
0
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    System.err.println("servlet NUOVO UTENTE");
    String nome = request.getParameter("nome");
    String cognome = request.getParameter("cognome");
    String citta = request.getParameter("citta");
    GregorianCalendar nascita =
        DateUtils.getGregorianCalendarFromString(request.getParameter("nascita"));
    String sesso = request.getParameter("sesso");
    String mail = request.getParameter("mail");
    int ruolo = (int) Integer.parseInt(request.getParameter("ruolo"));
    String username = request.getParameter("username");
    String password = request.getParameter("password");

    System.err.println("servlet NUOVO UTENTE" + nome);

    UtenteBean utenteBean =
        new UtenteBean()
            .setNome(nome)
            .setCognome(cognome)
            .setCitta(citta)
            .setNascita(nascita)
            .setSesso(sesso)
            .setMail(mail)
            .setRuolo(FactoryRuoli.getInstance().assegnaRuolo(ruolo))
            .setUsername(username)
            .setPassword(password);

    System.err.println("servlet NUOVO UTENTE BEAN" + utenteBean.getNome());

    try {
      this.controllerAmministraUtenti.nuovo(utenteBean);
    } catch (DatiUtenteInconsistentiException | LoginInconsistenteException e) {
      System.err.println("servlet NUOVO UTENTE: ERRORE!!!");
      e.printStackTrace();
    }
  }