Browse Source

Merge branch 'dev_DY_CC' of http://dev.ccwin-in.com:3000/BoXu.Zheng/WZC2 into dev_DY_CC

dev_DY_CC
lvzb 1 year ago
parent
commit
602f9a8180
  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. 195
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/InjectionJobController.cs
  20. 38
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/InjectionNoteController.cs
  21. 51
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/InjectionRequestController.cs
  22. 2
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ThirdLocationNoteController.cs
  23. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/BomManager.cs
  24. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Caches/Cache.cs
  25. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Kittings/KittingDbContextModelCreatingExtensions.cs
  26. 13
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs
  27. 23
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs
  28. 420
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferLibRequests/DTOs/TransferLibRequestDetailDTO.cs
  29. 283
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferLibRequests/Inputs/TransferLibRequestDetailInput.cs
  30. 27
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionJobs/InjectionJobAppService.cs
  31. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs
  32. 4
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CustomerProductionReturnNotes/CustomerProductionReturnNoteAppService.cs
  33. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAppService.cs
  34. 8
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferLibNotes/ITransferLibCallback.cs
  35. 33
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAppService.cs
  36. 16
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferLibRequests/TransferLibRequestAppService.cs
  37. 197
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/NewRecommendHandled/NewRecommendFromTo.cs
  38. 148
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/NewRecommendHandled/NewRecommendHandledFromTo.cs
  39. 49
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionJobs/InjectionJobManager.cs
  40. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/TransferLibJobs/TransferLibJobDetail.cs
  41. 8
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferLibNotes/TransferLibNoteDetail.cs
  42. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestDetail.cs
  43. 283
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/TransferLibRequests/TransferLibRequestDetail.cs
  44. 62
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/TransferLibJobs/TransferLibJobDbContextModelCreatingExtensions.cs
  45. 30131
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240415063138_transferLibV2222.Designer.cs
  46. 6132
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240415063138_transferLibV2222.cs
  47. 1037
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/StoreDbContextModelSnapshot.cs
  48. 66
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/TransferLibNotes/TransferLibNoteDbContextModelCreatingExtensions.cs
  49. 43
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/TransferLibRequests/TransferLibRequestDbContextModelCreatingExtensions.cs
  50. 46
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/TransferLibRequestAutoMapperProfile.cs
  51. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionRequestEventHandler.cs
  52. 139
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferLibRequestEventHandler.cs
  53. 8
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/MesNoteEventHandler.cs
  54. 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}}

195
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/InjectionJobController.cs

@ -0,0 +1,195 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Polly.Caching;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
using Win_in.Sfs.Auth.Application.Contracts;
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.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts;
namespace Win_in.Sfs.Wms.Pda.Controllers.Jobs;
/// <summary>
/// 注塑叫料任务
/// </summary>
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}job/injection")]
public class InjectionJobController : AbpController
{
private readonly IInjectionJobAppService _injectionJobAppService;
private readonly IUserWorkGroupAppService _userWorkGroupAppService;
private readonly IDictAppService _dictApp;
/// <summary>
///
/// </summary>
/// <param name="injectionJobAppService"></param>
/// <param name="userWorkGroupAppService"></param>
public InjectionJobController(
IInjectionJobAppService injectionJobAppService,
IDictAppService dictApp
, IUserWorkGroupAppService userWorkGroupAppService)
{
_userWorkGroupAppService = userWorkGroupAppService;
_injectionJobAppService = injectionJobAppService;
_dictApp = dictApp;
}
/// <summary>
/// 获取任务详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("{id}")]
public virtual async Task<ActionResult<InjectionJobDTO>> GetAsync(Guid id)
{
var result = await _injectionJobAppService.GetAsync(id).ConfigureAwait(false);
return Ok(result);
}
/// <summary>
/// 获取列表 筛选
/// </summary>
/// <param name="sfsRequestDTO"></param>
/// <returns></returns>
[HttpPost("list")]
public virtual async Task<PagedResultDto<InjectionJobDTO>> GetListAsync(SfsJobRequestInputBase sfsRequestDTO)
{
var list = await _injectionJobAppService.GetPagedListByFilterAsync(sfsRequestDTO, true).ConfigureAwait(false);
return list;
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="pageSize"></param>
/// <param name="pageIndex"></param>
/// <returns></returns>
[HttpGet("list")]
public virtual async Task<PagedResultDto<InjectionJobDTO>> GetListAsync(int pageSize, int pageIndex)
{
var status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase
{
MaxResultCount = pageSize,
SkipCount = (pageIndex - 1) * pageSize,
Sorting = $"{nameof(InjectionJobDTO.CreationTime)} ASC",
Condition = new Condition
{
Filters = new List<Filter>
{
new(nameof(IssueJobDTO.JobStatus),jsonStatus,"In")
}
}
};
var list = await _injectionJobAppService.GetPagedListByFilterAsync(request, true).ConfigureAwait(false);
return list;
}
/// <summary>
/// 根据Job Number 获取任务列表
/// </summary>
/// <param name="jobNumber"></param>
/// <returns></returns>
[HttpGet("by-number/{jobNumber}")]
public virtual async Task<ActionResult<InjectionJobDTO>> GetByNumberAsync(string jobNumber)
{
var jobDto = await _injectionJobAppService.GetByNumberAsync(jobNumber).ConfigureAwait(false);
if (jobDto == null)
{
throw new UserFriendlyException($"未找到编号为 {jobNumber} 的任务");
}
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
if (!wlgCodes.Contains(jobDto.WorkGroupCode))
{
return new NotFoundObjectResult($"任务属于工作组 {jobDto.WorkGroupCode}");
}
if (jobDto.JobStatus == EnumJobStatus.Doing && jobDto.AcceptUserId != CurrentUser.Id)
{
return new NotFoundObjectResult($"任务正在被 {jobDto.AcceptUserName} 处理");
}
return jobDto;
}
/// <summary>
/// 获取任务数量
/// </summary>
/// <returns></returns>
[HttpGet("count")]
public virtual async Task<ActionResult<long>> CountAsync()
{
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes);
var status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing };
var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase
{
Sorting = $"{nameof(InjectionJobDTO.Priority)} ASC",
Condition = new Condition
{
Filters = new List<Filter>
{
new(nameof(InjectionJobDTO.WorkGroupCode),jsonCodes,"In"),
new(nameof(InjectionJobDTO.JobStatus),jsonStatus,"In")
}
}
};
var count = await _injectionJobAppService.GetCountByFilterAsync(request).ConfigureAwait(false);
return Ok(count);
}
/// <summary>
/// 承接任务
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("take/{id}")]
public virtual async Task TakeAsync(Guid id)
{
await _injectionJobAppService.AcceptAsync(id).ConfigureAwait(false);
}
/// <summary>
/// 取消承接任务
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("cancel-take/{id}")]
public virtual async Task CancelTakeAsync(Guid id)
{
await _injectionJobAppService.CancelAcceptAsync(id).ConfigureAwait(false);
}
/// <summary>
/// 执行任务
/// </summary>
/// <param name="id"></param>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("finish/{id}")]
public virtual async Task FinishAsync(Guid id, [FromBody] InjectionJobDTO dto)
{
await _injectionJobAppService.CompleteAsync(id, dto).ConfigureAwait(false);
}
}

38
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/InjectionNoteController.cs

@ -0,0 +1,38 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
using Win_in.Sfs.Wms.Store.Application.Contracts;
namespace Win_in.Sfs.Wms.Pda.Controllers.Stores;
/// <summary>
/// 注塑叫料记录
/// </summary>
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}store/injection-note")]
public class InjectionNoteController : AbpController
{
private readonly IInjectionNoteAppService _injectionNoteAppService;
/// <summary>
///
/// </summary>
/// <param name="injectionNoteAppService"></param>
public InjectionNoteController(IInjectionNoteAppService injectionNoteAppService)
{
_injectionNoteAppService = injectionNoteAppService;
}
/// <summary>
/// 创建注塑叫料记录
/// </summary>
/// <param name="input">CreateInput</param>
/// <returns></returns>
[HttpPost("")]
public virtual async Task CreateAsync(InjectionNoteEditInput input)
{
await _injectionNoteAppService.CreateAsync(input).ConfigureAwait(false);
}
}

51
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/InjectionRequestController.cs

@ -0,0 +1,51 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
using Win_in.Sfs.Wms.Store.Application.Contracts;
namespace Win_in.Sfs.Wms.Pda.Controllers.Stores;
/// <summary>
/// 注塑叫料请求
/// </summary>
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}store/injection-request")]
public class InjectionRequestController : AbpController
{
private readonly IInjectionRequestAppService _injectionRequestAppService;
/// <summary>
///
/// </summary>
/// <param name="InjectionRequestAppService"></param>
public InjectionRequestController(IInjectionRequestAppService InjectionRequestAppService)
{
_injectionRequestAppService = InjectionRequestAppService;
}
/// <summary>
/// 注塑叫料申请
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("")]
public virtual async Task CreateAsync(InjectionRequestEditInput input)
{
_ = await _injectionRequestAppService.CreateAsync(input).ConfigureAwait(false);
}
/// <summary>
/// 根据number获取注塑叫料申请详情
/// </summary>
/// <param name="number"></param>
/// <returns></returns>
[HttpGet("{number}")]
public virtual async Task<ActionResult<InjectionRequestDTO>> GetAsync(string number)
{
var result = await _injectionRequestAppService.GetByNumberAsync(number).ConfigureAwait(false);
return Ok(result);
}
}

2
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ThirdLocationNoteController.cs

@ -25,7 +25,7 @@ public class ThirdLocationNoteController : AbpController
}
/// <summary>
/// 创建器具转移记录
/// 创建三方库转移记录
/// </summary>
/// <param name="input">CreateInput</param>
/// <returns></returns>

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();

13
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs

@ -110,12 +110,6 @@ public interface IBalanceAppService
Task<PagedResultDto<BalanceDTO>> GetByHoldLocationCodeAndNoOkAsync(SfsInventoryRequestInputBase sfsRequestDTO, bool includeDetails = false,
CancellationToken cancellationToken = default);
/// <summary>
/// 获取 【实际库存余额】(不包含预计入,抛出预计出)
/// </summary>
/// <returns></returns>
Task<BalanceDTO> GetRealQtyByPackingCodeAndItemCodeAndLocationCodeAndStatusAsync(string packingCode, string itemCode, string locationCode, EnumInventoryStatus status);
Task<List<BalanceDTO>> GetListByLocationCodeAndItemCodeAsync(string locationCode, string itemCode);
Task<List<BalanceDTO>> GetListByLocationCodeAndStatusAsync(string locationCode, EnumInventoryStatus status);
@ -174,4 +168,11 @@ public interface IBalanceAppService
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
Task<List<BalanceDTO>> GetUsableListAsync(RecommendBalanceRequestInput input);
/// <summary>
/// 获取 【实际库存余额】(不包含预计入,计算了预计出)
/// </summary>
/// <returns></returns>
Task<BalanceDTO> GetRealQtyByPackingCodeAndItemCodeAndLocationCodeAndStatusAsync(string packingCode,
string itemCode, string locationCode, EnumInventoryStatus status,string lot);
}

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

@ -39,6 +39,7 @@ public class BalanceAppService
private readonly IBalanceManager _balanceManager;
private readonly IItemBasicAppService _itemBasicAppService;
private readonly IStdCostPriceSheetAppService _stdCostPriceSheetAppService;
private readonly IExpectOutAppService _expectOutAppService;
public BalanceAppService(
IBalanceRepository repository,
@ -47,7 +48,8 @@ public class BalanceAppService
ILocationAclService locationAclService,
IItemBasicAclService itemBasicAclService,
IItemBasicAppService itemBasicAppService,
IStdCostPriceSheetAppService stdCostPriceSheetAppService) : base(repository)
IStdCostPriceSheetAppService stdCostPriceSheetAppService,
IExpectOutAppService expectOutAppService) : base(repository)
{
_repository = repository;
_transferLogManager = transferLogManager;
@ -56,6 +58,7 @@ public class BalanceAppService
_itemBasicAclService = itemBasicAclService;
_itemBasicAppService = itemBasicAppService;
_stdCostPriceSheetAppService = stdCostPriceSheetAppService;
_expectOutAppService = expectOutAppService;
}
#region Update
@ -803,12 +806,12 @@ public class BalanceAppService
}
/// <summary>
/// 获取 【实际库存余额】(不包含预计入,抛出预计出)
/// 获取 【实际库存余额】(不包含预计入,计算了预计出)
/// </summary>
/// <returns></returns>
[HttpPost("get-real-qty-by-packing-and-item-and-location-and-status")]
[HttpPost("get-real-qty-by-packing-and-item-and-location-and-status-and-lot")]
public async Task<BalanceDTO> GetRealQtyByPackingCodeAndItemCodeAndLocationCodeAndStatusAsync(string packingCode,
string itemCode, string locationCode, EnumInventoryStatus status)
string itemCode, string locationCode, EnumInventoryStatus status,string lot)
{
var entity = await _repository.FirstOrDefaultAsync(c =>
c.PackingCode == packingCode && c.ItemCode == itemCode && c.LocationCode == locationCode &&
@ -818,9 +821,14 @@ public class BalanceAppService
throw new UserFriendlyException($"未找到箱码为 {packingCode},物料代码为 {itemCode},库位代码为 {locationCode} 的库存");
}
//TODO 减去预计出
var expectOutDtos=await _expectOutAppService.GetListByItemCodeAndStatusAndPackingCodeAsync(itemCode,locationCode,packingCode,status,lot).ConfigureAwait(false);
var dto = ObjectMapper.Map<Balance, BalanceDTO>(entity);
foreach (var expectOutDto in expectOutDtos)
{
dto.Qty -= expectOutDto.Qty;
}
return dto;
}
@ -853,11 +861,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 +876,6 @@ public class BalanceAppService
});
}
}
return ExportImportService.Export(list, detailsProptyName: hasDetails ? nameof(EmptyDetail) : null);
}

420
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferLibRequests/DTOs/TransferLibRequestDetailDTO.cs

@ -1,4 +1,7 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.Domain;
@ -7,7 +10,7 @@ namespace Win_in.Sfs.Wms.Store.Application.Contracts;
/// <summary>
/// 库存转移记录-明细表
/// </summary>
public class TransferLibRequestDetailDTO : NewRecommendFromTo
public class TransferLibRequestDetailDTO : SfsDetailDTOBase
{
/// <summary>
@ -47,46 +50,423 @@ public class TransferLibRequestDetailDTO : NewRecommendFromTo
public string CallJobNumber { get; set; }
#endregion
#region 校验
#region 库存基础信息
/// <summary>
/// 物品代码
/// </summary>
public string ItemCode { get; set; }
/// <summary>
/// 物品名称
/// </summary>
public string ItemName { get; set; }
/// <summary>
/// 物品描述1
/// </summary>
public string ItemDesc1 { get; set; }
/// <summary>
/// 物品描述2
/// </summary>
public string ItemDesc2 { get; set; }
/// <summary>
/// 标包数量
/// </summary>
[Display(Name = "标包数量")]
[Column(TypeName = "decimal(18,6)")]
public decimal StdPackQty { get; set; }
/// <summary>
/// 库存状态
/// </summary>
public EnumInventoryStatus Status { get; set; }
/// <summary>
/// 计量单位
/// </summary>
public string Uom { get; set; }
#endregion
#region 请求信息
/// <summary>
/// 请求库位
/// </summary>
public string RequestLocationCode { get; set; }
/// <summary>
/// 到库区
/// </summary>
public string RequestLocationArea { get; set; }
/// <summary>
/// 到库位组
/// </summary>
public string RequestLocationGroup { get; set; }
/// <summary>
/// 到ERP库位
/// </summary>
public string RequestLocationErpCode { get; set; }
/// <summary>
/// 到仓库
/// </summary>
public string RequestWarehouseCode { get; set; }
/// <summary>
/// 在途库库位
/// </summary>
public string OnTheWayLocationCode { get; set; }
/// <summary>
/// 生产线
/// </summary>
public string ProdLine { get; set; }
/// <summary>
/// 位置码
/// </summary>
public string PositionCode { get; set; }
/// <summary>
/// 推荐的类型
/// </summary>
public EnumRecommendType RecommendType { get; set; }
/// <summary>
/// 需求数量
/// </summary>
public decimal RequestQty { get; set; }
#endregion
#region 推荐来源
/// <summary>
/// 推荐来源托标签
/// </summary>
public string RecommendFromContainerCode { get; set; }
/// <summary>
/// 推荐来源箱标签
/// </summary>
public string RecommendFromPackingCode { get; set; }
/// <summary>
/// 推荐来源批次供应商批次
/// </summary>
public string RecommendFromSupplierBatch { get; set; }
/// <summary>
/// 推荐来源批次到货时间
/// </summary>
public DateTime RecommendFromArriveDate { get; set; }
/// <summary>
/// 推荐来源批次生产时间
/// </summary>
public DateTime RecommendFromProduceDate { get; set; }
/// <summary>
/// 推荐来源批次过期时间
/// </summary>
public DateTime RecommendFromExpireDate { get; set; }
/// <summary>
/// 推荐来源批次排序
/// </summary>
public string RecommendFromLot { get; set; }
/// <summary>
/// 推荐来源库位
/// </summary>
public string RecommendFromLocationCode { get; set; }
/// <summary>
/// 推荐来源库区
/// </summary>
public string RecommendFromLocationArea { get; set; }
/// <summary>
/// 推荐来源库位组
/// </summary>
public string RecommendFromLocationGroup { get; set; }
/// <summary>
/// 推荐来源ERP库位
/// </summary>
public string RecommendFromLocationErpCode { get; set; }
/// <summary>
/// 推荐来源仓库
/// </summary>
public string RecommendFromWarehouseCode { get; set; }
/// <summary>
/// 推荐来源数量
/// </summary>
public decimal RecommendFromQty { get; set; }
#endregion
#region 推荐目标
/// <summary>
/// 推荐目标托标签
/// </summary>
public string RecommendToContainerCode { get; set; }
/// <summary>
/// 推荐目标箱标签
/// </summary>
public string RecommendToPackingCode { get; set; }
/// <summary>
/// 推荐目标批次供应商批次
/// </summary>
public string RecommendToSupplierBatch { get; set; }
/// <summary>
/// 推荐目标批次到货时间
/// </summary>
public DateTime RecommendToArriveDate { get; set; }
/// <summary>
/// 推荐目标批次生产时间
/// </summary>
public DateTime RecommendToProduceDate { get; set; }
/// <summary>
/// 推荐目标批次过期时间
/// </summary>
public DateTime RecommendToExpireDate { get; set; }
/// <summary>
/// 推荐目标批次排序
/// </summary>
public string RecommendToLot { get; set; }
/// <summary>
/// 推荐目标库位
/// </summary>
public string RecommendToLocationCode { get; set; }
/// <summary>
/// 推荐目标库区
/// </summary>
public string RecommendToLocationArea { get; set; }
/// <summary>
/// 推荐目标库位组
/// </summary>
public string RecommendToLocationGroup { get; set; }
/// <summary>
/// 推荐目标ERP库位
/// </summary>
public string RecommendToLocationErpCode { get; set; }
/// <summary>
/// 推荐目标仓库
/// </summary>
public string RecommendToWarehouseCode { get; set; }
/// <summary>
/// 推荐目标数量
/// </summary>
public decimal RecommendToQty { get; set; }
#endregion
#region 实际来源
/// <summary>
/// 实际目标托标签
/// </summary>
public string HandledFromContainerCode { get; set; }
/// <summary>
/// 实际箱标签
/// </summary>
public string HandledFromPackingCode { get; set; }
/// <summary>
/// 实际批次供应商批次
/// </summary>
public string HandledFromSupplierBatch { get; set; }
/// <summary>
/// 实际批次到货时间
/// </summary>
public DateTime HandledFromArriveDate { get; set; }
/// <summary>
/// 实际批次生产时间
/// </summary>
public DateTime HandledFromProduceDate { get; set; }
/// <summary>
/// 实际批次过期时间
/// </summary>
public DateTime HandledFromExpireDate { get; set; }
/// <summary>
/// 实际批次排序
/// </summary>
public string HandledFromLot { get; set; }
/// <summary>
/// 实际库位
/// </summary>
public string HandledFromLocationCode { get; set; }
/// <summary>
/// 实际库区
/// </summary>
public string HandledFromLocationArea { get; set; }
/// <summary>
/// 实际库位组
/// </summary>
public string HandledFromLocationGroup { get; set; }
/// <summary>
/// 实际ERP库位
/// </summary>
public string HandledFromLocationErpCode { get; set; }
/// <summary>
/// 实际仓库
/// </summary>
public string HandledFromWarehouseCode { get; set; }
/// <summary>
/// 实际数量
/// </summary>
public decimal HandledFromQty { get; set; }
#endregion
#region 实际目标
/// <summary>
/// 实际目标托标签
/// </summary>
public string HandledToContainerCode { get; set; }
/// <summary>
/// 实际箱标签
/// </summary>
public string HandledToPackingCode { get; set; }
/// <summary>
/// 实际批次供应商批次
/// </summary>
public string HandledToSupplierBatch { get; set; }
/// <summary>
/// 实际批次到货时间
/// </summary>
public DateTime HandledToArriveDate { get; set; }
/// <summary>
/// 实际批次生产时间
/// </summary>
public DateTime HandledToProduceDate { get; set; }
/// <summary>
/// 实际批次过期时间
/// </summary>
public DateTime HandledToExpireDate { get; set; }
/// <summary>
/// 实际批次排序
/// </summary>
public string HandledToLot { get; set; }
/// <summary>
/// 实际库位
/// </summary>
public string HandledToLocationCode { get; set; }
/// <summary>
/// 实际库区
/// </summary>
public string HandledToLocationArea { get; set; }
/// <summary>
/// 实际库位组
/// </summary>
public string HandledToLocationGroup { get; set; }
/// <summary>
/// 实际ERP库位
/// </summary>
public string HandledToLocationErpCode { get; set; }
/// <summary>
/// 实际仓库
/// </summary>
public string HandledToWarehouseCode { get; set; }
/// <summary>
/// 实际数量
/// </summary>
public decimal HandledToQty { get; set; }
#endregion
#region 开关
//箱码
public bool CheckPackingCodeFrom { get; set; }
public bool IsPackingCodeFrom { get; set; }
public bool IsPackingCodeTo { get; set; }
public bool CheckPackingCodeTo { get; set; }
//批次
public bool CheckLotFrom { get; set; }
public bool IsLotFrom { get; set; }
public bool IsLotTo { get; set; }
public bool CheckLotTo { get; set; }
//零件号
public bool CheckItemCodeFrom { get; set; }
public bool IsItemCodeFrom { get; set; }
public bool IsItemCodeTo { get; set; }
public bool CheckItemCodeTo { get; set; }
//状态
public bool CheckStatusFrom { get; set; }
public bool IsStatusFrom { get; set; }
public bool IsStatusTo { get; set; }
public bool CheckStatusTo { get; set; }
//库位
public bool CheckLocationCodeFrom { get; set; }
public bool IsLocationCodeFrom { get; set; }
public bool CheckLocationCodeTo { get; set; }
public bool IsLocationCodeTo { get; set; }
//库位组
public bool CheckLocationGroupFrom { get; set; }
public bool IsLocationGroupFrom { get; set; }
public bool CheckLocationGroupTo { get; set; }
public bool IsLocationGroupTo { get; set; }
//区域
public bool CheckLocationAreaFrom { get; set; }
public bool IsLocationAreaFrom { get; set; }
public bool CheckLocationAreaTo { get; set; }
public bool IsLocationAreaTo { get; set; }
//储位
public bool CheckLocationErpCodeFrom { get; set; }
public bool IsLocationErpCodeFrom { get; set; }
public bool IsLocationErpCodeTo { get; set; }
public bool CheckLocationErpCodeTo { get; set; }
//数量
public bool CheckQtyFrom { get; set; }
public bool IsQtyFrom { get; set; }
public bool CheckQtyTo { get; set; }
public bool IsQtyTo { get; set; }
#endregion

283
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferLibRequests/Inputs/TransferLibRequestDetailInput.cs

@ -1,4 +1,7 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.Domain;
@ -8,7 +11,7 @@ namespace Win_in.Sfs.Wms.Store.Application.Contracts;
/// <summary>
/// 库存转移记录-明细表
/// </summary>
public class TransferLibRequestDetailInput : NewRecommendFromTo
public class TransferLibRequestDetailInput : SfsDetailInputBase
{
/// <summary>
/// 原因
@ -48,47 +51,285 @@ public class TransferLibRequestDetailInput : NewRecommendFromTo
public string CallJobNumber { get; set; }
#endregion
#region 校验
#region 库存基础信息
/// <summary>
/// 物品代码
/// </summary>
public string ItemCode { get; set; }
/// <summary>
/// 物品名称
/// </summary>
public string ItemName { get; set; }
/// <summary>
/// 物品描述1
/// </summary>
public string ItemDesc1 { get; set; }
/// <summary>
/// 物品描述2
/// </summary>
public string ItemDesc2 { get; set; }
/// <summary>
/// 标包数量
/// </summary>
[Display(Name = "标包数量")]
[Column(TypeName = "decimal(18,6)")]
public decimal StdPackQty { get; set; }
/// <summary>
/// 库存状态
/// </summary>
public EnumInventoryStatus Status { get; set; }
/// <summary>
/// 计量单位
/// </summary>
public string Uom { get; set; }
#endregion
#region 请求信息
/// <summary>
/// 请求库位
/// </summary>
public string RequestLocationCode { get; set; }
/// <summary>
/// 到库区
/// </summary>
public string RequestLocationArea { get; set; }
/// <summary>
/// 到库位组
/// </summary>
public string RequestLocationGroup { get; set; }
/// <summary>
/// 到ERP库位
/// </summary>
public string RequestLocationErpCode { get; set; }
/// <summary>
/// 到仓库
/// </summary>
public string RequestWarehouseCode { get; set; }
/// <summary>
/// 在途库库位
/// </summary>
public string OnTheWayLocationCode { get; set; }
/// <summary>
/// 生产线
/// </summary>
public string ProdLine { get; set; }
/// <summary>
/// 位置码
/// </summary>
public string PositionCode { get; set; }
/// <summary>
/// 推荐的类型
/// </summary>
public EnumRecommendType RecommendType { get; set; }
/// <summary>
/// 需求数量
/// </summary>
public decimal RequestQty { get; set; }
#endregion
#region 推荐来源
/// <summary>
/// 推荐来源托标签
/// </summary>
public string RecommendFromContainerCode { get; set; }
/// <summary>
/// 推荐来源箱标签
/// </summary>
public string RecommendFromPackingCode { get; set; }
/// <summary>
/// 推荐来源批次供应商批次
/// </summary>
public string RecommendFromSupplierBatch { get; set; }
/// <summary>
/// 推荐来源批次到货时间
/// </summary>
public DateTime RecommendFromArriveDate { get; set; }
/// <summary>
/// 推荐来源批次生产时间
/// </summary>
public DateTime RecommendFromProduceDate { get; set; }
/// <summary>
/// 推荐来源批次过期时间
/// </summary>
public DateTime RecommendFromExpireDate { get; set; }
/// <summary>
/// 推荐来源批次排序
/// </summary>
public string RecommendFromLot { get; set; }
/// <summary>
/// 推荐来源库位
/// </summary>
public string RecommendFromLocationCode { get; set; }
/// <summary>
/// 推荐来源库区
/// </summary>
public string RecommendFromLocationArea { get; set; }
/// <summary>
/// 推荐来源库位组
/// </summary>
public string RecommendFromLocationGroup { get; set; }
/// <summary>
/// 推荐来源ERP库位
/// </summary>
public string RecommendFromLocationErpCode { get; set; }
/// <summary>
/// 推荐来源仓库
/// </summary>
public string RecommendFromWarehouseCode { get; set; }
/// <summary>
/// 推荐来源数量
/// </summary>
public decimal RecommendFromQty { get; set; }
#endregion
#region 推荐目标
/// <summary>
/// 推荐目标托标签
/// </summary>
public string RecommendToContainerCode { get; set; }
/// <summary>
/// 推荐目标箱标签
/// </summary>
public string RecommendToPackingCode { get; set; }
/// <summary>
/// 推荐目标批次供应商批次
/// </summary>
public string RecommendToSupplierBatch { get; set; }
/// <summary>
/// 推荐目标批次到货时间
/// </summary>
public DateTime RecommendToArriveDate { get; set; }
/// <summary>
/// 推荐目标批次生产时间
/// </summary>
public DateTime RecommendToProduceDate { get; set; }
/// <summary>
/// 推荐目标批次过期时间
/// </summary>
public DateTime RecommendToExpireDate { get; set; }
/// <summary>
/// 推荐目标批次排序
/// </summary>
public string RecommendToLot { get; set; }
/// <summary>
/// 推荐目标库位
/// </summary>
public string RecommendToLocationCode { get; set; }
/// <summary>
/// 推荐目标库区
/// </summary>
public string RecommendToLocationArea { get; set; }
/// <summary>
/// 推荐目标库位组
/// </summary>
public string RecommendToLocationGroup { get; set; }
/// <summary>
/// 推荐目标ERP库位
/// </summary>
public string RecommendToLocationErpCode { get; set; }
/// <summary>
/// 推荐目标仓库
/// </summary>
public string RecommendToWarehouseCode { get; set; }
/// <summary>
/// 推荐目标数量
/// </summary>
public decimal RecommendToQty { get; set; }
#endregion
#region 开关
//箱码
public bool CheckPackingCodeFrom { get; set; }
public bool IsPackingCodeFrom { get; set; }
public bool IsPackingCodeTo { get; set; }
public bool CheckPackingCodeTo { get; set; }
//批次
public bool CheckLotFrom { get; set; }
public bool IsLotFrom { get; set; }
public bool IsLotTo { get; set; }
public bool CheckLotTo { get; set; }
//零件号
public bool CheckItemCodeFrom { get; set; }
public bool IsItemCodeFrom { get; set; }
public bool IsItemCodeTo { get; set; }
public bool CheckItemCodeTo { get; set; }
//状态
public bool CheckStatusFrom { get; set; }
public bool IsStatusFrom { get; set; }
public bool IsStatusTo { get; set; }
public bool CheckStatusTo { get; set; }
//库位
public bool CheckLocationCodeFrom { get; set; }
public bool IsLocationCodeFrom { get; set; }
public bool CheckLocationCodeTo { get; set; }
public bool IsLocationCodeTo { get; set; }
//库位组
public bool CheckLocationGroupFrom { get; set; }
public bool IsLocationGroupFrom { get; set; }
public bool CheckLocationGroupTo { get; set; }
public bool IsLocationGroupTo { get; set; }
//区域
public bool CheckLocationAreaFrom { get; set; }
public bool IsLocationAreaFrom { get; set; }
public bool CheckLocationAreaTo { get; set; }
public bool IsLocationAreaTo { get; set; }
//储位
public bool CheckLocationErpCodeFrom { get; set; }
public bool IsLocationErpCodeFrom { get; set; }
public bool IsLocationErpCodeTo { get; set; }
public bool CheckLocationErpCodeTo { get; set; }
//数量
public bool CheckQtyFrom { get; set; }
public bool IsQtyFrom { get; set; }
public bool CheckQtyTo { get; set; }
public bool IsQtyTo { get; set; }
#endregion
}

27
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionJobs/InjectionJobAppService.cs

@ -41,12 +41,7 @@ public class InjectionJobAppService
_transferLibJobAppService = transferLibJobAppService;
}
/// <summary>
/// 批量创建
/// </summary>
/// <param name="inputs"></param>
/// <returns></returns>
[HttpPost("create-many")]
[HttpPost("add-many")]
public override async Task<List<InjectionJobDTO>> CreateManyAsync(List<InjectionJobEditInput> inputs)
{
foreach (var input in inputs)
@ -57,11 +52,6 @@ public class InjectionJobAppService
return await base.CreateManyAsync(inputs).ConfigureAwait(false);
}
/// <summary>
/// 创建
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("")]
public override async Task<InjectionJobDTO> CreateAsync(InjectionJobEditInput input)
{
@ -82,8 +72,10 @@ public class InjectionJobAppService
var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode)
.ConfigureAwait(false);
if (loctionDto.RowCode == 1)
if (loctionDto.RowCode != 1)
{
input.JobStatus = EnumJobStatus.Wait;
jobDetailInputdetail.TransferLibFromArriveDate = jobDetailInputdetail.RecommendFromArriveDate;
jobDetailInputdetail.TransferLibFromContainerCode = jobDetailInputdetail.RecommendFromContainerCode;
jobDetailInputdetail.TransferLibFromExpireDate = jobDetailInputdetail.RecommendFromExpireDate;
@ -112,10 +104,6 @@ public class InjectionJobAppService
jobDetailInputdetail.TransferLibToSupplierBatch = jobDetailInputdetail.RecommendToSupplierBatch;
jobDetailInputdetail.TransferLibToWarehouseCode = jobDetailInputdetail.RecommendToWarehouseCode;
}
else
{
input.JobStatus = EnumJobStatus.Wait;
}
}
[HttpPost("cancel-by-request/{injectionNumber}")]
@ -149,8 +137,8 @@ public class InjectionJobAppService
return ObjectMapper.Map<List<InjectionJob>, List<InjectionJobDTO>>(entitys);
}
[HttpPost("do-call-back")]
public async Task<Tuple<bool?, string>> DoTransferLibCallbackAsync(string businessType, string requestNum, string jobNum)
[HttpPost("Do-Call-Back")]
public async Task<TransferLibJobDTO> DoTransferLibCallbackAsync(string businessType, string requestNum, string jobNum)
{
var job = await _repository.FindAsync(p => p.Number == jobNum).ConfigureAwait(false);
@ -193,7 +181,8 @@ public class InjectionJobAppService
await _repository.UpdateAsync(job).ConfigureAwait(false);
return new Tuple<bool?, string>(true,"s");
//return new Tuple<bool?, string>(true,"s");
return new TransferLibJobDTO();
}
[HttpPost("test")]

9
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs

@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp;
using Volo.Abp.Uow;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
@ -33,6 +34,8 @@ public class TransferLibJobAppService
/// <param name="id"></param>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("handle/{id}")]
[UnitOfWork]
public override async Task<TransferLibJobDTO> CompleteAsync(Guid id, TransferLibJobDTO dto)
{
//var str = "Win_in.Sfs.Wms.Store.Application.InjectionJobAppService";
@ -72,10 +75,10 @@ public class TransferLibJobAppService
{
throw new UserFriendlyException($"{methodPrefix}类型为{dto.CallServerName}的对象没有实现ITransferLibCallback接口");
}
Tuple<bool?, string> callbackRet = await transferLibCallback.DoTransferLibCallbackAsync(dto.CallServerName, dto.CallRequestNumber, dto.CallJobNumber);
if (callbackRet != null && callbackRet.Item1 == false)
TransferLibJobDTO callbackRet = await transferLibCallback.DoTransferLibCallbackAsync(dto.CallServerName, dto.CallRequestNumber, dto.CallJobNumber).ConfigureAwait(false);
if (callbackRet == null || callbackRet.Number == null)
{
throw new UserFriendlyException($"{methodPrefix}执行回调服务{dto.CallServerName}出错,返回错误信息:{callbackRet.Item2}");
throw new UserFriendlyException($"{methodPrefix}执行回调服务{dto.CallServerName}出错,返回实体为空!");
}
//var assembly = Assembly.GetExecutingAssembly();
//var ty = assembly.GetType(dto.CallServerName);

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.Application/Notes/TransferLibNotes/ITransferLibCallback.cs

@ -4,11 +4,12 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts;
namespace Win_in.Sfs.Wms.Store.Notes;
public interface ITransferLibCallback
{
Task<Tuple<bool?, string>> DoTransferLibCallbackAsync(string businessType, string requestNum, string jobNum);
Task<TransferLibJobDTO> DoTransferLibCallbackAsync(string businessType, string requestNum, string jobNum);
}
public class TestTransferLibCallback : ITransferLibCallback
@ -17,10 +18,9 @@ public class TestTransferLibCallback : ITransferLibCallback
{
}
public async Task<Tuple<bool?, string>> DoTransferLibCallbackAsync(string businessType, string requestNum,
public async Task<TransferLibJobDTO> DoTransferLibCallbackAsync(string businessType, string requestNum,
string jobNum)
{
return Tuple.Create<bool?, string>(true, "调用新移库回调方法成功!");
return new TransferLibJobDTO();
}
}

33
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAppService.cs

@ -15,6 +15,7 @@ using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Basedata.Application;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
@ -39,7 +40,8 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
private readonly ILocationAppService _locationAppService;
private readonly IItemBasicAppService _itemBasicAppService;
private readonly IProductionLineAppService _productionLineAppService;
private readonly IInjectionJobAppService _issueJobAppService;
private readonly IInjectionJobAppService _injectionJobAppService;
private readonly ITransactionTypeAppService _transactionTypeAppService;
public InjectionRequestAppService(
IInjectionRequestRepository repository,
@ -50,7 +52,8 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
ILocationAppService locationAppService,
IItemBasicAppService itemBasicAppService,
IProductionLineAppService productionLineAppService,
IInjectionJobAppService issueJobAppService)
ITransactionTypeAppService transactionTypeAppService,
IInjectionJobAppService injectionJobAppService)
: base(repository, injectionRequestManager)
{
_injectionRequestManager = injectionRequestManager;
@ -59,7 +62,8 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
_locationAppService = locationAppService;
_itemBasicAppService = itemBasicAppService;
_productionLineAppService = productionLineAppService;
_issueJobAppService = issueJobAppService;
_injectionJobAppService = injectionJobAppService;
_transactionTypeAppService = transactionTypeAppService;
}
@ -101,12 +105,7 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
detailInput.IssuedQty = 0;
}
input.AutoSubmit = true;
input.AutoAgree = true;
input.AutoHandle = true;
input.AutoCompleteJob = false;
input.DirectCreateNote = false;
await SetRequestAutoPropertiesAsync(input).ConfigureAwait(false);
var entity = ObjectMapper.Map<InjectionRequestEditInput, InjectionRequest>(input);
var result = await _injectionRequestManager.CreateByNumberAsync(entity).ConfigureAwait(false);
@ -116,6 +115,22 @@ public class InjectionRequestAppService : SfsStoreRequestAppServiceBase<Injectio
return dto;
}
/// <summary>
/// 赋值Request业务属性
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
private async Task SetRequestAutoPropertiesAsync(InjectionRequestEditInput entity)
{
var tranType = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false);
Check.NotNull(tranType, "事务类型", "事务类型不存在");
entity.AutoSubmit = tranType.AutoSubmitRequest;
entity.AutoAgree = tranType.AutoAgreeRequest;
entity.AutoHandle = tranType.AutoHandleRequest;
entity.AutoCompleteJob = tranType.AutoCompleteJob;
entity.DirectCreateNote = tranType.DirectCreateNote;
}
[HttpPost("create-and-handle")]
public async Task<InjectionRequestDTO> CreateAndHandleAsync(InjectionRequestEditInput input)
{

16
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferLibRequests/TransferLibRequestAppService.cs

@ -319,14 +319,14 @@ public class TransferLibRequestAppService : SfsStoreRequestAppServiceBase
var entity = ObjectMapper.Map<TransferLibRequestEditInput, TransferLibRequest>(input);
var subType = Enum.Parse<EnumTransSubType>(input.Type);
//var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.TransferLib, subType)
// .ConfigureAwait(false);
//entity.Type = ((int)subType).ToString();
//entity.AutoCompleteJob = tranType.AutoCompleteJob;
//entity.AutoSubmit = tranType.AutoSubmitRequest;
//entity.AutoAgree = tranType.AutoAgreeRequest;
//entity.AutoHandle = tranType.AutoHandleRequest;
//entity.DirectCreateNote = tranType.DirectCreateNote;
var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.TransferLib, subType)
.ConfigureAwait(false);
entity.Type = ((int)subType).ToString();
entity.AutoCompleteJob = tranType.AutoCompleteJob;
entity.AutoSubmit = tranType.AutoSubmitRequest;
entity.AutoAgree = tranType.AutoAgreeRequest;
entity.AutoHandle = tranType.AutoHandleRequest;
entity.DirectCreateNote = tranType.DirectCreateNote;
await _transferLibRequestManager.CreateAsync(entity).ConfigureAwait(false);

197
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/NewRecommendHandled/NewRecommendFromTo.cs

@ -1,197 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Domain;
public class NewRecommendFromTo : SfsStoreDetailEntityBase//SfsDetailEntityBase
{
#region 库存基础信息
/*
/// <summary>
/// 物品代码
/// </summary>
public string ItemCode { get; set; }
/// <summary>
/// 物品名称
/// </summary>
public string ItemName { get; set; }
/// <summary>
/// 物品描述1
/// </summary>
public string ItemDesc1 { get; set; }
/// <summary>
/// 物品描述2
/// </summary>
public string ItemDesc2 { get; set; }
*/
/// <summary>
/// 标包数量
/// </summary>
[Display(Name = "标包数量")]
[Column(TypeName = "decimal(18,6)")]
public decimal StdPackQty { get; set; }
/// <summary>
/// 库存状态
/// </summary>
public EnumInventoryStatus Status { get; set; }
/// <summary>
/// 计量单位
/// </summary>
public string Uom { get; set; }
#endregion
#region 推荐来源
/// <summary>
/// 推荐来源托标签
/// </summary>
public string RecommendFromContainerCode { get; set; }
/// <summary>
/// 推荐来源箱标签
/// </summary>
public string RecommendFromPackingCode { get; set; }
/// <summary>
/// 推荐来源批次供应商批次
/// </summary>
public string RecommendFromSupplierBatch { get; set; }
/// <summary>
/// 推荐来源批次到货时间
/// </summary>
public DateTime RecommendFromArriveDate { get; set; }
/// <summary>
/// 推荐来源批次生产时间
/// </summary>
public DateTime RecommendFromProduceDate { get; set; }
/// <summary>
/// 推荐来源批次过期时间
/// </summary>
public DateTime RecommendFromExpireDate { get; set; }
/// <summary>
/// 推荐来源批次排序
/// </summary>
public string RecommendFromLot { get; set; }
/// <summary>
/// 推荐来源库位
/// </summary>
public string RecommendFromLocationCode { get; set; }
/// <summary>
/// 推荐来源库区
/// </summary>
public string RecommendFromLocationArea { get; set; }
/// <summary>
/// 推荐来源库位组
/// </summary>
public string RecommendFromLocationGroup { get; set; }
/// <summary>
/// 推荐来源ERP库位
/// </summary>
public string RecommendFromLocationErpCode { get; set; }
/// <summary>
/// 推荐来源仓库
/// </summary>
public string RecommendFromWarehouseCode { get; set; }
/// <summary>
/// 推荐来源数量
/// </summary>
public decimal RecommendFromQty { get; set; }
#endregion
#region 推荐目标
/// <summary>
/// 推荐目标托标签
/// </summary>
public string RecommendToContainerCode { get; set; }
/// <summary>
/// 推荐目标箱标签
/// </summary>
public string RecommendToPackingCode { get; set; }
/// <summary>
/// 推荐目标批次供应商批次
/// </summary>
public string RecommendToSupplierBatch { get; set; }
/// <summary>
/// 推荐目标批次到货时间
/// </summary>
public DateTime RecommendToArriveDate { get; set; }
/// <summary>
/// 推荐目标批次生产时间
/// </summary>
public DateTime RecommendToProduceDate { get; set; }
/// <summary>
/// 推荐目标批次过期时间
/// </summary>
public DateTime RecommendToExpireDate { get; set; }
/// <summary>
/// 推荐目标批次排序
/// </summary>
public string RecommendToLot { get; set; }
/// <summary>
/// 推荐目标库位
/// </summary>
public string RecommendToLocationCode { get; set; }
/// <summary>
/// 推荐目标库区
/// </summary>
public string RecommendToLocationArea { get; set; }
/// <summary>
/// 推荐目标库位组
/// </summary>
public string RecommendToLocationGroup { get; set; }
/// <summary>
/// 推荐目标ERP库位
/// </summary>
public string RecommendToLocationErpCode { get; set; }
/// <summary>
/// 推荐目标仓库
/// </summary>
public string RecommendToWarehouseCode { get; set; }
/// <summary>
/// 推荐目标数量
/// </summary>
public decimal RecommendToQty { get; set; }
#endregion
public void SetId(Guid id)
{
this.Id = id;
}
}

148
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/NewRecommendHandled/NewRecommendHandledFromTo.cs

@ -1,148 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Win_in.Sfs.Wms.Store.Domain;
public class NewRecommendHandledFromTo : NewRecommendFromTo
{
#region 实际来源
/// <summary>
/// 实际目标托标签
/// </summary>
public string HandledFromContainerCode { get; set; }
/// <summary>
/// 实际箱标签
/// </summary>
public string HandledFromPackingCode { get; set; }
/// <summary>
/// 实际批次供应商批次
/// </summary>
public string HandledFromSupplierBatch { get; set; }
/// <summary>
/// 实际批次到货时间
/// </summary>
public DateTime HandledFromArriveDate { get; set; }
/// <summary>
/// 实际批次生产时间
/// </summary>
public DateTime HandledFromProduceDate { get; set; }
/// <summary>
/// 实际批次过期时间
/// </summary>
public DateTime HandledFromExpireDate { get; set; }
/// <summary>
/// 实际批次排序
/// </summary>
public string HandledFromLot { get; set; }
/// <summary>
/// 实际库位
/// </summary>
public string HandledFromLocationCode { get; set; }
/// <summary>
/// 实际库区
/// </summary>
public string HandledFromLocationArea { get; set; }
/// <summary>
/// 实际库位组
/// </summary>
public string HandledFromLocationGroup { get; set; }
/// <summary>
/// 实际ERP库位
/// </summary>
public string HandledFromLocationErpCode { get; set; }
/// <summary>
/// 实际仓库
/// </summary>
public string HandledFromWarehouseCode { get; set; }
/// <summary>
/// 实际数量
/// </summary>
public decimal HandledFromQty { get; set; }
#endregion
#region 实际目标
/// <summary>
/// 实际目标托标签
/// </summary>
public string HandledToContainerCode { get; set; }
/// <summary>
/// 实际箱标签
/// </summary>
public string HandledToPackingCode { get; set; }
/// <summary>
/// 实际批次供应商批次
/// </summary>
public string HandledToSupplierBatch { get; set; }
/// <summary>
/// 实际批次到货时间
/// </summary>
public DateTime HandledToArriveDate { get; set; }
/// <summary>
/// 实际批次生产时间
/// </summary>
public DateTime HandledToProduceDate { get; set; }
/// <summary>
/// 实际批次过期时间
/// </summary>
public DateTime HandledToExpireDate { get; set; }
/// <summary>
/// 实际批次排序
/// </summary>
public string HandledToLot { get; set; }
/// <summary>
/// 实际库位
/// </summary>
public string HandledToLocationCode { get; set; }
/// <summary>
/// 实际库区
/// </summary>
public string HandledToLocationArea { get; set; }
/// <summary>
/// 实际库位组
/// </summary>
public string HandledToLocationGroup { get; set; }
/// <summary>
/// 实际ERP库位
/// </summary>
public string HandledToLocationErpCode { get; set; }
/// <summary>
/// 实际仓库
/// </summary>
public string HandledToWarehouseCode { get; set; }
/// <summary>
/// 实际数量
/// </summary>
public decimal HandledToQty { get; set; }
#endregion
}

49
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionJobs/InjectionJobManager.cs

@ -4,19 +4,24 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Users;
using Volo.Abp.Validation;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
namespace Win_in.Sfs.Wms.Store.Domain;
public class InjectionJobManager : SfsJobManagerBase<InjectionJob, InjectionJobDetail>, IInjectionJobManager
{
private readonly IBalanceAppService _balanceAppService;
private readonly IExpectOutAppService _expectOutAppService;
public InjectionJobManager(
IInjectionJobRepository repository
) : base(repository)
IInjectionJobRepository repository, IBalanceAppService balanceAppService, IExpectOutAppService expectOutAppService) : base(repository)
{
_balanceAppService = balanceAppService;
_expectOutAppService = expectOutAppService;
}
/// <summary>
@ -33,6 +38,28 @@ public class InjectionJobManager : SfsJobManagerBase<InjectionJob, InjectionJobD
var inputDetail = input.Details.First();
var detail = entity.Details.First();
var expectOutDtos = await _expectOutAppService.GetListByItemCodeAndStatusAndPackingCodeAsync(detail.ItemCode, detail.HandledFromLocationCode, detail.HandledFromPackingCode, detail.Status, detail.HandledFromLot).ConfigureAwait(false);
if (expectOutDtos.Any())
{
throw new UserFriendlyException($" 箱码:{detail.HandledFromPackingCode}," +
$" 物品代码:{detail.ItemCode}," +
$" 库位代码:{detail.HandledFromLocationCode}," +
$" 状态:{detail.Status}," +
$" 批次:{detail.HandledFromLot}" +
$" 的库存被占用【预计出】");
}
var balanceDto=await _balanceAppService.GetRealQtyByPackingCodeAndItemCodeAndLocationCodeAndStatusAsync(detail.HandledFromPackingCode,detail.ItemCode,detail.HandledFromLocationCode,detail.Status,detail.HandledFromLot).ConfigureAwait(false);
if (balanceDto.Qty <= 0)
{
throw new UserFriendlyException($" 箱码:{detail.HandledFromPackingCode}," +
$" 物品代码:{detail.ItemCode}," +
$" 库位代码:{detail.HandledFromLocationCode}," +
$" 状态:{detail.Status}," +
$" 批次:{detail.HandledFromLot}" +
$" 的可用库存不大于0,现在为{balanceDto.Qty},请检查【库存数量】和【预计出】");
}
detail.HandledFromArriveDate = inputDetail.HandledFromArriveDate;
detail.HandledFromContainerCode = inputDetail.HandledFromContainerCode;
detail.HandledFromExpireDate = inputDetail.HandledFromExpireDate;
@ -68,19 +95,6 @@ public class InjectionJobManager : SfsJobManagerBase<InjectionJob, InjectionJobD
return await base.CompleteAsync(entity, user).ConfigureAwait(false);
}
public override void CheckDetails(InjectionJob entity, AbpValidationResult result)
{
var details = entity.Details;
foreach (var detail in details)
{
if (detail.HandledFromLocationCode == null)
{
result.Errors.Add(new ValidationResult($"{detail.HandledFromLocationCode} 不能为空"));
}
}
}
public async Task<InjectionJob> GetAsync(Expression<Func<InjectionJob, bool>> expression)
{
return await Repository.FindAsync(expression).ConfigureAwait(false);
@ -98,5 +112,10 @@ public class InjectionJobManager : SfsJobManagerBase<InjectionJob, InjectionJobD
throw new NotImplementedException();
}
public override void CheckDetails(InjectionJob entity, AbpValidationResult result)
{
throw new NotImplementedException();
}
#endregion
}

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/TransferLibJobs/TransferLibJobDetail.cs

@ -1,6 +1,7 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Domain;
@ -8,7 +9,7 @@ namespace Win_in.Sfs.Wms.Store.Domain;
/// <summary>
/// //??TransferLib实体
/// </summary>
public class TransferLibJobDetail : SfsStoreDetailEntityBase
public class TransferLibJobDetail : SfsDetailEntityBase
{
/// <summary>
/// 原因

8
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferLibNotes/TransferLibNoteDetail.cs

@ -49,22 +49,22 @@ public class TransferLibNoteDetail : SfsStoreDetailEntityBase
/// <summary>
/// 物品代码
/// </summary>
public string ItemCode { get; set; }
public new string ItemCode { get; set; }
/// <summary>
/// 物品名称
/// </summary>
public string ItemName { get; set; }
public new string ItemName { get; set; }
/// <summary>
/// 物品描述1
/// </summary>
public string ItemDesc1 { get; set; }
public new string ItemDesc1 { get; set; }
/// <summary>
/// 物品描述2
/// </summary>
public string ItemDesc2 { get; set; }
public new string ItemDesc2 { get; set; }
/// <summary>
/// 标包数量

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/InjectionRequests/InjectionRequestDetail.cs

@ -45,11 +45,7 @@ public class InjectionRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasToLoc
public string ToWarehouseCode { get; set; }
#endregion
// /// <summary>
// /// 在途库库位
// /// </summary>
// public string OnTheWayLocationCode { get; set; }
/// <summary>
/// 生产线

283
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/TransferLibRequests/TransferLibRequestDetail.cs

@ -1,4 +1,8 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.Domain;
@ -6,7 +10,7 @@ namespace Win_in.Sfs.Wms.Store.Domain;
/// <summary>
/// //??TransferLib实体
/// </summary>
public class TransferLibRequestDetail : NewRecommendFromTo
public class TransferLibRequestDetail : SfsStoreDetailEntityBase
{
/// <summary>
/// 原因代码
@ -44,46 +48,285 @@ public class TransferLibRequestDetail : NewRecommendFromTo
public string CallJobNumber { get; set; }
#endregion
#region 校验
#region 库存基础信息
/// <summary>
/// 物品代码
/// </summary>
public new string ItemCode { get; set; }
/// <summary>
/// 物品名称
/// </summary>
public new string ItemName { get; set; }
/// <summary>
/// 物品描述1
/// </summary>
public new string ItemDesc1 { get; set; }
/// <summary>
/// 物品描述2
/// </summary>
public new string ItemDesc2 { get; set; }
/// <summary>
/// 标包数量
/// </summary>
[Display(Name = "标包数量")]
[Column(TypeName = "decimal(18,6)")]
public decimal StdPackQty { get; set; }
/// <summary>
/// 库存状态
/// </summary>
public EnumInventoryStatus Status { get; set; }
/// <summary>
/// 计量单位
/// </summary>
public string Uom { get; set; }
#endregion
#region 请求信息
/// <summary>
/// 请求库位
/// </summary>
public string RequestLocationCode { get; set; }
/// <summary>
/// 到库区
/// </summary>
public string RequestLocationArea { get; set; }
/// <summary>
/// 到库位组
/// </summary>
public string RequestLocationGroup { get; set; }
/// <summary>
/// 到ERP库位
/// </summary>
public string RequestLocationErpCode { get; set; }
/// <summary>
/// 到仓库
/// </summary>
public string RequestWarehouseCode { get; set; }
/// <summary>
/// 在途库库位
/// </summary>
public string OnTheWayLocationCode { get; set; }
/// <summary>
/// 生产线
/// </summary>
public string ProdLine { get; set; }
/// <summary>
/// 位置码
/// </summary>
public string PositionCode { get; set; }
/// <summary>
/// 推荐的类型
/// </summary>
public EnumRecommendType RecommendType { get; set; }
/// <summary>
/// 需求数量
/// </summary>
public decimal RequestQty { get; set; }
#endregion
#region 推荐来源
/// <summary>
/// 推荐来源托标签
/// </summary>
public string RecommendFromContainerCode { get; set; }
/// <summary>
/// 推荐来源箱标签
/// </summary>
public string RecommendFromPackingCode { get; set; }
/// <summary>
/// 推荐来源批次供应商批次
/// </summary>
public string RecommendFromSupplierBatch { get; set; }
/// <summary>
/// 推荐来源批次到货时间
/// </summary>
public DateTime RecommendFromArriveDate { get; set; }
/// <summary>
/// 推荐来源批次生产时间
/// </summary>
public DateTime RecommendFromProduceDate { get; set; }
/// <summary>
/// 推荐来源批次过期时间
/// </summary>
public DateTime RecommendFromExpireDate { get; set; }
/// <summary>
/// 推荐来源批次排序
/// </summary>
public string RecommendFromLot { get; set; }
/// <summary>
/// 推荐来源库位
/// </summary>
public string RecommendFromLocationCode { get; set; }
/// <summary>
/// 推荐来源库区
/// </summary>
public string RecommendFromLocationArea { get; set; }
/// <summary>
/// 推荐来源库位组
/// </summary>
public string RecommendFromLocationGroup { get; set; }
/// <summary>
/// 推荐来源ERP库位
/// </summary>
public string RecommendFromLocationErpCode { get; set; }
/// <summary>
/// 推荐来源仓库
/// </summary>
public string RecommendFromWarehouseCode { get; set; }
/// <summary>
/// 推荐来源数量
/// </summary>
public decimal RecommendFromQty { get; set; }
#endregion
#region 推荐目标
/// <summary>
/// 推荐目标托标签
/// </summary>
public string RecommendToContainerCode { get; set; }
/// <summary>
/// 推荐目标箱标签
/// </summary>
public string RecommendToPackingCode { get; set; }
/// <summary>
/// 推荐目标批次供应商批次
/// </summary>
public string RecommendToSupplierBatch { get; set; }
/// <summary>
/// 推荐目标批次到货时间
/// </summary>
public DateTime RecommendToArriveDate { get; set; }
/// <summary>
/// 推荐目标批次生产时间
/// </summary>
public DateTime RecommendToProduceDate { get; set; }
/// <summary>
/// 推荐目标批次过期时间
/// </summary>
public DateTime RecommendToExpireDate { get; set; }
/// <summary>
/// 推荐目标批次排序
/// </summary>
public string RecommendToLot { get; set; }
/// <summary>
/// 推荐目标库位
/// </summary>
public string RecommendToLocationCode { get; set; }
/// <summary>
/// 推荐目标库区
/// </summary>
public string RecommendToLocationArea { get; set; }
/// <summary>
/// 推荐目标库位组
/// </summary>
public string RecommendToLocationGroup { get; set; }
/// <summary>
/// 推荐目标ERP库位
/// </summary>
public string RecommendToLocationErpCode { get; set; }
/// <summary>
/// 推荐目标仓库
/// </summary>
public string RecommendToWarehouseCode { get; set; }
/// <summary>
/// 推荐目标数量
/// </summary>
public decimal RecommendToQty { get; set; }
#endregion
#region 开关
//箱码
public bool CheckPackingCodeFrom { get; set; }
public bool IsPackingCodeFrom { get; set; }
public bool IsPackingCodeTo { get; set; }
public bool CheckPackingCodeTo { get; set; }
//批次
public bool CheckLotFrom { get; set; }
public bool IsLotFrom { get; set; }
public bool IsLotTo { get; set; }
public bool CheckLotTo { get; set; }
//零件号
public bool CheckItemCodeFrom { get; set; }
public bool IsItemCodeFrom { get; set; }
public bool IsItemCodeTo { get; set; }
public bool CheckItemCodeTo { get; set; }
//状态
public bool CheckStatusFrom { get; set; }
public bool IsStatusFrom { get; set; }
public bool IsStatusTo { get; set; }
public bool CheckStatusTo { get; set; }
//库位
public bool CheckLocationCodeFrom { get; set; }
public bool IsLocationCodeFrom { get; set; }
public bool CheckLocationCodeTo { get; set; }
public bool IsLocationCodeTo { get; set; }
//库位组
public bool CheckLocationGroupFrom { get; set; }
public bool IsLocationGroupFrom { get; set; }
public bool CheckLocationGroupTo { get; set; }
public bool IsLocationGroupTo { get; set; }
//区域
public bool CheckLocationAreaFrom { get; set; }
public bool IsLocationAreaFrom { get; set; }
public bool CheckLocationAreaTo { get; set; }
public bool IsLocationAreaTo { get; set; }
//储位
public bool CheckLocationErpCodeFrom { get; set; }
public bool IsLocationErpCodeFrom { get; set; }
public bool IsLocationErpCodeTo { get; set; }
public bool CheckLocationErpCodeTo { get; set; }
//数量
public bool CheckQtyFrom { get; set; }
public bool IsQtyFrom { get; set; }
public bool CheckQtyTo { get; set; }
public bool IsQtyTo { get; set; }
#endregion

62
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/TransferLibJobs/TransferLibJobDbContextModelCreatingExtensions.cs

@ -41,6 +41,68 @@ public static class TransferLibJobDbContextModelCreatingExtensions
//Configure Job base properties
//b.ConfigureJobRecommendFromDetail();
//Properties
b.Property(q => q.Reason).HasMaxLength(SfsPropertyConst.CodeLength);
//b.Property(q => q.Status).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
b.Property(q => q.ItemCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.ItemName).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.ItemDesc1).HasMaxLength(SfsPropertyConst.DescLength);
b.Property(q => q.ItemDesc2).HasMaxLength(SfsPropertyConst.DescLength);
b.Property(q => q.CallServerName).HasMaxLength(SfsPropertyConst.TitleLength);
b.Property(q => q.CallBusinessType).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.CallRequestNumber).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.CallJobNumber).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.Uom).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RequestLocationCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RequestLocationArea).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RequestLocationGroup).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RequestLocationErpCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RequestWarehouseCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.OnTheWayLocationCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.PositionCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledFromContainerCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledFromLocationArea).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledFromLocationCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledFromLocationErpCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledFromLocationGroup).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledFromLot).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledFromPackingCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledFromSupplierBatch).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledFromWarehouseCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledToContainerCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledToLocationArea).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledToLocationCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledToLocationErpCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledToLocationGroup).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledToLot).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledToPackingCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledToSupplierBatch).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledToWarehouseCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromContainerCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromLocationArea).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromLocationCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromLocationErpCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromLocationGroup).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromLot).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromPackingCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromSupplierBatch).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromWarehouseCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToContainerCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToLocationArea).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToLocationCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToLocationErpCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToLocationGroup).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToLot).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToPackingCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToSupplierBatch).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToWarehouseCode).HasMaxLength(SfsPropertyConst.NameLength);
//Relations
//None

30131
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240415063138_transferLibV2222.Designer.cs

File diff suppressed because it is too large

6132
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20240415063138_transferLibV2222.cs

File diff suppressed because it is too large

1037
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/StoreDbContextModelSnapshot.cs

File diff suppressed because it is too large

66
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/TransferLibNotes/TransferLibNoteDbContextModelCreatingExtensions.cs

@ -38,15 +38,75 @@ public static class TransferLibNoteDbContextModelCreatingExtensions
//Configure Sfs store detail properties
b.ConfigureSfsStoreDetailBase();
//Properties
b.Property(q => q.Reason).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.Status).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
b.Property(q => q.Status).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
//b.Property(q => q.Status).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
b.Property(q => q.ItemCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.ItemName).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.ItemDesc1).HasMaxLength(SfsPropertyConst.DescLength);
b.Property(q => q.ItemDesc2).HasMaxLength(SfsPropertyConst.DescLength);
b.Property(q => q.CallServerName).HasMaxLength(SfsPropertyConst.TitleLength);
b.Property(q => q.CallBusinessType).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.CallRequestNumber).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.CallJobNumber).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.Uom).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RequestLocationCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RequestLocationArea).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RequestLocationGroup).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RequestLocationErpCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RequestWarehouseCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.OnTheWayLocationCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.PositionCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledFromContainerCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledFromLocationArea).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledFromLocationCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledFromLocationErpCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledFromLocationGroup).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledFromLot).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledFromPackingCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledFromSupplierBatch).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledFromWarehouseCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledToContainerCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledToLocationArea).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledToLocationCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledToLocationErpCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledToLocationGroup).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledToLot).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledToPackingCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledToSupplierBatch).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.HandledToWarehouseCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromContainerCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromLocationArea).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromLocationCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromLocationErpCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromLocationGroup).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromLot).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromPackingCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromSupplierBatch).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromWarehouseCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToContainerCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToLocationArea).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToLocationCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToLocationErpCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToLocationGroup).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToLot).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToPackingCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToSupplierBatch).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToWarehouseCode).HasMaxLength(SfsPropertyConst.NameLength);
//Relations
//Indexes
b.HasIndex(q => new { q.Number, q.HandledFromPackingCode, q.HandledFromLocationCode, q.HandledToLocationCode, q.Status }).IsUnique();
b.HasIndex(q => new { q.Number }).IsUnique();
});
}
}

43
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/TransferLibRequests/TransferLibRequestDbContextModelCreatingExtensions.cs

@ -40,9 +40,48 @@ public static class TransferLibRequestDbContextModelCreatingExtensions
b.ConfigureSfsStoreDetailBase();
//Properties
//b.Property(q => q.FromStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
//b.Property(q => q.ToStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
b.Property(q => q.Reason).HasMaxLength(SfsPropertyConst.DescLength);
//b.Property(q => q.Status).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>();
b.Property(q => q.ItemCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.ItemName).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.ItemDesc1).HasMaxLength(SfsPropertyConst.DescLength);
b.Property(q => q.ItemDesc2).HasMaxLength(SfsPropertyConst.DescLength);
b.Property(q => q.CallServerName).HasMaxLength(SfsPropertyConst.TitleLength);
b.Property(q => q.CallBusinessType).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.CallRequestNumber).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.CallJobNumber).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.Uom).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RequestLocationCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RequestLocationArea).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RequestLocationGroup).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RequestLocationErpCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RequestWarehouseCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.OnTheWayLocationCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.PositionCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromContainerCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromLocationArea).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromLocationCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromLocationErpCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromLocationGroup).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromLot).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromPackingCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromSupplierBatch).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendFromWarehouseCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToContainerCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToLocationArea).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToLocationCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToLocationErpCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToLocationGroup).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToLot).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToPackingCode).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToSupplierBatch).HasMaxLength(SfsPropertyConst.NameLength);
b.Property(q => q.RecommendToWarehouseCode).HasMaxLength(SfsPropertyConst.NameLength);
//Relations
//Indexes

46
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/TransferLibRequestAutoMapperProfile.cs

@ -9,6 +9,50 @@ public partial class StoreEventAutoMapperProfile : Profile
{
private void TransferLibRequestAutoMapperProfile()
{
CreateMap<TransferLibRequest, TransferLibNote>()
.IgnoreAuditedObjectProperties()
.ForMember(x => x.RequestNumber, y => y.MapFrom(d => d.Number))
.ForMember(x => x.Confirmed, y => y.MapFrom(d => !d.UseOnTheWayLocation))
.Ignore(x => x.ConfirmTime)
.Ignore(x => x.JobNumber)
.Ignore(x => x.Number)
.Ignore(x => x.Id);
CreateMap<TransferLibRequestDetail, TransferLibNoteDetail>(MemberList.None)
.Ignore(x => x.OnTheWayLocationCode);
CreateMap<TransferLibRequest, TransferLibJob>()
.IgnoreAuditedObjectProperties()
.ForMember(x => x.RequestNumber, y => y.MapFrom(d => d.Number))
.ForMember(x => x.Confirmed, y => y.MapFrom(d => !d.UseOnTheWayLocation))
.ForMember(dest => dest.Details, option => option.MapFrom(src => src.Details))
.Ignore(x => x.ConfirmTime)
.Ignore(x => x.JobNumber)
.Ignore(x => x.Number)
.Ignore(x => x.Id)
.Ignore(x => x.WarehouseCode)
//.Ignore(x => x.Details)
.Ignore(x => x.IsAutoComplete)
.Ignore(x => x.JobType)
.Ignore(x => x.JobDescription)
.Ignore(x => x.JobStatus)
.Ignore(x => x.WorkGroupCode)
.Ignore(x => x.Priority)
.Ignore(x => x.PriorityIncrement)
.Ignore(x => x.AcceptUserId)
.Ignore(x => x.AcceptUserName)
.Ignore(x => x.AcceptTime)
.Ignore(x => x.CompleteUserId)
.Ignore(x => x.CompleteUserName)
.Ignore(x => x.CompleteTime)
.Ignore(x => x.UpStreamJobNumber)
.BeforeMap((notice, input) => input.JobType = EnumJobType.Transfer)
.BeforeMap((notice, input) => input.JobStatus = EnumJobStatus.Open)
.BeforeMap((notice, input) => input.IsAutoComplete = false)
;
CreateMap<TransferLibRequestDetail, TransferLibJobDetail>(MemberList.None)
.Ignore(x => x.OnTheWayLocationCode)
;
}
}

5
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionRequestEventHandler.cs

@ -449,6 +449,11 @@ public class InjectionRequestEventHandler
{
var detail = new InjectionJobDetailInput();
detail.RequestLocationCode = injectionRequestDetail.ToLocationCode;
detail.RequestLocationGroup=injectionRequestDetail.ToLocationGroup;
detail.RequestLocationArea = injectionRequestDetail.ToLocationArea;
detail.RequestLocationErpCode = injectionRequestDetail.ToLocationErpCode;
detail.RequestWarehouseCode=injectionRequestDetail.ToWarehouseCode;
detail.PositionCode = injectionRequestDetail.PositionCode;
detail.RecommendType = injectionRequestDetail.RecommendType;
detail.ProdLine = injectionRequestDetail.ToLocationCode;

139
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferLibRequestEventHandler.cs

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Bibliography;
using Volo.Abp;
using Volo.Abp.EventBus;
using Volo.Abp.EventBus.Local;
using Volo.Abp.SettingManagement;
@ -56,9 +57,8 @@ public class TransferLibRequestEventHandler
if (entity.DirectCreateNote)
{
//todo 等云峰做完处理
var input = new TransferLibNote()
{ };
//todo 等云峰做完处理, lyf complete at 2024-04-15
var input = ObjectMapper.Map<TransferLibRequest, TransferLibNote>(entity);
//获取在途库
var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT)
@ -74,9 +74,9 @@ public class TransferLibRequestEventHandler
}
else
{
//todo 刘云峰
//var input = ObjectMapper.Map<TransferLibRequest, TransferLibJob>(entity);
var input = new TransferLibJob();
//todo 刘云峰 1. autoMapper映射 2 校验checkXX实现, 3 回调方法返回
var input = ObjectMapper.Map<TransferLibRequest, TransferLibJob>(entity);
//var input = new TransferLibJob();
//获取在途库
var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT)
@ -88,6 +88,133 @@ public class TransferLibRequestEventHandler
input.Details.ForEach(p => { p.OnTheWayLocationCode = locationDto.Code; });
//校验
foreach (var detailObj in input.Details)
{
if (detailObj.IsPackingCodeFrom)
{
if (detailObj.RecommendFromPackingCode != detailObj.HandledFromPackingCode)
{
throw new UserFriendlyException($"触发校验:推荐From箱码必须等于实际From箱码");
}
}
if (detailObj.IsPackingCodeTo)
{
if (detailObj.RecommendToPackingCode != detailObj.HandledToPackingCode)
{
throw new UserFriendlyException($"触发校验:推荐To箱码必须等于实际To箱码");
}
}
if (detailObj.IsLotFrom)
{
if (detailObj.RecommendFromLot != detailObj.HandledFromLot)
{
throw new UserFriendlyException($"触发校验:推荐From批次必须等于实际From批次");
}
}
if (detailObj.IsLotTo)
{
if (detailObj.RecommendToLot != detailObj.HandledToLot)
{
throw new UserFriendlyException($"触发校验:推荐To批次必须等于实际To批次");
}
}
//if (detailObj.IsItemCodeFrom)
//{
//}
//if (detailObj.IsItemCodeTo)
//{
//}
//if (detailObj.IsStatusFrom)
//{
//}
//if (detailObj.IsStatusTo)
//{
//}
if (detailObj.IsLocationCodeFrom)
{
if (detailObj.RecommendFromLocationCode != detailObj.HandledFromLocationCode)
{
throw new UserFriendlyException($"触发校验:推荐From库位必须等于实际From库位");
}
}
if (detailObj.IsLocationCodeTo)
{
if (detailObj.RecommendToLocationCode != detailObj.HandledToLocationCode)
{
throw new UserFriendlyException($"触发校验:推荐To库位必须等于实际To库位");
}
}
if (detailObj.IsLocationGroupFrom)
{
if (detailObj.RecommendFromLocationGroup != detailObj.HandledFromLocationGroup)
{
throw new UserFriendlyException($"触发校验:推荐From库位组必须等于实际From库位组");
}
}
if (detailObj.IsLocationGroupTo)
{
if (detailObj.RecommendToLocationGroup != detailObj.HandledToLocationGroup)
{
throw new UserFriendlyException($"触发校验:推荐To库位组必须等于实际To库位组");
}
}
if (detailObj.IsLocationAreaFrom)
{
if (detailObj.RecommendFromLocationArea != detailObj.HandledFromLocationArea)
{
throw new UserFriendlyException($"触发校验:推荐From库区必须等于实际From库区");
}
}
if (detailObj.IsLocationAreaTo)
{
if (detailObj.RecommendToLocationArea != detailObj.HandledToLocationArea)
{
throw new UserFriendlyException($"触发校验:推荐To库区必须等于实际To库区");
}
}
if (detailObj.IsLocationErpCodeFrom)
{
if (detailObj.RecommendFromLocationErpCode != detailObj.HandledFromLocationErpCode)
{
throw new UserFriendlyException($"触发校验:推荐From ERP库区必须等于实际From ERP库区");
}
}
if (detailObj.IsLocationErpCodeTo)
{
if (detailObj.RecommendToLocationErpCode != detailObj.HandledToLocationErpCode)
{
throw new UserFriendlyException($"触发校验:推荐To ERP库区必须等于实际To ERP库区");
}
}
if (detailObj.IsQtyFrom)
{
if (detailObj.RecommendFromQty != detailObj.HandledFromQty)
{
throw new UserFriendlyException($"触发校验:推荐From数量必须等于实际From数量");
}
}
if (detailObj.IsQtyTo)
{
if (detailObj.RecommendToQty != detailObj.HandledToQty)
{
throw new UserFriendlyException($"触发校验:推荐To数量必须等于实际To数量");
}
}
}
await _transferLibJobManager.AddAsync(input).ConfigureAwait(false);
}

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