日期-货架 区间查询

Business中

            // 日期处理
            Date[] dates = WmsFormatter.getFromTo( (Date)txt_PrdDateFrom.getValue(), (Date)txt_PrdDateTo.getValue());
            String fromDate = WmsFormatter.toParamDate( dates[0] );
            String toDate = WmsFormatter.toParamDate( dates[1] );
            if( StringUtils.isBlank( fromDate ) ){
            	inparam.set(RetrievalSetSearchOutSCHParams.PRD_DATE_FROM, RetrievalUtil.MIN_PLAN_DAY);
            }else{
            	inparam.set(RetrievalSetSearchOutSCHParams.PRD_DATE_FROM, fromDate);
            }
            if( StringUtils.isBlank( toDate ) ){
            	inparam.set(RetrievalSetSearchOutSCHParams.PRD_DATE_TO, RetrievalUtil.MAX_PLAN_DAY);
            }else{
            	inparam.set(RetrievalSetSearchOutSCHParams.PRD_DATE_TO, toDate);
            }
            
            // 货架处理
            String style = areaCtrl.getAreaOrionDefault().getLocationStyle();
            String[] dispLocations = WmsFormatter.getFromTo(txt_LocationFrom.getStringValue(), txt_LocationTo.getStringValue());
            if( !StringUtils.isBlank( dispLocations[0]) ){
            	inparam.set(RetrievalSetSearchOutSCHParams.LOCATION_FROM, WmsFormatter.toParamLocation(dispLocations[0], style));
            }else{
            	inparam.set(RetrievalSetSearchOutSCHParams.LOCATION_FROM, "");
            }
            if( !StringUtils.isBlank( dispLocations[1]) ){
            	inparam.set(RetrievalSetSearchOutSCHParams.LOCATION_TO, WmsFormatter.toParamLocation(dispLocations[1], style));
            }else{
            	inparam.set(RetrievalSetSearchOutSCHParams.LOCATION_TO, "");
            }


SCH中

        // 生产日期
        String fromDay = (String)param.getPrdDateFrom();
        String toDay = (String)param.getPrdDateTo();
        if( !StringUtils.isBlank( fromDay ) ){
        	key.setKey(BatchInfo.PRD_DATE, fromDay, ">=", "", "", true);
        }
        if( !StringUtils.isBlank( toDay ) ){
        	key.setKey(BatchInfo.PRD_DATE, toDay, "<=", "", "", true);
        }
        
        // 货架
        LocationNumber fromLoc = null;
        LocationNumber toLoc = null;
        AreaController areaCtlr = new AreaController(getConnection(), getClass());
        Area area = areaCtlr.getAreaOrionDefault();
        String whStNo = area.getWhstationNo();
        String areaNo = areaCtlr.getAreaOrionDefault().getAreaNo();
        String eType = areaCtlr.getEmploymentTypeOfWarehouse(whStNo);
        boolean closeSystem = WareHouse.EMPLOYMENT_TYPE_CLOSE.equals(eType);
        if (!StringUtil.isBlank(param.getLocationFrom()))
        {
            fromLoc = new LocationNumber(areaCtlr.getLocationStyle(areaNo));
            fromLoc.parseParam( (String)param.getLocationFrom() );
        }
        if (!StringUtil.isBlank(param.getLocationTo()))
        {
            toLoc = new LocationNumber(areaCtlr.getLocationStyle(areaNo));
            toLoc.parseParam( (String)param.getLocationTo());
        }
        //----------------------
        // Pallet
        //----------------------
        key.setKey(Pallet.WH_STATION_NO, whStNo);

        // stock status
        String[] palletStats = {
                Pallet.PALLET_STATUS_REGULAR,
                Pallet.PALLET_STATUS_RETRIEVAL_PLAN,
                Pallet.PALLET_STATUS_RETRIEVAL,
        };
        key.setKey(Pallet.STATUS_FLAG, palletStats, true);

        if (closeSystem)
        {
            key.setKey(Pallet.EMPTY_FLAG, SystemDefine.EMPTY_FLAG_EMPTY, "!=", "", "", true);
        }

        //----------------------
        // Shelf
        //----------------------
        key.setKey(Shelf.STATUS_FLAG, SystemDefine.LOCATION_STATUS_FLAG_STORAGED);
        key.setKey(Shelf.PROHIBITION_FLAG, Shelf.PROHIBITION_FLAG_OK);
        key.setKey(Shelf.ACCESS_NG_FLAG, Shelf.ACCESS_NG_FLAG_OK);

        // Location range
        if (fromLoc != null)
        {
            String location[] = fromLoc.getLocation();
            key.setKey(Shelf.BANK_NO, new BigDecimal(location[LocationNumber.IDX_BANK]), ">=", "", "", true);
            key.setKey(Shelf.BAY_NO, new BigDecimal(location[LocationNumber.IDX_BAY]), ">=", "", "", true);
            key.setKey(Shelf.LEVEL_NO, new BigDecimal(location[LocationNumber.IDX_LEVEL]), ">=", "", "", true);
        }
        if (toLoc != null)
        {
            String location[] = toLoc.getLocation();
            key.setKey(Shelf.BANK_NO, new BigDecimal(location[LocationNumber.IDX_BANK]), "<=", "", "", true);
            key.setKey(Shelf.BAY_NO, new BigDecimal(location[LocationNumber.IDX_BAY]), "<=", "", "", true);
            key.setKey(Shelf.LEVEL_NO, new BigDecimal(location[LocationNumber.IDX_LEVEL]), "<=", "", "", true);
        }

        //----------------------
        // set join keys
        //----------------------
        key.setJoin(Stock.PALLET_ID, Pallet.PALLET_ID);
        key.setJoin(Pallet.CURRENT_STATION_NO, Shelf.STATION_NO);
        // 商品表
        key.setJoin(Stock.CONSIGNOR_CODE, "", Item.CONSIGNOR_CODE, "(+)");
        key.setJoin(Stock.ITEM_CODE, "", Item.ITEM_CODE, "(+)");
        key.setJoin( Item.CLS_PRODUCT_ID, ItemType.CLS_PRODUCT_ID );
        key.setJoin( Item.SORT_ID, ItemVariety.SORT_ID );
        // 批次表
        key.setJoin(Stock.LOT_NO, BatchInfo.LOT_NO);
        // 订单明细
        if( isACode ){
        	key.setJoin( Item.JAN, OrderDetail.SAP_PRODUCT_ID );
        }else{
        	key.setKey( Item.ITF, OrderDetail.SAP_PRODUCT_ID );
        }
        


 

你可能感兴趣的:(日期-货架 区间查询)