Exemplo n.º 1
0
  /**
   * 商品コードから商品数を取得します(前方一致).
   *
   * @return 商品数
   * @throws Exception
   */
  @Execute(validator = false)
  public String getProductByCodeLike() throws Exception {
    LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
    try {

      List<Product> productList =
          productService.findProductByCodeLike(commonProductForm.productCode);
      if (productList == null || productList.size() == 0) {
        map.put(Param.PRODUCT_COUNT, String.valueOf("0"));
        ResponseUtil.write(JSON.encode(map), "text/javascript");
      } else {

        if (productList.size() == 1) {
          Product product = productList.get(0);
          BeanMap bmap = super.createBeanMapWithNullToEmpty(product);
          bmap.put(Param.PRODUCT_COUNT, String.valueOf(productList.size()));
          ResponseUtil.write(JSON.encode(bmap), "text/javascript");
        } else {
          map.put(Param.PRODUCT_COUNT, String.valueOf(productList.size()));
          ResponseUtil.write(JSON.encode(map), "text/javascript");
        }
      }

    } catch (ServiceException e) {
      super.errorLog(e);
      throw e;
    }

    return null;
  }
Exemplo n.º 2
0
  /**
   * 商品コードから商品情報を取得します.
   *
   * @return 商品情報
   * @throws Exception
   */
  @Execute(validator = false)
  public String getProductInfos() throws Exception {
    ProductJoin product;
    int movableQuantity;
    try {

      product = productService.findById(commonProductForm.productCode);
      this.stockInfoDto =
          this.productStockService.calcStockQuantityByProductCode(commonProductForm.productCode);

      if (product != null && !StringUtil.hasLength(commonProductForm.rackCode)) {
        commonProductForm.rackCode = product.rackCode;
      }

      int unclosedQuantity =
          eadService.countUnclosedQuantityByProductCode(
              commonProductForm.productCode, commonProductForm.rackCode);
      int closedQuantity =
          productStockService.countClosedQuantityByProductCode(
              commonProductForm.productCode, commonProductForm.rackCode);
      movableQuantity = unclosedQuantity + closedQuantity;
    } catch (ServiceException e) {
      super.errorLog(e);
      throw e;
    }
    LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();

    if (product != null) {
      map.put(Param.SUPPLIER_CODE, (product.supplierCode == null ? "" : product.supplierCode));
      map.put(Param.PRODUCT_NAME, (product.productName == null ? "" : product.productName));
      map.put(Param.SUPPLIER_PCODE, (product.supplierPcode == null ? "" : product.supplierPcode));
      map.put(Param.PO_LOT, (product.poLot == null ? "" : product.poLot.toString()));
      map.put(Param.MAX_PO_NUM, (product.maxPoNum == null ? "" : product.maxPoNum.toString()));
      map.put(
          Param.MAX_STOCK_NUM, (product.maxStockNum == null ? "" : product.maxStockNum.toString()));
      map.put(
          Param.DISCARD_DATE,
          (product.discardDate == null ? "" : DF_YMD.format(product.discardDate)));
      map.put(
          Param.SUPPLIER_PRICE_YEN,
          (product.supplierPriceYen == null ? "" : product.supplierPriceYen.toString()));
      map.put(
          Param.SUPPLIER_PRICE_DOL,
          (product.supplierPriceDol == null ? "" : product.supplierPriceDol.toString()));
      map.put(Param.RACK_CODE, (product.rackCode == null ? "" : product.rackCode));

      map.put(
          Param.RETAIL_PRICE, (product.retailPrice == null ? "" : product.retailPrice.toString()));

      map.put(Param.RO_MAX_NUM, (product.roMaxNum == null ? "" : product.roMaxNum.toString()));

      map.put(
          Param.SET_TYPE_CATEGORY,
          (product.setTypeCategory == null ? "" : product.setTypeCategory));

      map.put(Param.DISCARDED, (product.discarded == null ? "" : product.discarded));

      map.put(Param.TAX_CATEGORY, (product.taxCategory == null ? "" : product.taxCategory));

      map.put(Param.REMARKS, (product.remarks == null ? "" : product.remarks));

      map.put(Param.EAD_REMARKS, (product.eadRemarks == null ? "" : product.eadRemarks));

      map.put(Param.UNIT_CATEGORY, (product.unitCategory == null ? "" : product.unitCategory));

      map.put(
          Param.UNIT_CATEGORY_NAME,
          (product.unitCategoryName == null ? "" : product.unitCategoryName));

      map.put(Param.ONLINE_PCODE, (product.onlinePcode == null ? "" : product.onlinePcode));

      map.put(
          Param.PACK_QUANTITY,
          (product.packQuantity == null ? "" : product.packQuantity.toString()));

      map.put(Param.LENGTH, (product.length == null ? "" : product.length.toString()));

      map.put(Param.SO_RATE, (product.soRate == null ? "" : product.soRate.toString()));

      map.put(
          Param.STOCK_CTL_CATEGORY,
          (product.stockCtlCategory == null ? "" : product.stockCtlCategory));
    } else {
      ResponseUtil.write("", "text/javascript");
      return null;
    }

    map.put(
        ShowStockInfoDialogAction.Param.PRODUCT_CODE,
        (stockInfoDto.productCode == null ? "" : stockInfoDto.productCode));
    map.put(
        ShowStockInfoDialogAction.Param.CURRENT_TOTAL_QUANTITY,
        (String.valueOf(stockInfoDto.currentTotalQuantity)));
    map.put(
        ShowStockInfoDialogAction.Param.RORDER_REST_QUANTITY,
        (String.valueOf(stockInfoDto.rorderRestQuantity)));
    map.put(
        ShowStockInfoDialogAction.Param.PORDER_REST_QUANTITY,
        (String.valueOf(stockInfoDto.porderRestQuantity)));
    map.put(
        ShowStockInfoDialogAction.Param.ENTRUST_REST_QUANTITY,
        (String.valueOf(stockInfoDto.entrustRestQuantity)));
    map.put(
        ShowStockInfoDialogAction.Param.POSSIBLE_DROW_QUANTITY,
        (String.valueOf(stockInfoDto.possibleDrawQuantity)));
    map.put(
        ShowStockInfoDialogAction.Param.HOLDING_STOCK_QUANTITY,
        (String.valueOf(stockInfoDto.holdingStockQuantity)));

    if (StringUtil.hasLength(commonProductForm.rackCode)) {
      map.put(Param.MOVABLE_QUANTITY, String.valueOf(movableQuantity));
    } else {
      map.put(Param.MOVABLE_QUANTITY, "");
    }

    ResponseUtil.write(JSON.encode(map), "text/javascript");

    return null;
  }