| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IAllocateService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Model.Models.Allocate; |
| | | |
| | | namespace WIDESEA_AllocateService |
| | | { |
| | | |
| | | public partial class AllocateService : ServiceBase<Dt_AllocateOrder, IRepository<Dt_AllocateOrder>>, IAllocateService |
| | | { |
| | | public AllocateService(IRepository<Dt_AllocateOrder> BaseDal) : base(BaseDal) |
| | | { |
| | | } |
| | | |
| | | public IRepository<Dt_AllocateOrder> Repository => BaseDal; |
| | | |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <Project Sdk="Microsoft.NET.Sdk"> |
| | | |
| | | <PropertyGroup> |
| | | <TargetFramework>net6.0</TargetFramework> |
| | | <ImplicitUsings>enable</ImplicitUsings> |
| | | <Nullable>enable</Nullable> |
| | | </PropertyGroup> |
| | | |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\WIDESEA_Core\WIDESEA_Core.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_IAllocateService\WIDESEA_IAllocateService.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_Model\WIDESEA_Model.csproj" /> |
| | | </ItemGroup> |
| | | |
| | | </Project> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.Extensions.Caching.Memory; |
| | | using Microsoft.Extensions.Logging; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Concurrent; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Model.Models.Basic; |
| | | |
| | | namespace WIDESEA_BasicService |
| | | { |
| | | public class DailySequenceService : ServiceBase<DT_DailySequence, IRepository<DT_DailySequence>>, IDailySequenceService |
| | | { |
| | | private readonly ILogger<DailySequenceService> _logger; |
| | | private readonly IMemoryCache _cache; |
| | | |
| | | private readonly SemaphoreSlim _lock = new(1, 1); |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | public DailySequenceService(IRepository<DT_DailySequence> BaseDal, ILogger<DailySequenceService> logger, IMemoryCache cache, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal) |
| | | { |
| | | _logger = logger; |
| | | _cache = cache; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | } |
| | | |
| | | public IRepository<DT_DailySequence> Repository => BaseDal; |
| | | |
| | | |
| | | public async Task<int> GetNextSequenceAsync() |
| | | { |
| | | return await GetNextSequenceAsync("MESBarcode"); |
| | | } |
| | | public async Task<int> GetNextSequence2Async(string sequenceKey) |
| | | { |
| | | var today = DateTime.Today; |
| | | var cacheKey = $"DailySequence_{sequenceKey}_{today:yyyyMMdd}"; |
| | | |
| | | |
| | | await _lock.WaitAsync(); |
| | | try |
| | | { |
| | | // å
æ£æ¥ç¼å |
| | | if (_cache.TryGetValue(cacheKey, out int currentValue)) |
| | | { |
| | | currentValue++; |
| | | _cache.Set(cacheKey, currentValue, TimeSpan.FromHours(24)); |
| | | return currentValue; |
| | | } |
| | | |
| | | // ç¼å䏿²¡æï¼ä»æ°æ®åºè·åæå建 |
| | | var result= await Repository.Db.Ado.UseTranAsync(async () => |
| | | { |
| | | // æ¸
çæ¨å¤©çè®°å½ |
| | | var yesterday = today.AddDays(-1); |
| | | await Repository.Db.Deleteable<DT_DailySequence>() |
| | | .Where(x => x.SequenceDate == yesterday && x.SequenceKey == sequenceKey) |
| | | .ExecuteCommandAsync(); |
| | | |
| | | // æ¥æ¾æå建ä»å¤©çè®°å½ |
| | | var sequence = await Repository.Db.Queryable<DT_DailySequence>() |
| | | .Where(x => x.SequenceDate == today && x.SequenceKey == sequenceKey) |
| | | .With(SqlWith.UpdLock) |
| | | .FirstAsync(); |
| | | |
| | | int nextValue; |
| | | if (sequence == null) |
| | | { |
| | | sequence = new DT_DailySequence |
| | | { |
| | | SequenceDate = today, |
| | | SequenceKey = sequenceKey, |
| | | CurrentValue = 1, |
| | | |
| | | }; |
| | | await Repository.Db.Insertable(sequence).ExecuteReturnEntityAsync(); |
| | | nextValue = 1; |
| | | } |
| | | else |
| | | { |
| | | nextValue = sequence.CurrentValue + 1; |
| | | sequence.CurrentValue = nextValue; |
| | | |
| | | await Repository.Db.Updateable(sequence).ExecuteCommandAsync(); |
| | | } |
| | | |
| | | // 设置ç¼å |
| | | _cache.Set(cacheKey, nextValue, TimeSpan.FromHours(24)); |
| | | return nextValue; |
| | | }); |
| | | return result.Data; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _logger.LogError(ex, "è·ååºåå·å¤±è´¥ï¼SequenceKey: {SequenceKey}", sequenceKey); |
| | | throw; |
| | | } |
| | | finally |
| | | { |
| | | _lock.Release(); |
| | | } |
| | | } |
| | | |
| | | public async Task<int> GetNextSequenceAsync(string sequenceKey) |
| | | { |
| | | var today = DateTime.Today; |
| | | var cacheKey = $"DailySequence_{sequenceKey}_{today:yyyyMMdd}"; |
| | | |
| | | |
| | | await _lock.WaitAsync(); |
| | | try |
| | | { |
| | | // æ£æ¥ç¼å䏿¯å¦æä»å¤©çåºåå¼ |
| | | if (!_cache.TryGetValue(cacheKey, out int currentValue)) |
| | | { |
| | | // ç¼å䏿²¡æï¼ä»æ°æ®åºè·åæå建 |
| | | currentValue = await GetOrCreateSequenceFromDatabase(today, sequenceKey); |
| | | // 设置ç¼åï¼è¿ææ¶é´ä¸ºä»å¤©ç»æ |
| | | var _cacheOptions = new MemoryCacheEntryOptions |
| | | { |
| | | AbsoluteExpiration = today.AddDays(1) |
| | | }; |
| | | _cache.Set(cacheKey, currentValue, _cacheOptions); |
| | | return currentValue; |
| | | } |
| | | |
| | | // ç¼åä¸åå¨ï¼éå¢å¹¶æ´æ°ç¼å |
| | | currentValue++; |
| | | var cacheOptions = new MemoryCacheEntryOptions |
| | | { |
| | | AbsoluteExpiration = today.AddDays(1) |
| | | }; |
| | | _cache.Set(cacheKey, currentValue, cacheOptions); |
| | | |
| | | // 弿¥æ´æ°å°æ°æ®åº |
| | | _ = Task.Run(async () => |
| | | { |
| | | try |
| | | { |
| | | await UpdateSequenceInDatabase(today, sequenceKey, currentValue); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _logger.LogWarning(ex, "弿¥æ´æ°åºåå°æ°æ®åºå¤±è´¥ï¼SequenceKey: {SequenceKey}", sequenceKey); |
| | | } |
| | | }); |
| | | |
| | | return currentValue; |
| | | } |
| | | finally |
| | | { |
| | | _lock.Release(); |
| | | } |
| | | } |
| | | private async Task<int> GetOrCreateSequenceFromDatabase(DateTime date, string sequenceKey) |
| | | { |
| | | var result= await Repository.Db.Ado.UseTranAsync(async () => |
| | | { |
| | | var sequence = await Repository.Db.Queryable<DT_DailySequence>() |
| | | .Where(x => x.SequenceDate == date && x.SequenceKey == sequenceKey) |
| | | .With(SqlWith.UpdLock) |
| | | .FirstAsync(); |
| | | |
| | | if (sequence == null) |
| | | { |
| | | sequence = new DT_DailySequence |
| | | { |
| | | SequenceDate = date, |
| | | SequenceKey = sequenceKey, |
| | | CurrentValue = 1, |
| | | |
| | | }; |
| | | await Repository.Db.Insertable(sequence).ExecuteReturnEntityAsync(); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | var nextValue = sequence.CurrentValue + 1; |
| | | sequence.CurrentValue = nextValue; |
| | | |
| | | await Repository.Db.Updateable(sequence).ExecuteCommandAsync(); |
| | | return nextValue; |
| | | } |
| | | }) ; |
| | | return result.Data; |
| | | } |
| | | |
| | | private async Task UpdateSequenceInDatabase(DateTime date, string sequenceKey, int value) |
| | | { |
| | | var sequence = await Repository.Db.Queryable<DT_DailySequence>() |
| | | .Where(x => x.SequenceDate == date && x.SequenceKey == sequenceKey) |
| | | .FirstAsync(); |
| | | |
| | | if (sequence != null) |
| | | { |
| | | sequence.CurrentValue = value; |
| | | |
| | | await Repository.Db.Updateable(sequence).ExecuteCommandAsync(); |
| | | } |
| | | else |
| | | { |
| | | // å¦ææ°æ®åºè®°å½ä¸åå¨ï¼åå建 |
| | | sequence = new DT_DailySequence |
| | | { |
| | | SequenceDate = date, |
| | | SequenceKey = sequenceKey, |
| | | CurrentValue = value, |
| | | |
| | | }; |
| | | await Repository.Db.Insertable(sequence).ExecuteCommandAsync(); |
| | | } |
| | | } |
| | | |
| | | public async Task CleanOldSequencesAsync(int keepDays = 30) |
| | | { |
| | | try |
| | | { |
| | | var deleteBefore = DateTime.Today.AddDays(-keepDays); |
| | | var deletedCount = await Repository.Db.Deleteable<DT_DailySequence>() |
| | | .Where(x => x.SequenceDate < deleteBefore) |
| | | .ExecuteCommandAsync(); |
| | | |
| | | for (int i = 1; i < keepDays; i++) { |
| | | var cacheKey = $"DailySequence_MESBarcode_{DateTime.Now.AddDays(-i):yyyyMMdd}"; |
| | | _cache.Remove(cacheKey); |
| | | } |
| | | |
| | | |
| | | _logger.LogInformation("æ¸
çäº {Count} æ¡ {Days} 天åçåºåè®°å½", deletedCount, keepDays); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _logger.LogError(ex, "æ¸
çæ§åºåè®°å½å¤±è´¥"); |
| | | throw; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Text.Json; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEA_IBasicService; |
| | |
| | | /// </summary> |
| | | public async Task MoveContainerAsync(MoveContainerRequest request) |
| | | { |
| | | var url = "conveyor/moveContainer"; |
| | | try |
| | | { |
| | | var url = "conveyor/moveContainer"; |
| | | |
| | | var result = await PostAsync<MoveContainerRequest, ApiResponse<string>>(url, request); |
| | | |
| | | var result = await PostAsync<MoveContainerRequest, ApiResponse<string>>(url, request); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _logger.LogInformation("容卿µå¨å¤±è´¥: " + ex.Message); |
| | | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | public async Task<bool> CreateTaskAsync(TaskModel request) |
| | | { |
| | | _logger.LogInformation("å建任å¡Request: " + JsonConvert.SerializeObject(request)); |
| | | var url = "task/create"; |
| | | |
| | | var result = await PostAsync<TaskModel, ApiResponse<TasksData>>(url, request); |
| | | if (result != null && result.Code == 0) |
| | | try |
| | | { |
| | | return true; |
| | | _logger.LogInformation("å建任å¡Request: " + JsonConvert.SerializeObject(request)); |
| | | var url = "task/create"; |
| | | |
| | | var result = await PostAsync<TaskModel, ApiResponse<TasksData>>(url, request); |
| | | if (result != null && result.Code == 0) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | return false; |
| | | catch (Exception ex) |
| | | { |
| | | _logger.LogInformation("å建任å¡å¤±è´¥: " + ex.Message); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | private async Task<TResponse> PostAsync<TRequest, TResponse>(string url, TRequest request) |
| | | { |
| | | |
| | | string json = JsonConvert.SerializeObject(request, new JsonSerializerSettings |
| | | { |
| | | ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver() |
| | |
| | | |
| | | using var response = await _client.PostAsync(url, content); |
| | | string body = await response.Content.ReadAsStringAsync(); |
| | | _logger.LogInformation($"ESSAPI post : {_client.BaseAddress} {url} {body}" ); |
| | | _logger.LogInformation($"ESSAPI post : {_client.BaseAddress} {url} {body}"); |
| | | if (!response.IsSuccessStatusCode) |
| | | { |
| | | throw new HttpRequestException(body); |
| | | } |
| | | |
| | | return JsonConvert.DeserializeObject<TResponse>(body); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | using NetTaste; |
| | | using Microsoft.Extensions.Logging; |
| | | using NetTaste; |
| | | using Newtonsoft.Json; |
| | | using Org.BouncyCastle.Ocsp; |
| | | using SqlSugar.Extensions; |
| | |
| | | private readonly ISupplierInfoService _supplierInfoService; |
| | | private readonly IMaterialUnitService _materialUnitService; |
| | | private readonly IMaterielInfoService _materielInfoService; |
| | | private readonly ILogger<ErpApiService> _logger; |
| | | |
| | | public ErpApiService(IHttpClientFactory httpClientFactory, ISupplierInfoService supplierInfoService, IMaterialUnitService materialUnitService, IMaterielInfoService materielInfoService) |
| | | public ErpApiService(IHttpClientFactory httpClientFactory, ISupplierInfoService supplierInfoService, IMaterialUnitService materialUnitService, IMaterielInfoService materielInfoService, ILogger<ErpApiService> logger) |
| | | { |
| | | _httpClientFactory = httpClientFactory; |
| | | _supplierInfoService = supplierInfoService; |
| | | _materialUnitService = materialUnitService; |
| | | _materielInfoService = materielInfoService; |
| | | _logger = logger; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | public async Task<string> GetTokenAsync() |
| | | { |
| | | var request = new TokenRequest { appId = "BG_SYSTEM", secretKey = "7e9239c1e132462a9cf03bfa342a044aMTcxODE5MzgxODI4Mw" }; |
| | | var response = await PostAsync<TokenRequest, TokenResponse>("auth/getAccessToken", request, includeToken: false); |
| | | var _token = response?.data?.access_token; |
| | | return _token ?? ""; |
| | | try |
| | | { |
| | | var request = new TokenRequest { appId = "BG_SYSTEM", secretKey = "7e9239c1e132462a9cf03bfa342a044aMTcxODE5MzgxODI4Mw" }; |
| | | var response = await PostAsync<TokenRequest, TokenResponse>("auth/getAccessToken", request, includeToken: false); |
| | | var _token = response?.data?.access_token; |
| | | return _token ?? ""; |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _logger.LogInformation("ErpApiService GetTokenAsync失败: " + ex.Message); |
| | | return ""; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | /// <returns></returns> |
| | | public async Task GetSuppliersAsync(string vendorCode = null) |
| | | { |
| | | var req = new SupplierRequest { vendorCode = vendorCode }; |
| | | var result = await PostAsync<SupplierRequest, SupplierResponse>("erp/getVendorInfo", req, includeToken: true); |
| | | if (result != null && result.data != null && result.data.Any()) |
| | | try |
| | | { |
| | | var dblists = _supplierInfoService.Repository.QueryData(); |
| | | var excepts = dblists.Select(O => O.SupplierCode).Except(result.data.Select(o => o.vendorCode)); |
| | | foreach (var except in excepts) |
| | | var req = new SupplierRequest { vendorCode = vendorCode }; |
| | | var result = await PostAsync<SupplierRequest, SupplierResponse>("erp/getVendorInfo", req, includeToken: true); |
| | | if (result != null && result.data != null && result.data.Any()) |
| | | { |
| | | var first = dblists.FirstOrDefault(o => o.SupplierCode == except); |
| | | if (first != null) |
| | | var dblists = _supplierInfoService.Repository.QueryData(); |
| | | var excepts = dblists.Select(O => O.SupplierCode).Except(result.data.Select(o => o.vendorCode)); |
| | | foreach (var except in excepts) |
| | | { |
| | | _supplierInfoService.Repository.DeleteData(first); |
| | | } |
| | | } |
| | | foreach (var item in result.data) |
| | | { |
| | | var first = dblists.FirstOrDefault(o => o.SupplierCode == item.vendorCode); |
| | | if (first != null) |
| | | { |
| | | first.SupplierCode = item.vendorCode; |
| | | first.SupplierName = item.vendorName; |
| | | first.SupplierShortName = item.vendorShortName; |
| | | first.Status = item.effective.ObjToInt(); |
| | | first.CreateDate = item.createDate.ObjToDate(); |
| | | first.ModifyDate = item.modifyDate.ObjToDate(); |
| | | _supplierInfoService.Repository.UpdateData(first); |
| | | } |
| | | else |
| | | { |
| | | Dt_SupplierInfo dt_SupplierInfo = new() |
| | | var first = dblists.FirstOrDefault(o => o.SupplierCode == except); |
| | | if (first != null) |
| | | { |
| | | SupplierCode = item.vendorCode, |
| | | SupplierName = item.vendorName, |
| | | SupplierShortName = item.vendorShortName, |
| | | Status = item.effective.ObjToInt(), |
| | | CreateDate = item.createDate.ObjToDate(), |
| | | Creater = "ERP", |
| | | Modifier = "ERP", |
| | | ModifyDate = item.modifyDate.ObjToDate() |
| | | }; |
| | | _supplierInfoService.Repository.AddData(dt_SupplierInfo); |
| | | _supplierInfoService.Repository.DeleteData(first); |
| | | } |
| | | } |
| | | foreach (var item in result.data) |
| | | { |
| | | var first = dblists.FirstOrDefault(o => o.SupplierCode == item.vendorCode); |
| | | if (first != null) |
| | | { |
| | | first.SupplierCode = item.vendorCode; |
| | | first.SupplierName = item.vendorName; |
| | | first.SupplierShortName = item.vendorShortName; |
| | | first.Status = item.effective.ObjToInt(); |
| | | first.CreateDate = item.createDate.ObjToDate(); |
| | | first.ModifyDate = item.modifyDate.ObjToDate(); |
| | | _supplierInfoService.Repository.UpdateData(first); |
| | | } |
| | | else |
| | | { |
| | | Dt_SupplierInfo dt_SupplierInfo = new() |
| | | { |
| | | SupplierCode = item.vendorCode, |
| | | SupplierName = item.vendorName, |
| | | SupplierShortName = item.vendorShortName, |
| | | Status = item.effective.ObjToInt(), |
| | | CreateDate = item.createDate.ObjToDate(), |
| | | Creater = "ERP", |
| | | Modifier = "ERP", |
| | | ModifyDate = item.modifyDate.ObjToDate() |
| | | }; |
| | | _supplierInfoService.Repository.AddData(dt_SupplierInfo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _logger.LogInformation("ErpApiService GetSuppliersAsync失败: " + ex.Message); |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | /// <returns></returns> |
| | | public async Task GetMaterialUnitAsync(string itemNo = null) |
| | | { |
| | | var req = new MaterialUnitRequest { itemNo = itemNo }; |
| | | var result = await PostAsync<MaterialUnitRequest, MaterialUnitResponse>("erp/getMaterialUnit", req, true); |
| | | if (result != null && result.data != null && result.data.Any()) |
| | | try |
| | | { |
| | | var dblists = _materialUnitService.Repository.QueryData(); |
| | | var excepts = dblists.Select(O => O.ItemNo).Except(result.data.Select(o => o.itemNo)); |
| | | foreach (var except in excepts) |
| | | var req = new MaterialUnitRequest { itemNo = itemNo }; |
| | | var result = await PostAsync<MaterialUnitRequest, MaterialUnitResponse>("erp/getMaterialUnit", req, true); |
| | | if (result != null && result.data != null && result.data.Any()) |
| | | { |
| | | var first = dblists.FirstOrDefault(o => o.ItemNo == except); |
| | | if (first != null) |
| | | var dblists = _materialUnitService.Repository.QueryData(); |
| | | var excepts = dblists.Select(O => O.ItemNo).Except(result.data.Select(o => o.itemNo)); |
| | | foreach (var except in excepts) |
| | | { |
| | | _materialUnitService.Repository.DeleteData(first); |
| | | } |
| | | } |
| | | foreach (var item in result.data) |
| | | { |
| | | var first = dblists.FirstOrDefault(o => o.ItemNo == item.itemNo); |
| | | if (first != null) |
| | | { |
| | | first.ItemNo = item.itemNo; |
| | | first.ProductName = item.productName; |
| | | first.FromUom = item.fromUom; |
| | | first.ToUom = item.toUom; |
| | | first.Ratio = item.ratio.ObjToDecimal(); |
| | | first.Creater = "ERP"; |
| | | first.Modifier = "ERP"; |
| | | first.CreateDate = item.createDate.ObjToDate(); |
| | | first.ModifyDate = item.modifyDate.ObjToDate(); |
| | | _materialUnitService.Repository.UpdateData(first); |
| | | } |
| | | else |
| | | { |
| | | Dt_MaterialUnit dt_MaterialUnit = new() |
| | | var first = dblists.FirstOrDefault(o => o.ItemNo == except); |
| | | if (first != null) |
| | | { |
| | | ItemNo = item.itemNo, |
| | | ProductName = item.productName, |
| | | FromUom = item.fromUom, |
| | | ToUom = item.toUom, |
| | | Ratio = item.ratio.ObjToDecimal(), |
| | | CreateDate = item.createDate.ObjToDate(), |
| | | Creater = "ERP", |
| | | Modifier = "ERP", |
| | | ModifyDate = item.modifyDate.ObjToDate() |
| | | }; |
| | | _materialUnitService.Repository.AddData(dt_MaterialUnit); |
| | | _materialUnitService.Repository.DeleteData(first); |
| | | } |
| | | } |
| | | foreach (var item in result.data) |
| | | { |
| | | var first = dblists.FirstOrDefault(o => o.ItemNo == item.itemNo); |
| | | if (first != null) |
| | | { |
| | | first.ItemNo = item.itemNo; |
| | | first.ProductName = item.productName; |
| | | first.FromUom = item.fromUom; |
| | | first.ToUom = item.toUom; |
| | | first.Ratio = item.ratio.ObjToDecimal(); |
| | | first.Creater = "ERP"; |
| | | first.Modifier = "ERP"; |
| | | first.CreateDate = item.createDate.ObjToDate(); |
| | | first.ModifyDate = item.modifyDate.ObjToDate(); |
| | | _materialUnitService.Repository.UpdateData(first); |
| | | } |
| | | else |
| | | { |
| | | Dt_MaterialUnit dt_MaterialUnit = new() |
| | | { |
| | | ItemNo = item.itemNo, |
| | | ProductName = item.productName, |
| | | FromUom = item.fromUom, |
| | | ToUom = item.toUom, |
| | | Ratio = item.ratio.ObjToDecimal(), |
| | | CreateDate = item.createDate.ObjToDate(), |
| | | Creater = "ERP", |
| | | Modifier = "ERP", |
| | | ModifyDate = item.modifyDate.ObjToDate() |
| | | }; |
| | | _materialUnitService.Repository.AddData(dt_MaterialUnit); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _logger.LogInformation("ErpApiService GetMaterialUnitAsync 失败: " + ex.Message); |
| | | |
| | | } |
| | | |
| | | } |
| | | public async Task GetMaterialInfoAsync(MaterialRequest materialRequest) |
| | | { |
| | | var first = WIDESEA_Core.Helper.AppSettings.GetValue("FirstMaterialSync").ObjToBool(); |
| | | if (first) |
| | | try |
| | | { |
| | | var _token = await GetTokenAsync(); |
| | | for (int i = 1; i < 400; i++) |
| | | var first = WIDESEA_Core.Helper.AppSettings.GetValue("FirstMaterialSync").ObjToBool(); |
| | | if (first) |
| | | { |
| | | materialRequest.pageNum = i; |
| | | var _token = await GetTokenAsync(); |
| | | for (int i = 1; i < 400; i++) |
| | | { |
| | | materialRequest.pageNum = i; |
| | | materialRequest.pageSize = 5000; |
| | | var result = await PostAsync<MaterialRequest, MaterialResponse>("erp/getMaterialInfo", materialRequest, _token, true); |
| | | if (result != null && result.data != null && result.data.Any()) |
| | | { |
| | | foreach (var item in result.data) |
| | | { |
| | | Dt_MaterielInfo dt_MaterielInfo = new Dt_MaterielInfo() |
| | | { |
| | | MaterielModel = item.productModel, |
| | | MaterielCode = item.itemNo, |
| | | MaterielName = item.productName, |
| | | MaterielSpec = item.spec, |
| | | productTypeDesc = item.productTypeDesc, |
| | | productFamilyName = item.productFamilyName, |
| | | productFamilyShortName = item.productFamilyShortName, |
| | | plcode = item.plcode, |
| | | pl = item.pl, |
| | | drawingNo = item.drawingNo, |
| | | mversion = item.mversion, |
| | | warehouseName = item.warehouseName, |
| | | usageUOM = item.usageUOM, |
| | | purchaseUOM = item.purchaseUOM, |
| | | inventoryUOM = item.inventoryUOM, |
| | | CreateDate = item.createDate.ObjToDate(), |
| | | ModifyDate = item.modifyDate.ObjToDate(), |
| | | }; |
| | | _materielInfoService.Repository.AddData(dt_MaterielInfo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | materialRequest.modifyDateStart = DateTime.Now.AddDays(-1).Date.ToString("yyyy-MM-dd") + " 00:00:01"; |
| | | materialRequest.modifyDateEnd = DateTime.Now.ToString("yyyy-MM-dd HH:mm") + ":01"; |
| | | materialRequest.pageNum = 1; |
| | | materialRequest.pageSize = 5000; |
| | | var result = await PostAsync<MaterialRequest, MaterialResponse>("erp/getMaterialInfo", materialRequest, _token, true); |
| | | |
| | | var result = await PostAsync<MaterialRequest, MaterialResponse>("erp/getMaterialInfo", materialRequest, true, true); |
| | | if (result != null && result.data != null && result.data.Any()) |
| | | { |
| | | foreach (var item in result.data) |
| | | { |
| | | Dt_MaterielInfo dt_MaterielInfo = new Dt_MaterielInfo() |
| | | var dbfirst = _materielInfoService.Repository.QueryData(x => x.MaterielModel == item.productModel && x.MaterielCode == item.itemNo).FirstOrDefault(); |
| | | if (dbfirst != null) |
| | | { |
| | | MaterielModel = item.productModel, |
| | | MaterielCode = item.itemNo, |
| | | MaterielName = item.productName, |
| | | MaterielSpec = item.spec, |
| | | productTypeDesc = item.productTypeDesc, |
| | | productFamilyName = item.productFamilyName, |
| | | productFamilyShortName = item.productFamilyShortName, |
| | | plcode = item.plcode, |
| | | pl = item.pl, |
| | | drawingNo = item.drawingNo, |
| | | mversion = item.mversion, |
| | | warehouseName = item.warehouseName, |
| | | usageUOM = item.usageUOM, |
| | | purchaseUOM = item.purchaseUOM, |
| | | inventoryUOM = item.inventoryUOM, |
| | | CreateDate = item.createDate.ObjToDate(), |
| | | ModifyDate = item.modifyDate.ObjToDate(), |
| | | }; |
| | | _materielInfoService.Repository.AddData(dt_MaterielInfo); |
| | | dbfirst.MaterielModel = item.productModel; |
| | | dbfirst.MaterielCode = item.itemNo; |
| | | dbfirst.MaterielName = item.productName; |
| | | dbfirst.MaterielSpec = item.spec; |
| | | dbfirst.productTypeDesc = item.productTypeDesc; |
| | | dbfirst.productFamilyName = item.productFamilyName; |
| | | dbfirst.productFamilyShortName = item.productFamilyShortName; |
| | | dbfirst.plcode = item.plcode; |
| | | dbfirst.pl = item.pl; |
| | | dbfirst.drawingNo = item.drawingNo; |
| | | dbfirst.mversion = item.mversion; |
| | | dbfirst.warehouseName = item.warehouseName; |
| | | dbfirst.usageUOM = item.usageUOM; |
| | | dbfirst.purchaseUOM = item.purchaseUOM; |
| | | dbfirst.inventoryUOM = item.inventoryUOM; |
| | | dbfirst.CreateDate = item.createDate.ObjToDate(); |
| | | dbfirst.ModifyDate = item.modifyDate.ObjToDate(); |
| | | _materielInfoService.Repository.UpdateData(dbfirst); |
| | | } |
| | | else |
| | | { |
| | | Dt_MaterielInfo dt_MaterielInfo = new Dt_MaterielInfo() |
| | | { |
| | | MaterielModel = item.productModel, |
| | | MaterielCode = item.itemNo, |
| | | MaterielName = item.productName, |
| | | MaterielSpec = item.spec, |
| | | productTypeDesc = item.productTypeDesc, |
| | | productFamilyName = item.productFamilyName, |
| | | productFamilyShortName = item.productFamilyShortName, |
| | | plcode = item.plcode, |
| | | pl = item.pl, |
| | | drawingNo = item.drawingNo, |
| | | mversion = item.mversion, |
| | | warehouseName = item.warehouseName, |
| | | usageUOM = item.usageUOM, |
| | | purchaseUOM = item.purchaseUOM, |
| | | inventoryUOM = item.inventoryUOM, |
| | | CreateDate = item.createDate.ObjToDate(), |
| | | ModifyDate = item.modifyDate.ObjToDate(), |
| | | }; |
| | | _materielInfoService.Repository.AddData(dt_MaterielInfo); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | catch (Exception ex) |
| | | { |
| | | materialRequest.modifyDateStart = DateTime.Now.AddDays(-1).Date.ToString("yyyy-MM-dd") + " 00:00:01"; |
| | | materialRequest.modifyDateEnd = DateTime.Now.ToString("yyyy-MM-dd HH:mm")+ ":01"; |
| | | materialRequest.pageNum = 1; |
| | | materialRequest.pageSize = 5000; |
| | | _logger.LogInformation("ErpApiService GetMaterialInfoAsync 失败: " + ex.Message); |
| | | |
| | | var result = await PostAsync<MaterialRequest, MaterialResponse>("erp/getMaterialInfo", materialRequest, true, true); |
| | | if (result != null && result.data != null && result.data.Any()) |
| | | { |
| | | foreach (var item in result.data) |
| | | { |
| | | var dbfirst = _materielInfoService.Repository.QueryData(x => x.MaterielModel == item.productModel && x.MaterielCode == item.itemNo).FirstOrDefault(); |
| | | if (dbfirst != null) |
| | | { |
| | | dbfirst.MaterielModel = item.productModel; |
| | | dbfirst.MaterielCode = item.itemNo; |
| | | dbfirst.MaterielName = item.productName; |
| | | dbfirst.MaterielSpec = item.spec; |
| | | dbfirst.productTypeDesc = item.productTypeDesc; |
| | | dbfirst.productFamilyName = item.productFamilyName; |
| | | dbfirst.productFamilyShortName = item.productFamilyShortName; |
| | | dbfirst.plcode = item.plcode; |
| | | dbfirst.pl = item.pl; |
| | | dbfirst.drawingNo = item.drawingNo; |
| | | dbfirst.mversion = item.mversion; |
| | | dbfirst.warehouseName = item.warehouseName; |
| | | dbfirst.usageUOM = item.usageUOM; |
| | | dbfirst.purchaseUOM = item.purchaseUOM; |
| | | dbfirst.inventoryUOM = item.inventoryUOM; |
| | | dbfirst.CreateDate = item.createDate.ObjToDate(); |
| | | dbfirst.ModifyDate = item.modifyDate.ObjToDate(); |
| | | _materielInfoService.Repository.UpdateData(dbfirst); |
| | | } |
| | | else |
| | | { |
| | | Dt_MaterielInfo dt_MaterielInfo = new Dt_MaterielInfo() |
| | | { |
| | | MaterielModel = item.productModel, |
| | | MaterielCode = item.itemNo, |
| | | MaterielName = item.productName, |
| | | MaterielSpec = item.spec, |
| | | productTypeDesc = item.productTypeDesc, |
| | | productFamilyName = item.productFamilyName, |
| | | productFamilyShortName = item.productFamilyShortName, |
| | | plcode = item.plcode, |
| | | pl = item.pl, |
| | | drawingNo = item.drawingNo, |
| | | mversion = item.mversion, |
| | | warehouseName = item.warehouseName, |
| | | usageUOM = item.usageUOM, |
| | | purchaseUOM = item.purchaseUOM, |
| | | inventoryUOM = item.inventoryUOM, |
| | | CreateDate = item.createDate.ObjToDate(), |
| | | ModifyDate = item.modifyDate.ObjToDate(), |
| | | }; |
| | | _materielInfoService.Repository.AddData(dt_MaterielInfo); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | private async Task<TResponse> PostAsync<TRequest, TResponse>(string url, TRequest request, string _token, bool isNullSerialize = false) |
| | |
| | | } |
| | | else |
| | | { |
| | | json = JsonConvert.SerializeObject(request ); |
| | | json = JsonConvert.SerializeObject(request); |
| | | } |
| | | |
| | | var content = new StringContent(json, Encoding.UTF8, "application/json"); |
| | |
| | | using Newtonsoft.Json; |
| | | using Microsoft.Extensions.Logging; |
| | | using Newtonsoft.Json; |
| | | using Org.BouncyCastle.Asn1.Ocsp; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | public class InvokeMESService : IInvokeMESService |
| | | { |
| | | private readonly IHttpClientFactory _httpClientFactory; |
| | | |
| | | private readonly ILogger<InvokeMESService> _logger; |
| | | private string UserName = "12312"; |
| | | private string Password = "1"; |
| | | public InvokeMESService(IHttpClientFactory httpClientFactory) |
| | | public InvokeMESService(IHttpClientFactory httpClientFactory, ILogger<InvokeMESService> logger) |
| | | { |
| | | _httpClientFactory = httpClientFactory; |
| | | _logger = logger; |
| | | } |
| | | |
| | | public async Task FeedbackInbound(string url, FeedbackInboundRequestModel model) |
| | |
| | | Depth = depth, |
| | | }; |
| | | |
| | | locationInfo.LocationCode = $"HAI-{locationInfo.Row.ToString().PadLeft(3, '0')}-{locationInfo.Column.ToString().PadLeft(3, '0')}-{locationInfo.Layer.ToString().PadLeft(2, '0')} "; |
| | | locationInfo.LocationName = $"HAI{locationInfo.RoadwayNo}å··é{locationInfo.Row.ToString().PadLeft(3, '0')}è¡{locationInfo.Column.ToString().PadLeft(3, '0')}å{locationInfo.Layer.ToString().PadLeft(3, '0')}å± "; |
| | | locationInfo.LocationCode = $"HAI-{locationInfo.Row.ToString().PadLeft(3, '0')}-{locationInfo.Column.ToString().PadLeft(3, '0')}-{locationInfo.Layer.ToString().PadLeft(2, '0')}"; |
| | | locationInfo.LocationName = $"HAI{locationInfo.RoadwayNo}å··é{locationInfo.Row.ToString().PadLeft(3, '0')}è¡{locationInfo.Column.ToString().PadLeft(3, '0')}å{locationInfo.Layer.ToString().PadLeft(3, '0')}å±"; |
| | | |
| | | |
| | | //locationInfo.LocationCode = $"{locationInfo.RoadwayNo}-{locationInfo.Row.ToString().PadLeft(3, '0')}-{locationInfo.Column.ToString().PadLeft(3, '0')}-{locationInfo.Layer.ToString().PadLeft(3, '0')}-{locationInfo.Depth.ToString().PadLeft(2, '0')}"; |
| | |
| | | using System; |
| | | using Microsoft.Extensions.Logging; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | |
| | | { |
| | | public class MaterialUnitService : ServiceBase<Dt_MaterialUnit, IRepository<Dt_MaterialUnit>>, IMaterialUnitService |
| | | { |
| | | private readonly ILogger<MaterialUnitService> _logger; |
| | | public IRepository<Dt_MaterialUnit> Repository => BaseDal; |
| | | public MaterialUnitService(IRepository<Dt_MaterialUnit> BaseDal) : base(BaseDal) |
| | | |
| | | public IRepository<Dt_MaterielInfo> _materielInfoRepository; |
| | | public MaterialUnitService(IRepository<Dt_MaterialUnit> BaseDal, ILogger<MaterialUnitService> logger, IRepository<Dt_MaterielInfo> materielInfoRepository) : base(BaseDal) |
| | | { |
| | | _logger = logger; |
| | | _materielInfoRepository = materielInfoRepository; |
| | | } |
| | | /// <summary> |
| | | /// åä½è½¬æ¢ |
| | | /// </summary> |
| | | public async Task<decimal> ConvertAsync(string materialCode, decimal quantity, string fromUnit, string toUnit) |
| | | { |
| | | if (string.IsNullOrEmpty(materialCode)) |
| | | throw new ArgumentException("ç©æç¼å·ä¸è½ä¸ºç©º"); |
| | | |
| | | if (string.IsNullOrEmpty(fromUnit) || string.IsNullOrEmpty(toUnit)) |
| | | throw new ArgumentException("åä½ä¸è½ä¸ºç©º"); |
| | | |
| | | // 妿åä½ç¸åï¼ç´æ¥è¿å |
| | | if (fromUnit.Equals(toUnit, StringComparison.OrdinalIgnoreCase)) |
| | | return quantity; |
| | | |
| | | var ratio = await GetConversionRatioAsync(materialCode, fromUnit, toUnit); |
| | | |
| | | if (ratio == null) |
| | | { |
| | | _logger.LogWarning($"æªæ¾å°ç©æ {materialCode} ä» {fromUnit} å° {toUnit} çåä½è½¬æ¢å
³ç³»"); |
| | | throw new InvalidOperationException($"æªæ¾å°ç©æ {materialCode} ä» {fromUnit} å° {toUnit} çåä½è½¬æ¢å
³ç³»"); |
| | | } |
| | | |
| | | return quantity * ratio.Value; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// éè´åä½è½¬åºååä½ |
| | | /// </summary> |
| | | public async Task<decimal> ConvertPurchaseToStockAsync(string materialCode, decimal quantity) |
| | | { |
| | | // è·åç©æä¿¡æ¯ |
| | | var material = await _materielInfoRepository.Db.Queryable<Dt_MaterielInfo>() |
| | | .Where(x => x.MaterielCode == materialCode) |
| | | .FirstAsync(); |
| | | |
| | | if (material == null) |
| | | { |
| | | throw new ArgumentException($"æªæ¾å°ç©æç¼å·: {materialCode}"); |
| | | } |
| | | |
| | | return await ConvertAsync(materialCode, quantity, material.purchaseUOM, material.inventoryUOM); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 颿åä½è½¬åºååä½ |
| | | /// </summary> |
| | | public async Task<decimal> ConvertIssueToStockAsync(string materialCode, decimal quantity) |
| | | { |
| | | // è·åç©æä¿¡æ¯ |
| | | var material = await _materielInfoRepository.Db.Queryable<Dt_MaterielInfo>() |
| | | .Where(x => x.MaterielCode == materialCode) |
| | | .FirstAsync(); |
| | | |
| | | if (material == null) |
| | | { |
| | | throw new ArgumentException($"æªæ¾å°ç©æç¼å·: {materialCode}"); |
| | | } |
| | | |
| | | return await ConvertAsync(materialCode, quantity, material.usageUOM, material.inventoryUOM); |
| | | } |
| | | /// <summary> |
| | | /// è·ååä½è½¬æ¢æ¯ç |
| | | /// </summary> |
| | | public async Task<decimal?> GetConversionRatioAsync(string materialCode, string fromUnit, string toUnit) |
| | | { |
| | | // å°è¯ç´æ¥æ¥æ¾è½¬æ¢å
³ç³» |
| | | var conversion = await Repository.Db.Queryable<Dt_MaterialUnit>() |
| | | .Where(x => x.ItemNo == materialCode && |
| | | x.FromUom == fromUnit && |
| | | x.ToUom == toUnit) |
| | | .FirstAsync(); |
| | | |
| | | if (conversion != null) |
| | | { |
| | | return conversion.Ratio; |
| | | } |
| | | |
| | | // å°è¯æ¥æ¾åå转æ¢å
³ç³»ï¼ååæ°ï¼ |
| | | var reverseConversion = await Repository.Db.Queryable<Dt_MaterialUnit>() |
| | | .Where(x => x.ItemNo == materialCode && |
| | | x.FromUom == toUnit && |
| | | x.ToUom == fromUnit) |
| | | .FirstAsync(); |
| | | |
| | | if (reverseConversion != null) |
| | | { |
| | | return 1 / reverseConversion.Ratio; |
| | | } |
| | | |
| | | // å°è¯éè¿ä¸é´åä½ï¼åºååä½ï¼è¿è¡è½¬æ¢ |
| | | var material = await _materielInfoRepository.Db.Queryable<Dt_MaterielInfo>() |
| | | .Where(x => x.MaterielCode == materialCode) |
| | | .FirstAsync(); |
| | | |
| | | if (material != null) |
| | | { |
| | | var stockUnit = material.inventoryUOM; |
| | | |
| | | // å¦æç®æ åä½å·²ç»æ¯åºååä½ï¼ç´æ¥æ¥æ¾æºåä½å°åºååä½çè½¬æ¢ |
| | | if (toUnit.Equals(stockUnit, StringComparison.OrdinalIgnoreCase)) |
| | | { |
| | | var toStockRatio = await GetDirectRatioAsync(materialCode, fromUnit, stockUnit); |
| | | if (toStockRatio != null) return toStockRatio; |
| | | } |
| | | |
| | | // 妿æºå使¯åºååä½ï¼ç´æ¥æ¥æ¾åºååä½å°ç®æ åä½çè½¬æ¢ |
| | | if (fromUnit.Equals(stockUnit, StringComparison.OrdinalIgnoreCase)) |
| | | { |
| | | var fromStockRatio = await GetDirectRatioAsync(materialCode, stockUnit, toUnit); |
| | | if (fromStockRatio != null) return fromStockRatio; |
| | | } |
| | | |
| | | // éè¿åºååä½è¿è¡é´æ¥è½¬æ¢ï¼fromUnit -> stockUnit -> toUnit |
| | | var ratio1 = await GetDirectRatioAsync(materialCode, fromUnit, stockUnit); |
| | | var ratio2 = await GetDirectRatioAsync(materialCode, stockUnit, toUnit); |
| | | |
| | | if (ratio1 != null && ratio2 != null) |
| | | { |
| | | return ratio1 * ratio2; |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åç´æ¥è½¬æ¢æ¯çï¼å
嫿£ååå忥æ¾ï¼ |
| | | /// </summary> |
| | | private async Task<decimal?> GetDirectRatioAsync(string materialCode, string fromUnit, string toUnit) |
| | | { |
| | | // æ£åæ¥æ¾ |
| | | var conversion = await Repository.Db.Queryable<Dt_MaterialUnit>() |
| | | .Where(x => x.ItemNo == materialCode && |
| | | x.FromUom == fromUnit && |
| | | x.ToUom == toUnit) |
| | | .FirstAsync(); |
| | | |
| | | if (conversion != null) |
| | | { |
| | | return conversion.Ratio; |
| | | } |
| | | |
| | | // ååæ¥æ¾ |
| | | var reverseConversion = await Repository.Db.Queryable<Dt_MaterialUnit>() |
| | | .Where(x => x.ItemNo == materialCode && |
| | | x.FromUom == toUnit && |
| | | x.ToUom == fromUnit) |
| | | .FirstAsync(); |
| | | |
| | | if (reverseConversion != null) |
| | | { |
| | | return 1 / reverseConversion.Ratio; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | [Description("éå®")] |
| | | Lock = 1, |
| | | |
| | | |
| | | /// <summary> |
| | | /// æè´§éå® |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | [Description("æè´§")] |
| | | InStock = 100, |
| | | |
| | | /// <summary> |
| | | /// 大æçéå® |
| | | /// 空æç |
| | | /// </summary> |
| | | [Description("大æçéå®")] |
| | | PalletLock = 99 |
| | | [Description("空æç")] |
| | | Pallet = 99 |
| | | } |
| | | } |
| | |
| | | [Description("å
¶ä»å
¥åºå")] |
| | | Other = 130 |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åæ®ç±»åæä¸¾ |
| | | /// </summary> |
| | | public enum DocumentType |
| | | { |
| | | /// <summary> |
| | | /// éè´å
¥åºå |
| | | /// </summary> |
| | | [Description("éè´å
¥åº")] |
| | | PurchaseInbound = 11, |
| | | |
| | | /// <summary> |
| | | /// ææ¶å |
| | | /// </summary> |
| | | [Description("ææ¶å")] |
| | | MiscellaneousReceipt = 12, |
| | | |
| | | /// <summary> |
| | | /// ç产éæå |
| | | /// </summary> |
| | | [Description("ç产éæå")] |
| | | ProductionReturn = 13, |
| | | |
| | | /// <summary> |
| | | /// å¤åéæå |
| | | /// </summary> |
| | | [Description("å¤åéæå")] |
| | | OutsourcingReturn = 14, |
| | | |
| | | /// <summary> |
| | | /// éå®éåºå |
| | | /// </summary> |
| | | [Description("éå®éåºå")] |
| | | SalesReturn = 15, |
| | | |
| | | /// <summary> |
| | | /// å·¥å颿å |
| | | /// </summary> |
| | | [Description("å·¥å颿åºåºå")] |
| | | WorkOrderPicking = 21, |
| | | |
| | | /// <summary> |
| | | /// æåå |
| | | /// </summary> |
| | | [Description("æåå")] |
| | | MiscellaneousIssue = 22, |
| | | |
| | | /// <summary> |
| | | /// éè´§å |
| | | /// </summary> |
| | | [Description("éè´§å")] |
| | | ReturnGoods = 23, |
| | | |
| | | /// <summary> |
| | | /// éå®åºåºå |
| | | /// </summary> |
| | | [Description("éå®åºåºå")] |
| | | SalesOutbound = 24, |
| | | |
| | | /// <summary> |
| | | /// å¤å颿ç³è¯·å |
| | | /// </summary> |
| | | [Description("å¤å颿ç³è¯·å")] |
| | | OutsourcingPickingRequest = 25 |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Common.TaskEnum |
| | | { |
| | | /// <summary> |
| | | /// ä»»å¡ç±»å |
| | | /// </summary> |
| | | public enum TaskType |
| | | { |
| | | /// <summary> |
| | | /// ç»ç |
| | | /// </summary> |
| | | [Description("ç»ç")] |
| | | SetPlate = 0, |
| | | |
| | | /// <summary> |
| | | /// å
¥åº |
| | | /// </summary> |
| | | [Description("å
¥åº")] |
| | | EnterDepot = 1, |
| | | |
| | | /// <summary> |
| | | /// åºåº |
| | | /// </summary> |
| | | [Description("åºåº")] |
| | | OutDepot = 2, |
| | | |
| | | /// <summary> |
| | | /// ç§»åº |
| | | /// </summary> |
| | | [Description("ç§»åº")] |
| | | TransferDepot = 3, |
| | | |
| | | /// <summary> |
| | | /// æ¬è¿ |
| | | /// </summary> |
| | | [Description("æ¬è¿")] |
| | | Delivery = 5, |
| | | } |
| | | public enum TaskTypeEnum |
| | | { |
| | | /// <summary> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEA_DTO.Allocate |
| | | { |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [JsonObject(MemberSerialization.OptIn)] |
| | | public class AllocateDto |
| | | { |
| | | /// <summary> |
| | | /// 请æ±ç¼ç |
| | | /// </summary> |
| | | [JsonProperty("reqCode")] |
| | | public string ReqCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è¯·æ±æ¶é´ |
| | | /// </summary> |
| | | [JsonProperty("reqTime")] |
| | | public DateTime ReqTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 订åç¼å· |
| | | /// </summary> |
| | | [JsonProperty("orderNo")] |
| | | public string OrderNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¸å¡ç±»å |
| | | /// </summary> |
| | | [JsonProperty("business_type")] |
| | | public string BusinessType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦åæ¹ |
| | | /// </summary> |
| | | [JsonProperty("isBatch")] |
| | | public bool IsBatch { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ååºä»£ç |
| | | /// </summary> |
| | | [JsonProperty("factoryArea")] |
| | | public string FactoryArea { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æä½ç±»å |
| | | /// </summary> |
| | | [JsonProperty("operationType")] |
| | | public int OperationType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 订å详æ
å表 |
| | | /// </summary> |
| | | [JsonProperty("details")] |
| | | public List<AllocateDtoDetail> Details { get; set; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 订å详æ
|
| | | /// </summary> |
| | | [JsonObject(MemberSerialization.OptIn)] |
| | | public class AllocateDtoDetail |
| | | { |
| | | /// <summary> |
| | | /// ä»åºç¼ç |
| | | /// </summary> |
| | | [JsonProperty("warehouseCode")] |
| | | public string WarehouseCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æç¼ç |
| | | /// </summary> |
| | | [JsonProperty("materialCode")] |
| | | public string MaterialCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è¡å· |
| | | /// </summary> |
| | | [JsonProperty("lineNo")] |
| | | public string LineNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°é |
| | | /// </summary> |
| | | [JsonProperty("qty")] |
| | | public decimal Qty { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åä½ |
| | | /// </summary> |
| | | [JsonProperty("unit")] |
| | | public string Unit { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¡ç å表 |
| | | /// </summary> |
| | | [JsonProperty("barcodes")] |
| | | public List<BarcodeInfo>? Barcodes { get; set; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¡ç ä¿¡æ¯ |
| | | /// </summary> |
| | | [JsonObject(MemberSerialization.OptIn)] |
| | | public class BarcodeInfo |
| | | { |
| | | /// <summary> |
| | | /// æ¡ç |
| | | /// </summary> |
| | | [JsonProperty("barcode")] |
| | | public string Barcode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¹æ¬¡å· |
| | | /// </summary> |
| | | [JsonProperty("batchNo")] |
| | | public string BatchNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°é |
| | | /// </summary> |
| | | [JsonProperty("qty")] |
| | | public decimal Qty { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åä½ |
| | | /// </summary> |
| | | [JsonProperty("unit")] |
| | | public string Unit { get; set; } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Model.Models.Allocate; |
| | | |
| | | namespace WIDESEA_IAllocateService |
| | | { |
| | | |
| | | public interface IAllocateService : IService<Dt_AllocateOrder> |
| | | { |
| | | IRepository<Dt_AllocateOrder> Repository { get; } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <Project Sdk="Microsoft.NET.Sdk"> |
| | | |
| | | <PropertyGroup> |
| | | <TargetFramework>net6.0</TargetFramework> |
| | | <ImplicitUsings>enable</ImplicitUsings> |
| | | <Nullable>enable</Nullable> |
| | | </PropertyGroup> |
| | | |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\WIDESEA_Core\WIDESEA_Core.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_Model\WIDESEA_Model.csproj" /> |
| | | </ItemGroup> |
| | | |
| | | </Project> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Model.Models.Basic; |
| | | |
| | | namespace WIDESEA_IBasicService |
| | | { |
| | | public interface IDailySequenceService : IService<DT_DailySequence> |
| | | { |
| | | IRepository<DT_DailySequence> Repository { get; } |
| | | |
| | | Task<int> GetNextSequenceAsync(); |
| | | } |
| | | } |
| | |
| | | public interface IMaterialUnitService : IService<Dt_MaterialUnit> |
| | | { |
| | | IRepository<Dt_MaterialUnit> Repository { get; } |
| | | |
| | | Task<decimal> ConvertAsync(string materialCode, decimal quantity, string fromUnit, string toUnit); |
| | | |
| | | Task<decimal> ConvertPurchaseToStockAsync(string materialCode, decimal quantity); |
| | | |
| | | Task<decimal> ConvertIssueToStockAsync(string materialCode, decimal quantity); |
| | | } |
| | | } |
| | |
| | | IRepository<Dt_Task> Repository { get; } |
| | | |
| | | Task<WebResponseContent> RequestInboundTask(string palletCode, string stationCode); |
| | | |
| | | Task<WebResponseContent> TaskCompleted(string taskNum); |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | |
| | | StockQuantity = item.BarcodeQty, |
| | | Status = 0, |
| | | OrderNo = inboundOrder.InboundOrderNo, |
| | | BusinessType=inboundOrder.BusinessType, |
| | | }); |
| | | |
| | | item.ReceiptQuantity = item.BarcodeQty; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.DB.Models; |
| | | |
| | | namespace WIDESEA_Model.Models.Allocate |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_InboundOrder), "å
¥åºå")] |
| | | public class Dt_AllocateOrder : BaseEntity |
| | | { |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEA_Model.Models.Allocate |
| | | { |
| | | public class Dt_AllocateOrderDetail |
| | | { |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.DB.Models; |
| | | |
| | | namespace WIDESEA_Model.Models.Basic |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | |
| | | [SugarTable("DT_DailySequence")] |
| | | public class DT_DailySequence : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] |
| | | public long Id { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = false)] |
| | | public DateTime SequenceDate { get; set; } |
| | | |
| | | [SugarColumn(Length = 50, IsNullable = false)] |
| | | public string SequenceKey { get; set; } = "MESBarcode"; |
| | | |
| | | [SugarColumn(IsNullable = false)] |
| | | public int CurrentValue { get; set; } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | [SugarColumn(ColumnName = "barcode", ColumnDescription = "æ¡ç ")] |
| | | public string? Barcode { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// å¤ æ³¨:ä¸å¡ç±»å |
| | | /// é»è®¤å¼: |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "businessType", ColumnDescription = "ä¸å¡ç±»å")] |
| | | public string? BusinessType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | |
| | | public string PalletCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æçç±»å |
| | | /// æçç±»å -1 空æç |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "æçç±»å")] |
| | | public int PalletType { get; set; } |
| | |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "åæ®ç¼å·")] |
| | | public string? OrderNo { get; set; } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// ä¼å
级 |
| | | /// </summary> |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | |
| | | using Newtonsoft.Json; |
| | | using Org.BouncyCastle.Asn1.Ocsp; |
| | | using SqlSugar; |
| | | using System.Reflection; |
| | | using System.Reflection.Emit; |
| | | using System.Threading.Tasks; |
| | | using System.Xml.Linq; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.OrderEnum; |
| | |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEA_DTO.Task; |
| | |
| | | private readonly IRepository<Dt_StockInfo> _stockRepository; |
| | | private readonly ILocationInfoService _locationInfoService; |
| | | private readonly IInboundOrderService _inboundOrderService; |
| | | private readonly IInboundOrderDetailService _inboundOrderDetailService; |
| | | private readonly ILocationStatusChangeRecordService _locationStatusChangeRecordService; |
| | | private readonly IESSApiService _eSSApiService; |
| | | private readonly IStockService _stockService; |
| | | private readonly IRecordService _recordService; |
| | | public IRepository<Dt_Task> Repository => BaseDal; |
| | | |
| | | private Dictionary<string, SqlSugar.OrderByType> _taskOrderBy = new() |
| | |
| | | private Dictionary<string, string> stations = new Dictionary<string, string> |
| | | { |
| | | {"3-5","3-9" }, |
| | | {"2-5","2-9" }, |
| | | {"1-11","1-1" }, |
| | | {"2-5","2-9" }, |
| | | {"1-11","1-1" }, |
| | | }; |
| | | |
| | | public List<int> TaskTypes => typeof(TaskTypeEnum).GetEnumIndexList(); |
| | | |
| | | public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList(); |
| | | |
| | | public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger) : base(BaseDal) |
| | | public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | _locationStatusChangeRecordService = locationStatusChangeRecordService; |
| | | _eSSApiService = eSSApiService; |
| | | _logger = logger; |
| | | } |
| | | |
| | | public async Task<WebResponseContent> RequestInboundTask(string palletCode, string stationCode) |
| | | { |
| | | try |
| | | { |
| | | Dt_Task dbtask = Repository.QueryFirst(x => x.PalletCode == palletCode); |
| | | if (dbtask != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçå·²çæä»»å¡"); |
| | | } |
| | | |
| | | Dt_StockInfo stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First(); |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç»çä¿¡æ¯"); |
| | | } |
| | | |
| | | if (stockInfo.StockStatus != StockStatusEmun.ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æå¨ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æ£é宿.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçç¶æä¸æ£ç¡®,ä¸å¯ç³è¯·å
¥åº"); |
| | | } |
| | | if (!string.IsNullOrEmpty(stockInfo.LocationCode)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçå·²ç»å®è´§ä½"); |
| | | } |
| | | |
| | | Dt_LocationInfo? locationInfo = _locationInfoService.AssignLocation(); |
| | | if (locationInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"è´§ä½åé
失败,æªæ¾å°å¯åé
è´§ä½"); |
| | | } |
| | | |
| | | |
| | | var newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = stationCode, |
| | | Grade = 0, |
| | | NextAddress = stations.GetValueOrDefault(stationCode) ?? "", |
| | | PalletCode = palletCode, |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stationCode, |
| | | TargetAddress = locationInfo.LocationCode, |
| | | TaskType = TaskTypeEnum.Inbound.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | PalletType = stockInfo.PalletType, |
| | | }; |
| | | |
| | | if (stockInfo.PalletType == PalletTypeEnum.Empty.ObjToInt()) |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | _locationInfoService.UpdateData(locationInfo); |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | _stockRepository.UpdateData(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | else |
| | | { |
| | | //è·åæ¯å¦åå¨å
¥åºå |
| | | Dt_InboundOrder? inboundOrder = null; |
| | | if (stockInfo != null && stockInfo.Details.Count > 0) |
| | | { |
| | | string? orderNo = stockInfo.Details.FirstOrDefault()?.OrderNo ?? ""; |
| | | inboundOrder = _inboundOrderService.Repository.QueryFirst(x => x.InboundOrderNo == orderNo && x.OrderStatus < InOrderStatusEnum.å
¥åºå®æ.ObjToInt()); |
| | | } |
| | | |
| | | if (inboundOrder != null) |
| | | { |
| | | if (inboundOrder.OrderType == InOrderTypeEnum.Allocat.ObjToInt()) |
| | | { |
| | | newTask.TaskType = TaskTypeEnum.InAllocate.ObjToInt(); |
| | | } |
| | | else if (inboundOrder.OrderType == InOrderTypeEnum.Return.ObjToInt()) |
| | | { |
| | | newTask.TaskType = TaskTypeEnum.ProductionReturn.ObjToInt(); |
| | | } |
| | | } |
| | | if (stockInfo.StockStatus == StockStatusEmun.æå¨ç»çæå.ObjToInt()) |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.æå¨ç»çå
¥åºç¡®è®¤.ObjToInt(); |
| | | } |
| | | else if (stockInfo.StockStatus == StockStatusEmun.MESéåº.ObjToInt()) |
| | | { |
| | | newTask.TaskType = TaskTypeEnum.MesMatReturn.ObjToInt(); |
| | | } |
| | | else if (stockInfo.StockStatus == StockStatusEmun.æ£é宿.ObjToInt()) |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | newTask.TaskType = TaskTypeEnum.InPick.ObjToInt(); |
| | | } |
| | | else if (stockInfo.StockStatus == StockStatusEmun.鿣åºå宿.ObjToInt()) |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.æå¨ç»çå
¥åºç¡®è®¤.ObjToInt(); |
| | | newTask.TaskType = TaskTypeEnum.InQuality.ObjToInt(); |
| | | } |
| | | else if (stockInfo.StockStatus == StockStatusEmun.çç¹åºå宿.ObjToInt()) |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.æå¨ç»çå
¥åºç¡®è®¤.ObjToInt(); |
| | | newTask.TaskType = TaskTypeEnum.InInventory.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | } |
| | | |
| | | LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | |
| | | _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, locationInfo.LocationStatus, StockChangeType.Inbound.ObjToInt(), inboundOrder.InboundOrderNo, newTask.TaskNum); |
| | | |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | _locationInfoService.UpdateData(locationInfo); |
| | | |
| | | _stockRepository.UpdateData(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | TaskModel esstask = new TaskModel() |
| | | { |
| | | taskType = "putaway", |
| | | taskGroupCode = "", |
| | | groupPriority = 0, |
| | | tasks = new List<TasksType> |
| | | { |
| | | new() |
| | | { |
| | | taskCode=newTask.TaskNum.ToString(), |
| | | taskPriority=0, |
| | | taskDescribe=new TaskDescribeType{ |
| | | containerCode=palletCode, |
| | | containerType= "CT_KUBOT_STANDARD", |
| | | fromLocationCode=stations.GetValueOrDefault(stationCode)??"", |
| | | toStationCode="", |
| | | toLocationCode=locationInfo.LocationCode, |
| | | deadline=0,storageTag="" |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | _logger.LogInformation("å建任å¡Request: " + JsonConvert.SerializeObject(esstask)); |
| | | var result = await _eSSApiService.CreateTaskAsync(esstask); |
| | | |
| | | _logger.LogInformation("å建任å¡è¿å: " + result); |
| | | if (result) |
| | | { |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error("ä¸åæºå¨äººä»»å¡å¤±è´¥ï¼"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å
¥ç©ºç®± |
| | | /// </summary> |
| | | /// <param name="palletCode"></param> |
| | | /// <param name="address"></param> |
| | | /// <param name="WarehouseId"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent InEmpty(string palletCode, string address, int WarehouseId) |
| | | { |
| | | try |
| | | { |
| | | |
| | | Dt_Task dbtask = Repository.QueryFirst(x => x.PalletCode == palletCode); |
| | | if (dbtask != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçå·²çæä»»å¡"); |
| | | } |
| | | |
| | | Dt_StockInfo stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).First(); |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç»çä¿¡æ¯"); |
| | | } |
| | | if (stockInfo.StockStatus != StockStatusEmun.ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æå¨ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æ£é宿.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçç¶æä¸æ£ç¡®,ä¸å¯ç³è¯·å
¥åº"); |
| | | } |
| | | if (!string.IsNullOrEmpty(stockInfo.LocationCode)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçå·²ç»å®è´§ä½"); |
| | | } |
| | | //stockInfo = new Dt_StockInfo() |
| | | //{ |
| | | // PalletCode = barcode, |
| | | // StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(), |
| | | // WarehouseId = WarehouseId, |
| | | // PalletType = PalletTypeEnum.Empty.ObjToInt(), |
| | | // Details = new List<Dt_StockInfoDetail>() |
| | | //}; |
| | | |
| | | var locationInfo = _locationInfoService.AssignLocation(); |
| | | if (locationInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"è´§ä½åé
失败,æªæ¾å°å¯åé
è´§ä½"); |
| | | } |
| | | |
| | | Dt_Task newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = address, |
| | | Grade = 0, |
| | | NextAddress = locationInfo.LocationCode, |
| | | PalletCode = palletCode, |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = address, |
| | | TargetAddress = locationInfo.LocationCode, |
| | | TaskType = TaskTypeEnum.InEmpty.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | PalletType = stockInfo.PalletType |
| | | }; |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | _locationInfoService.UpdateData(locationInfo); |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | _stockRepository.AddData(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | _stockService = stockService; |
| | | _recordService = recordService; |
| | | _inboundOrderDetailService = inboundOrderDetailService; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> TaskCompleted(int taskNum) |
| | | public async Task<WebResponseContent> TaskCompleted(string taskNum) |
| | | { |
| | | try |
| | | { |
| | | Dt_Task task; |
| | | if (int.TryParse(taskNum, out var newTaskNum)) |
| | | { |
| | | task = BaseDal.QueryFirst(x => x.TaskNum == newTaskNum); |
| | | if (task == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ä¿¡æ¯"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ä¿¡æ¯"); |
| | | } |
| | | |
| | | MethodInfo? methodInfo = GetType().GetMethod(((TaskTypeEnum)task.TaskType) + "TaskCompleted"); |
| | | if (methodInfo != null) |
| | | { |
| | | WebResponseContent? responseContent = (WebResponseContent?)methodInfo.Invoke(this, new object[] { task }); |
| | | if (responseContent != null) |
| | | { |
| | | return responseContent; |
| | | } |
| | | } |
| | | return WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ç±»å对åºä¸å¡å¤çé»è¾"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// å
¥åºå®æ |
| | | /// </summary> |
| | | /// <param name="task"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent InboundTaskCompleted(Dt_Task task) |
| | | { |
| | | decimal beforeQuantity = 0; |
| | | |
| | | //æ¥åºå |
| | | Dt_StockInfo stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode && x.WarehouseId == task.WarehouseId).First(); |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°æç对åºçç»çä¿¡æ¯"); |
| | | } |
| | | if (stockInfo.Details.Count == 0 && stockInfo.PalletType != PalletTypeEnum.Empty.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥æçåºåæç»ä¿¡æ¯"); |
| | | } |
| | | //æ¥è´§ä½ |
| | | Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | if (locationInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å¯¹åºçç»ç¹è´§ä½ä¿¡æ¯"); |
| | | } |
| | | |
| | | var ordernos = stockInfo.Details.GroupBy(x => x.OrderNo).Select(o => o.Key).ToList(); |
| | | var inboundOrders = _inboundOrderService.Repository.Db.Queryable<Dt_InboundOrder>().Where(x => ordernos.Contains(x.InboundOrderNo)).Includes(x => x.Details).ToList(); |
| | | Dt_InboundOrderDetail? inboundOrderDetail = null; |
| | | |
| | | foreach (var inboundOrder in inboundOrders) |
| | | { |
| | | //æ åå
¥åºæµç¨æ¥æ¾å
¥åºåæ® |
| | | if (inboundOrder != null && stockInfo.StockStatus == StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt()) |
| | | { |
| | | foreach (var item in stockInfo.Details.Where(x => x.OrderNo == inboundOrder.InboundOrderNo).ToList()) |
| | | { |
| | | var inbounddetail = inboundOrder.Details.Where(x => x.lineNo == item.InboundOrderRowNo && x.Barcode == item.Barcode).FirstOrDefault(); |
| | | if (inbounddetail != null) |
| | | { |
| | | inbounddetail.OverInQuantity += item.StockQuantity; |
| | | if (inbounddetail.OverInQuantity == inbounddetail.OrderQuantity) |
| | | { |
| | | inbounddetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt(); |
| | | } |
| | | else if (inbounddetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt()) |
| | | { |
| | | inbounddetail.OrderDetailStatus = OrderDetailStatusEnum.Inbounding.ObjToInt(); |
| | | } |
| | | _inboundOrderDetailService.UpdateData(inbounddetail); |
| | | } |
| | | } |
| | | if (inboundOrder.Details.Count == inboundOrder.Details.Where(x => x.OrderQuantity == x.OverInQuantity).Count()) |
| | | { |
| | | inboundOrder.OrderStatus = InOrderStatusEnum.å
¥åºå®æ.ObjToInt(); |
| | | } |
| | | else if (inboundOrder.OrderStatus == InOrderStatusEnum.æªå¼å§.ObjToInt()) |
| | | { |
| | | inboundOrder.OrderStatus = InOrderStatusEnum.å
¥åºä¸.ObjToInt(); |
| | | } |
| | | _inboundOrderService.UpdateData(inboundOrder); |
| | | } |
| | | } |
| | | stockInfo.LocationCode = task.TargetAddress; |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | stockInfo.Details.ForEach(x => |
| | | { |
| | | x.Status = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | }); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | _stockService.StockInfoDetailService.Repository.UpdateData(stockInfo.Details); |
| | | |
| | | beforeQuantity = stockInfo.Details.Where(x => x.Id != 0).Sum(x => x.StockQuantity); |
| | | |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | if (stockInfo.PalletType == PalletTypeEnum.Empty.ObjToInt()) |
| | | { |
| | | locationInfo.LocationStatus = LocationStatusEnum.Pallet.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | } |
| | | _locationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | |
| | | _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum); |
| | | |
| | | _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) + beforeQuantity, WIDESEA_Common.StockEnum.StockChangeType.MaterielGroup); |
| | | |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | |
| | | |
| | | public async Task<WebResponseContent> InEmptyTaskCompleted(Dt_Task task) |
| | | { |
| | | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_Task task = await Repository.QueryFirstAsync(x => x.TaskNum == taskNum); |
| | | if (task == null) |
| | | { |
| | | return await Task.FromResult(WebResponseContent.Instance.Error($"æªæ¾å°ä»»å¡ä¿¡æ¯")); |
| | | } |
| | | |
| | | Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | if (locationInfo == null) |
| | | { |
| | | return content.Error($"æªæ¾å°å¯¹åºçç»ç¹è´§ä½ä¿¡æ¯"); |
| | | } |
| | | Dt_StockInfo stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode && x.WarehouseId == task.WarehouseId).Includes(x => x.Details).First(); |
| | | Dt_StockInfo stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode && x.WarehouseId == task.WarehouseId).First(); |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°æç对åºçç»çä¿¡æ¯"); |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"è´§ä½ç¶æä¸æ£ç¡®"); |
| | | } |
| | | LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | |
| | | |
| | | var beforelocationStatus = locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.Pallet.ObjToInt(); |
| | | _locationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | | stockInfo.LocationCode = locationInfo.LocationCode; |
| | | stockInfo.PalletCode = task.PalletCode; |
| | | stockInfo.LocationCode = task.TargetAddress; |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | _stockRepository.UpdateData(stockInfo); |
| | | |
| | | Dt_InboundOrder? inboundOrder = _inboundOrderService.Repository.Db.Queryable<Dt_InboundOrder>().Where(x => x.InboundOrderNo == stockInfo.Details.FirstOrDefault().OrderNo).Includes(x => x.Details).First(); |
| | | Dt_InboundOrderDetail? inboundOrderDetail = null; |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? WIDESEA_Core.Enums.OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | |
| | | _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforelocationStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum); |
| | | |
| | | |
| | | |
| | | return content; |
| | | } |
| | |
| | | return await Task.FromResult(WebResponseContent.Instance.Error(ex.Message)); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public async Task<WebResponseContent> OutEmptyTaskCompleted(Dt_Task task) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_StockInfo stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode && x.WarehouseId == task.WarehouseId).First(); |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°æç对åºçåºåä¿¡æ¯"); |
| | | } |
| | | Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress); |
| | | |
| | | if (locationInfo == null) |
| | | { |
| | | return content.Error($"æªæ¾å°å¯¹åºçç»ç¹è´§ä½ä¿¡æ¯"); |
| | | } |
| | | |
| | | _stockRepository.Db.Deleteable(stockInfo); |
| | | |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | |
| | | _locationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | | |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | |
| | | _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return await Task.FromResult(WebResponseContent.Instance.Error(ex.Message)); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.Extensions.Logging; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_TaskInfoService |
| | | { |
| | | public partial class TaskService |
| | | { |
| | | |
| | | public async Task<WebResponseContent> RequestInboundTask(string palletCode, string stationCode) |
| | | { |
| | | try |
| | | { |
| | | Dt_Task dbtask = Repository.QueryFirst(x => x.PalletCode == palletCode); |
| | | if (dbtask != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçå·²çæä»»å¡"); |
| | | } |
| | | |
| | | Dt_StockInfo stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First(); |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç»çä¿¡æ¯"); |
| | | } |
| | | |
| | | if (stockInfo.StockStatus != StockStatusEmun.ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æå¨ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æ£é宿.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçç¶æä¸æ£ç¡®,ä¸å¯ç³è¯·å
¥åº"); |
| | | } |
| | | if (!string.IsNullOrEmpty(stockInfo.LocationCode)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçå·²ç»å®è´§ä½"); |
| | | } |
| | | |
| | | Dt_LocationInfo? locationInfo = _locationInfoService.AssignLocation(); |
| | | if (locationInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"è´§ä½åé
失败,æªæ¾å°å¯åé
è´§ä½"); |
| | | } |
| | | |
| | | |
| | | var newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = stationCode, |
| | | Grade = 0, |
| | | NextAddress = stations.GetValueOrDefault(stationCode) ?? "", |
| | | PalletCode = palletCode, |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stationCode, |
| | | TargetAddress = locationInfo.LocationCode, |
| | | TaskType = TaskTypeEnum.Inbound.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | PalletType = stockInfo.PalletType, |
| | | |
| | | }; |
| | | //空箱 |
| | | if (stockInfo.PalletType == PalletTypeEnum.Empty.ObjToInt()) |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | newTask.TaskType = TaskTypeEnum.InEmpty.ObjToInt(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | _locationInfoService.UpdateData(locationInfo); |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | |
| | | _stockRepository.UpdateData(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | else |
| | | { |
| | | //è·åæ¯å¦åå¨å
¥åºå |
| | | Dt_InboundOrder? inboundOrder = null; |
| | | if (stockInfo != null && stockInfo.Details.Count > 0) |
| | | { |
| | | string? orderNo = stockInfo.Details.FirstOrDefault()?.OrderNo ?? ""; |
| | | inboundOrder = _inboundOrderService.Repository.QueryFirst(x => x.InboundOrderNo == orderNo && x.OrderStatus < InOrderStatusEnum.å
¥åºå®æ.ObjToInt()); |
| | | |
| | | } |
| | | |
| | | |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | |
| | | LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | |
| | | _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, locationInfo.LocationStatus, StockChangeType.Inbound.ObjToInt(), inboundOrder?.InboundOrderNo, newTask.TaskNum); |
| | | |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | _locationInfoService.UpdateData(locationInfo); |
| | | |
| | | _stockRepository.UpdateData(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | TaskModel esstask = new TaskModel() |
| | | { |
| | | taskType = "putaway", |
| | | taskGroupCode = "", |
| | | groupPriority = 0, |
| | | tasks = new List<TasksType> |
| | | { |
| | | new() |
| | | { |
| | | taskCode=newTask.TaskNum.ToString(), |
| | | taskPriority=0, |
| | | taskDescribe=new TaskDescribeType{ |
| | | containerCode=palletCode, |
| | | containerType= "CT_KUBOT_STANDARD", |
| | | fromLocationCode=stations.GetValueOrDefault(stationCode)??"", |
| | | toStationCode="", |
| | | toLocationCode=locationInfo.LocationCode, |
| | | deadline=0,storageTag="" |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | _logger.LogInformation("å建任å¡Request: " + JsonConvert.SerializeObject(esstask)); |
| | | var result = await _eSSApiService.CreateTaskAsync(esstask); |
| | | |
| | | _logger.LogInformation("å建任å¡è¿å: " + result); |
| | | if (result) |
| | | { |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error("ä¸åæºå¨äººä»»å¡å¤±è´¥ï¼"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å
¥ç©ºç®± |
| | | /// </summary> |
| | | /// <param name="palletCode"></param> |
| | | /// <param name="address"></param> |
| | | /// <param name="WarehouseId"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent InEmpty(string palletCode, string address, int WarehouseId) |
| | | { |
| | | try |
| | | { |
| | | |
| | | Dt_Task dbtask = Repository.QueryFirst(x => x.PalletCode == palletCode); |
| | | if (dbtask != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçå·²çæä»»å¡"); |
| | | } |
| | | |
| | | Dt_StockInfo stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).First(); |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç»çä¿¡æ¯"); |
| | | } |
| | | if (stockInfo.StockStatus != StockStatusEmun.ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æå¨ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æ£é宿.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçç¶æä¸æ£ç¡®,ä¸å¯ç³è¯·å
¥åº"); |
| | | } |
| | | if (!string.IsNullOrEmpty(stockInfo.LocationCode)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçå·²ç»å®è´§ä½"); |
| | | } |
| | | //stockInfo = new Dt_StockInfo() |
| | | //{ |
| | | // PalletCode = barcode, |
| | | // StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(), |
| | | // WarehouseId = WarehouseId, |
| | | // PalletType = PalletTypeEnum.Empty.ObjToInt(), |
| | | // Details = new List<Dt_StockInfoDetail>() |
| | | //}; |
| | | |
| | | var locationInfo = _locationInfoService.AssignLocation(); |
| | | if (locationInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"è´§ä½åé
失败,æªæ¾å°å¯åé
è´§ä½"); |
| | | } |
| | | |
| | | Dt_Task newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = address, |
| | | Grade = 0, |
| | | NextAddress = locationInfo.LocationCode, |
| | | PalletCode = palletCode, |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = address, |
| | | TargetAddress = locationInfo.LocationCode, |
| | | TaskType = TaskTypeEnum.InEmpty.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | PalletType = stockInfo.PalletType |
| | | }; |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | _locationInfoService.UpdateData(locationInfo); |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | _stockRepository.AddData(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.Extensions.Logging; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.OtherEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_TaskInfoService |
| | | { |
| | | public partial class TaskService |
| | | { |
| | | /// <summary> |
| | | /// 空æçåºåºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="inTask"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> PalletOutboundTask(string endStation, string palletCode = "") |
| | | { |
| | | try |
| | | { |
| | | Dt_StockInfo stockInfo ; |
| | | if (string.IsNullOrEmpty(palletCode)) |
| | | { |
| | | stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletType == PalletTypeEnum.Empty.ObjToInt()).First(); |
| | | } |
| | | else |
| | | { |
| | | stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode) .First(); |
| | | } |
| | | |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°ç©ºæçåºå"); |
| | | } |
| | | Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode); |
| | | if (locationInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°ç©ºæçåºå对åºçè´§ä½ä¿¡æ¯"); |
| | | } |
| | | |
| | | Dt_Task task = new Dt_Task() |
| | | { |
| | | CurrentAddress = stockInfo.LocationCode, |
| | | Grade = 0, |
| | | NextAddress = endStation, |
| | | PalletCode = stockInfo.PalletCode, |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stockInfo.LocationCode, |
| | | TargetAddress = endStation, |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | TaskType = TaskTypeEnum.OutEmpty.ObjToInt(), |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | PalletType = stockInfo.PalletType |
| | | |
| | | }; |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | _unitOfWorkManage.BeginTran(); |
| | | stockInfo.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | |
| | | int taskId = BaseDal.AddData(task); |
| | | task.TaskId = taskId; |
| | | |
| | | _stockService.StockInfoService.UpdateData(stockInfo); |
| | | |
| | | _locationInfoService.UpdateData(locationInfo); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), "", task.TaskNum); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | TaskModel esstask = new TaskModel() |
| | | { |
| | | taskType = "carry", |
| | | taskGroupCode = "", |
| | | groupPriority = 0, |
| | | tasks = new List<TasksType> |
| | | { |
| | | new() |
| | | { |
| | | taskCode=task.TaskNum.ToString(), |
| | | taskPriority=0, |
| | | taskDescribe=new TaskDescribeType{ |
| | | containerCode=stockInfo.PalletCode, |
| | | containerType= "CT_KUBOT_STANDARD", |
| | | fromLocationCode=stockInfo.LocationCode??"", |
| | | toStationCode="", |
| | | toLocationCode=endStation, |
| | | deadline=0,storageTag="" |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | _logger.LogInformation("å建任å¡PalletOutboundTask Request: " + JsonConvert.SerializeObject(esstask)); |
| | | var result = await _eSSApiService.CreateTaskAsync(esstask); |
| | | |
| | | _logger.LogInformation("å建任å¡PalletOutboundTask è¿å: " + result); |
| | | if (result) |
| | | { |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error("ä¸åæºå¨äººä»»å¡å¤±è´¥ï¼"); |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WIDESEA_CheckService", "WIDESEA_CheckService\WIDESEA_CheckService.csproj", "{C57C16CE-88A7-499A-8CE1-855D55482891}" |
| | | EndProject |
| | | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Allocate", "Allocate", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}" |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WIDESEA_AllocateService", "WIDESEA_AllocateService\WIDESEA_AllocateService.csproj", "{D35E0897-0E66-4E1E-B8DA-28701BE3B2B7}" |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WIDESEA_IAllocateService", "WIDESEA_IAllocateService\WIDESEA_IAllocateService.csproj", "{A6E822A3-5A09-4B18-BEE6-57CC7D7B8BEC}" |
| | | EndProject |
| | | Global |
| | | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
| | | Debug|Any CPU = Debug|Any CPU |
| | |
| | | {C57C16CE-88A7-499A-8CE1-855D55482891}.Release|Any CPU.Build.0 = Release|Any CPU |
| | | {C57C16CE-88A7-499A-8CE1-855D55482891}.Release|x86.ActiveCfg = Release|Any CPU |
| | | {C57C16CE-88A7-499A-8CE1-855D55482891}.Release|x86.Build.0 = Release|Any CPU |
| | | {D35E0897-0E66-4E1E-B8DA-28701BE3B2B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
| | | {D35E0897-0E66-4E1E-B8DA-28701BE3B2B7}.Debug|Any CPU.Build.0 = Debug|Any CPU |
| | | {D35E0897-0E66-4E1E-B8DA-28701BE3B2B7}.Debug|x86.ActiveCfg = Debug|Any CPU |
| | | {D35E0897-0E66-4E1E-B8DA-28701BE3B2B7}.Debug|x86.Build.0 = Debug|Any CPU |
| | | {D35E0897-0E66-4E1E-B8DA-28701BE3B2B7}.Dev|Any CPU.ActiveCfg = Release|Any CPU |
| | | {D35E0897-0E66-4E1E-B8DA-28701BE3B2B7}.Dev|Any CPU.Build.0 = Release|Any CPU |
| | | {D35E0897-0E66-4E1E-B8DA-28701BE3B2B7}.Dev|x86.ActiveCfg = Release|Any CPU |
| | | {D35E0897-0E66-4E1E-B8DA-28701BE3B2B7}.Dev|x86.Build.0 = Release|Any CPU |
| | | {D35E0897-0E66-4E1E-B8DA-28701BE3B2B7}.Release|Any CPU.ActiveCfg = Release|Any CPU |
| | | {D35E0897-0E66-4E1E-B8DA-28701BE3B2B7}.Release|Any CPU.Build.0 = Release|Any CPU |
| | | {D35E0897-0E66-4E1E-B8DA-28701BE3B2B7}.Release|x86.ActiveCfg = Release|Any CPU |
| | | {D35E0897-0E66-4E1E-B8DA-28701BE3B2B7}.Release|x86.Build.0 = Release|Any CPU |
| | | {A6E822A3-5A09-4B18-BEE6-57CC7D7B8BEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
| | | {A6E822A3-5A09-4B18-BEE6-57CC7D7B8BEC}.Debug|Any CPU.Build.0 = Debug|Any CPU |
| | | {A6E822A3-5A09-4B18-BEE6-57CC7D7B8BEC}.Debug|x86.ActiveCfg = Debug|Any CPU |
| | | {A6E822A3-5A09-4B18-BEE6-57CC7D7B8BEC}.Debug|x86.Build.0 = Debug|Any CPU |
| | | {A6E822A3-5A09-4B18-BEE6-57CC7D7B8BEC}.Dev|Any CPU.ActiveCfg = Release|Any CPU |
| | | {A6E822A3-5A09-4B18-BEE6-57CC7D7B8BEC}.Dev|Any CPU.Build.0 = Release|Any CPU |
| | | {A6E822A3-5A09-4B18-BEE6-57CC7D7B8BEC}.Dev|x86.ActiveCfg = Release|Any CPU |
| | | {A6E822A3-5A09-4B18-BEE6-57CC7D7B8BEC}.Dev|x86.Build.0 = Release|Any CPU |
| | | {A6E822A3-5A09-4B18-BEE6-57CC7D7B8BEC}.Release|Any CPU.ActiveCfg = Release|Any CPU |
| | | {A6E822A3-5A09-4B18-BEE6-57CC7D7B8BEC}.Release|Any CPU.Build.0 = Release|Any CPU |
| | | {A6E822A3-5A09-4B18-BEE6-57CC7D7B8BEC}.Release|x86.ActiveCfg = Release|Any CPU |
| | | {A6E822A3-5A09-4B18-BEE6-57CC7D7B8BEC}.Release|x86.Build.0 = Release|Any CPU |
| | | EndGlobalSection |
| | | GlobalSection(SolutionProperties) = preSolution |
| | | HideSolutionNode = FALSE |
| | |
| | | {294A53A4-1311-4B71-A812-378A2BCB8346} = {60DE2920-37C6-4C2B-A053-6B1B2DAF047A} |
| | | {82EBBC95-FD6E-4E30-9F21-625DE1991C2C} = {294A53A4-1311-4B71-A812-378A2BCB8346} |
| | | {C57C16CE-88A7-499A-8CE1-855D55482891} = {294A53A4-1311-4B71-A812-378A2BCB8346} |
| | | {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} = {60DE2920-37C6-4C2B-A053-6B1B2DAF047A} |
| | | {D35E0897-0E66-4E1E-B8DA-28701BE3B2B7} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} |
| | | {A6E822A3-5A09-4B18-BEE6-57CC7D7B8BEC} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} |
| | | EndGlobalSection |
| | | GlobalSection(ExtensibilityGlobals) = postSolution |
| | | SolutionGuid = {599A7267-7402-4143-84AE-9B407FC2BB69} |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using WIDESEA_Core.BaseController; |
| | | using WIDESEA_IAllocateService; |
| | | using WIDESEA_IInboundService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Model.Models.Allocate; |
| | | |
| | | namespace WIDESEA_WMSServer.Controllers.Allocate |
| | | { |
| | | |
| | | /// <summary> |
| | | /// è°æ¨å |
| | | /// </summary> |
| | | [Route("api/AllocateOrder")] |
| | | [ApiController] |
| | | public class AllocateOrderController : ApiBaseController<IAllocateService, Dt_AllocateOrder> |
| | | { |
| | | public AllocateOrderController(IAllocateService service) : base(service) |
| | | { |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.Extensions.Caching.Memory; |
| | | using Newtonsoft.Json; |
| | | using System.DirectoryServices.Protocols; |
| | | using System.Threading.Tasks; |
| | |
| | | |
| | | public readonly ITaskService _taskService; |
| | | private readonly ILogger<ESSController> _logger; |
| | | public ESSController(ITaskService taskService, ILogger<ESSController> logger) |
| | | private readonly IMemoryCache _memoryCache; |
| | | private static readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1); |
| | | public ESSController(ITaskService taskService, ILogger<ESSController> logger, IMemoryCache memoryCache) |
| | | { |
| | | _taskService = taskService; |
| | | _logger = logger; |
| | | _memoryCache = memoryCache; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | [HttpPost("ContainerArrivalReport"), AllowAnonymous] |
| | | public async Task<IActionResult> ContainerArrivalReport([FromBody] ContainerArrivalRequest request) |
| | | { |
| | | //è¿éè¦å¤æåºåºçæ¶åï¼æç®±ä¼å°æ«ç å¤ãä¹ä¼è¯·æ±è¿ä¸ªæ¥å£ã |
| | | |
| | | var response = new ApiResponse<ContainerArrivalResponseData> |
| | | { |
| | | Code = 0, |
| | |
| | | direction = "100" // 示ä¾å¼ï¼å¯æ ¹æ®å®é
æ
åµè¿åæ¹åæå
¶ä»ä¿¡æ¯ |
| | | } |
| | | }; |
| | | var result = await _taskService.RequestInboundTask(request.ContainerCode, request.SlotCode); |
| | | if (result.Status) |
| | | |
| | | // çæè¯·æ±çå¯ä¸æ è¯ï¼åºäºcallId + æ¶é´æ³ï¼ |
| | | var requestKey = $"callback_{request.CallId}-{request.ContainerCode}_{DateTime.UtcNow:yyyyMMddHH}"; |
| | | |
| | | // æ£æ¥æ¯å¦å·²ç»å¤çè¿ç¸åçè¯·æ± |
| | | if (_memoryCache.TryGetValue(requestKey, out bool _)) |
| | | { |
| | | return Ok(response); |
| | | } |
| | | else |
| | | { |
| | | _logger.LogWarning("æ£æµå°éå¤è¯·æ±ï¼å·²å¿½ç¥: CallId={CallId}", request.CallId); |
| | | response.Code = 1; |
| | | response.Msg = "error"; |
| | | response.Data.direction = "0"; |
| | | return Ok(response); |
| | | return Ok(response); |
| | | } |
| | | |
| | | |
| | | await _semaphore.WaitAsync(); |
| | | try |
| | | { |
| | | if (_memoryCache.TryGetValue(requestKey, out bool _)) |
| | | { |
| | | _logger.LogWarning("åéæ£æ¥æ£æµå°éå¤è¯·æ±ï¼å·²å¿½ç¥: CallId={CallId}", request.CallId); |
| | | response.Code = 1; |
| | | response.Msg = "error"; |
| | | response.Data.direction = "0"; |
| | | return Ok(response); |
| | | } |
| | | |
| | | var result = await _taskService.RequestInboundTask(request.ContainerCode, request.SlotCode); |
| | | |
| | | var cacheOptions = new MemoryCacheEntryOptions |
| | | { |
| | | AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(1) |
| | | }; |
| | | _memoryCache.Set(requestKey, true, cacheOptions); |
| | | if (result.Status) |
| | | { |
| | | response = new ApiResponse<ContainerArrivalResponseData> |
| | | { |
| | | Code = 0, |
| | | Msg = "", |
| | | Data = new ContainerArrivalResponseData |
| | | { |
| | | direction = "100" |
| | | } |
| | | }; |
| | | return Ok(response); |
| | | } |
| | | else |
| | | { |
| | | response.Code = 1; |
| | | response.Msg = "error"; |
| | | response.Data.direction = "0"; |
| | | return Ok(response); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _logger.LogError(ex, "å¤çä»»å¡ç¶æåè°æ¶åçå¼å¸¸: CallId={CallId}", request.CallId); |
| | | return Ok($"å¤çåè°æ¶åçå¼å¸¸: {ex.Message}"); |
| | | } |
| | | finally |
| | | { |
| | | _semaphore.Release(); |
| | | } |
| | | |
| | | } |
| | |
| | | // æ ¹æ®äºä»¶ç±»ååç¶æè¿è¡ä¸åçä¸å¡å¤ç |
| | | switch (request.EventType) |
| | | { |
| | | case EventType.task: |
| | | await HandleTaskStatusChange(request); |
| | | break; |
| | | case EventType.task_allocated: |
| | | await HandleTaskAllocated(request); |
| | | break; |
| | | case EventType.tote_load: |
| | | await HandleToteLoad(request); |
| | | break; |
| | |
| | | case EventType.robot_reach: |
| | | await HandleRobotReach(request); |
| | | break; |
| | | case EventType.task: |
| | | await HandleTaskStatusChange(request); |
| | | break; |
| | | case EventType.task_allocated: |
| | | await HandleTaskAllocated(request); |
| | | break; |
| | | |
| | | default: |
| | | _logger.LogWarning("æªç¥çäºä»¶ç±»å: {EventType}", request.EventType); |
| | | break; |
| | |
| | | _logger.LogInformation("ä»»å¡å®æ: TaskCode={TaskCode}, Container={Container}, Robot={Robot}", |
| | | request.TaskCode, request.ContainerCode, request.RobotCode); |
| | | |
| | | _taskService.TaskCompleted(request.TaskCode); |
| | | // æ ¹æ®ä¸åçä»»å¡ç±»åè¿è¡ç¹æ®å¤ç |
| | | if (request.Weight.HasValue) |
| | | { |
| | |
| | | using SqlSugar; |
| | | using System.Net; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_BasicService; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Attributes; |
| | |
| | | private readonly WIDESEA_IBasicService.IInvokeMESService _invokeMESService; |
| | | |
| | | private readonly IESSApiService _eSSApiService; |
| | | public InboundOrderController(IInboundOrderService service, WIDESEA_IBasicService.IErpApiService erpApiService, WIDESEA_IBasicService.IInvokeMESService invokeMESService, IESSApiService eSSApiService) : base(service) |
| | | |
| | | private readonly IDailySequenceService _dailySequenceService; |
| | | public InboundOrderController(IInboundOrderService service, WIDESEA_IBasicService.IErpApiService erpApiService, WIDESEA_IBasicService.IInvokeMESService invokeMESService, IESSApiService eSSApiService, IDailySequenceService dailySequenceService) : base(service) |
| | | { |
| | | this.erpApiService = erpApiService; |
| | | _invokeMESService = invokeMESService; |
| | | _eSSApiService = eSSApiService; |
| | | _dailySequenceService = dailySequenceService; |
| | | } |
| | | |
| | | [HttpPost, Route("Test"), AllowAnonymous, MethodParamsValidate] |
| | | public async Task<WebResponseContent> Test() |
| | | { |
| | | await _dailySequenceService.GetNextSequenceAsync(); |
| | | //erpApiService.GetSuppliersAsync(); |
| | | |
| | | //erpApiService.GetMaterialUnitAsync(); |
| | |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\WIDESEA_AllocateService\WIDESEA_AllocateService.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_BasicService\WIDESEA_BasicService.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_CheckService\WIDESEA_CheckService.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_InboundService\WIDESEA_InboundService.csproj" /> |