| 
					
				 | 
			
			
				@@ -1,28 +1,55 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package nckd.jimin.jyyy.fi.plugin.form; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.dataentity.OperateOption; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.dataentity.entity.DynamicObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import kd.bos.dataentity.resource.ResManager; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.entity.EntityMetadataCache; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.entity.MainEntityType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.entity.datamodel.ListSelectedRow; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import kd.bos.entity.datamodel.ListSelectedRowCollection; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.entity.operate.result.OperationResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import kd.bos.form.control.events.ItemClickEvent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.form.events.AfterDoOperationEventArgs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import kd.bos.list.BillList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import kd.bos.list.IListView; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import kd.bos.list.plugin.AbstractListPlugin; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.servicehelper.BusinessDataServiceHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.servicehelper.operation.OperationServiceHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import kd.sdk.plugin.Plugin; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.HashSet; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Set; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * 标准单据列表插件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class VoucherListPlugin extends AbstractListPlugin implements Plugin { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void itemClick(ItemClickEvent evt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        super.itemClick(evt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if("nckd_sap".equalsIgnoreCase(evt.getItemKey() )) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //获取单据体控件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ListSelectedRowCollection selectedRows = ((IListView) this.getView()).getSelectedRows(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (selectedRows == null || selectedRows.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                this.getView().showTipNotification("没选中数据!", 2500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void afterDoOperation(AfterDoOperationEventArgs e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        super.afterDoOperation(e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ListSelectedRowCollection selectedRows = this.getSelectedRows(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String key = e.getOperateKey(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        StringBuffer errorInfo = new StringBuffer(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        MainEntityType entityType= EntityMetadataCache.getDataEntityType("gl_voucher"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DynamicObject[] vouchers = BusinessDataServiceHelper.load(selectedRows.getPrimaryKeyValues(), entityType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /*** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         * 审核后,调用SAP同步操作 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ("audit".equals(key)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            OperationResult operationResult = e.getOperationResult(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (operationResult.isSuccess()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                OperationResult opResult = OperationServiceHelper.executeOperate("synsap", "gl_voucher", vouchers, OperateOption.create()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (opResult != null && opResult.isSuccess()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    errorInfo.append(opResult.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (errorInfo.length() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.getView().showTipNotification(errorInfo.toString(), 2500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |