コード例 #1
0
ファイル: ApInvoiceAction.java プロジェクト: zskang/scm
  /** @return */
  public String afteredit_invoiceline() {

    ActionContext ctx = ActionContext.getContext();
    String dispatch = Struts2Util.getRequest().getParameter("dispatch").trim();
    if (null != ctx.getSession().get("apInvoice")) {
      apInvoice = (ApInvoice) ctx.getSession().get("apInvoice");
      param = (Map) ctx.getSession().get("param");
      //						ctx.getSession().remove("apInvoice");
    }
    String LineNo = "" + apInvoiceLine.getLineNo();

    String[] itemNos = param.get("itemNo") == null ? null : (String[]) param.get("itemNo");
    String[] catalogNo = param.get("catalogNo") == null ? null : (String[]) param.get("catalogNo");
    String[] names = param.get("name") == null ? null : (String[]) param.get("name");
    String[] qtys = param.get("qty") == null ? null : (String[]) param.get("qty");
    String[] qtyUoms = param.get("qtyUom") == null ? null : (String[]) param.get("qtyUom");
    String[] unitPrices = param.get("unitPrice") == null ? null : (String[]) param.get("unitPrice");
    String[] amounts = param.get("amount") == null ? null : (String[]) param.get("amount");
    String[] taxs = param.get("tax") == null ? null : (String[]) param.get("tax");
    String[] sizes = param.get("size") == null ? null : (String[]) param.get("size");
    String[] lineNo = param.get("lineNo") == null ? null : (String[]) param.get("lineNo");
    String[] creationDate =
        param.get("creationDate") == null ? null : (String[]) param.get("creationDate");
    String[] creationBy = param.get("createdBy") == null ? null : (String[]) param.get("createdBy");
    //			        String[] modify_dates = param.get("modifyDate")== null ? null :
    // (String[])param.get("modifyDate");
    //					String[] modified_by = param.get("modifiedBy")== null ? null :
    // (String[])param.get("modifiedBy");
    //			        ctx.getSession().remove("param");
    int i = 0;
    for (i = 0; i < lineNo.length; i++) {
      if (LineNo.equals(lineNo[i])) {
        break;
      }
    }
    amounts[i] = "" + apInvoiceLine.getAmount();
    catalogNo[i] = apInvoiceLine.getCatalogNo();
    itemNos[i] = "" + apInvoiceLine.getItemNo();
    names[i] = apInvoiceLine.getName();
    qtys[i] = "" + apInvoiceLine.getQty();
    qtyUoms[i] = "" + apInvoiceLine.getQtyUom();
    unitPrices[i] = "" + apInvoiceLine.getUnitPrice();
    taxs[i] = "" + apInvoiceLine.getTax();
    sizes[i] = "" + apInvoiceLine.getSize();
    lineNo[i] = "" + apInvoiceLine.getLineNo();
    creationDate[i] = Tools.getCurrentTime("yyyy-MM-dd");
    creationBy[i] = "" + SessionUtil.getUserId();

    //			        modify_dates[i]=Tools.getCurrentTime("yyyy-MM-dd");
    //			        modified_by[i]=""+SessionUtil.getUserId();

    Struts2Util.getRequest().setAttribute("paramEL", param);
    return dispatch;
  }
コード例 #2
0
ファイル: ApInvoiceAction.java プロジェクト: zskang/scm
  /**
   * 修改invocie
   *
   * @return
   */
  public String edit() {
    int invoiceId = Tools.String2Integer(Struts2Util.getParameter("invoiceId"));
    List<ApInvoiceLine> apInvoiceLines = null;
    try {
      apInvoice = new ApInvoice();
      apInvoice = (ApInvoice) this.apInvoiceDao.getSession().get(ApInvoice.class, invoiceId);
      apInvoice.setOldStatus(apInvoice.getStatus());
      apInvoiceLines = apInvoiceLineDao.queryInvoiceByInvoiceId(apInvoice.getInvoiceId());
      String symbol = currency_Dao.getCurrencySymbol(apInvoice.getCurrency());
      apInvoice.setSymbol(symbol);
    } catch (Exception e) {
      e.printStackTrace();
    }

    if ((null == apInvoiceLines) || (0 == apInvoiceLines.size())) {
      return "edit_invoice";
    }
    int length = apInvoiceLines.size();

    String[] itemNos = new String[length];
    String[] invoiceLineIds = new String[length];
    String[] invoiceIds = new String[length];
    String[] catalogNo = new String[length];
    String[] names = new String[length];
    String[] qtys = new String[length];
    String[] qtyUoms = new String[length];
    String[] unitPrices = new String[length];
    String[] amounts = new String[length];
    String[] taxs = new String[length];
    String[] sizes = new String[length];
    String[] lineNo = new String[length];
    String[] discounts = new String[length];
    String[] createDate = new String[length];
    String[] createBy = new String[length];
    String[] modifyDate = new String[length];
    String[] modifyBy = new String[length];
    ApInvoiceLine InvoiceLine = null;

    for (int i = 0; i < apInvoiceLines.size(); i++) {
      InvoiceLine = apInvoiceLines.get(i);
      invoiceLineIds[i] = "" + InvoiceLine.getInvoiceLineId();
      invoiceIds[i] = "" + InvoiceLine.getInvoiceId();
      amounts[i] = "" + InvoiceLine.getAmount();
      catalogNo[i] = InvoiceLine.getCatalogNo();
      itemNos[i] = "" + InvoiceLine.getItemNo();
      names[i] = InvoiceLine.getName();
      qtys[i] = "" + InvoiceLine.getQty();
      qtyUoms[i] = "" + InvoiceLine.getQtyUom();
      unitPrices[i] = "" + InvoiceLine.getUnitPrice();
      taxs[i] = "" + InvoiceLine.getTax();
      sizes[i] = "" + InvoiceLine.getSize();
      lineNo[i] = "" + InvoiceLine.getLineNo();
      discounts[i] = "" + InvoiceLine.getDiscount();
      createDate[i] = "" + InvoiceLine.getCreationDate();
      createBy[i] = "" + InvoiceLine.getCreatedBy();
      modifyDate[i] = "" + InvoiceLine.getModifyDate();
      modifyBy[i] = "" + InvoiceLine.getModifiedBy();
    }

    param.put("invoiceLineIds", invoiceLineIds);
    param.put("invoiceIds", invoiceIds);
    param.put("itemNo", itemNos);
    param.put("catalogNo", catalogNo);
    param.put("name", names);
    param.put("qty", qtys);
    param.put("qtyUom", qtyUoms);
    param.put("unitPrice", unitPrices);
    param.put("amount", amounts);
    param.put("tax", taxs);
    param.put("size", sizes);
    param.put("lineNo", lineNo);
    param.put("discount", discounts);
    param.put("creationDate", createDate);
    param.put("createdBy", createBy);
    param.put("modifyDate", modifyDate);
    param.put("modifiedBy", modifyBy);

    Struts2Util.getRequest().setAttribute("paramEL", param);
    return "edit_invoice";
  }