|
|
@ -53,6 +53,13 @@ public class InjectionMoldingRequestReader : IReader |
|
|
|
_locService = locService; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
@ -61,8 +68,7 @@ public class InjectionMoldingRequestReader : IReader |
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
public virtual async Task<List<IncomingFromExternal>> ReadAsync() |
|
|
|
{ |
|
|
|
|
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
// 获取注塑叫料任务数量
|
|
|
@ -71,28 +77,21 @@ public class InjectionMoldingRequestReader : IReader |
|
|
|
if (count == 0) |
|
|
|
{ |
|
|
|
// 调用 ReaderCameraApi 方法获取摄像头信息
|
|
|
|
|
|
|
|
|
|
|
|
string camera = await ReaderCameraApi().ConfigureAwait(false); |
|
|
|
|
|
|
|
List<InjectionRequest> cameraList = new List<InjectionRequest>(); |
|
|
|
|
|
|
|
if (camera == "Error occured") |
|
|
|
{ |
|
|
|
// 记录错误日志并返回空列表
|
|
|
|
_logger.LogInformation($"没有读取到摄像头信息{DateTime.Now},请检查网络"); |
|
|
|
return new List<IncomingFromExternal>(); |
|
|
|
} |
|
|
|
//将摄像头信息转换为注塑叫料明细任务数据
|
|
|
|
cameraList = System.Text.Json.JsonSerializer.Deserialize<List<InjectionRequest>>(camera); |
|
|
|
|
|
|
|
//测试数据
|
|
|
|
//var cameraList = new List<InjectionRequest>()
|
|
|
|
//string camera = await ReaderCameraApi().ConfigureAwait(false);
|
|
|
|
//List<InjectionRequest> cameraList = new List<InjectionRequest>();
|
|
|
|
//if (camera == "Error occured")
|
|
|
|
//{
|
|
|
|
// new InjectionRequest() { ItemCode = "THILDD0A542AG", ToLocCode = "ZSXB2", Qty = 100 },
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
// // 记录错误日志并返回空列表
|
|
|
|
// _logger.LogInformation($"没有读取到摄像头信息{DateTime.Now},请检查网络");
|
|
|
|
// return new List<IncomingFromExternal>();
|
|
|
|
//}
|
|
|
|
////将摄像头信息转换为注塑叫料明细任务数据
|
|
|
|
//cameraList = System.Text.Json.JsonSerializer.Deserialize<List<InjectionRequest>>(camera);
|
|
|
|
//测试数据
|
|
|
|
var cameraList = new List<InjectionRequest>() |
|
|
|
{ |
|
|
|
new InjectionRequest() { ItemCode = "THILDD0A542AG", ToLocCode = "ZSXB2", Qty = 100 }, |
|
|
|
}; |
|
|
|
InjectionRequestEditInput input = new InjectionRequestEditInput(); |
|
|
|
input.Worker = "Vision"; |
|
|
|
input.Type = "Vision"; |
|
|
@ -105,7 +104,6 @@ public class InjectionMoldingRequestReader : IReader |
|
|
|
{ |
|
|
|
var detailInput = new InjectionRequestDetailInput() |
|
|
|
{ |
|
|
|
|
|
|
|
ItemCode = job.ItemCode, |
|
|
|
ToLocationCode = job.ToLocCode, |
|
|
|
Qty = job.Qty, |
|
|
@ -208,6 +206,7 @@ public class InjectionMoldingRequestReader : IReader |
|
|
|
// 将用户名和密码转换为Base64编码的凭据,并设置请求的身份验证信息
|
|
|
|
var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}")); |
|
|
|
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", credentials); |
|
|
|
|
|
|
|
|
|
|
|
// 发送GET请求到远程摄像头地址并等待响应
|
|
|
|
var response = await client.GetAsync(address).ConfigureAwait(false); |
|
|
|