09 MES系统访问金蝶云星空(ERP): MES传入工序委外入
2020-03-14 本文已影响0人
Steve_Hu
返回根目录 MES系统访问金蝶云星空(ERP)的接口定义及示例
需求描述
MES集成逻辑:
1、MES传入工序委外单到ERP,ERP生成工序委外单并关联生产订单(生产订单下查可寻,工序委外单上查可寻);
2、ERP根据工序委外单自动下推工序委外出库单并审核;
3、MES传入工序委外入库单到ERP,ERP生成工序委外入库单,关联工序委外入库单(上查下查可关联);
接口定义
工序委外入库单保存接口(自定义webapi接口)的定义如下:
//其中BLN.CY.ApiClient.K3Cloud.Stub是命名空间,PrdInStockService是类名
BLN.CY.ApiClient.K3Cloud.Stub.ProcessSubService.ProcessSubInstockStock(string param)
请求参数
[{
"MoId": "100122",
"MoEntryId": "100148",
"MESLot": "20200315",
"MaterialNumber": "000006",
"Qty": 1.0,
"Bak": "abc",
"InStockPosition": "AAAA",
"StockNumber": "01"
}]
返回结果
{
"IsSuccess": true,
"Message": "操作成功!",
"ErrorStackTrace": null
}
代码示例
无引用组件示例(不引用金蝶的组件):
http://ServerIp/K3Cloud/接口命名空间.接口实现类名.方法,组件名.common.kdsvc
if (LoginByAppSecret())
{
HttpClient httpClient = new HttpClient();
httpClient.Url = "http://localhost/k3cloud/BLN.CY.ApiClient.K3Cloud.Stub.ProcessSubService.ProcessSubInstockStock,BLN.CY.ApiClient.K3Cloud.Stub.common.kdsvc";
List<ProcessSubInstockParameter> processSubOrderParameters = new List<ProcessSubInstockParameter>();
processSubOrderParameters.Add(new ProcessSubInstockParameter()
{
Bak = "abc", //分录备注
MoId = 100122, //生产订单内码
MoEntryId = 100148, //生产订单分录内码
MESLot="20200315", //批次号
MaterialNumber = "000006", //物料编码
Qty = 1, //数量
StockNumber="01", //仓库编码
InStockPosition="AAAA", //入库位置
});
List<object> parameters = new List<object>();
parameters.Add(processSubOrderParameters);
httpClient.Content = JsonConvert.SerializeObject(parameters);
var result = httpClient.AsyncRequest();
}
入库参数实体定义
[Serializable]
public class ProcessSubInstockParameter
{
/// <summary>
/// 生产订单内码
/// </summary>
public long MoId { get; set; }
/// <summary>
/// 生产订单分录内码
/// </summary>
public long MoEntryId { get; set; }
/// <summary>
/// MES批次号
/// </summary>
public string MESLot { get; set; }
public string MaterialNumber { get; set; }
public decimal Qty { get; set; }
public string Bak { get; set; }
/// <summary>
/// 入库位置
/// </summary>
public string InStockPosition { get; set; }
public string StockNumber { get; set; }
}