
@[TOC](目录)
## 背景
供应商协同平台的【送货通知单】**保存、提交**时相应的企业端的【收料通知单】的**单据状态**也会相应的进行更新,但是却无法触发在企业端配置的**审批流**。这是由于送货通知单的提交是通过操作插件直接调用的收料通知单的提交操作,不会触发审批流。==目前代码触发审批流的提交方式只有两种==,**一种**是在表单插件中通过`billView.InvokeFormOperation("Submit")`触发,**另一种**是通过`WebApi`方式调用提交接口。这里送货通知单提交用的是不会触发审批流的**第三种**提交,即`ISubmitService`接口的`Submit()`方法。==当前要想在送货通知单提交时触发收料通知单的审批流,可以在送货通知单的提交操作插件中通过`WebApi`的方式来调用收料通知单提交接口进行实现==
## 步骤
1、添加【第三方系统登陆授权】密钥

2、生成测试链接获取数据中心ID

3、启用供应商协同平台,并选择相应的第三方授权ID(步骤1创建的)

4、编写送货通知的提交操作通过WebApi调收料通知单提交接口代码

5、给收料通知单设计和配置审批流

6、取消送货通知单提交操作标准的插件

7、注册新的插件

## 示例代码
```c#
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Util;
using Kingdee.BOS.WebApi.Client;
using Kingdee.K3.Core.SCM;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kingdee.K3.SCM.App.SCP.ServicePlugIn.ReceiveBill
{
public class TestSubmit : AbstractOperationServicePlugIn
{
public override void BeforeExecuteOperationTransaction(BOS.Core.DynamicForm.PlugIn.Args.BeforeExecuteOperationTransaction e)
{
base.BeforeExecuteOperationTransaction(e);
string[] billNoArr = e.SelectedRows.Select(p => Convert.ToString(p["BillNo"])).Where(p => !String.IsNullOrWhiteSpace(p)).Distinct().ToArray<string>();
string jsonString = GetBillData(billNoArr);
if (!string.IsNullOrEmpty(jsonString))
{
var client = new K3CloudApiClient();
client.InitClient("64xxxxxxxxx", "268289_xxxxxxxxxxxxxxxxxxxxxxxxxx", "e8xxxxxxxxxxxxxxxxxxxxxx", "share", 2052, "101.2", "http://xxx.xx.x.xxx/k3cloud/");
string logMsg = client.ValidateLogin("64xxxxxxxxx", "share", "xxxxxxxxxxx", 2052);
string resultMsg = client.Submit(SCMFormIdConst.PUR_ReceiveBill, jsonString);
}
}
private string GetBillData(string[] billNoArr)
{
if (billNoArr.Length > 0)
{
Dictionary<string, object> data = new Dictionary<string, object>();
data.Add("Numbers", billNoArr);
return JsonUtil.Serialize(data);
}
else
{
return string.Empty;
}
}
}
}
```
## 效果
### 一、原效果
1、企业端直接提交

2、送货通知单进行提交

3、未触发收料通知单审批流

### 二、新效果
2、送货通知单进行提交

3、送货通知单提交触发了收料通知单审批流

**其他更多文章入口:**[https://vip.kingdee.com/link/s/lbRPP](https://vip.kingdee.com/link/s/lbRPP)