【生产商】卫生许可证号添加到明细
This commit is contained in:
		
							parent
							
								
									0ab92e354c
								
							
						
					
					
						commit
						ab5206bcfd
					
				|  | @ -0,0 +1,62 @@ | |||
| package tqq9.lc123.cloud.app.plugin.form.sys; | ||||
| 
 | ||||
| import kd.bos.bill.AbstractBillPlugIn; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.entity.DynamicObjectCollection; | ||||
| import kd.bos.form.control.events.ItemClickEvent; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| 
 | ||||
| import java.util.Date; | ||||
| import java.util.EventObject; | ||||
| import java.util.HashSet; | ||||
| import java.util.Set; | ||||
| 
 | ||||
| /** | ||||
|  * 生产商界面插件 | ||||
|  *      卫生许可证明细上的添加按钮 | ||||
|  */ | ||||
| public class ProxyAndFactoryBillPlugin extends AbstractBillPlugIn { | ||||
| 
 | ||||
|     @Override | ||||
|     public void registerListener(EventObject e) { | ||||
|         super.registerListener(e); | ||||
|         this.addItemClickListeners("tqq9_advcontoolbarap"); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void itemClick(ItemClickEvent evt) { | ||||
|         super.itemClick(evt); | ||||
|         String itemKey = evt.getItemKey(); | ||||
|         if("tqq9_additem".equals(itemKey)){ | ||||
|             String tqq9_cleanno = (String) this.getModel().getValue("tqq9_cleanno");//卫消字证号 | ||||
|             Date tqq9_cleanstartdate = (Date) this.getModel().getValue("tqq9_cleanstartdate");//开始时间 | ||||
|             Date tqq9_cleanenddate = (Date) this.getModel().getValue("tqq9_cleanenddate");//结束时间 | ||||
|             if(StringUtils.isNotBlank(tqq9_cleanno) && tqq9_cleanstartdate != null && tqq9_cleanenddate != null){ | ||||
|                 DynamicObjectCollection tqq9_clnentries = this.getModel().getDataEntity(true).getDynamicObjectCollection("tqq9_clnentry"); | ||||
|                 Set<String> set = new HashSet<>(); | ||||
|                 if(tqq9_clnentries != null && tqq9_clnentries.size() > 0){ | ||||
|                     for (DynamicObject tqq9_clnentry : tqq9_clnentries) { | ||||
|                         String tqq9_clnno = tqq9_clnentry.getString("tqq9_clnno");//明细-卫消字证号 | ||||
|                         set.add(tqq9_clnno); | ||||
|                     } | ||||
|                 } | ||||
|                 if(set.contains(tqq9_cleanno)){ | ||||
|                     this.getView().showTipNotification("卫消字证号["+tqq9_cleanno+"]已经添加过,不需要重复添加!"); | ||||
|                 }else{ | ||||
|                     DynamicObject entry = tqq9_clnentries.addNew(); | ||||
|                     entry.set("tqq9_clnno", tqq9_cleanno); | ||||
|                     entry.set("tqq9_clnstartdate", tqq9_cleanstartdate); | ||||
|                     entry.set("tqq9_clnenddate", tqq9_cleanenddate); | ||||
| 
 | ||||
|                     this.getModel().setValue("tqq9_cleanno", null); | ||||
|                     this.getModel().setValue("tqq9_cleanstartdate", null); | ||||
|                     this.getModel().setValue("tqq9_cleanenddate", null); | ||||
|                     this.getView().updateView("tqq9_entry"); | ||||
|                     this.getView().updateView(); | ||||
|                 } | ||||
|             }else{ | ||||
|                 this.getView().showTipNotification("请填写卫消字证号和开始/截止时间!"); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Loading…
	
		Reference in New Issue