/** * Excel出力時のバリデートを行います. * * @return 表示するメッセージ */ public ActionErrors validate() { ActionErrors errors = new ActionErrors(); String labelPeriodMonth = MessageResourcesUtil.getMessage("labels.periodMonth"); String labelAllocatedQuantity = MessageResourcesUtil.getMessage("labels.allocatedQuantity"); if (RadioCond2.VALUE_5.equals(radioCond2) && !StringUtil.hasLength(allocatedQuantity)) { errors.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.required", labelAllocatedQuantity)); } if (StringUtil.hasLength(periodMonth)) { try { Integer.valueOf(periodMonth); } catch (NumberFormatException e) { errors.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.integer", labelPeriodMonth)); } } if (RadioCond2.VALUE_5.equals(radioCond2) && StringUtil.hasLength(allocatedQuantity)) { try { Integer.valueOf(allocatedQuantity); } catch (NumberFormatException e) { errors.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.integer", labelAllocatedQuantity)); } } return errors; }
/** * 顧客コードから顧客と請求先情報を取得します( 完全一致版).<br> * 顧客コードが完全に一致しない場合は値が返りません. * * @return 納入先情報(1件) * @throws Exception */ @Execute(validator = false, urlPattern = "getCustomerAndBillInfosByCustomerCode/{customerCode}") public String getCustomerAndBillInfosByCustomerCode() throws Exception { // 顧客コードを指定しない場合は検索しません if (!StringUtil.hasLength(commonDeliveryForm.customerCode)) { ResponseUtil.write("", "text/javascript"); return null; } List<DeliveryAndPre> deliveryList; try { deliveryList = deliveryService.searchDeliveryByCompleteCustomerCode(commonDeliveryForm.customerCode); } catch (ServiceException e) { super.errorLog(e); throw e; } // 納入先コードを指定した検索なので複数はかえらない if (deliveryList.size() == 1) { BeanMap map = super.createBeanMapWithNullToEmpty(deliveryList.get(0)); ResponseUtil.write(JSON.encode(map), "text/javascript"); } else { ResponseUtil.write("", "text/javascript"); } return null; }
/** * レートIDからレートマスタの情報を取得します. * * @return レートマスタ情報 * @throws Exception */ @Execute(validator = false, urlPattern = "getRateInfosByRateId/{rateId}") public String getRateInfosByRateId() throws Exception { if (!StringUtil.hasLength(commonRateForm.rateId)) { ResponseUtil.write("", "text/javascript"); return null; } try { Rate rate = rateService.findById(commonRateForm.rateId); if (rate != null) { BeanMap map = Beans.createAndCopy(BeanMap.class, rate) .dateConverter(Constants.FORMAT.TIMESTAMP, "creDatetm", "updDatetm") .execute(); BeanMap bmap = super.createBeanMapWithNullToEmpty(map); ResponseUtil.write(JSON.encode(bmap), "text/javascript"); } else { ResponseUtil.write("", "text/javascript"); } } catch (ServiceException e) { super.errorLog(e); throw e; } return null; }
/** * パラメータの入力チェックを行います. * * @return 表示するメッセージ */ public ActionMessages validate() { ActionMessages errors = new ActionMessages(); // 検索条件の有無チェック if (!StringUtil.hasLength(productCode)) { errors.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.condition.insufficiency")); } return errors; }
/** * 編集モード時の初期化処理を行います.<br> * 処理実行後、{@link Mapping#INPUT}で定義されたURIに遷移します. * * @return 画面遷移先のURI文字列 * @throws Exception */ @Execute(validator = false, urlPattern = "edit/{deptId}") public String edit() throws Exception { try { this.editDeptForm.deptId = StringUtil.decodeSL(this.editDeptForm.deptId); this.init(this.editDeptForm.deptId); } catch (ServiceException e) { super.errorLog(e); throw e; } return EditDeptAction.Mapping.INPUT; }
/** * 検索条件を設定します. * * @param conditions 検索条件値のマップ * @param param 検索条件のマップ * @return 検索条件値を設定した検索条件マップ */ private Map<String, Object> setConditionParam( Map<String, Object> conditions, Map<String, Object> param) { for (int i = 0; i < CustomerHistoryService.paramArray.length; i++) { String key = CustomerHistoryService.paramArray[i]; if (conditions.containsKey(key)) { if (StringUtil.hasLength((String) conditions.get(key))) { param.put(key, (String) conditions.get(key)); } } } return param; }
/** * 顧客コードから納入先リストを返します.<br> * 顧客コードが完全に一致しない場合は値が返りません.<br> * 返す値は、納入先コードと納入先名のリスト、かつ、作成日の昇順で、請求先は除外しています.<br> * mapの内容は key = "value" + No name = 納入先コード、納入先名の順番です. * * @return 納入先リスト情報 * @throws Exception */ @Execute(validator = false) public String getDeliveryListByCustomerCodeSortedByCreDate() throws Exception { // 顧客コードを指定しない場合は検索しません if (!StringUtil.hasLength(commonDeliveryForm.customerCode)) { ResponseUtil.write("", "text/javascript"); return null; } List<DeliveryAndPre> deliveryList; try { deliveryList = deliveryService.searchDeliveryByCompleteCustomerCodeSortedByCreDate( commonDeliveryForm.customerCode); // 納入先コードと納入先名を返す int i = 0; String key; Map<String, Object> param = new HashMap<String, Object>(); for (DeliveryAndPre dap : deliveryList) { key = "value" + Integer.toString(i); param.put(key, dap.deliveryCode); key = "name" + Integer.toString(i); param.put(key, dap.deliveryName); i++; } if (deliveryList.size() != 0) { BeanMap map = super.createBeanMapWithNullToEmpty(param); ResponseUtil.write(JSON.encode(map), "text/javascript"); } else { ResponseUtil.write("", "text/javascript"); } } catch (ServiceException e) { super.errorLog(e); throw e; } return null; }
/** * アクションフォームを初期化します. * * @param deptId 部門ID * @throws ServiceException */ private void init(String deptId) throws ServiceException { this.editDeptForm.reset(); this.editDeptForm.isUpdate = super.userDto.isMenuUpdate(Constants.MENU_ID.SETTING_DEPT); List<Dept> deptList = this.deptService.findAllDept(); for (Dept dept : deptList) { this.editDeptForm.parentList.add(new LabelValueBean(dept.name, dept.deptId)); } this.editDeptForm.parentList.add(0, new LabelValueBean()); if (!StringUtil.hasLength(deptId)) { return; } List<DeptDto> deptDtoList = this.deptService.convertEntityToDto(deptList); for (DeptDto dto : deptDtoList) { if (!deptId.equals(dto.deptId)) { continue; } List<DeptDto> descDeptList = dto.getDescDetp(); Iterator<LabelValueBean> ite = this.editDeptForm.parentList.iterator(); while (ite.hasNext()) { LabelValueBean bean = ite.next(); if (bean.getValue() == null) { continue; } if (bean.getValue().equals(deptId)) { ite.remove(); continue; } for (DeptDto desc : descDeptList) { if (bean.getValue().equals(desc.deptId)) { ite.remove(); break; } } } } Dept dept = this.deptService.findById(deptId); if (dept == null) { return; } Beans.copy(dept, this.editDeptForm) .timestampConverter(Constants.FORMAT.TIMESTAMP) .dateConverter(Constants.FORMAT.DATE) .execute(); this.editDeptForm.creDatetmShow = StringUtil.getDateString(Constants.FORMAT.DATE, dept.creDatetm); this.editDeptForm.updDatetmShow = StringUtil.getDateString(Constants.FORMAT.DATE, dept.updDatetm); this.editDeptForm.editMode = true; }
/** * 検索条件パラメータを設定して返します. * * @param conditions 検索条件 * @param param 検索条件パラメータ * @return 検索条件が設定された検索条件パラメータ */ private Map<String, Object> setConditionParam( Map<String, Object> conditions, Map<String, Object> param) { if (conditions.containsKey(Param.SUPPLIER_SLIP_ID)) { if (StringUtil.hasLength((String) conditions.get(Param.SUPPLIER_SLIP_ID))) { param.put( Param.SUPPLIER_SLIP_ID, new Long((String) conditions.get(Param.SUPPLIER_SLIP_ID))); } } if (conditions.containsKey(Param.STATUS)) { if ((conditions.get(Param.STATUS) != null)) { param.put(Param.STATUS, conditions.get(Param.STATUS)); } } if (conditions.containsKey(Param.PO_SLIP_ID)) { if (StringUtil.hasLength((String) conditions.get(Param.PO_SLIP_ID))) { param.put(Param.PO_SLIP_ID, new Long((String) conditions.get(Param.PO_SLIP_ID))); } } if (conditions.containsKey(Param.USER_NAME)) { if (StringUtil.hasLength((String) conditions.get(Param.USER_NAME))) { param.put( Param.USER_NAME, super.createPartialSearchCondition((String) conditions.get(Param.USER_NAME))); } } if (conditions.containsKey(Param.SUPPLIER_DATE_FROM)) { if (StringUtil.hasLength((String) conditions.get(Param.SUPPLIER_DATE_FROM))) { param.put(Param.SUPPLIER_DATE_FROM, (String) conditions.get(Param.SUPPLIER_DATE_FROM)); } } if (conditions.containsKey(Param.SUPPLIER_DATE_TO)) { if (StringUtil.hasLength((String) conditions.get(Param.SUPPLIER_DATE_TO))) { param.put(Param.SUPPLIER_DATE_TO, (String) conditions.get(Param.SUPPLIER_DATE_TO)); } } if (conditions.containsKey(Param.DELIVERY_PROCESS_CATEGORY)) { Object obj = conditions.get(Param.DELIVERY_PROCESS_CATEGORY); if (obj != null) { String[] arry = (String[]) obj; if (arry.length > 0) { param.put(Param.DELIVERY_PROCESS_CATEGORY, arry); } } } if (conditions.containsKey(Param.SUPPLIER_CODE)) { if (StringUtil.hasLength((String) conditions.get(Param.SUPPLIER_CODE))) { param.put( Param.SUPPLIER_CODE, super.createPrefixSearchCondition((String) conditions.get(Param.SUPPLIER_CODE))); } } if (conditions.containsKey(Param.SUPPLIER_NAME)) { if (StringUtil.hasLength((String) conditions.get(Param.SUPPLIER_NAME))) { param.put( Param.SUPPLIER_NAME, super.createPartialSearchCondition((String) conditions.get(Param.SUPPLIER_NAME))); } } if (conditions.containsKey(Param.REMARKS)) { if (StringUtil.hasLength((String) conditions.get(Param.REMARKS))) { param.put( Param.REMARKS, super.createPartialSearchCondition((String) conditions.get(Param.REMARKS))); } } if (conditions.containsKey(Param.PRODUCT_CODE)) { if (StringUtil.hasLength((String) conditions.get(Param.PRODUCT_CODE))) { param.put( Param.PRODUCT_CODE, super.createPrefixSearchCondition((String) conditions.get(Param.PRODUCT_CODE))); } } if (conditions.containsKey(Param.PRODUCT_ABSTRACT)) { if (StringUtil.hasLength((String) conditions.get(Param.PRODUCT_ABSTRACT))) { param.put( Param.PRODUCT_ABSTRACT, super.createPartialSearchCondition((String) conditions.get(Param.PRODUCT_ABSTRACT))); } } if (conditions.containsKey(Param.PRODUCT1)) { if (StringUtil.hasLength((String) conditions.get(Param.PRODUCT1))) { param.put(Param.PRODUCT1, conditions.get(Param.PRODUCT1)); } } if (conditions.containsKey(Param.PRODUCT2)) { if (StringUtil.hasLength((String) conditions.get(Param.PRODUCT2))) { param.put(Param.PRODUCT2, conditions.get(Param.PRODUCT2)); } } if (conditions.containsKey(Param.PRODUCT3)) { if (StringUtil.hasLength((String) conditions.get(Param.PRODUCT3))) { param.put(Param.PRODUCT3, conditions.get(Param.PRODUCT3)); } } if (conditions.containsKey(Param.SORT_COLUMN)) { if (StringUtil.hasLength((String) conditions.get(Param.SORT_COLUMN))) { param.put( Param.SORT_COLUMN, StringUtil.convertColumnName((String) conditions.get(Param.SORT_COLUMN))); } } Boolean sortOrderAsc = (Boolean) conditions.get(Param.SORT_ORDER_ASC); if (sortOrderAsc) { param.put(Param.SORT_ORDER_ASC, Constants.SQL.ASC); } else { param.put(Param.SORT_ORDER_ASC, Constants.SQL.DESC); } if (conditions.containsKey(Param.ROW_COUNT)) { param.put(Param.ROW_COUNT, conditions.get(Param.ROW_COUNT)); } if (conditions.containsKey(Param.OFFSET_ROW)) { param.put(Param.OFFSET_ROW, conditions.get(Param.OFFSET_ROW)); } return param; }
/** * 商品コードから商品情報を取得します. * * @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; }