Browse Source

更新

dev_DY_CC
赵新宇 1 year ago
parent
commit
307683b21f
  1. 19
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Authenticaitons/BaererToken.cs
  2. 9
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Authenticaitons/ITokenService.cs
  3. 57
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Authenticaitons/TokenService.cs
  4. 72
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Client/WebApi.cs
  5. 181
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/FawtygAutoMapperProfile.cs
  6. 40
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/HttpAuthorizationHandler.cs
  7. 218
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs
  8. 51
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingTaskIncomingBackgroundWorker.cs
  9. 40
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/InjectionMoldingTaskAgentHostedService.cs
  10. 167
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/InjectionMoldingTaskAgentModule.cs
  11. 12
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/InjectionMoldingTaskAgentService.cs
  12. 39
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/InjectionMoldingTaskOptions.cs
  13. 54
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Outgoing/InjectionMoldingTaskOutgoingBackgroundWorker.cs
  14. 53
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Program.cs
  15. 43
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.csproj
  16. 88
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/appsettings.json
  17. 39
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/serilogsettings.json
  18. 1
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/tempkey.jwk
  19. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/BomManager.cs
  20. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Caches/Cache.cs
  21. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Kittings/KittingDbContextModelCreatingExtensions.cs
  22. 3
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs
  23. 4
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CustomerProductionReturnNotes/CustomerProductionReturnNoteAppService.cs
  24. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAppService.cs
  25. 8
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/MesNoteEventHandler.cs
  26. 7
      be/WZC2.sln

19
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Authenticaitons/BaererToken.cs

@ -0,0 +1,19 @@
using System;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Authenticaitons;
public class BaererToken
{
public string access_token { get; set; }
public long expires_in { get; set; } = 3600;
public string token_type { get; set; }
public string refresh_token { get; set; }
public string scope { get; set; }
}
public class TokenInfo
{
public BaererToken BaererToken { get; set; } = new();
public DateTimeOffset GetTime { get; set; } = DateTimeOffset.Now;
public DateTimeOffset ExpireTime => GetTime.AddSeconds(BaererToken.expires_in);
}

9
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Authenticaitons/ITokenService.cs

@ -0,0 +1,9 @@
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Authenticaitons;
public interface ITokenService : ITransientDependency
{
Task<BaererToken> GetTokenAsync();
}

57
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Authenticaitons/TokenService.cs

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Volo.Abp;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Authenticaitons;
public class TokenService : ITokenService
{
private readonly IConfiguration _configuration;
public TokenService(IConfiguration configuration)
{
_configuration = configuration;
}
public virtual async Task<BaererToken> GetTokenAsync()
{
const string routeString = "connect/token";
var baseUrl = _configuration["AuthServer:Authority"];
var client_id = _configuration["Authentication:client_id"];
var client_secret = _configuration["Authentication:client_secret"];
var grant_type = _configuration["Authentication:grant_type"];
var username = _configuration["Authentication:username"];
var password = _configuration["Authentication:password"];
var client = new HttpClient();
client.BaseAddress = new Uri(baseUrl);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("client_id",client_id),
new KeyValuePair<string, string>("client_secret",client_secret),
new KeyValuePair<string, string>("grant_type",grant_type),
new KeyValuePair<string, string>("username",username),
new KeyValuePair<string, string>("password",password),
});
var response = await client.PostAsync(routeString, content).ConfigureAwait(false);
Console.WriteLine(response.RequestMessage.RequestUri);
if (!response.IsSuccessStatusCode)
{
var str = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
throw new UserFriendlyException(str);
}
var dto = await response.Content.ReadFromJsonAsync<BaererToken>().ConfigureAwait(false);
return dto;
}
}

72
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Client/WebApi.cs

@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using StackExchange.Redis;
using Volo.Abp.Application.Services;
using Win_in.Sfs.Wms.DataExchange.Domain;
using Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent;
using static Volo.Abp.Identity.Settings.IdentitySettingNames;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Client;
public class WebServiceAppService : IReader
{
private readonly IHttpClientFactory _httpClientFactory;
private readonly IOptions<InjectionMoldingTaskOptions> _options;
public WebServiceAppService(IHttpClientFactory httpClientFactory, IOptions<InjectionMoldingTaskOptions> options)
{
_httpClientFactory = httpClientFactory;
_options = options;
}
public Task<List<IncomingFromExternal>> ReadAsync()
{
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <param name="p_type"></param>
/// <returns></returns>
public async Task<string> WebApi(int p_type)
{
//var client = _httpClientFactory.CreateClient();
//// 设置用户名和密码
//var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}"));
//client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", credentials);
//// 发送HTTP请求
//var response = await client.GetAsync("https://example.com/api/data");
//if (response.IsSuccessStatusCode)
//{
// return await response.Content.ReadAsStringAsync();
//}
// SoapClient
var address = _options.Value.AutoRemote.IpAddress;
var username = _options.Value.AutoRemote.UserName;
var password=_options.Value.AutoRemote.Password;
var token= _options.Value.AutoRemote.Token;
var client = _httpClientFactory.CreateClient();
var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}"));
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", credentials);
var response = await client.GetAsync("https://example.com/api/data").ConfigureAwait(false);
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStringAsync();
}
return "Error occurred";
}
}

181
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/FawtygAutoMapperProfile.cs

@ -0,0 +1,181 @@
using AutoMapper;
using Volo.Abp.AutoMapper;
using Win_in.Sfs.Shared.Application;
using Win_in.Sfs.Wms.DataExchange.Domain;
using Win_in.Sfs.Wms.DataExchange.WMS.BackFlushNote;
using Win_in.Sfs.Wms.DataExchange.WMS.MaterialRequest;
using Win_in.Sfs.Wms.DataExchange.WMS.PCK;
using Win_in.Sfs.Wms.DataExchange.WMS.ProductReceiptNote;
using Win_in.Sfs.Wms.DataExchange.WMS.ScrapNote;
using Win_in.Sfs.Wms.Store.Application.Contracts;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent;
public class FawtygAutoMapperProfile : Profile
{
public FawtygAutoMapperProfile()
{
CreateMap<IncomingToWms, ArchivedIncomingToWms>();
CreateMap<IncomingFromExternal, ArchivedIncomingFromExternal>();
CreateMap<OutgoingFromWms, ArchivedOutgoingFromWms>();
CreateMap<OutgoingToExternal, ArchivedOutgoingToExternal>();
CreateMap<BackFlushNoteExchangeDto, BackFlushNoteEditInput>();
CreateMap<BackFlushNoteDetailExchangeDto, BackFlushNoteDetailInput>();
CreateMap<ProductReceiptNoteExchangeDto, ProductReceiptNoteEditInput>()
.Ignore(x => x.Number)
.Ignore(x => x.ProductionPlanNumber)
.Ignore(x => x.JobNumber)
.Ignore(x => x.WorkShop) //必填
.Ignore(x => x.ReceiptType)
.Ignore(x => x.SourceNumber)
.Ignore(x => x.Worker)
.Ignore(x => x.Remark)
.Ignore(x => x.Details)
.Ignore(x => x.ExtraProperties);
CreateMap<ProductReceiptNoteDetailExchangeDto, ProductReceiptNoteDetailInput>()
.Ignore(x => x.Shift)
.Ignore(x => x.ProdLine)
.Ignore(x => x.BomVersion)
.Ignore(x => x.Status)
.Ignore(x => x.PackingCode)
.Ignore(x => x.ContainerCode)
.Ignore(x => x.StdPackQty)
.Ignore(x => x.Lot) //必填
.Ignore(x => x.SupplierBatch)
.Ignore(x => x.ArriveDate)
.Ignore(x => x.ProduceDate)
.Ignore(x => x.ExpireDate)
.Ignore(x => x.ItemName)
.Ignore(x => x.ItemDesc1)
.Ignore(x => x.ItemDesc2)
.Ignore(x => x.RecommendContainerCode)
.Ignore(x => x.RecommendPackingCode)
.Ignore(x => x.RecommendSupplierBatch)
.Ignore(x => x.RecommendArriveDate)
.Ignore(x => x.RecommendProduceDate)
.Ignore(x => x.RecommendExpireDate)
.Ignore(x => x.RecommendLot)
.Ignore(x => x.RecommendToLocationCode)
.Ignore(x => x.RecommendToLocationArea)
.Ignore(x => x.RecommendToLocationGroup)
.Ignore(x => x.RecommendToLocationErpCode)
.Ignore(x => x.RecommendToWarehouseCode)
.Ignore(x => x.RecommendQty)
.Ignore(t => t.HandledContainerCode)
.Ignore(x => x.HandledPackingCode)
.Ignore(x => x.HandledSupplierBatch)
.Ignore(x => x.HandledArriveDate)
.Ignore(x => x.HandledProduceDate)
.Ignore(x => x.HandledExpireDate)
.Ignore(x => x.HandledLot)
.Ignore(x => x.HandledToLocationCode)
.Ignore(x => x.HandledToLocationArea)
.Ignore(x => x.HandledToLocationGroup)
.Ignore(x => x.HandledToLocationErpCode)
.Ignore(x => x.HandledToWarehouseCode)
.Ignore(x => x.HandledQty);
CreateMap<MaterialRequestExchangeDto, MaterialRequestEditInput>()
//必填
.Ignore(x => x.Workshop)
.Ignore(x => x.ProdLine)
.Ignore(x => x.PreparationPlanNumber)
.Ignore(x => x.AutoSubmit)
.Ignore(x => x.AutoAgree)
.Ignore(x => x.AutoHandle)
.Ignore(x => x.AutoCompleteJob)
.Ignore(x => x.DirectCreateNote)
.Ignore(x => x.Worker)
.Ignore(x => x.ActiveDate)
.Ignore(x => x.Remark)
.Ignore(x => x.Details)
.Ignore(x => x.ExtraProperties);
CreateMap<MaterialRequestDetailExchangeDto, MaterialRequestDetailInput>()
.Ignore(x => x.ProdLine)
.Ignore(x => x.WorkStation)
.Ignore(x => x.ExpiredTime)
.Ignore(x => x.RequestStatus)
.Ignore(x => x.ToLocationErpCode)
.Ignore(x => x.Uom)
.Ignore(x => x.StdPackQty)
.Ignore(x => x.Remark)
.Ignore(x => x.ItemName)
.Ignore(x => x.ItemDesc1)
.Ignore(x => x.ItemDesc2);
CreateMap<IssueNoteExchangeDto, IssueNoteEditInput>()
.Ignore(x => x.Details)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.JobNumber)
.Ignore(x => x.Workshop)
.Ignore(x => x.RequestNumber)
.Ignore(x => x.Worker)
.Ignore(x => x.ActiveDate)
;
CreateMap<IssueNoteDetailExchangeDto, IssueNoteDetailInput>()
.Ignore(x => x.ItemName)
.Ignore(x => x.ItemDesc1)
.Ignore(x => x.ItemDesc2)
.Ignore(x => x.IssueTime)
.Ignore(x => x.ExpiredTime)
.Ignore(x => x.ProdLine)
.Ignore(x => x.WorkStation)
.Ignore(x => x.FromContainerCode)
.Ignore(x => x.ToContainerCode)
.Ignore(x => x.FromLot)
.Ignore(x => x.ToLot)
.Ignore(x => x.SupplierBatch)
.Ignore(x => x.ArriveDate)
.Ignore(x => x.ProduceDate)
.Ignore(x => x.ExpireDate)
.Ignore(x => x.FromLocationCode)
.Ignore(x => x.FromLocationErpCode)
.Ignore(x => x.FromWarehouseCode)
.Ignore(x => x.StdPackQty)
.Ignore(x => x.Remark)
.Ignore(x => x.ToPackingCode)
.Ignore(x => x.ToWarehouseCode)
.Ignore(x => x.FromStatus)
.Ignore(x => x.ToStatus)
.Ignore(x => x.Uom)
.IgnoreIHasRecommendAndHandledFrom();
CreateMap<IssueNoteDTO, IssueNoteExchangeDto>()
.Ignore(x => x.Detail)
;
CreateMap<IssueNoteDetailDTO, IssueNoteDetailExchangeDto>();
CreateMap<ScrapNoteExchangeDto, ScrapNoteEditInput>()
.Ignore(x => x.Details)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.Number)
.Ignore(x => x.JobNumber)
;
CreateMap<ScrapNoteDetailExchangeDto, ScrapNoteDetailInput>()
.Ignore(x => x.ItemName)
.Ignore(x => x.ItemDesc1)
.Ignore(x => x.ItemDesc2)
.Ignore(x => x.FromPackingCode)
.Ignore(x => x.ToPackingCode)
.Ignore(x => x.FromContainerCode)
.Ignore(x => x.ToContainerCode)
.Ignore(x => x.FromLot)
.Ignore(x => x.ToLot)
.Ignore(x => x.SupplierBatch)
.Ignore(x => x.ArriveDate)
.Ignore(x => x.ProduceDate)
.Ignore(x => x.ExpireDate)
.Ignore(x => x.ToWarehouseCode)
.Ignore(x => x.ToWarehouseCode)
.Ignore(x => x.Uom)
.Ignore(x => x.StdPackQty)
;
}
}

40
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/HttpAuthorizationHandler.cs

@ -0,0 +1,40 @@
using System;
using Microsoft.Extensions.Configuration;
using Volo.Abp.DependencyInjection;
using Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Authenticaitons;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent;
public class HttpAuthorizationHandler : ISingletonDependency
{
private readonly ITokenService _tokenService;
private readonly IConfiguration _configuration;
private static TokenInfo TokenInfo { get; } = new();
public HttpAuthorizationHandler(ITokenService tokenService, IConfiguration configuration)
{
_tokenService = tokenService;
_configuration = configuration;
}
public bool IsLoggedIn()
{
if (!string.IsNullOrEmpty(TokenInfo.BaererToken?.access_token) &&
TokenInfo.ExpireTime > DateTimeOffset.Now)
{
return true;
}
var token = _tokenService.GetTokenAsync().Result;
TokenInfo.BaererToken = token;
TokenInfo.GetTime = DateTimeOffset.Now;
return true;
}
public string GetCurrentBearer()
{
return TokenInfo.BaererToken.access_token;
}
}

218
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs

@ -0,0 +1,218 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Volo.Abp.Application.Services;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.DataExchange.Domain;
using Win_in.Sfs.Wms.DataExchange.Domain.Shared;
using Win_in.Sfs.Wms.DataExchange.WMS.PCK;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using System.Text.Json.Serialization;
using System.IdentityModel.Tokens.Jwt;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming;
public class InjectionMoldingRequestReader : IReader
{
private readonly IInjectionRequestAppService _injectionRequest;
private readonly IItemBasicAppService _itemService;
private readonly ILocationAppService _locService;
private readonly IIncomingFromExternalManager _incomingFromExternalManager;
private readonly ILogger<InjectionMoldingRequestReader> _logger;
private readonly IOptions<InjectionMoldingTaskOptions> _options;
private readonly IHttpClientFactory _httpClientFactory;
public InjectionMoldingRequestReader(
IInjectionRequestAppService injectionRequest
, IIncomingFromExternalManager incomingFromExternalManager
, ILogger<InjectionMoldingRequestReader> logger
,IOptions<InjectionMoldingTaskOptions> options
, IHttpClientFactory httpClientFactory
,IItemBasicAppService itemService
,ILocationAppService locService
)
{
_injectionRequest = injectionRequest;
_incomingFromExternalManager = incomingFromExternalManager;
_logger = logger;
_options = options;
_httpClientFactory = httpClientFactory;
_itemService=itemService;
_locService = locService;
}
public virtual async Task<List<IncomingFromExternal>> ReadAsync()
{
try
{
var jobCondition = new SfsStoreRequestInputBase();
Filter filter = new Filter()
{
Action = "<>",
Column = "JobStatus",
Logic = EnumFilterLogic.And.ToString(),
Value = ((int)EnumJobStatus.Done).ToString()
};
jobCondition.Condition.Filters.Add(filter);
var jobs = await _injectionRequest.GetAllListByFilterAsync(jobCondition).ConfigureAwait(false);
List<InjectionRequestEditInput> joblist = new List<InjectionRequestEditInput>();
if (jobs.Count == 0)
{
string camera =await ReaderCameraApi().ConfigureAwait(false);
List<InjectionRequest> cameraList = new List<InjectionRequest>();
if (camera == "Error occured")
{
_logger.LogError($"没有读取到摄像头信息{DateTime.Now},请检查网络");
return new List<IncomingFromExternal>();
}
cameraList = System.Text.Json.JsonSerializer.Deserialize<List<InjectionRequest>>(camera);//camera转注塑叫料明细任务数据
InjectionRequestEditInput input=new InjectionRequestEditInput();
List<InjectionRequestDetailInput> injectionRequestDetails = new List<InjectionRequestDetailInput>();
foreach (var job in cameraList) {
var detailInput = new InjectionRequestDetailInput()
{
ItemCode = job.ItemCode,
ToLocationCode = job.ToLocCode,
Qty = job.Qty,
};
injectionRequestDetails.Add(detailInput);
}
input.Details.AddRange(injectionRequestDetails);
var errors=await BindAsync(input.Details).ConfigureAwait(false);//零件仓库赋值
if (errors.Count > 0)
{
foreach (var error in errors) {
_logger.LogError(error);
}
return new List<IncomingFromExternal>();
}
await _injectionRequest.CreateAsync(input).ConfigureAwait(false);
}
}
catch (Exception ex)
{
_logger.LogError(ex.Message);
}
return new List<IncomingFromExternal>();
}
private async Task<List<string>> BindAsync(List<InjectionRequestDetailInput> p_list)
{
List<string> errors = new List<string>();
foreach (var request in p_list)
{
var itm =await _itemService.GetByCodeAsync(request.ItemCode).ConfigureAwait(false);
if(itm == null) { errors.Add($"编号:{request.ItemCode}零件表中没找到!" ); }else
{
request.ItemDesc1 = itm.Desc1;
request.ItemDesc2 = itm.Desc2;
request.ItemName = itm.Name;
}
var loc = await _locService.GetByCodeAsync(request.ToLocationCode).ConfigureAwait(false);
if (loc == null) { errors.Add($"编号:{request.ToLocationCode}库位表中没找到!"); }else
{
request.ToLocationCode = loc.Code;
request.ToLocationGroup = loc.LocationGroupCode;
request.ToLocationErpCode = loc.ErpLocationCode;
request.ToWarehouseCode= loc.WarehouseCode;
}
}
return errors;
}
/// <summary>
///
/// </summary>
/// <param name="p_type"></param>
/// <returns></returns>
public async Task<string> ReaderCameraApi()
{
var address = _options.Value.AutoRemote.IpAddress;
var username = _options.Value.AutoRemote.UserName;
var password = _options.Value.AutoRemote.Password;
var token = _options.Value.AutoRemote.Token;
var client = _httpClientFactory.CreateClient();
var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}"));
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", credentials);
var response = await client.GetAsync("https://example.com/api/data").ConfigureAwait(false);
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStringAsync().ConfigureAwait(false);
}
return "Error occurred";
}
public class InjectionRequest
{
/// <summary>
/// 零件吗
/// </summary>
public string ItemCode { get; set; }
/// <summary>
/// 零件名称
/// </summary>
public string ItemName { get; set; }
/// <summary>
/// 发运库位
/// </summary>
public string ToLocCode { get; set; }
/// <summary>
/// 来源库位
/// </summary>
public string FromLocCode { get; set; }
/// <summary>
/// 数量
/// </summary>
public decimal Qty { get; set; }
}
}

51
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingTaskIncomingBackgroundWorker.cs

@ -0,0 +1,51 @@
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Volo.Abp.BackgroundWorkers;
using Volo.Abp.Threading;
using Volo.Abp.Uow;
using Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming;
using Win_in.Sfs.Wms.Store.Application.Contracts;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent;
public class InjectionMoldingTaskIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
{
private readonly string Incoming = "InjectionMoldingTask Incoming";
private readonly IOptions<InjectionMoldingTaskOptions> _options;
public InjectionMoldingTaskIncomingBackgroundWorker(
AbpAsyncTimer timer,
IOptions<InjectionMoldingTaskOptions> options,
IServiceScopeFactory serviceScopeFactory
) : base(timer, serviceScopeFactory)
{
_options = options;
Timer.Period = options.Value.IncomingOptions.PeriodSeconds * 1000; //default 10 minutes
}
[UnitOfWork]
protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext)
{
Logger.LogInformation($"Starting: Handling {Incoming}");
if (!_options.Value.IncomingOptions.Active)
{
Logger.LogInformation($"{Incoming} is not active!");
return;
}
int min = DateTime.Now.Hour*60+ DateTime.Now.Minute;//第二天00:05:00与当天23:55:00不执行避免tyrpnumber重复
if ( (24*60-5)<= min || min <= 5)
{
Logger.LogInformation($"{Incoming} 时间小于第二天00:05:00大于当天23:55:00");
return;
}
Logger.LogInformation($"注塑任务");//缴库
var reader = workerContext.ServiceProvider.GetService<InjectionMoldingRequestReader>();
await reader.ReadAsync().ConfigureAwait(false);
Logger.LogInformation($"Completed: Handling {Incoming}");
}
}

40
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/InjectionMoldingTaskAgentHostedService.cs

@ -0,0 +1,40 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Volo.Abp;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent;
public class InjectionMoldingTaskAgentHostedService : IHostedService
{
private readonly IAbpApplicationWithExternalServiceProvider _application;
private readonly IServiceProvider _serviceProvider;
private readonly InjectionMoldingTaskAgentService _agentService;
public InjectionMoldingTaskAgentHostedService(
IAbpApplicationWithExternalServiceProvider application,
IServiceProvider serviceProvider,
InjectionMoldingTaskAgentService agentService)
{
_application = application;
_serviceProvider = serviceProvider;
_agentService = agentService;
}
public Task StartAsync(CancellationToken cancellationToken)
{
_application.Initialize(_serviceProvider);
_agentService.Start();
return Task.CompletedTask;
}
public Task StopAsync(CancellationToken cancellationToken)
{
_application.Shutdown();
return Task.CompletedTask;
}
}

167
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/InjectionMoldingTaskAgentModule.cs

@ -0,0 +1,167 @@
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Polly;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.BackgroundWorkers;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Http.Client;
using Volo.Abp.Modularity;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Label.Application.Contracts;
using Win_in.Sfs.Shared.Host;
using Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent;
[DependsOn(
typeof(AbpAutofacModule),
typeof(AbpAutoMapperModule),
typeof(AbpBackgroundJobsModule),
typeof(AbpBackgroundWorkersModule),
typeof(AbpHttpClientModule)
)]
[DependsOn(
typeof(StoreApplicationContractsModule),
typeof(InventoryApplicationContractsModule),
typeof(LabelApplicationContractsModule),
typeof(DataExchangeDomainModule),
typeof(DataExchangeEntityFrameworkCoreModule),
//typeof(DataExchangeDomainFawtygMesModule),
//typeof(DataExchangeEntityFrameworkCoreFawtygModule),
typeof(AbpAccountApplicationContractsModule)
)]
public class InjectionMoldingTaskAgentModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
PreConfigure<AbpHttpClientBuilderOptions>(options =>
{
//Polly 重试3次
options.ProxyClientBuildActions.Add((remoteServiceName, clientBuilder) =>
{
clientBuilder.AddTransientHttpErrorPolicy(policyBuilder =>
policyBuilder.WaitAndRetryAsync(
3,
i => TimeSpan.FromSeconds(Math.Pow(2, i))
)
);
});
//默认添加Authorization Header: Bearer Token
options.ProxyClientActions.Add((a, s, h) =>
{
var httpAuthorizationHandler = s.GetService<HttpAuthorizationHandler>();
if (httpAuthorizationHandler != null && httpAuthorizationHandler.IsLoggedIn())
{
h.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", httpAuthorizationHandler.GetCurrentBearer());
}
});
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
var env = context.Services.GetSingletonInstance<IHostEnvironment>();
context.SetConsoleTitleOfConsoleApp("MesAgent", env.EnvironmentName);
ConfigureDbContext();
ConfigureOptions(configuration);
context.Services.AddHostedService<InjectionMoldingTaskAgentHostedService>();
ConfigureAutoMapper(context);
ConfigureHttpClientProxies(context);
ConfigureAuthentication(context, configuration);
}
private void ConfigureDbContext()
{
Configure<AbpDbContextOptions>(options =>
{
options.UseSqlServer();
//options.UseSqlServer<DbContext>();
});
}
private void ConfigureOptions(IConfiguration configuration)
{
Configure<InjectionMoldingTaskOptions>(configuration.GetSection("InjectionMoldingTaskOptions"));
}
private void ConfigureAutoMapper(ServiceConfigurationContext context)
{
context.Services.AddAutoMapperObjectMapper<InjectionMoldingTaskAgentModule>();
Configure<AbpAutoMapperOptions>(options => { options.AddMaps<InjectionMoldingTaskAgentModule>(validate: false); });
}
private static void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
{
var isAlwaysAllowAuthorization = configuration.GetValue<bool>("AuthServer:AlwaysAllowAuthorization");
if (isAlwaysAllowAuthorization)
{
//绕过授权服务,用于测试
context.Services.AddAlwaysAllowAuthorization();
}
else
{
context.Services.AddHttpClient();
context.Services.AddAuthentication()
.AddJwtBearer(options =>
{
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
options.Audience = "DataExchange";
options.BackchannelHttpHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback =
HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};
});
}
}
private static void ConfigureHttpClientProxies(ServiceConfigurationContext context)
{
context.Services.AddHttpClientProxies(
typeof(BasedataApplicationContractsModule).Assembly,
"BaseData"
);
context.Services.AddHttpClientProxies(
typeof(StoreApplicationContractsModule).Assembly,
"Store"
);
context.Services.AddHttpClientProxies(
typeof(LabelApplicationContractsModule).Assembly,
"Label"
);
}
public override void OnApplicationInitialization(
ApplicationInitializationContext context)
{
context.AddBackgroundWorkerAsync<InjectionMoldingTaskIncomingBackgroundWorker>();
context.AddBackgroundWorkerAsync<InjectionMoldingTaskOutgoingBackgroundWorker>();
}
}

12
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/InjectionMoldingTaskAgentService.cs

@ -0,0 +1,12 @@
using System;
using Volo.Abp.DependencyInjection;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent;
public class InjectionMoldingTaskAgentService : ITransientDependency
{
public void Start()
{
Console.WriteLine("InjectionMoldingTask data exchange service has started...");
}
}

39
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/InjectionMoldingTaskOptions.cs

@ -0,0 +1,39 @@
using System.Net;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent;
public class InjectionMoldingTaskOptions
{
public DataExchangeOptions IncomingOptions { get; set; }
public DataExchangeOptions OutgoingOptions { get; set; }
public InjectionAutoRemote AutoRemote { get; set; }
}
public class InjectionAutoRemote
{
public string IpAddress { set; get; }
public string UserName { set; get; }
public string Password { set; get; }
public string Token { set; get; }
}
public class DataExchangeOptions
{
public bool Active { get; set; }
public int PeriodSeconds { get; set; } = 60;
public int BatchSize { get; set; } = 10;
public int MaxCount { get; set; } = 100;
public int RetryTimes { get; set; } = 3;
}

54
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Outgoing/InjectionMoldingTaskOutgoingBackgroundWorker.cs

@ -0,0 +1,54 @@
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Volo.Abp.BackgroundWorkers;
using Volo.Abp.Threading;
using Volo.Abp.Uow;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent;
public class InjectionMoldingTaskOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
{
private readonly string Outgoing = "InjectionMoldingTaskOptions Outgoing";
private readonly IOptions<InjectionMoldingTaskOptions> _options;
public InjectionMoldingTaskOutgoingBackgroundWorker(
AbpAsyncTimer timer
, IOptions<InjectionMoldingTaskOptions> options
, IServiceScopeFactory serviceScopeFactory
) : base(timer, serviceScopeFactory)
{
_options = options;
Timer.Period = options.Value.OutgoingOptions.PeriodSeconds * 1000; //default 10 minutes
}
[UnitOfWork]
protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext)
{
Logger.LogInformation($"Starting: Handling {Outgoing}");
if (!_options.Value.IncomingOptions.Active)
{
Logger.LogInformation($"{Outgoing} is not active!");
return;
}
Logger.LogInformation($"Write Issue");
//var issueConvert = workerContext.ServiceProvider.GetRequiredService<IssuesConverter>();
//var issueNoteList = await issueConvert.ConvertAsync().ConfigureAwait(false);
//var issueWriter = workerContext.ServiceProvider.GetRequiredService<IssueNoteWriter>();
//await issueWriter.WriteAsync(issueNoteList).ConfigureAwait(false);
Logger.LogInformation($"Completed: Handling {Outgoing}");
}
}

53
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Program.cs

@ -0,0 +1,53 @@
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent;
public class Program
{
public static async Task<int> Main(string[] args)
{
IConfigurationRoot configuration =
new ConfigurationBuilder()
.AddJsonFile("serilogsettings.json", false, true)
.Build();
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.CreateLogger();
try
{
Log.Information("Starting console host.");
await CreateHostBuilder(args).RunConsoleAsync().ConfigureAwait(false);
return 0;
}
catch (Exception ex)
{
Log.Fatal(ex, "Host terminated unexpectedly!");
return 1;
}
finally
{
Log.CloseAndFlush();
}
}
internal static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseAutofac()
.UseSerilog()
.ConfigureAppConfiguration((context, config) =>
{
//setup your additional configuration sources
})
.ConfigureServices((hostContext, services) =>
{
services.AddApplication<InjectionMoldingTaskAgentModule>();
});
}

43
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.csproj

@ -0,0 +1,43 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.12" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.*" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="6.0.12" />
<PackageReference Include="Serilog.Sinks.MSSqlServer" Version="6.3.0" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="5.3.5" />
<PackageReference Include="Volo.Abp.BackgroundJobs" Version="5.3.5" />
<PackageReference Include="Volo.Abp.BackgroundWorkers" Version="5.3.5" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="5.3.5" />
<PackageReference Include="Volo.Abp.Http.Client" Version="5.3.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Modules\Label\src\Win_in.Sfs.Label.Application.Contracts\Win_in.Sfs.Label.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\Modules\Shared\src\Win_in.Sfs.Shared.Host\Win_in.Sfs.Shared.Host.csproj" />
<ProjectReference Include="..\..\..\Modules\Store\src\Win_in.Sfs.Wms.Store.Application.Contracts\Win_in.Sfs.Wms.Store.Application.Contracts.csproj" />
<ProjectReference Include="..\..\src\Win_in.Sfs.Wms.DataExchange.Application.Contracts\Win_in.Sfs.Wms.DataExchange.Application.Contracts.csproj" />
<ProjectReference Include="..\..\src\Win_in.Sfs.Wms.DataExchange.Domain\Win_in.Sfs.Wms.DataExchange.Domain.csproj" />
<ProjectReference Include="..\..\src\Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore\Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>
<Content Include="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="serilogsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
</Project>

88
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/appsettings.json

@ -0,0 +1,88 @@
{
"ConnectionStrings": {
"Default": "Server=10.164.113.32,1818\\SHDB;Database=Wms_Dy_ShangHai;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True;Encrypt=false",
"DataExchange": "Server=10.164.113.32,1818\\SHDB;Database=Wms_DataExchange_Main_Dy_ShangHai;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True;Encrypt=false",
"MES": "Server=10.164.113.32,1818\\SHDB;Database=MES_SH;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True;Encrypt=false"
},
"AuthServer": {
"Authority": "http://dev.ccwin-in.com:60083",
"RequireHttpsMetadata": "false",
"SwaggerClientId": "admin",
"SwaggerClientSecret": "1q2w3E*",
"grant_type": "password",
"AlwaysAllowAuthorization": true
},
"Authentication": {
"client_id": "Auth_App",
"client_secret": "1q2w3e*",
"grant_type": "password",
"username": "jiekou",
"password": "1q2w3E*"
},
"RemoteServices": {
"Inventory": {
"BaseUrl": "http://localhost:59095/"
},
"Job": {
"BaseUrl": "http://localhost:59095/"
},
"Label": {
"BaseUrl": "http://dev.ccwin-in.com:60082/"
},
"Message": {
"BaseUrl": "http://dev.ccwin-in.com:60082/"
},
"Store": {
"BaseUrl": "http://localhost:59095/"
}
},
//"RemoteServices": {
// "BaseData": {
// "BaseUrl": "http://10.164.113.31:60084/"
// },
// "Store": {
// "BaseUrl": "http://10.164.113.31:60085/"
// },
// "Label": {
// "BaseUrl": "http://10.164.113.31:60082/"
// }
//},
"InjectionMoldingTaskOptions": {
"AutoRemote": {
"IpAddress": "http://10.164.113.31:60085/",
"UserName": "",
"Password": "",
"Token": ""
},
"IncomingOptions": {
"Active": true,
"PeriodSeconds": 10,
"BatchSize": 10,
"MaxCount": 100,
"RetryTimes": 3
},
"OutgoingOptions": {
"Active": true,
"PeriodSeconds": 10,
"BatchSize": 10,
"MaxCount": 100,
"RetryTimes": 3
}
}
}

39
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/serilogsettings.json

@ -0,0 +1,39 @@
{
"Serilog": {
"Using": [ "Serilog.Sinks.File", "Serilog.Sinks.Async", "Serilog.Sinks.Console", "Serilog.Sinks.MSSqlServer" ],
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Information",
"Microsoft.EntityFrameworkCore": "Warning"
}
},
"WriteTo": [
{
"Name": "Async",
"Args": {
"configure": [
{
"Name": "File",
"Args": {
"path": "..//Logs//MesAgent//MesAgent_.log",
"rollingInterval": "Day",
"fileSizeLimitBytes": "52428800",
"rollOnFileSizeLimit": "true",
"restrictedToMinimumLevel": "Debug"
}
}
]
}
},
{
"Name": "Console",
"Args": {
"restrictedToMinimumLevel": "Debug",
"outputTemplate": "{Timestamp:HH:mm:ss.fff} [{Level:u3}] {Message} {NewLine}{Exception}"
}
}
],
"Enrich": [ "FromLogContext", "WithMachineName", "WithProcessId", "WithThreadId" ]
}
}

1
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/tempkey.jwk

@ -0,0 +1 @@
{"AdditionalData":{},"Alg":"RS256","Crv":null,"D":"oAL-OdQF7tHgMYho6jsPrxtuvDFdF0T6IRBihCrz0b_IB-aqWTVMTe5uilRgmY3aAzQC8mCmkFamneGLZy7QplZlOc57TSv64zAeRBSCyIfn1gvWCj7_p6qI7lElu0QHwnaErfDHsV47sIukRf_q2sE9ZVfHBYKNMLR_kbZZlzs3YZCIiiJwFbE6VKZ2HH2s9gf-DSpJ5WIGnyeAswZflNjkQdUbUl8tJCOHyi7BC60sCoPqASEeRIyarMG7AKjMw44rTs5TGpTp8uoPg4XhV4xP4LzX436gFFjrhf_EOo5UI2d6UCLwQNGWmrpWjLUAs7QjjcxH4sSaniDR51DTnQ","DP":"ayJZOPaME1B4c7tLZJdTpXCF5AUXUnS-Bq_buYxZAYXLaOdxJHjltCSLTdQ7p6Y1Y4tISg74uXFzmx18ERbi5WNMzhsGAezSDV_PWePu6Ujpm--F7TcE3aYRs0srsnbFWq57W2DusxwjWr_a-g08zP10O4IJP5WmE5rd4xQDO_s","DQ":"Q80U7ZCxMDcpmO87VHYS9sIZdoHu7PXK7mdjxTuTXYJTOE4BBMwacF-MbPO_Smno9-p32RnH7rJp8dpSevU5sUwT-xEPpGbJILBnFGesmBMiOiK5aKBhZ60T4gw6VNf_iIBHuIYB9MGybJfbf-7iZ7aGgNGdwr5XKITDahq_5Jk","E":"AQAB","K":null,"KeyId":"D6178DB50135E8E220498A66064AEF08","Kid":"D6178DB50135E8E220498A66064AEF08","Kty":"RSA","N":"tqqOx4HSDkuiEXAzYdJxsXyhXnXYaezE5KCHy4Mx6lFDmJfx6IQf9dhcCrumCga_1PfxXdV0R2OHo4i67yiQm-0XRgx7W87S6LR7ARraVme25SiOnZEtwlauYvEXz0cCR-bhvLwLTOPjptSKHl5DVl8Lcw7PjBpJLDP1zqCFMgU-KVusNoaruLFBb3zdgYt7ovzBOj94UkRAy5cLmAJKh73IOyExM-fO7rTR7dyc1jstNbUGhdX3fui3f0hUGsNOCvIyaaJn2SuGbSo5loWHBFtNkLHrXD9dLirJaXqkP7zK4rAYu0KrFqUp9LA_RNK2QLD2LnucCsmLPzz3jnpufQ","Oth":null,"P":"4D4K7xT2s-TJyUzbFZDsGPzD1kLbuB3lQnp6_tkHg0GrXgojf-obIviQPqhKmOQN-qAq0hoSVYXXmUCf-iMsV0XM6UcChI6GSO3dAQyB-e6TdCIw6kSEEJrhr6tadwOnOFb6HssX7n5nxw47dJV7ORQ6tjrTGi3IdlTUl8uo1-c","Q":"0Ikp47a-_VxvflocNK_6YyeNukMOjEmGqIQWQgXGJv6dd2-_ox6BztA9qcmmfuKU5xmD9aOlj_WIATRi3meSH7DdiGYCd-56QDj-Lvwej6_27rX8lISQ2D0TQqgPZCGAE_1PvIAmYfv0D7GrCFevJrJ2Z5zLC6GK61WjC0V3afs","QI":"Xk7BkXcsdP-RQc1VaJqQ9krQftyYlsxM6hC6x80y7fi7tR6g68GwrNdIw-dPE_bHQuD7DKwq8FFMROzR4t2cRTOGhlKj7VgJ8N8soXzXxUAmerhOXMJ1nJOAnNBSTglVFVUqdZMgOfPbClgg29tRBPQgrKnN_-yzXgglCB6rqPU","Use":null,"X":null,"X5t":null,"X5tS256":null,"X5u":null,"Y":null,"KeySize":2048,"HasPrivateKey":true,"CryptoProviderFactory":{"CryptoProviderCache":{},"CustomCryptoProvider":null,"CacheSignatureProviders":true,"SignatureProviderObjectPoolCacheSize":32}}

2
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/BomManager.cs

@ -129,7 +129,7 @@ public class BomManager : DomainService, IBomManager
{
await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false);
}
Cache.Boms.Clear();
await _repository.BulkMergeAsync(mergeEntities).ConfigureAwait(false);
}

2
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Caches/Cache.cs

@ -9,6 +9,8 @@ namespace Win_in.Sfs.Basedata.Caches;
public static class Cache
{
public static List<Bom> Boms = new List<Bom>();
public static async void BomsLifeCycle(int lifetime)
{
var reassigner = new Reassigner(DateTime.Now,new TimeSpan(0,5,0));

2
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Kittings/KittingDbContextModelCreatingExtensions.cs

@ -49,7 +49,7 @@ public static class KittingDbContextModelCreatingExtensions
//Indexes
//b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired();
// b.HasMany(q => q.).WithOne().HasForeignKey(d => d.MasterID).IsRequired();

3
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs

@ -853,11 +853,9 @@ public class BalanceAppService
var entities = await _repository.GetPagedListAsync(expression, input.SkipCount, input.MaxResultCount,
input.Sorting, true).ConfigureAwait(false);
var list = ObjectMapper.Map<List<Balance>, List<BalanceDTO>>(entities);
//var hasDetails = typeof(TEntity) is SfsMasterAggregateRootBase<TDetail> detailEntity;
var tt = typeof(Balance).GetBaseClasses(typeof(SfsMasterAggregateRootBase<EmptyDetail>));
var hasDetails = tt.Length > 0 ? true : false;
if (list.Count > 0)
{
var itemCodes = list.Select(t => t.ItemCode).Distinct();
@ -870,7 +868,6 @@ public class BalanceAppService
});
}
}
return ExportImportService.Export(list, detailsProptyName: hasDetails ? nameof(EmptyDetail) : null);
}

4
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CustomerProductionReturnNotes/CustomerProductionReturnNoteAppService.cs

@ -92,8 +92,8 @@ public class CustomerProductionReturnNoteAppService :
itm.ToStatus=EnumInventoryStatus.OK;
itm.FromLocationArea = "OK";
itm.FromLocationErpCode= "OK";
itm.FromLot = "NONE";
itm.FromPackingCode = "NONE";
itm.FromLot = "";
itm.FromPackingCode = "";
itm.FromWarehouseCode = "OK";
itm.FromLocationGroup = "OK";
itm.FromContainerCode = "OK";

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAppService.cs

@ -92,7 +92,7 @@ public class MesNoteAppService :
var first = balanceLst.FirstOrDefault();
if (first != null)
{
if (detail.Qty <= first.Qty)
if (detail.Qty > first.Qty)
{
throw new UserFriendlyException($"库存数量不足");
}

8
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/MesNoteEventHandler.cs

@ -78,7 +78,13 @@ public class MesNoteEventHandler
var transferLogs = new List<TransferLogEditInput>();
foreach (var detail in MesNote.Details.Where(detail => detail.Qty != 0))
{
detail.FromPackingCode = "";
detail.ToPackingCode = "";
detail.FromContainerCode = "";
detail.FromLot = "";
detail.ToContainerCode = "";
var transferLog = ObjectMapper.Map<MesNoteDetail, TransferLogEditInput>(detail);
transferLog.TransType = Enum.Parse<EnumTransType>(MesNote.Type); ;
transferLog.TransSubType = EnumTransSubType.None;

7
be/WZC2.sln

@ -264,6 +264,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Wms.Store.Domain
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "解决方案项", "解决方案项", "{1295E21B-E615-4C99-93A3-218BB082F610}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent", "DataExchange\Fawtyg\Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent\Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.csproj", "{1552D8A4-E897-4017-B4C4-834E183AB066}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -650,6 +652,10 @@ Global
{666C8442-DF6C-4F1E-855D-851777C2395A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{666C8442-DF6C-4F1E-855D-851777C2395A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{666C8442-DF6C-4F1E-855D-851777C2395A}.Release|Any CPU.Build.0 = Release|Any CPU
{1552D8A4-E897-4017-B4C4-834E183AB066}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1552D8A4-E897-4017-B4C4-834E183AB066}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1552D8A4-E897-4017-B4C4-834E183AB066}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1552D8A4-E897-4017-B4C4-834E183AB066}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -778,6 +784,7 @@ Global
{637A1F71-B29E-4247-B1C6-695790CE0525} = {F17D371C-DF73-4CD7-8BE1-3254110FB20B}
{EBC2FEC4-BCCC-4430-953B-2712C0416BC6} = {ED39BD34-B85D-4683-BF54-68996C248C1A}
{666C8442-DF6C-4F1E-855D-851777C2395A} = {4D8578B9-A0E1-4A0D-8044-1F417620C34A}
{1552D8A4-E897-4017-B4C4-834E183AB066} = {BA78EB96-38FD-4488-B9AA-9CF85481BC36}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7A77C2A7-D19D-40B4-AE22-85473900E6F9}

Loading…
Cancel
Save