/**
* 验证客户名称是否唯一
*
* @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();
}
BOS查询过滤总集
最新推荐文章于 2021-04-28 15:34:00 发布