using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common.APIEnum;
using WIDESEA_Core.Helper;
using WIDESEA_External.Model;
using WIDESEA_IBasicRepository;
using WIDESEA_Model.Models;
namespace WIDESEA_External.ERPService
{
///
/// 调用ERP接口
///
public class InvokeERPService : IInvokeERPService
{
private readonly IApiInfoRepository _apiInfoRepository;
public InvokeERPService(IApiInfoRepository apiInfoRepository)
{
_apiInfoRepository= apiInfoRepository;
}
///
/// ERP收货单接口调用
///
///
///
public string InvokeMatReceiveApi(ERPReceiveModel receiveModel)
{
Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x=>x.ApiCode==APIEnum.InvokeMatReceiveApi.ToString());
ERPBaseModel model = new ERPBaseModel()
{
Data = receiveModel,
Desc = "收货单",
Type = "toTCWMSReceive",
SecurityCode = ""
};
string response = HttpHelper.Post(apiInfo.ApiAddress, model.Serialize());
return response;
}
///
/// ERP物料IQC检验单接口调用
///
///
///
public string InvokeCheckOrderApi(ERPCheckModel checkModel)
{
Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.InvokeCheckOrderApi.ToString());
ERPBaseModel model = new ERPBaseModel()
{
Data = checkModel,
Desc = "收货单",
Type = "toTCWMSIQCTest",
SecurityCode = ""
};
string response = HttpHelper.Post(apiInfo.ApiAddress, model.Serialize());
return response;
}
///
/// ERP物料入库单接口调用
///
///
///
public string InvokeInboundOrderApi(ERPInboundModel inboundModel)
{
Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.InvokeInboundOrderApi.ToString());
ERPBaseModel model = new ERPBaseModel()
{
Data = inboundModel,
Desc = "收货单",
Type = "toTCWMSMaterialWarehousing",
SecurityCode = ""
};
string response = HttpHelper.Post(apiInfo.ApiAddress, model.Serialize());
return response;
}
///
/// ERP物料出库接口调用
///
///
///
public string InvokeOutboundOrderApi(ERPOutboundModel outboundModel)
{
Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.InvokeOutboundOrderApi.ToString());
ERPBaseModel model = new ERPBaseModel()
{
Data = outboundModel,
Desc = "材料出库",
Type = "toBomMaterialOutTC",
SecurityCode = "LxkgPgN3$U"
};
string response = HttpHelper.Post(apiInfo.ApiAddress, model.Serialize());
return response;
}
}
}