|
@ -9,6 +9,7 @@ using System.Threading.Tasks; |
|
|
using Castle.Components.DictionaryAdapter; |
|
|
using Castle.Components.DictionaryAdapter; |
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
|
|
using Microsoft.Extensions.Logging; |
|
|
using Microsoft.Extensions.Options; |
|
|
using Microsoft.Extensions.Options; |
|
|
using MyNamespace; |
|
|
using MyNamespace; |
|
|
using Volo.Abp; |
|
|
using Volo.Abp; |
|
@ -40,11 +41,14 @@ public class CoatingIssueJobAppService |
|
|
private readonly IHttpClientFactory _httpClientFactory; |
|
|
private readonly IHttpClientFactory _httpClientFactory; |
|
|
private readonly ITransferLibRequestAppService _transferLibRequestAppService; |
|
|
private readonly ITransferLibRequestAppService _transferLibRequestAppService; |
|
|
private readonly IOptions<RestoOptions> _options; |
|
|
private readonly IOptions<RestoOptions> _options; |
|
|
|
|
|
private readonly ILogger<CoatingIssueJobAppService> _logger; |
|
|
|
|
|
|
|
|
protected ICoatingIssueRequestAppService CoatingIssueRequestAppService => |
|
|
protected ICoatingIssueRequestAppService CoatingIssueRequestAppService => |
|
|
LazyServiceProvider.LazyGetRequiredService<ICoatingIssueRequestAppService>(); |
|
|
LazyServiceProvider.LazyGetRequiredService<ICoatingIssueRequestAppService>(); |
|
|
|
|
|
|
|
|
public CoatingIssueJobAppService( |
|
|
public CoatingIssueJobAppService( |
|
|
|
|
|
|
|
|
|
|
|
ILogger<CoatingIssueJobAppService> logger, |
|
|
ICoatingIssueJobRepository repository, ICoatingIssueJobManager coatingIssueJobManager, |
|
|
ICoatingIssueJobRepository repository, ICoatingIssueJobManager coatingIssueJobManager, |
|
|
ILocationAppService locationAppService, |
|
|
ILocationAppService locationAppService, |
|
|
ICoatingIssueNoteAppService coatingIssueNoteAppService, IExpectOutAppService expectOutAppService |
|
|
ICoatingIssueNoteAppService coatingIssueNoteAppService, IExpectOutAppService expectOutAppService |
|
@ -59,6 +63,7 @@ public class CoatingIssueJobAppService |
|
|
_httpClientFactory = httpClientFactory; |
|
|
_httpClientFactory = httpClientFactory; |
|
|
_options = options; |
|
|
_options = options; |
|
|
_transferLibRequestAppService = transferLibRequestAppService; |
|
|
_transferLibRequestAppService = transferLibRequestAppService; |
|
|
|
|
|
_logger = logger; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[HttpPost("get-by-number-2")] |
|
|
[HttpPost("get-by-number-2")] |
|
@ -315,7 +320,7 @@ public class CoatingIssueJobAppService |
|
|
var ret = new ReusltObject(); |
|
|
var ret = new ReusltObject(); |
|
|
ret.Code = "1"; |
|
|
ret.Code = "1"; |
|
|
ret.Message = "操作成功"; |
|
|
ret.Message = "操作成功"; |
|
|
ret.OperateTime = DateTime.Now.ToString("yyyy-MM-dd"); |
|
|
ret.OperateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
var IssueJobToRestoDetailDTOs = new List<IssueJobToRestoDetailDTO>(); |
|
|
var IssueJobToRestoDetailDTOs = new List<IssueJobToRestoDetailDTO>(); |
|
@ -341,12 +346,24 @@ public class CoatingIssueJobAppService |
|
|
#if DEBUG
|
|
|
#if DEBUG
|
|
|
|
|
|
|
|
|
var json = JsonSerializer.Serialize(main); |
|
|
var json = JsonSerializer.Serialize(main); |
|
|
_options.Value.Address = "http://localhost:59094/"; //测试地址
|
|
|
_options.Value.Address = "http://7e42682n64.goho.co:21171/"; //测试地址
|
|
|
_options.Value.Token = ""; //测试token
|
|
|
_options.Value.Token = ""; //测试token
|
|
|
_options.Value.UserName = ""; //测试用户名
|
|
|
_options.Value.UserName = ""; //测试用户名
|
|
|
_options.Value.Password = ""; //测试密码
|
|
|
_options.Value.Password = ""; //测试密码
|
|
|
|
|
|
_options.Value.Path = "zozocnApi/custom/receiveProductionPlan"; //测试密码
|
|
|
|
|
|
|
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
//var json = JsonSerializer.Serialize(main);
|
|
|
|
|
|
_options.Value.Address = "http://7e42682n64.goho.co:21171/"; //测试地址
|
|
|
|
|
|
_options.Value.Token = ""; //测试token
|
|
|
|
|
|
_options.Value.UserName = ""; //测试用户名
|
|
|
|
|
|
_options.Value.Password = ""; //测试密码
|
|
|
|
|
|
_options.Value.Path = "zozocnApi/custom/receiveProductionPlan"; //测试密码
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation(System.Text.Json.JsonSerializer.Serialize(_options)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(_options.Value.Token)) |
|
|
if (!string.IsNullOrEmpty(_options.Value.Token)) |
|
|
{ |
|
|
{ |
|
|
var token = _options.Value.Token; |
|
|
var token = _options.Value.Token; |
|
@ -361,15 +378,22 @@ public class CoatingIssueJobAppService |
|
|
Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}"))); |
|
|
Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}"))); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var client = new IssueJobToRestoClient(_options.Value.Address, httpclient); |
|
|
var client = new IssueJobToRestoClient(_options.Value.Address, httpclient,_options.Value.Path); |
|
|
|
|
|
|
|
|
|
|
|
var flag=DateTime.Now.ToString("yyyyMMddHHmmss"); |
|
|
|
|
|
_logger.LogInformation($"标志{flag}开始调用高通WMS:传递值{System.Text.Json.JsonSerializer.Serialize(main)}"); |
|
|
|
|
|
|
|
|
ret = await client.SyncIssueJobStereoAsync(main).ConfigureAwait(false); |
|
|
ret = await client.SyncIssueJobStereoAsync(main).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"标志{flag}调用高通WMS:返回值{ret}"); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
|
ret = new ReusltObject(); |
|
|
ret = new ReusltObject(); |
|
|
ret.Code = "2"; |
|
|
ret.Code = "2"; |
|
|
ret.Message = ex.Message; |
|
|
ret.Message = ex.Message; |
|
|
ret.OperateTime = DateTime.Now.ToString("yyyy-MM-dd"); |
|
|
ret.OperateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return ret; |
|
|
return ret; |
|
@ -382,7 +406,7 @@ public class CoatingIssueJobAppService |
|
|
var json = JsonSerializer.Serialize(input); |
|
|
var json = JsonSerializer.Serialize(input); |
|
|
#endif
|
|
|
#endif
|
|
|
var errors = new List<string>(); |
|
|
var errors = new List<string>(); |
|
|
var ret = new ReusltObject { Code = "1", OperateTime = DateTime.Now.ToString("yyyy-MM-dd"), Message = "操作成功" }; |
|
|
var ret = new ReusltObject { Code = "1", OperateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Message = "操作成功" }; |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
if (input.Jobs.Count > 0) |
|
|
if (input.Jobs.Count > 0) |
|
@ -546,12 +570,17 @@ public class CoatingIssueJobAppService |
|
|
|
|
|
|
|
|
var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) |
|
|
var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) |
|
|
.ConfigureAwait(false); |
|
|
.ConfigureAwait(false); |
|
|
|
|
|
var flag = DateTime.Now.ToString("yyyyMMddHHmmss"); |
|
|
|
|
|
_logger.LogInformation($"立体库任务检查开始{flag}"); |
|
|
if (loctionDto.Type == EnumLocationType.DimensionalStorehouse) |
|
|
if (loctionDto.Type == EnumLocationType.DimensionalStorehouse) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"立体库任务开始标记{flag}"); |
|
|
//TODO 立体库
|
|
|
//TODO 立体库
|
|
|
var ret = await SyncIssueJobStereoAsync(new List<CoatingIssueJobDTO> { coatingIssueJobDto }, |
|
|
var ret = await SyncIssueJobStereoAsync(new List<CoatingIssueJobDTO> { coatingIssueJobDto }, |
|
|
loctionDto.Code).ConfigureAwait(false); |
|
|
loctionDto.Code).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"立体库任务结束标记{flag},返回值{ret}"); |
|
|
if (ret.Code != "1") |
|
|
if (ret.Code != "1") |
|
|
{ |
|
|
{ |
|
|
throw new UserFriendlyException($"调用立体库不成功!原因:{ret.Message}"); |
|
|
throw new UserFriendlyException($"调用立体库不成功!原因:{ret.Message}"); |
|
|