Exemple #1
0
  public String doDelete() {
    ActionContext ctx = ActionContext.getContext();
    HttpServletRequest req = Struts2Util.getRequest();
    String[] invoiceIds = req.getParameter("invoiceIds").split(",");
    // System.out.println("SessionUtil.getUserId():"+SessionUtil.getUserId());
    // System.out.println("statusUpReason:"+req.getParameter("statusUpReason"));

    List<ApInvoice> list = new ArrayList();
    for (int i = 0; i < invoiceIds.length; i++) {
      ApInvoice entity =
          (ApInvoice)
              apInvoiceDao
                  .getSession()
                  .get(
                      ApInvoice.class,
                      new Integer(invoiceIds[i])); // apInvoiceDao.get(new Integer(invoiceIds[i]));
      entity.setOldStatus(entity.getStatus()); // 原始状态
      entity.setStatus(Constant.STATUS_VOID); // 修改后的状态
      entity.setModifiedBy(SessionUtil.getUserId());
      entity.setModifyDate(new Date());
      entity.setStatusUpdReason(req.getParameter("statusUpReason"));
      list.add(entity);
    }

    boolean bres = apInvoiceService.delete(list);
    Struts2Util.getRequest().setAttribute("operate_result", bres);

    return "delete_invoice_page";
    //				return input();
  }
Exemple #2
0
 /**
  * 获取saler的名称
  *
  * @return
  */
 public String getSalerName() {
   int id = 0;
   String msg = "";
   try {
     id = Integer.parseInt(Struts2Util.getParameter("orderNo"));
     Map m = this.apInvoiceDao.getInfoByOrder(id);
     msg =
         "{ state:'success', currency:'"
             + m.get("currency")
             + "', name : '"
             + m.get("name")
             + "',saleId:'"
             + m.get("saleId")
             + "',amt:"
             + m.get("amt")
             + ",currency:'"
             + m.get("currency")
             + "',symbol:'"
             + m.get("symbol")
             + "' }";
   } catch (Exception e) {
     e.printStackTrace();
     msg = "{ state:'error',msg:'" + e.getMessage() + "' }";
   }
   Struts2Util.renderJson(msg);
   return null;
 }
Exemple #3
0
  /** @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;
  }
Exemple #4
0
  /**
   * 添加或修改invoiceline信息的时候,点击cancel触发的事件
   *
   * @return
   */
  public String cancel() {

    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("arInvoice");
      //						ctx.getSession().remove("param");
    }
    Struts2Util.getRequest().setAttribute("paramEL", param);
    return dispatch;
  }
Exemple #5
0
  /**
   * 检查该发票是否对过账,如果已经对过账,则不能修改currency
   *
   * @return
   */
  public String checkInvoiceIsAllocatied() {
    int invoiceId = 0;
    String msg = "";
    try {
      invoiceId = Integer.parseInt(Struts2Util.getParameter("invoiceId"));

      boolean flag = this.apInvoiceDao.isAllocation(invoiceId);
      msg = "{ state:'success',flag : " + flag + "}";
    } catch (Exception e) {
      e.printStackTrace();
      msg = "{ state:'error',msg:'" + e.getMessage() + "' }";
    }
    Struts2Util.renderJson(msg);
    return null;
  }
Exemple #6
0
  public String saveServicePriceToSession() throws Exception {
    Map<String, Object> rt = new HashMap<String, Object>();
    String returnType = ServletActionContext.getRequest().getParameter("returnType");
    String serviceIdDetail = ServletActionContext.getRequest().getParameter("serviceIdDetail");
    String catalogNo = ServletActionContext.getRequest().getParameter("catalogNo");
    String key = null;
    if ("serviceId".equals(returnType)) {
      servicePrice.setServiceId(Integer.valueOf(serviceIdDetail));
      key = servicePrice.getCatalogId() + "_" + servicePrice.getServiceId();
    } else {
      List<com.genscript.gsscm.serv.entity.Service> serv =
          this.servService.getServiceByCatalogNo(catalogNo);
      servicePrice.setServiceId(serv.get(0).getServiceId());
      key = servicePrice.getCatalogId() + "_" + catalogNo;
    }

    ServicePrice sp =
        this.servService.getServicePriceByServiceIdAndCatalogId(
            servicePrice.getCatalogId(), servicePrice.getServiceId());
    if (sp == null) {
      sp = servicePrice;
    } else {
      sp.setLimitPrice(servicePrice.getLimitPrice());
      sp.setStandardPrice(servicePrice.getStandardPrice());
      sp.setPriceRuleGroup(servicePrice.getPriceRuleGroup());
      sp.setCategoryId(servicePrice.getCategoryId());
    }
    SessionUtil.updateOneRow(SessionPdtServ.ServicePricing.value(), sessionServiceId, key, sp);
    rt.put("key", key);
    rt.put("message", SUCCESS);
    Struts2Util.renderJson(rt);
    return null;
  }
Exemple #7
0
 /**
  * 浏览历史付款
  *
  * @return
  */
 public String viewAllocationHistory() {
   int id = Tools.String2Integer(Struts2Util.getParameter("invoiceId"));
   if (id != 0) {
     String hql = "from ApTransactionAllocation a where a.invoiceId= ? ";
     apInvoiceAllocationList =
         (List<ApTransactionAllocation>) this.apInvoiceAllocationDao.createQuery(hql, id).list();
   }
   return "view_allocation_history";
 }
Exemple #8
0
 /** 分页查询 */
 public String list() throws Exception {
   PagerUtil<ApInvoiceView> pagerUtil = new PagerUtil<ApInvoiceView>();
   apInvoicePage = pagerUtil.getRequestPage();
   apInvoicePage.setPageSize(10);
   Map m = Tools.buildMap(Struts2Util.getRequest());
   List<ApInvoiceView> invoiceList = null;
   long total = 0;
   try {
     invoiceList = apInvoiceDao.list(apInvoicePage, m);
     total = this.apInvoiceDao.getTotalPage(m);
   } catch (Exception e) {
     e.printStackTrace();
   }
   apInvoicePage.setTotalCount(total);
   apInvoicePage.setResult(invoiceList);
   Struts2Util.getRequest().setAttribute("pagerInfo", apInvoicePage);
   Struts2Util.getRequest().setAttribute("params", m);
   return "success";
 }
Exemple #9
0
  /**
   * @function 修改
   * @author 陈文擎 @
   */
  public String edit_invoiceline() {
    ActionContext ctx = ActionContext.getContext();
    String symbol = currency_Dao.getCurrencySymbol(apInvoice.getCurrency());
    apInvoice.setSymbol(symbol);
    ctx.getSession().put("apInvoice", apInvoice);
    ctx.getSession().put("param", param);

    Struts2Util.getRequest().setAttribute("paramEL", param);

    String LineNo = Struts2Util.getRequest().getParameter("LineNo").trim();
    if (0 == param.size()) return "edit_invoiceline";

    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");

    int i = 0;
    for (i = 0; i < lineNo.length; i++) {
      if (LineNo.equals(lineNo[i])) {
        break;
      }
    }
    apInvoiceLine.setAmount(Tools.String2Float(amounts[i]));
    apInvoiceLine.setCatalogNo(catalogNo[i]);
    apInvoiceLine.setItemNo(Tools.String2Integer(itemNos[i]));
    apInvoiceLine.setName(names[i]);
    apInvoiceLine.setQty(Tools.String2Integer(qtys[i]));
    apInvoiceLine.setQtyUom(qtyUoms[i]);
    apInvoiceLine.setUnitPrice(Tools.String2Float(unitPrices[i]));
    apInvoiceLine.setTax(Tools.String2Float(taxs[i]));
    apInvoiceLine.setSize(Tools.String2Float(sizes[i]));
    apInvoiceLine.setLineNo(Tools.String2Integer(lineNo[i]));
    return "edit_invoiceline";
  }
Exemple #10
0
 public String getCategoryByCatalogAndCategory() {
   Map<String, Object> rt = new HashMap<String, Object>();
   String catalogId = Struts2Util.getParameter("catalogId");
   String categoryId = Struts2Util.getParameter("categoryId");
   String categoryLevel = Struts2Util.getParameter("categoryLevel");
   if (categoryLevel.equals("2")) {
     this.serviceCCategoryOfPriceList =
         this.servService.getServiceCategoryByCatalogId(catalogId, Integer.valueOf(categoryId), 2);
     categoryLevel = "3";
     if (this.serviceCCategoryOfPriceList != null && !this.serviceCCategoryOfPriceList.isEmpty()) {
       this.serviceCategoryOfPriceList =
           this.servService.getServiceCategoryByCatalogId(
               catalogId, serviceCCategoryOfPriceList.get(0).getCategoryId(), 3);
     }
   } else if (categoryLevel.equals("3")) {
     this.serviceCategoryOfPriceList =
         this.servService.getServiceCategoryByCatalogId(catalogId, Integer.valueOf(categoryId), 3);
   }
   rt.put("serviceCategoryOfPriceList", serviceCategoryOfPriceList);
   rt.put("serviceCCategoryOfPriceList", serviceCCategoryOfPriceList);
   Struts2Util.renderJson(rt);
   return null;
 }
Exemple #11
0
 public String searchServicePriceByCategoryIdServiceId() {
   Map<String, Object> rt = new HashMap<String, Object>();
   String catalogId = ServletActionContext.getRequest().getParameter("catalogId");
   String catalogNo = ServletActionContext.getRequest().getParameter("catalogNo");
   String returnType = ServletActionContext.getRequest().getParameter("returnType");
   String serviceIdDetail = ServletActionContext.getRequest().getParameter("serviceIdDetail");
   String key = null;
   if ("serviceId".equals(returnType)) {
     key = catalogId + "_" + serviceIdDetail;
   } else {
     key = catalogId + "_" + catalogNo;
   }
   Object obj =
       SessionUtil.getOneRow(SessionPdtServ.ServicePricing.value(), sessionServiceId, key);
   if (obj != null) {
     this.servicePrice = (ServicePrice) obj;
   } else {
     if ("serviceId".equals(returnType)) {
       this.servicePrice =
           this.servService.getServicePriceByServiceIdAndCatalogId(
               catalogId, Integer.valueOf(serviceIdDetail));
     } else {
       List<com.genscript.gsscm.serv.entity.Service> serv =
           this.servService.getServiceByCatalogNo(catalogNo);
       if (serv.isEmpty()) {
         this.servicePrice = new ServicePrice();
         this.group = new ArrayList<PriceRuleGroups>();
       } else {
         this.servicePrice =
             this.servService.getServicePriceByServiceIdAndCatalogId(
                 catalogId, serv.get(0).getServiceId());
         this.group =
             this.priceRuleService.searchPriceRuleGroupListByClsId(serv.get(0).getServiceClsId());
       }
     }
   }
   Catalog catg = this.productService.getCatalogByCatalogId(catalogId);
   rt.put("priceAppr", this.getPriceAppr());
   rt.put("group", group);
   rt.put("currencyCode", catg.getCurrencyCode());
   rt.put("id", catg.getId());
   rt.put("message", SUCCESS);
   rt.put("servicePrice", servicePrice);
   Struts2Util.renderJson(rt);
   return null;
 }
Exemple #12
0
 public String saveServiceSubStepPriceToSession() throws Exception {
   Map<String, Object> rt = new HashMap<String, Object>();
   String key = subStepPrice.getCatalogId() + "_" + subStepPrice.getStepId();
   ServiceSubStepPrice sssp =
       this.servService.getSubStepPrice(subStepPrice.getCatalogId(), subStepPrice.getStepId());
   if (sssp == null) {
     sssp = subStepPrice;
   } else {
     sssp.setLimitPrice(subStepPrice.getLimitPrice());
     sssp.setRetailPrice(subStepPrice.getRetailPrice());
     sssp.setCatalogId(subStepPrice.getCatalogId());
   }
   SessionUtil.updateOneRow(
       SessionPdtServ.ServiceSubStepPricing.value(), sessionServiceId, key, sssp);
   rt.put("key", key);
   rt.put("message", SUCCESS);
   Struts2Util.renderJson(rt);
   return null;
 }
Exemple #13
0
  /**
   * @function 创建invoiceline信息
   * @author 周勇 @
   */
  public String add_invoiceline() {
    ActionContext ctx = ActionContext.getContext();
    String symbol = currency_Dao.getCurrencySymbol(apInvoice.getCurrency());
    apInvoice.setSymbol(symbol);
    ctx.getSession().put("apInvoice", apInvoice);
    ctx.getSession().put("param", param);

    Struts2Util.getRequest().setAttribute("paramEL", param);

    int maxLineNo = 0;
    if (param.get("lineNo") == null) {
      maxLineNo = 1;
    } else {
      String[] lineNo = (String[]) param.get("lineNo");
      //			maxLineNo = Integer.parseInt(lineNo[lineNo.length-1] )+1;
      maxLineNo = lineNo.length + 1;
    }
    apInvoiceLine.setLineNo(maxLineNo);
    return "add_invoiceline";
  }
Exemple #14
0
  public String priceApprovedSaveSession() {
    Map<String, Object> rt = new HashMap<String, Object>();
    String key = Struts2Util.getParameter("priceId");
    String approved = Struts2Util.getParameter("approved");
    String groupApproved = Struts2Util.getParameter("groupApproved");
    String approvedReason = Struts2Util.getParameter("approvedReason");
    String oldVal = Struts2Util.getParameter("oldPriceApproved");
    ServicePriceDTO dto = new ServicePriceDTO();
    if (key == null) {
      key = Struts2Util.getParameter("subPriceId");
      if (key != null) {
        dto.setPriceId(Integer.valueOf(key));
        dto.setServiceSubPriceApprove(Double.valueOf(approved));
        dto.setServicePriceReason(approvedReason);
        dto.setServicePriceOldVal(Double.valueOf(oldVal));
        SessionUtil.updateOneRow(
            SessionPdtServ.ServiceSubPriceApproved.value(), sessionServiceId, key, dto);
        rt.put("key", key);
      }
    } else {
      dto.setPriceId(Integer.valueOf(key));
      if (groupApproved != null && !groupApproved.equals("")) {
        dto.setServiceRuleGroupPriceApprove(Integer.valueOf(groupApproved));
      }
      if (approved != null && !approved.equals("")) {
        dto.setServicePriceApprove(Double.valueOf(approved));
      }
      dto.setServicePriceReason(approvedReason);
      if (oldVal != null && !oldVal.equals("")) {
        dto.setServicePriceOldVal(Double.valueOf(oldVal));
      } else {
        dto.setServicePriceOldVal(Double.valueOf(0));
      }

      SessionUtil.updateOneRow(
          SessionPdtServ.ServicePriceApproved.value(), sessionServiceId, key, dto);
      rt.put("key", key);
    }

    rt.put("message", SUCCESS);
    Struts2Util.renderJson(rt);
    return null;
  }
Exemple #15
0
 public String searchSubStepPrice() {
   Map<String, Object> rt = new HashMap<String, Object>();
   String catalogId = ServletActionContext.getRequest().getParameter("catalogId");
   String stepId = ServletActionContext.getRequest().getParameter("stepId");
   String key = catalogId + "_" + stepId;
   Object obj =
       SessionUtil.getOneRow(SessionPdtServ.ServiceSubStepPricing.value(), sessionServiceId, key);
   if (obj != null) {
     this.subStepPrice = (ServiceSubStepPrice) obj;
   } else {
     this.subStepPrice = this.servService.getSubStepPrice(catalogId, Integer.valueOf(stepId));
   }
   Catalog catg = this.productService.getCatalogByCatalogId(catalogId);
   rt.put("priceAppr", this.getPriceAppr());
   rt.put("currencyCode", catg.getCurrencyCode());
   rt.put("id", catg.getId());
   rt.put("message", SUCCESS);
   rt.put("subStepPrice", subStepPrice);
   Struts2Util.renderJson(rt);
   return null;
 }
Exemple #16
0
  /** 进入invoice_list页面 */
  @Override
  public String input() {
    // TODO Auto-generated method stub
    PagerUtil<ApInvoiceView> pagerUtil = new PagerUtil<ApInvoiceView>();
    apInvoicePage = pagerUtil.getRequestPage();
    apInvoicePage.setPageSize(10);
    List<ApInvoiceView> invoiceList = null;
    long total = 0;
    try {
      invoiceList = apInvoiceDao.list(apInvoicePage, null);
      total = this.apInvoiceDao.getTotalPage(null);
    } catch (Exception e) {
      e.printStackTrace();
    }
    apInvoicePage.setTotalCount(total);
    apInvoicePage.setResult(invoiceList);

    //		ApInvoiceLine a = this.apInvoiceLineDao.get(1);

    Struts2Util.getRequest().setAttribute("pagerInfo", apInvoicePage);

    return "enter";
  }
Exemple #17
0
 public String delete() throws Exception {
   String ids = Struts2Util.getParameter("invoiceIds");
   Struts2Util.getRequest().setAttribute("invoiceIds", ids);
   return "delete_invoice_page";
 }
Exemple #18
0
  /**
   * 修改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";
  }
Exemple #19
0
  /**
   * 新增一个发票点击save后,但是数据还没有保存到数据库
   *
   * @return
   */
  public String afteradd_invoiceline() {

    ActionContext ctx = ActionContext.getContext();
    String dispatch = Struts2Util.getRequest().getParameter("dispatch").trim();

    if (null != ctx.getSession().get("apInvoice")) {
      apInvoice = (ApInvoice) ctx.getSession().get("apInvoice");
      //		 			ctx.getSession().remove("apInvoice");
    }

    if (null != ctx.getSession().get("param")) {
      param = (Map) ctx.getSession().get("param");

      String[] invoiceLineIds =
          param.get("invoiceLineIds") == null ? null : (String[]) param.get("invoiceLineIds");
      String[] invoiceIds =
          param.get("invoiceIds") == null ? null : (String[]) param.get("invoiceIds");
      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[] discounts = param.get("discount") == null ? null : (String[]) param.get("discount");
      String[] creation_dates =
          param.get("creationDate") == null ? null : (String[]) param.get("creationDate");
      String[] created_by =
          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");

      String[] invoiceLineIds1 = Tools.add(invoiceLineIds, "0");
      String[] invoiceIds1 = Tools.add(invoiceIds, "0");
      String itemNo1[] = Tools.add(itemNos, this.apInvoiceLine.getItemNo() + "");
      String catalogNo1[] = Tools.add(catalogNo, this.apInvoiceLine.getCatalogNo());
      String names1[] = Tools.add(names, this.apInvoiceLine.getName()); // name 未填
      String qtys1[] = Tools.add(qtys, this.apInvoiceLine.getQty() + "");
      String qtyUoms1[] = Tools.add(qtyUoms, this.apInvoiceLine.getQtyUom());
      String unitPrices1[] = Tools.add(unitPrices, this.apInvoiceLine.getUnitPrice() + "");
      String amounts1[] = Tools.add(amounts, this.apInvoiceLine.getAmount() + "");
      String taxs1[] = Tools.add(taxs, this.apInvoiceLine.getTax() + "");
      String[] sizes1 = Tools.add(sizes, this.apInvoiceLine.getSize() + "");
      String[] lineNo1 = Tools.add(lineNo, this.apInvoiceLine.getLineNo() + "");
      String[] discounts1 = Tools.add(discounts, this.apInvoiceLine.getDiscount() + "");
      String[] creation_dates1 = Tools.add(creation_dates, Tools.getCurrentTime("yyyy-MM-dd"));
      String[] created_by1 = Tools.add(created_by, SessionUtil.getUserId() + "");
      String[] modify_dates1 = Tools.add(modify_dates, Tools.getCurrentTime("yyyy-MM-dd") + "");
      String[] modified_by1 = Tools.add(modified_by, SessionUtil.getUserId() + "");

      param.put("invoiceLineIds", invoiceLineIds1);
      param.put("invoiceIds", invoiceIds1);
      param.put("itemNo", itemNo1);
      param.put("catalogNo", catalogNo1);
      param.put("name", names1);
      param.put("qty", qtys1);
      param.put("qtyUom", qtyUoms1);
      param.put("amount", amounts1);
      param.put("tax", taxs1);
      param.put("unitPrice", unitPrices1);
      param.put("size", sizes1);
      param.put("lineNo", lineNo1);
      param.put("discount", discounts1);
      param.put("creationDate", creation_dates1);
      param.put("createdBy", created_by1);
      param.put("modifyDate", modify_dates1);
      param.put("modifiedBy", modified_by1);

      //		 			ctx.getSession().put("param", param);
    } else {
      String[] invoiceLineIds = new String[1];
      invoiceLineIds[0] = "0";
      String[] invoiceIds = new String[1];
      invoiceIds[0] = "0";
      String itemNo[] = new String[1];
      itemNo[0] = this.apInvoiceLine.getItemNo() + "";
      String catalogNo[] = new String[1];
      catalogNo[0] = apInvoiceLine.getCatalogNo();
      String names[] = new String[1];
      names[0] = apInvoiceLine.getName(); // 还未给值
      String qtys[] = new String[1];
      qtys[0] = apInvoiceLine.getQty() + "";
      String qtyUoms[] = new String[1];
      qtyUoms[0] = apInvoiceLine.getQtyUom();
      String unitPrices[] = new String[1];
      unitPrices[0] = this.apInvoiceLine.getUnitPrice() + "";
      String amounts[] = new String[1];
      amounts[0] = this.apInvoiceLine.getAmount() + "";
      String taxs[] = new String[1];
      taxs[0] = this.apInvoiceLine.getTax() + "";
      String[] sizes = new String[1];
      sizes[0] = this.apInvoiceLine.getSize() + "";
      String[] lineNo = new String[1];
      lineNo[0] = this.apInvoiceLine.getLineNo() + "";
      String[] discount = new String[1];
      discount[0] = this.apInvoiceLine.getDiscount() + "";
      String[] creation_dates = Tools.add(null, Tools.getCurrentTime("yyyy-MM-dd") + "");
      String[] created_by = Tools.add(null, SessionUtil.getUserId() + "");
      String[] modify_dates = Tools.add(null, Tools.getCurrentTime("yyyy-MM-dd") + "");
      String[] modified_by = Tools.add(null, SessionUtil.getUserId() + "");

      param.put("invoiceLineIds", invoiceLineIds);
      param.put("invoiceIds", invoiceIds);
      param.put("itemNo", itemNo);
      param.put("catalogNo", catalogNo);
      param.put("name", names);
      param.put("qty", qtys);
      param.put("qtyUom", qtyUoms);
      param.put("amount", amounts);
      param.put("tax", taxs);
      param.put("unitPrice", unitPrices);
      param.put("size", sizes);
      param.put("lineNo", lineNo);
      param.put("discount", discount);
      param.put("creationDate", creation_dates);
      param.put("createdBy", created_by);
      param.put("modifyDate", modify_dates);
      param.put("modifiedBy", modified_by);
      //		 			ctx.getSession().put("param", param);
    }

    Struts2Util.getRequest().setAttribute("paramEL", param);
    return dispatch;
  }
Exemple #20
0
  public String searchServicePriceByCatalogId() {
    Map<String, Object> rt = new HashMap<String, Object>();
    String catalogId = ServletActionContext.getRequest().getParameter("catalogId");
    String catalogNo = ServletActionContext.getRequest().getParameter("catalogNo");
    String returnType = ServletActionContext.getRequest().getParameter("returnType");
    String serviceIdDetail = ServletActionContext.getRequest().getParameter("serviceIdDetail");
    this.serviceBCategoryOfPriceList =
        this.servService.getServiceCategoryByCatalogId(catalogId, null, 1);
    if (serviceBCategoryOfPriceList != null && !serviceBCategoryOfPriceList.isEmpty()) {
      this.serviceCCategoryOfPriceList =
          this.servService.getServiceCategoryByCatalogId(
              catalogId, serviceBCategoryOfPriceList.get(0).getCategoryId(), 2);
      if (serviceCCategoryOfPriceList != null && !serviceCCategoryOfPriceList.isEmpty()) {
        this.serviceCategoryOfPriceList =
            this.servService.getServiceCategoryByCatalogId(
                catalogId, serviceCCategoryOfPriceList.get(0).getCategoryId(), 3);
      } else {
        this.serviceCategoryOfPriceList = new ArrayList<ServiceCategory>();
      }
    } else {
      this.serviceCCategoryOfPriceList = new ArrayList<ServiceCategory>();
      this.serviceCategoryOfPriceList = new ArrayList<ServiceCategory>();
    }

    if (serviceCategoryOfPriceList == null || serviceCategoryOfPriceList.isEmpty()) {
      this.servicePrice = new ServicePrice();
    } else {

      String key = null;
      if ("serviceId".equals(returnType)) {
        key = catalogId + "_" + serviceIdDetail;
      } else {
        key = catalogId + "_" + catalogNo;
      }
      Object obj =
          SessionUtil.getOneRow(SessionPdtServ.ServicePricing.value(), sessionServiceId, key);
      if (obj != null) {
        this.servicePrice = (ServicePrice) obj;
        if (servicePrice != null && servicePrice.getCategoryId() != null) {
          ServiceCategory pcategory =
              this.servService.getServiceCategoryDetail(servicePrice.getCategoryId());
          if (pcategory != null && pcategory.getParentCatId() != null) {
            ServiceCategory ccategory =
                this.servService.getServiceCategoryDetail(pcategory.getParentCatId());
            if (ccategory != null) {
              this.ccategoryId = ccategory.getCategoryId();
              if (ccategory.getParentCatId() != null) {
                ServiceCategory bcategory =
                    this.servService.getServiceCategoryDetail(ccategory.getParentCatId());
                if (bcategory != null) {
                  this.bcategoryId = bcategory.getCategoryId();
                }
              }
            }
          }
        }
      } else {
        if ("serviceId".equals(returnType)) {
          this.servicePrice =
              this.servService.getServicePriceByServiceIdAndCatalogId(
                  catalogId, Integer.valueOf(serviceIdDetail));
          if (servicePrice != null && servicePrice.getCategoryId() != null) {
            ServiceCategory pcategory =
                this.servService.getServiceCategoryDetail(servicePrice.getCategoryId());
            if (pcategory != null && pcategory.getParentCatId() != null) {
              ServiceCategory ccategory =
                  this.servService.getServiceCategoryDetail(pcategory.getParentCatId());
              if (ccategory != null) {
                this.ccategoryId = ccategory.getCategoryId();
                if (ccategory.getParentCatId() != null) {
                  ServiceCategory bcategory =
                      this.servService.getServiceCategoryDetail(ccategory.getParentCatId());
                  if (bcategory != null) {
                    this.bcategoryId = bcategory.getCategoryId();
                  }
                }
              }
            }
          }
        } else {
          List<com.genscript.gsscm.serv.entity.Service> serv =
              this.servService.getServiceByCatalogNo(catalogNo);
          if (serv.isEmpty()) {
            this.servicePrice = new ServicePrice();
          } else {
            this.servicePrice =
                this.servService.getServicePriceByServiceIdAndCatalogId(
                    catalogId, serv.get(0).getServiceId());
          }
        }
      }
    }
    Catalog catg = this.productService.getCatalogByCatalogId(catalogId);
    rt.put("priceAppr", this.getPriceAppr());
    rt.put("serviceCategoryOfPriceList", serviceCategoryOfPriceList);
    rt.put("serviceBCategoryOfPriceList", serviceBCategoryOfPriceList);
    rt.put("serviceCCategoryOfPriceList", serviceCCategoryOfPriceList);
    rt.put("ccategoryId", this.ccategoryId);
    rt.put("bcategoryId", this.bcategoryId);
    rt.put("currencyCode", catg.getCurrencyCode());
    rt.put("id", catg.getId());
    rt.put("message", SUCCESS);
    rt.put("servicePrice", servicePrice);
    Struts2Util.renderJson(rt);
    return null;
  }