|
@ -2,6 +2,7 @@ using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using System.Net.Http; |
|
|
using System.Net.Http; |
|
|
|
|
|
using System.Net.Http.Headers; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using Castle.Components.DictionaryAdapter; |
|
|
using Castle.Components.DictionaryAdapter; |
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
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.Notes; |
|
|
using Win_in.Sfs.Wms.Store.Options; |
|
|
using Win_in.Sfs.Wms.Store.Options; |
|
|
using static IdentityModel.ClaimComparer; |
|
|
using static IdentityModel.ClaimComparer; |
|
|
|
|
|
using static Volo.Abp.Identity.Settings.IdentitySettingNames; |
|
|
|
|
|
|
|
|
namespace Win_in.Sfs.Wms.Store.Application; |
|
|
namespace Win_in.Sfs.Wms.Store.Application; |
|
|
|
|
|
|
|
@ -368,10 +370,15 @@ public class KittingIssueJobAppService |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 立体库同步
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
|
/// <param name="p_loc"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost("sync-issue-job-stereo")] |
|
|
|
|
|
|
|
|
|
|
|
public async Task<ReusltObject> SyncIssueJobStereoAsync(List<KittingIssueJobDTO> input,string p_loc) |
|
|
|
|
|
|
|
|
private async Task<ReusltObject> SyncIssueJobStereoAsync(List<KittingIssueJobDTO> input,string p_loc) |
|
|
|
|
|
{ |
|
|
{ |
|
|
ReusltObject ret = new ReusltObject(); |
|
|
ReusltObject ret = new ReusltObject(); |
|
|
ret.Code = "1"; |
|
|
ret.Code = "1"; |
|
@ -397,15 +404,29 @@ public class KittingIssueJobAppService |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
main.Details = IssueJobToRestoDetailDTOs; |
|
|
main.Details = IssueJobToRestoDetailDTOs; |
|
|
|
|
|
var httpclient = _httpClientFactory.CreateClient(); |
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
#if DEBUG
|
|
|
|
|
|
|
|
|
string json= System.Text.Json.JsonSerializer.Serialize(main); |
|
|
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
|
|
|
#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, httpclient); |
|
|
IssueJobToRestoClient client = new IssueJobToRestoClient(_options.Value.Address, _httpClientFactory.CreateClient()); |
|
|
|
|
|
ret = await client.SyncIssueJobStereoAsync(main).ConfigureAwait(false); |
|
|
ret = await client.SyncIssueJobStereoAsync(main).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
|
catch(Exception ex) { |
|
|
catch(Exception ex) { |
|
@ -414,14 +435,11 @@ public class KittingIssueJobAppService |
|
|
ret.Message=ex.Message; |
|
|
ret.Message=ex.Message; |
|
|
ret.OperateTime = DateTime.Now.ToString("yyyy-MM-dd"); |
|
|
ret.OperateTime = DateTime.Now.ToString("yyyy-MM-dd"); |
|
|
} |
|
|
} |
|
|
#endregion
|
|
|
|
|
|
return ret; |
|
|
return ret; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost("receive-issue-job-stereo")] |
|
|
[HttpPost("receive-issue-job-stereo")] |
|
|
public virtual async Task<ReusltObject> SyncReciveIssueJobStereoAsync(IssueRequestFromRestoDTO input) |
|
|
public virtual async Task<ReusltObject> SyncReciveIssueJobStereoAsync(IssueRequestFromRestoDTO input) |
|
|
{ |
|
|
{ |
|
@ -446,18 +464,11 @@ public class KittingIssueJobAppService |
|
|
var query = _repository.WithDetails() |
|
|
var query = _repository.WithDetails() |
|
|
.Where(p => numbers.Contains(p.Number)); |
|
|
.Where(p => numbers.Contains(p.Number)); |
|
|
var entities = query.ToList(); |
|
|
var entities = query.ToList(); |
|
|
|
|
|
|
|
|
var dtos = ObjectMapper.Map<List<KittingIssueJob>, List<KittingIssueJobDTO>>(entities); |
|
|
var dtos = ObjectMapper.Map<List<KittingIssueJob>, List<KittingIssueJobDTO>>(entities); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (input.Jobs.Count == entities.Count) |
|
|
if (input.Jobs.Count == entities.Count) |
|
|
{ |
|
|
{ |
|
|
errors.Add("提交出库任务和WMS出库任务不符,请核对! \n"); |
|
|
errors.Add("立体库提交出库任务和WMS任务不符,请核对! \n"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var itm in dtos) |
|
|
foreach (var itm in dtos) |
|
|
{ |
|
|
{ |
|
|
var first = jobs.FirstOrDefault<IssueJobFromRestoDTO>(p => p.JobNumber == itm.Number); |
|
|
var first = jobs.FirstOrDefault<IssueJobFromRestoDTO>(p => p.JobNumber == itm.Number); |
|
@ -465,17 +476,20 @@ public class KittingIssueJobAppService |
|
|
List<KittingIssueJobDetailDTO> details = new List<KittingIssueJobDetailDTO>(); |
|
|
List<KittingIssueJobDetailDTO> details = new List<KittingIssueJobDetailDTO>(); |
|
|
foreach (var detail in first.Details) |
|
|
foreach (var detail in first.Details) |
|
|
{ |
|
|
{ |
|
|
|
|
|
var entity = itmDetails.FirstOrDefault(p => p.ItemCode == detail.ItemCode); |
|
|
KittingIssueJobDetailDTO dto = new KittingIssueJobDetailDTO(); |
|
|
KittingIssueJobDetailDTO dto = new KittingIssueJobDetailDTO(); |
|
|
dto.HandledFromLocationCode = detail.FromLocationCode; |
|
|
dto.HandledFromLocationCode = entity.HandledFromLocationCode; |
|
|
dto.HandledToLocationCode = detail.ToLocationCode; |
|
|
dto.HandledToLocationCode = entity.HandledToLocationCode; |
|
|
dto.ItemCode = detail.ItemCode; |
|
|
dto.ItemCode = detail.ItemCode; |
|
|
dto.RecommendFromQty = detail.Qty; |
|
|
dto.RecommendFromQty = detail.Qty; |
|
|
dto.RecommendToQty = detail.Qty; |
|
|
dto.RecommendToQty = detail.Qty; |
|
|
dto.HandledFromQty = detail.Qty; |
|
|
dto.HandledFromQty = detail.Qty; |
|
|
dto.HandledToQty = detail.Qty; |
|
|
dto.HandledToQty = detail.Qty; |
|
|
|
|
|
dto.Status =entity.Status; |
|
|
details.Add(dto); |
|
|
details.Add(dto); |
|
|
} |
|
|
} |
|
|
itm.Details = details; |
|
|
itm.Details = details; |
|
|
|
|
|
await CompleteAsync(itm.Id, itm).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|