|
|
@ -2,6 +2,7 @@ using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Net.Http; |
|
|
|
using System.Net.Http.Headers; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Castle.Components.DictionaryAdapter; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
@ -22,6 +23,7 @@ using Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; |
|
|
|
using Win_in.Sfs.Wms.Store.Notes; |
|
|
|
using Win_in.Sfs.Wms.Store.Options; |
|
|
|
using static IdentityModel.ClaimComparer; |
|
|
|
using static Volo.Abp.Identity.Settings.IdentitySettingNames; |
|
|
|
|
|
|
|
namespace Win_in.Sfs.Wms.Store.Application; |
|
|
|
|
|
|
@ -358,10 +360,15 @@ public class KittingIssueJobAppService |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 立体库同步
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <param name="p_loc"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("sync-issue-job-stereo")] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task<ReusltObject> SyncIssueJobStereoAsync(List<KittingIssueJobDTO> input,string p_loc) |
|
|
|
public async Task<ReusltObject> SyncIssueJobStereoAsync(List<KittingIssueJobDTO> input,string p_loc) |
|
|
|
{ |
|
|
|
|
|
|
|
ReusltObject ret = new ReusltObject(); |
|
|
@ -388,15 +395,29 @@ public class KittingIssueJobAppService |
|
|
|
} |
|
|
|
} |
|
|
|
main.Details = IssueJobToRestoDetailDTOs; |
|
|
|
|
|
|
|
|
|
|
|
var httpclient = _httpClientFactory.CreateClient(); |
|
|
|
#if DEBUG
|
|
|
|
|
|
|
|
string json= System.Text.Json.JsonSerializer.Serialize(main); |
|
|
|
_options.Value.Address = "http://localhost:59094/CargoState/SyncCoatingJobStereo";//测试地址
|
|
|
|
_options.Value.Address = "http://localhost:59094/";//测试地址
|
|
|
|
_options.Value.Token = "";//测试token
|
|
|
|
_options.Value.UserName = "";//测试用户名
|
|
|
|
_options.Value.Password = "";//测试密码
|
|
|
|
|
|
|
|
#endif
|
|
|
|
if (!string.IsNullOrEmpty(_options.Value.Token)) |
|
|
|
{ |
|
|
|
var token = _options.Value.Token; |
|
|
|
httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer",token ); |
|
|
|
} |
|
|
|
if (!string.IsNullOrEmpty(_options.Value.UserName) && !string.IsNullOrEmpty(_options.Value.Password)) |
|
|
|
{ |
|
|
|
var username = _options.Value.UserName; |
|
|
|
var password = _options.Value.Password; |
|
|
|
httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes($"{username}:{password}"))); |
|
|
|
} |
|
|
|
|
|
|
|
#region
|
|
|
|
IssueJobToRestoClient client = new IssueJobToRestoClient(_options.Value.Address, _httpClientFactory.CreateClient()); |
|
|
|
IssueJobToRestoClient client = new IssueJobToRestoClient(_options.Value.Address, httpclient); |
|
|
|
ret = await client.SyncIssueJobStereoAsync(main).ConfigureAwait(false); |
|
|
|
} |
|
|
|
catch(Exception ex) { |
|
|
@ -405,14 +426,11 @@ public class KittingIssueJobAppService |
|
|
|
ret.Message=ex.Message; |
|
|
|
ret.OperateTime = DateTime.Now.ToString("yyyy-MM-dd"); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
return ret; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost("receive-issue-job-stereo")] |
|
|
|
public virtual async Task<ReusltObject> SyncReciveIssueJobStereoAsync(IssueRequestFromRestoDTO input) |
|
|
|
{ |
|
|
@ -440,7 +458,7 @@ public class KittingIssueJobAppService |
|
|
|
var dtos = ObjectMapper.Map<List<KittingIssueJob>, List<KittingIssueJobDTO>>(entities); |
|
|
|
if (input.Jobs.Count == entities.Count) |
|
|
|
{ |
|
|
|
errors.Add("提交出库任务和WMS出库任务不符,请核对! \n"); |
|
|
|
errors.Add("立体库提交出库任务和WMS任务不符,请核对! \n"); |
|
|
|
} |
|
|
|
foreach (var itm in dtos) |
|
|
|
{ |
|
|
|