|
|
@ -25,6 +25,8 @@ using Win_in.Sfs.Wms.Store.Options; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using Win_in.Sfs.Shared.Application.Contracts; |
|
|
|
using Win_in.Sfs.Wms.Store.Application; |
|
|
|
using Org.BouncyCastle.Asn1.Ocsp; |
|
|
|
using DocumentFormat.OpenXml.Office2016.Excel; |
|
|
|
|
|
|
|
|
|
|
|
namespace Win_in.Sfs.Wms.Store.Jobs.AgvJobs; |
|
|
@ -43,6 +45,8 @@ public class AgvJobOutputService : ApplicationService |
|
|
|
private readonly SparePartIssueJobAppService _sparePartIssueJobAppService; |
|
|
|
private readonly UnplannedIssueJobAppService _unplannedIssueJobAppService; |
|
|
|
private readonly UnplannedReceiptJobAppService _unplannedReceiptJobAppService; |
|
|
|
private readonly IOptions<AgvOptions> _agvOptions; |
|
|
|
|
|
|
|
|
|
|
|
public AgvJobOutputService( |
|
|
|
UnitOfWorkManager unitOfWorkManager, |
|
|
@ -59,13 +63,13 @@ public class AgvJobOutputService : ApplicationService |
|
|
|
|
|
|
|
) |
|
|
|
{ |
|
|
|
_assembleIssueJobAppService = assembleIssueJobAppService; |
|
|
|
_coatingIssueJobAppService = coatingIssueJobAppService; |
|
|
|
_injectionIssueJobAppService = injectionIssueJobAppService; |
|
|
|
_kittingIssueJobAppService = kittingIssueJobAppService; |
|
|
|
_sparePartIssueJobAppService = sparePartIssueJobAppService; |
|
|
|
_unplannedIssueJobAppService = unplannedIssueJobAppService; |
|
|
|
_unplannedReceiptJobAppService = unplannedReceiptJobAppService; |
|
|
|
_assembleIssueJobAppService = assembleIssueJobAppService; |
|
|
|
_coatingIssueJobAppService = coatingIssueJobAppService; |
|
|
|
_injectionIssueJobAppService = injectionIssueJobAppService; |
|
|
|
_kittingIssueJobAppService = kittingIssueJobAppService; |
|
|
|
_sparePartIssueJobAppService = sparePartIssueJobAppService; |
|
|
|
_unplannedIssueJobAppService = unplannedIssueJobAppService; |
|
|
|
_unplannedReceiptJobAppService = unplannedReceiptJobAppService; |
|
|
|
|
|
|
|
|
|
|
|
_logger = logger; |
|
|
@ -76,6 +80,77 @@ public class AgvJobOutputService : ApplicationService |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<AgvResultObject> TEST_Coating_CallAgvAsync(AgvRequest jobdto) |
|
|
|
{ |
|
|
|
|
|
|
|
var client =await GetAgvJobClient().ConfigureAwait(false); |
|
|
|
var ret=await client.PushOutTaskCoatingAsync(jobdto).ConfigureAwait(false); |
|
|
|
return ret; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public async Task<AgvResultObject> TEST_Kitting_CallAgvAsync(AgvRequest jobdto) |
|
|
|
{ |
|
|
|
var client = await GetAgvJobClient().ConfigureAwait(false); |
|
|
|
var ret = await client.PushOutTaskKittingAsync(jobdto).ConfigureAwait(false); |
|
|
|
return ret; |
|
|
|
|
|
|
|
} |
|
|
|
public async Task<AgvResultObject> TEST_UnplannedIssue_CallAgvAsync(AgvRequestUnplanned jobdto) |
|
|
|
{ |
|
|
|
var client = await GetAgvJobClient().ConfigureAwait(false); |
|
|
|
var ret = await client.PushOutTaskUnplannedAsync(jobdto).ConfigureAwait(false); |
|
|
|
return ret; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public async Task<AgvResultObject> TEST_UnplannedReceipt_CallAgvAsync(AgvRequestUnplanned jobdto) |
|
|
|
{ |
|
|
|
var client = await GetAgvJobClient().ConfigureAwait(false); |
|
|
|
var ret = await client.PushOutTaskUnplannedReceiptAsync(jobdto).ConfigureAwait(false); |
|
|
|
return ret; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task<AgvJobClient> GetAgvJobClient() |
|
|
|
{ |
|
|
|
|
|
|
|
var httpclient = _httpClientFactory.CreateClient(); |
|
|
|
_agvOptions.Value.Address = string.IsNullOrEmpty(_agvOptions.Value.Address) |
|
|
|
? "http://7e42682n64.goho.co:21171/" |
|
|
|
: _agvOptions.Value.Address; //测试地址
|
|
|
|
_agvOptions.Value.Token = |
|
|
|
string.IsNullOrEmpty(_agvOptions.Value.Token) ? string.Empty : _agvOptions.Value.Token; //测试token
|
|
|
|
_agvOptions.Value.UserName = |
|
|
|
string.IsNullOrEmpty(_agvOptions.Value.UserName) ? "" : _agvOptions.Value.UserName; //测试用户名
|
|
|
|
_agvOptions.Value.Password = |
|
|
|
string.IsNullOrEmpty(_agvOptions.Value.Password) ? "" : _agvOptions.Value.Password; //测试密码
|
|
|
|
_agvOptions.Value.Path = string.IsNullOrEmpty(_agvOptions.Value.Path) |
|
|
|
? "zozocnApi/custom/receiveProductionPlan" |
|
|
|
: _agvOptions.Value.Path; //测试密码
|
|
|
|
var flag = DateTime.Now.ToString("yyyyMMddHHmmss"); |
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(_agvOptions.Value.Token)) |
|
|
|
{ |
|
|
|
var token = _agvOptions.Value.Token; |
|
|
|
httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); |
|
|
|
} |
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(_agvOptions.Value.UserName) && !string.IsNullOrEmpty(_agvOptions.Value.Password)) |
|
|
|
{ |
|
|
|
var username = _agvOptions.Value.UserName; |
|
|
|
var password = _agvOptions.Value.Password; |
|
|
|
httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", |
|
|
|
Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}"))); |
|
|
|
} |
|
|
|
|
|
|
|
var client = new AgvJobClient(_agvOptions.Value.Address, httpclient, _agvOptions.Value.Path); |
|
|
|
return client; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/////// <summary>
|
|
|
|
///// 装配闻荫调用海康AGV接口测试
|
|
|
@ -87,7 +162,7 @@ public class AgvJobOutputService : ApplicationService |
|
|
|
//{
|
|
|
|
// var jobdto = await _assembleIssueJobAppService.GetAsync(id).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// var ret = await _assembleIssueJobAppService.CallAgvAsync(jobdto, "123", "321").ConfigureAwait(false);
|
|
|
|
// return ret;
|
|
|
|