
【场景】单据下推携带附件重复问题
【功能】支持版本2303及之后的补丁

【方案】历史版本的二开方案
在附件表单BOS_Attachment的保存操作服务插件进行过滤处理,针对同一个文件id进行过滤

```python
from System import *
def BeginOperationTransaction(e):
if e.DataEntitys == None or e.DataEntitys.Length <=0:
return;
firstBillType = e.DataEntitys[0]['BillType'];
handleBillType = ['PUR_PurchaseOrder'];
if firstBillType not in handleBillType:
return;
attachList = [];
attachDict= {};
for index in range(e.DataEntitys.Length):
attachObj = e.DataEntitys[index];
srcAttId = attachObj['SourceId'];
fileId = attachObj['FileId'];
if srcAttId != 0 and (fileId != None and len(fileId.strip()) >0):
billType = attachObj['BillType'];
interId = attachObj['InterID'];
key = billType+'_'+interId+'_'+fileId;
if attachDict.has_key(key):
continue;
attachDict[key] = key;
attachList.append(attachObj);
if(len(attachList) == e.DataEntitys.Length):
return;
attachArray = Array.CreateInstance(e.DataEntitys[0].GetType(), len(attachList));
for idx in range(len(attachList)):
attachArray[idx] = attachList[idx];
e.DataEntitys = attachArray;
```
```csharp
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Orm.DataEntity;
using System.Collections.Generic;
namespace DynamicFormPlugIn.Attachment
{
[System.ComponentModel.Description("携带附件去重")]
[Kingdee.BOS.Util.HotUpdate]
public class AttSaveValidateOpPlugIn : AbstractOperationServicePlugIn
{
/// <summary>
/// 处理的业务对象标识
/// </summary>
HashSet<string> handleBillType = new HashSet<string>() { "PUR_PurchaseOrder" };
public override void BeginOperationTransaction(BeginOperationTransactionArgs e)
{
if (e.DataEntitys == null || e.DataEntitys.Length <= 0)
return;
string firstBillType = System.Convert.ToString(e.DataEntitys[0]["BillType"]);
if (!handleBillType.Contains(firstBillType))
return;
List<DynamicObject> newObjs = new List<DynamicObject>();
Dictionar