【商品注册证】生产商许可证号添加到明细
This commit is contained in:
		
							parent
							
								
									51502ea298
								
							
						
					
					
						commit
						87e3bb8b19
					
				|  | @ -0,0 +1,112 @@ | ||||||
|  | package tqq9.lc123.cloud.app.plugin.form.sys; | ||||||
|  | 
 | ||||||
|  | import com.alibaba.fastjson.JSON; | ||||||
|  | import kd.bos.bill.AbstractBillPlugIn; | ||||||
|  | import kd.bos.dataentity.entity.DynamicObject; | ||||||
|  | import kd.bos.dataentity.entity.DynamicObjectCollection; | ||||||
|  | import kd.bos.dataentity.entity.LocaleString; | ||||||
|  | import kd.bos.entity.datamodel.events.PropertyChangedArgs; | ||||||
|  | import kd.bos.form.control.events.ItemClickEvent; | ||||||
|  | import kd.bos.form.field.ComboEdit; | ||||||
|  | import kd.bos.form.field.ComboItem; | ||||||
|  | import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||||
|  | import org.apache.commons.lang3.StringUtils; | ||||||
|  | 
 | ||||||
|  | import java.util.*; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * 注册证界面插件 | ||||||
|  |  *      厂商许可证号动态添加下拉框选项 | ||||||
|  |  */ | ||||||
|  | public class RegistBillFactoryPlugin extends AbstractBillPlugIn { | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public void registerListener(EventObject e) { | ||||||
|  |         super.registerListener(e); | ||||||
|  |         this.addItemClickListeners("tqq9_advcontoolbarap"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public void propertyChanged(PropertyChangedArgs e) { | ||||||
|  |         super.propertyChanged(e); | ||||||
|  |         String name = e.getProperty().getName(); | ||||||
|  |         if("tqq9_supplier".equals(name)){ | ||||||
|  |             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); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private static void addItem(String tqq9_taxno, List<ComboItem> comboItems, Map<String, String> beforeStageMap) { | ||||||
|  |         if(StringUtils.isNotBlank(tqq9_taxno)){ | ||||||
|  |             ComboItem comboItem = new ComboItem(); | ||||||
|  |             comboItem.setCaption(new LocaleString(tqq9_taxno + "-" + tqq9_taxno)); | ||||||
|  |             comboItem.setValue(tqq9_taxno + "-" + tqq9_taxno); | ||||||
|  |             comboItems.add(comboItem); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public void itemClick(ItemClickEvent evt) { | ||||||
|  |         super.itemClick(evt); | ||||||
|  |         String itemKey = evt.getItemKey(); | ||||||
|  |         if("tqq9_additem".equals(itemKey)){ | ||||||
|  |             DynamicObject tqq9_supplier = (DynamicObject) this.getModel().getValue("tqq9_supplier"); | ||||||
|  |             String tqq9_supno = (String) this.getModel().getValue("tqq9_supno"); | ||||||
|  |             if(tqq9_supplier != null && StringUtils.isNotBlank(tqq9_supno)){ | ||||||
|  |                 DynamicObjectCollection entries = this.getModel().getDataEntity(true).getDynamicObjectCollection("tqq9_entry"); | ||||||
|  |                 Set<Long> eSupIDSet = new HashSet<>(); | ||||||
|  |                 if(entries != null && entries.size() > 0){ | ||||||
|  |                     for (DynamicObject entry : entries) { | ||||||
|  |                         Long eSupID = entry.getDynamicObject("tqq9_e_supplier").getLong("id"); | ||||||
|  |                         eSupIDSet.add(eSupID); | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |                 if(eSupIDSet.contains(tqq9_supplier.getLong("id"))){ | ||||||
|  |                     this.getView().showTipNotification("已经添加过改厂家,不需要重复添加!"); | ||||||
|  |                 }else{ | ||||||
|  |                     DynamicObject entry = entries.addNew(); | ||||||
|  |                     entry.set("tqq9_e_supplier", tqq9_supplier); | ||||||
|  |                     entry.set("tqq9_e_supno", tqq9_supno); | ||||||
|  | 
 | ||||||
|  |                     this.getModel().setValue("tqq9_supplier", null); | ||||||
|  |                     ComboEdit comboEdit = this.getControl("tqq9_supno"); | ||||||
|  |                     comboEdit.setComboItems(null); | ||||||
|  |                     this.getView().updateView("tqq9_entry"); | ||||||
|  |                     this.getView().updateView(); | ||||||
|  |                 } | ||||||
|  |             }else{ | ||||||
|  |                 this.getView().showTipNotification("请选择生产商和对应的许可证号!"); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue