【商品注册证】加载已经保存的动态下拉框

This commit is contained in:
tanfengling@x-ri.com 2025-07-17 18:01:19 +08:00
parent 87e3bb8b19
commit 0ab92e354c
1 changed files with 55 additions and 33 deletions

View File

@ -26,50 +26,72 @@ public class RegistBillFactoryPlugin extends AbstractBillPlugIn {
this.addItemClickListeners("tqq9_advcontoolbarap");
}
@Override
public void afterBindData(EventObject e) {
super.afterBindData(e);
String tqq9_type = (String) this.getModel().getValue("tqq9_type");
if("A".equals(tqq9_type)){
//如果是总代加载总代的许可证号
String tqq9_proxyno = (String) this.getModel().getValue("tqq9_proxyno");
DynamicObject tqq9_supplier = (DynamicObject) this.getModel().getValue("tqq9_proxy");//生产厂家
ComboEdit comboEdit = this.getControl("tqq9_proxyno");
comboEdit.setText(tqq9_proxyno);
setProxyField(tqq9_supplier, "tqq9_proxyno", comboEdit);
}
}
@Override
public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e);
String name = e.getProperty().getName();
if("tqq9_supplier".equals(name)){
//动态添加厂商的许可证号
ComboEdit comboEdit = this.getControl("tqq9_supno");
DynamicObject tqq9_supplier = (DynamicObject) this.getModel().getValue("tqq9_supplier");//生产厂家
if(tqq9_supplier != null){
tqq9_supplier = BusinessDataServiceHelper.loadSingle(tqq9_supplier.getPkValue(), tqq9_supplier.getDynamicObjectType().getName());
String tqq9_taxno = tqq9_supplier.getString("tqq9_taxno");//税号
String tqq9_prolicense = tqq9_supplier.getString("tqq9_prolicense");//医疗器械生产许可证号
String tqq9_saleno = tqq9_supplier.getString("tqq9_saleno");//医疗器械经营许可证号
String tqq9_recordoneno = tqq9_supplier.getString("tqq9_recordoneno");//第一类器械备案号
String tqq9_recordtwono = tqq9_supplier.getString("tqq9_recordtwono");//第二类器械备案号
String tqq9_safeno = tqq9_supplier.getString("tqq9_safeno");//安全许可证号
String tqq9_beautyno = tqq9_supplier.getString("tqq9_beautyno");//化妆品许可证
DynamicObjectCollection tqq9_clnentries = tqq9_supplier.getDynamicObjectCollection("tqq9_clnentry");//卫生许可证明细
List<ComboItem> comboItems = new ArrayList<>();
Map<String, String> beforeStageMap = (Map<String, String>) JSON.parse(this.getPageCache().get("beforeStageMap"));
addItem(tqq9_taxno, comboItems, beforeStageMap);
addItem(tqq9_prolicense, comboItems, beforeStageMap);
addItem(tqq9_saleno, comboItems, beforeStageMap);
addItem(tqq9_recordoneno, comboItems, beforeStageMap);
addItem(tqq9_recordtwono, comboItems, beforeStageMap);
addItem(tqq9_safeno, comboItems, beforeStageMap);
addItem(tqq9_beautyno, comboItems, beforeStageMap);
for (DynamicObject entry : tqq9_clnentries) {
String tqq9_clnno = entry.getString("tqq9_clnno");
addItem(tqq9_clnno, comboItems, beforeStageMap);
}
ComboEdit comboEdit = this.getControl("tqq9_supno");
comboEdit.setComboItems(comboItems);
}
setProxyField(tqq9_supplier, "tqq9_supno", comboEdit);
}else if("tqq9_proxy".equals(name)){
//动态添加总代的许可证号
ComboEdit comboEdit = this.getControl("tqq9_proxyno");
DynamicObject tqq9_supplier = (DynamicObject) this.getModel().getValue("tqq9_proxy");//生产厂家
setProxyField(tqq9_supplier, "tqq9_proxyno", comboEdit);
}
}
private static void addItem(String tqq9_taxno, List<ComboItem> comboItems, Map<String, String> beforeStageMap) {
if(StringUtils.isNotBlank(tqq9_taxno)){
private void setProxyField(DynamicObject tqq9_supplier, String fieldName, ComboEdit comboEdit) {
if(tqq9_supplier != null){
tqq9_supplier = BusinessDataServiceHelper.loadSingle(tqq9_supplier.getPkValue(), tqq9_supplier.getDynamicObjectType().getName());
String tqq9_taxno = tqq9_supplier.getString("tqq9_taxno");//税号
String tqq9_prolicense = tqq9_supplier.getString("tqq9_prolicense");//医疗器械生产许可证号
String tqq9_saleno = tqq9_supplier.getString("tqq9_saleno");//医疗器械经营许可证号
String tqq9_recordoneno = tqq9_supplier.getString("tqq9_recordoneno");//第一类器械备案号
String tqq9_recordtwono = tqq9_supplier.getString("tqq9_recordtwono");//第二类器械备案号
String tqq9_safeno = tqq9_supplier.getString("tqq9_safeno");//安全许可证号
String tqq9_beautyno = tqq9_supplier.getString("tqq9_beautyno");//化妆品许可证
DynamicObjectCollection tqq9_clnentries = tqq9_supplier.getDynamicObjectCollection("tqq9_clnentry");//卫生许可证明细
List<ComboItem> comboItems = new ArrayList<>();
addItem(tqq9_taxno, comboItems);
addItem(tqq9_prolicense, comboItems);
addItem(tqq9_saleno, comboItems);
addItem(tqq9_recordoneno, comboItems);
addItem(tqq9_recordtwono, comboItems);
addItem(tqq9_safeno, comboItems);
addItem(tqq9_beautyno, comboItems);
for (DynamicObject entry : tqq9_clnentries) {
String tqq9_clnno = entry.getString("tqq9_clnno");
addItem(tqq9_clnno, comboItems);
}
comboEdit.setComboItems(comboItems);
}
}
private static void addItem(String value, List<ComboItem> comboItems) {
if(StringUtils.isNotBlank(value)){
ComboItem comboItem = new ComboItem();
comboItem.setCaption(new LocaleString(tqq9_taxno + "-" + tqq9_taxno));
comboItem.setValue(tqq9_taxno + "-" + tqq9_taxno);
comboItem.setCaption(new LocaleString(value));
comboItem.setValue(value);
comboItems.add(comboItem);
}
}