NC参照 根据名称转换为主键值,如部门、人员等参照根据部门名称、人员名称获取对应的主键值

NC参照 根据名称转换为主键值,如部门、人员等参照根据部门名称、人员名称获取对应的主键值

private BillCardPanel getEditBillCardPanel() {
	return getEditor().getBillCardPanel();
}

private BillData getEditorBillData() {
	return this.getEditor().getBillCardPanel().getBillData();
}

public ArapBillImportForm getEditor() {
	return (ArapBillImportForm) this.getBean(IArapImportConstant.BIZCATOR_EDITOR_BEAN_NAME);
}

String pkorg = (String) headVO.getAttributeValue(IArapImportConstant.IMPORT_PK_ORG);

String[] attributeNames = headVO.getAttributeNames();
Object attributeValue;
for (String key : attributeNames) {
	attributeValue = headVO.getAttributeValue(key);
}
BillItem headItem = getEditBillCardPanel().getHeadItem(key);
CustBankaccDefaultRefModel CustModel = (CustBankaccDefaultRefModel) ((UIRefPane) headItem.getComponent()).getRefModel();
CustModel.setPk_cust((String) headVO.getAttributeValue(IBillFieldGet.CUSTOMER));
((UIRefPane) headItem.getComponent()).setBlurValue(String.valueOf(attributeValue));
attributeValue = ((UIRefPane) headItem.getComponent()).getRefPK();

String[] attributeNames = bodyVO.getAttributeNames();
if (attributeNames != null) {
	for (String strKey : attributeNames) {
		Object attributeValue = vo.getAttributeValue(strKey);
		if (attributeValue != null) {
			BillItem bodyItem = getEditBillCardPanel().getBodyItem(strKey);
			convert2RefPK(bodyItem, attributeValue, pkorg);
		}
	}
}

public static String convert2RefPK(BillItem bodyItem, String value, String pk_org) {
		if (StringUtil.isEmpty(value)) {
			return value;
		}
		if (IBillFieldGet.SCOMMENT.equals(bodyItem.getKey()) || IBillFieldGet.CHECKNO.equals(bodyItem.getKey()))
			return value;
		String docpk = null;
		JComponent component = bodyItem.getComponent();
		((UIRefPane) component).setPk_org(pk_org);
		if (component != null && component instanceof UIRefPane) {
			if (bodyItem.getKey().equals(IBillFieldGet.PK_DEPTID) || bodyItem.getKey().equals(IBillFieldGet.PU_DEPTID) || bodyItem.getKey().equals(IBillFieldGet.SO_DEPTID)) {
				DeptDefaultNCRefModel deptModel = (DeptDefaultNCRefModel) ((UIRefPane) component).getRefModel();
				deptModel.setBusifuncode("all");
				((UIRefPane) component).setBlurValue(value);
				docpk = ((UIRefPane) component).getRefPK();
				if (docpk == null) {
					docpk = dealMultiOrgValue(pk_org, value, component);
					if (docpk != null)
						return docpk;
				}
			} else if (bodyItem.getKey().equals(IBillFieldGet.PK_DEPTID_V) || bodyItem.getKey().equals(IBillFieldGet.PU_DEPTID_V) || bodyItem.getKey().equals(IBillFieldGet.SO_DEPTID_V)) {
				DeptVersionDefaultNCRefModel deptModel = (DeptVersionDefaultNCRefModel) ((UIRefPane) component).getRefModel();
				deptModel.setBusifuncode("all");
				((UIRefPane) component).setBlurValue(value);
				docpk = ((UIRefPane) component).getRefPK();
				if (docpk == null) {
					docpk = dealMultiOrgValue(pk_org, value, component);
					if (docpk != null)
						return docpk;
				}
			} else if (bodyItem.getKey().equals(IBillFieldGet.PK_PSNDOC) || bodyItem.getKey().equals(IBillFieldGet.SO_PSNDOC) || bodyItem.getKey().equals(IBillFieldGet.PU_PSNDOC)) {
				PsndocDefaultNCRefModel psnModel = (PsndocDefaultNCRefModel) ((UIRefPane) component).getRefModel();
				psnModel.setBusifuncode("all");
			} else if (bodyItem.getKey().equals(IBillFieldGet.SUBJCODE)) {
				if (value.indexOf("\\") > 0) {
					value = value.substring(0, value.indexOf("\\"));
				}
			}
			((UIRefPane) component).setBlurValue(value);
			docpk = ((UIRefPane) component).getRefPK();
		}
		if (docpk == null) {
			StringBuffer sbException = new StringBuffer();
			sbException.append(bodyItem.getName()).append(":[").append(value).append("]不存在!");
			throw new BusinessRuntimeException(sbException.toString());
		}
		return docpk;
	}

	private static String dealMultiOrgValue(String pk_org, String value, JComponent component) {
		String docpk = null;
		try {
			Set<String> set = OrgConsignationUtils.getOrgConsignationList(pk_org);
			for (String org : set) {
				((UIRefPane) component).setPk_org(org);
				((UIRefPane) component).setBlurValue(value);
				docpk = ((UIRefPane) component).getRefPK();
				if (docpk != null)
					break;
			}
		} catch (Exception e) {
			throw new BusinessRuntimeException(e.getMessage(), e);
		}
		return docpk;
	}
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值