BOS查询过滤总集


	/**
	 * 验证客户名称是否唯一
	 * 
	 * @throws BOSException
	 * @throws SQLException
	 */
	private void isUniqueName() throws BOSException, SQLException {
		String customerName = "";
		String id = "";
		boolean flag = false;

		if (txtcustomerName.getStringValue() != null) {
			customerName = txtcustomerName.getStringValue();
		}

		if (prmtcustomerNumber.getValue() != null) {
			id = ((CustomerInfo) prmtcustomerNumber.getValue()).getId().toString();
		}

		if (customerBillType.getSelectedIndex() == 0) {// 单据类型为新增
			String sql = "select count(FID) as quantity from T_BD_Customer where FNAME_L2='" + customerName + "' and FCONTROLUNITID='" + SysContext.getSysContext().getCurrentCtrlUnit().getId().toString() + "'";

			IRowSet executeQuery = SQLExecutorFactory.getRemoteInstance(sql).executeSQL();

			if (executeQuery.next()) {
				int quantity = executeQuery.getInt("quantity");
				if (quantity >= 1) {
					flag = true;
				} else {
					flag = false;
				}

			}

		} else if (customerBillType.getSelectedIndex() == 1) {// 单据类型为变更
			String sql = "select count(FID) as quantity from T_BD_Customer where FNAME_L2='" + customerName + "' and FID <>'" + id + "' and FCONTROLUNITID='" + SysContext.getSysContext().getCurrentCtrlUnit().getId().toString() + "'";

			IRowSet executeQuery = SQLExecutorFactory.getRemoteInstance(sql).executeSQL();

			if (executeQuery.next()) {
				int quantity = executeQuery.getInt("quantity");
				if (quantity >= 1) {
					flag = true;
				} else {
					flag = false;
				}
			}

			if (flag) {
				MsgBox.showInfo("客户名称【" + customerName + "】重复!");
				SysUtil.abort();
			}
		}
	}
	
	
	/**
	 * 客户编码按照当前组织隔离
	 */
	private void setFilterForCustomerNumber() {
		EntityViewInfo view = new EntityViewInfo();
		FilterInfo filter = new FilterInfo();
		String ctrlId = SysContext.getSysContext().getCurrentFIUnit().getCU().getId().toString();
		filter.getFilterItems().add(new FilterItemInfo("CU.id", ctrlId, CompareType.EQUALS));
		view.setFilter(filter);
		prmtcustomerNumber.setEntityViewInfo(view);

	}
	
	
	/**
	 * 根据财务组织编码查找对应的法人标识值
	 */
	private String findValueByNumber(String number) {
		String sql = "select FNAME_L2 from CT_FC_CodingIdentifier where FNUMBER='" + number + "'";
		try {
			IRowSet executeQuery = SQLExecutorFactory.getRemoteInstance(sql).executeSQL();
			if (executeQuery.next()) {
				String name = executeQuery.getString("FNAME_L2");
				return name;
			}
		} catch (BOSException e1) {
			e1.printStackTrace();
		} catch (SQLException e2) {
			e2.printStackTrace();
		}
		return "B";
	}
	
	
	view.setSelector(sic); // 查询列
	FilterInfo filterCondition = new FilterInfo();
	filterCondition.getFilterItems().add(new FilterItemInfo("id", addressInfo.getId().toString(), CompareType.EQUALS));
	view.setFilter(filterCondition); // 过滤条件
	AddressCollection addressCollection;
	try {
		addressCollection = AddressFactory.getRemoteInstance().getAddressCollection(view);
		if (addressCollection != null && addressCollection.size() != 0) {
			addressInfo = addressCollection.get(0);
			kdtDeliveryAddresses.getRow(rowIndex).getCell("province").setValue(addressInfo.getProvinceId());
			kdtDeliveryAddresses.getRow(rowIndex).getCell("city").setValue(addressInfo.getCityId());
			kdtDeliveryAddresses.getRow(rowIndex).getCell("region").setValue(addressInfo.getDistrictId());
			kdtDeliveryAddresses.getRow(rowIndex).getCell("contacts").setValue(addressInfo.getLinkMan());
			kdtDeliveryAddresses.getRow(rowIndex).getCell("ContactNumber").setValue(addressInfo.getPhone());
		}
	} catch (BOSException e3) {
		e3.printStackTrace();
	}
	
	
	/**
	 * 根据记账分类类型过滤记帐分类
	 */
	private void setFilterToAC(CompanyOrgUnitInfo companyOrgInfo) {
		EntityViewInfo viewInfo = new EntityViewInfo();
		FilterInfo filterInfo = new FilterInfo();

		String companyId = "";
		String accountTableId = "";
		if (companyOrgInfo != null) {
			companyId = companyOrgInfo.getId().toString();
			if (companyOrgInfo.getAccountTable() != null) {
				accountTableId = companyOrgInfo.getAccountTable().getId().toString();
			}
		}

		filterInfo.getFilterItems().add(new FilterItemInfo("objectType.id", getTypeID(2), CompareType.EQUALS));

		filterInfo.getFilterItems().add(new FilterItemInfo("currencyCompany.id", companyId, CompareType.EQUALS));

		filterInfo.getFilterItems().add(new FilterItemInfo("accountTableId.id", accountTableId, CompareType.EQUALS));

		filterInfo.setMaskString("#0 and #1 and #2");

		viewInfo.setFilter(filterInfo);

		prmtaccountingClassfication.setDisplayFormat("$name$");
		prmtaccountingClassfication.setEditFormat("$number$");
		prmtaccountingClassfication.setCommitFormat("$number$");
		prmtaccountingClassfication.setQueryInfo("com.kingdee.eas.basedata.assistant.app.F7KAClassficationQuery");

		prmtaccountingClassfication.setEntityViewInfo(viewInfo);
		QueryAgent queryAgent = prmtaccountingClassfication.getQueryAgent();

		queryAgent.setEntityViewInfo(viewInfo);
		queryAgent.resetRuntimeEntityView();
	}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值