16 changed files with 1881 additions and 369 deletions
@ -0,0 +1,61 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Uow; |
|||
using Volo.Abp.Users; |
|||
using Win_in.Sfs.Basedata.Application.Contracts; |
|||
using Win_in.Sfs.Basedata.Domain; |
|||
using Win_in.Sfs.Basedata.Domain.Shared; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
using Win_in.Sfs.Wms.Inventory.Application.Contracts; |
|||
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
using Win_in.Sfs.Wms.Store.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Jobs.AgvJobs; |
|||
|
|||
|
|||
[AllowAnonymous] |
|||
[Route($"{StoreConsts.RootPath}agv-job-Account")] |
|||
public class AgvJobAccountService : ApplicationService |
|||
{ |
|||
|
|||
private readonly Func<string, IAgvJobAccountService> _Accessor; |
|||
|
|||
|
|||
public AgvJobAccountService( |
|||
Func<string, IAgvJobAccountService> Accessor |
|||
|
|||
|
|||
) |
|||
{ |
|||
_Accessor = Accessor; |
|||
|
|||
} |
|||
|
|||
public async Task<AgvResultObject> AccountOutOrderAsync(AgvRequestOnlyJobHK request) |
|||
{ |
|||
var res = new AgvResultObject(); |
|||
res.Code = "0"; |
|||
|
|||
var first=request.Data.FirstOrDefault(); |
|||
var agvJobAccountService = _Accessor(first.OrderType); |
|||
var result = await agvJobAccountService.AccountOutOrderAsync(request).ConfigureAwait(false); |
|||
if (result.Code!= "0") |
|||
{ |
|||
res.Code = "1"; |
|||
res.Message = result.Message; |
|||
|
|||
} |
|||
|
|||
return res; |
|||
|
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,94 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Net.Http.Headers; |
|||
using System.Net.Http; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using MyNamespace; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Uow; |
|||
using Volo.Abp.Users; |
|||
using Win_in.Sfs.Basedata.Application.Contracts; |
|||
using Win_in.Sfs.Basedata.Domain; |
|||
using Win_in.Sfs.Basedata.Domain.Shared; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
using Win_in.Sfs.Wms.Inventory.Application.Contracts; |
|||
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
using Win_in.Sfs.Wms.Store.Domain.Shared; |
|||
using Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; |
|||
using Microsoft.Extensions.Options; |
|||
using Win_in.Sfs.Wms.Store.Options; |
|||
using Microsoft.Extensions.Logging; |
|||
using Win_in.Sfs.Shared.Application.Contracts; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Jobs.AgvJobs; |
|||
[AllowAnonymous] |
|||
[Route($"{StoreConsts.RootPath}agv-job-in")] |
|||
public class AgvJobOutputService : ApplicationService, IAgvJobOutputService |
|||
{ |
|||
private readonly UnitOfWorkManager _unitOfWorkManager; |
|||
private readonly IHttpClientFactory _httpClientFactory; |
|||
private readonly IOptions<AgvOptions> _options; |
|||
private readonly ILogger<AgvJobOutputService> _logger; |
|||
|
|||
public AgvJobOutputService( |
|||
UnitOfWorkManager unitOfWorkManager, |
|||
IHttpClientFactory httpClientFactory, |
|||
IOptions<AgvOptions> options, |
|||
ILogger<AgvJobOutputService> logger |
|||
|
|||
) |
|||
{ |
|||
_logger = logger; |
|||
_unitOfWorkManager = unitOfWorkManager; |
|||
_httpClientFactory = httpClientFactory; |
|||
_options = options; |
|||
} |
|||
|
|||
|
|||
|
|||
[HttpPost("out-put-task")] |
|||
public async Task<AgvResultObject> OutPutTaskAsync(AgvRequest request) |
|||
{ |
|||
var httpclient = _httpClientFactory.CreateClient(); |
|||
_options.Value.Address = string.IsNullOrEmpty(_options.Value.Address) |
|||
? "http://7e42682n64.goho.co:21171/" |
|||
: _options.Value.Address; //测试地址
|
|||
_options.Value.Token = |
|||
string.IsNullOrEmpty(_options.Value.Token) ? string.Empty : _options.Value.Token; //测试token
|
|||
_options.Value.UserName = |
|||
string.IsNullOrEmpty(_options.Value.UserName) ? "" : _options.Value.UserName; //测试用户名
|
|||
_options.Value.Password = |
|||
string.IsNullOrEmpty(_options.Value.Password) ? "" : _options.Value.Password; //测试密码
|
|||
_options.Value.Path = string.IsNullOrEmpty(_options.Value.Path) |
|||
? "zozocnApi/custom/receiveProductionPlan" |
|||
: _options.Value.Path; //测试密码
|
|||
var flag = DateTime.Now.ToString("yyyyMMddHHmmss"); |
|||
// _logger.LogInformation($"标志{flag}开始调用高通WMS:传递值{JsonSerializer.Serialize(main)}");
|
|||
if (!string.IsNullOrEmpty(_options.Value.Token)) |
|||
{ |
|||
var token = _options.Value.Token; |
|||
httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); |
|||
} |
|||
|
|||
if (!string.IsNullOrEmpty(_options.Value.UserName) && !string.IsNullOrEmpty(_options.Value.Password)) |
|||
{ |
|||
var username = _options.Value.UserName; |
|||
var password = _options.Value.Password; |
|||
httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", |
|||
Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}"))); |
|||
} |
|||
|
|||
var client = new AgvJobClient(_options.Value.Address, httpclient, _options.Value.Path); |
|||
var ret = await client.PushOutTask4FWAsync(request).ConfigureAwait(false); |
|||
|
|||
return ret; |
|||
|
|||
} |
|||
|
|||
|
|||
} |
@ -1,99 +0,0 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Uow; |
|||
using Volo.Abp.Users; |
|||
using Win_in.Sfs.Basedata.Application.Contracts; |
|||
using Win_in.Sfs.Basedata.Domain; |
|||
using Win_in.Sfs.Basedata.Domain.Shared; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
using Win_in.Sfs.Wms.Inventory.Application.Contracts; |
|||
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
using Win_in.Sfs.Wms.Store.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs.AgvServices; |
|||
|
|||
|
|||
[AllowAnonymous] |
|||
[Route($"{StoreConsts.RootPath}agv-job-Account")] |
|||
public class AgvJobAccountService : ApplicationService, IAgvJobAccountService |
|||
{ |
|||
private IAssembleIssueJobAppService _assembleIssueJobAppService; |
|||
private ICoatingIssueJobAppService _coatingIssueJobAppService; |
|||
private IInjectionIssueJobAppService _injectionIssueJobAppService; |
|||
private IKittingIssueJobAppService _kittingIssueJobAppService; |
|||
private ISparePartIssueJobAppService _sparePartIssueJobAppService; |
|||
|
|||
public AgvJobAccountService( |
|||
|
|||
IAssembleIssueJobAppService assembleIssueJobAppService, |
|||
ICoatingIssueJobAppService coatingIssueJobAppService, |
|||
IInjectionIssueJobAppService injectionIssueJobAppService, |
|||
IKittingIssueJobAppService kittingIssueJobAppService, |
|||
ISparePartIssueJobAppService sparePartIssueJobAppService |
|||
|
|||
) |
|||
{ |
|||
_assembleIssueJobAppService = assembleIssueJobAppService; |
|||
_coatingIssueJobAppService= coatingIssueJobAppService; |
|||
_injectionIssueJobAppService= injectionIssueJobAppService; |
|||
_kittingIssueJobAppService = kittingIssueJobAppService; |
|||
_sparePartIssueJobAppService= sparePartIssueJobAppService; |
|||
} |
|||
|
|||
public async Task<AgvResultObject> AccountOutOrderAsync(AgvRequestOnlyJobHK request) |
|||
{ |
|||
var res=new AgvResultObject(); |
|||
res.Code = "0"; |
|||
|
|||
foreach (var itm in request.Data) |
|||
{ |
|||
switch (itm.OrderType) |
|||
{ |
|||
case "1": |
|||
|
|||
var assemblejob= new AssembleIssueJobDTO(); |
|||
|
|||
foreach (var detail in request.Data) |
|||
{ |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
var assemb=await _assembleIssueJobAppService.GetByNumberAsync(itm.OrderNum).ConfigureAwait(false); |
|||
await _assembleIssueJobAppService.CompleteAsync(assemb.Id).ConfigureAwait(false); |
|||
res.ReqCode = assemb.AssembleRequestNumber; |
|||
res.Message = "OK"; |
|||
break; |
|||
case "2": |
|||
var coating = await _coatingIssueJobAppService.GetByNumberAsync(itm.OrderNum).ConfigureAwait(false); |
|||
await _coatingIssueJobAppService.CompleteAsync(coating.Id).ConfigureAwait(false); |
|||
break; |
|||
case "3": |
|||
var injection = await _injectionIssueJobAppService.GetByNumberAsync(itm.OrderNum).ConfigureAwait(false); |
|||
await _injectionIssueJobAppService.CompleteAsync(injection.Id).ConfigureAwait(false); |
|||
break; |
|||
case "4": |
|||
var kitting = await _kittingIssueJobAppService.GetByNumberAsync(itm.OrderNum).ConfigureAwait(false); |
|||
await _kittingIssueJobAppService.CompleteAsync(kitting.Id).ConfigureAwait(false); |
|||
|
|||
break; |
|||
case "5": |
|||
var sparePart = await _sparePartIssueJobAppService.GetByNumberAsync(itm.OrderNum).ConfigureAwait(false); |
|||
await _sparePartIssueJobAppService.CompleteAsync(sparePart.Id).ConfigureAwait(false); |
|||
break; |
|||
|
|||
} |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
} |
@ -1,155 +0,0 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Net.Http.Headers; |
|||
using System.Net.Http; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using MyNamespace; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Uow; |
|||
using Volo.Abp.Users; |
|||
using Win_in.Sfs.Basedata.Application.Contracts; |
|||
using Win_in.Sfs.Basedata.Domain; |
|||
using Win_in.Sfs.Basedata.Domain.Shared; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
using Win_in.Sfs.Wms.Inventory.Application.Contracts; |
|||
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
using Win_in.Sfs.Wms.Store.Domain.Shared; |
|||
using Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; |
|||
using Microsoft.Extensions.Options; |
|||
using Win_in.Sfs.Wms.Store.Options; |
|||
using Microsoft.Extensions.Logging; |
|||
using Win_in.Sfs.Shared.Application.Contracts; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs.AgvServices; |
|||
[AllowAnonymous] |
|||
[Route($"{StoreConsts.RootPath}agv-job-in")] |
|||
public class AgvJobOutputService : ApplicationService, IAgvJobOutputService |
|||
{ |
|||
private readonly UnitOfWorkManager _unitOfWorkManager; |
|||
private readonly IHttpClientFactory _httpClientFactory; |
|||
private readonly IOptions<AgvOptions> _options; |
|||
private readonly ILogger<AgvJobOutputService> _logger; |
|||
|
|||
public AgvJobOutputService( |
|||
UnitOfWorkManager unitOfWorkManager, |
|||
IHttpClientFactory httpClientFactory, |
|||
IOptions<AgvOptions> options, |
|||
ILogger<AgvJobOutputService> logger |
|||
|
|||
) |
|||
{ |
|||
_logger = logger; |
|||
_unitOfWorkManager = unitOfWorkManager; |
|||
_httpClientFactory = httpClientFactory; |
|||
_options = options; |
|||
} |
|||
|
|||
|
|||
//public async Task<AgvResultObject> OutPutTaskAsync<T, TDetail>(T entity) where T : SfsJobDTOBase<TDetail>
|
|||
// where TDetail : SfsDetailDTOBase
|
|||
//{
|
|||
// if (entity is CoatingIssueJobDTO)
|
|||
// {
|
|||
// var coating = entity as CoatingIssueJobDTO;
|
|||
// var first = coating.Details.FirstOrDefault();
|
|||
// var requst = new AgvRequest();
|
|||
// requst.MatCode = first.ItemCode;
|
|||
// requst.MatQty = first.HandledToQty;
|
|||
// requst.OrderNum = entity.Number;
|
|||
// requst.OrderType = "1";
|
|||
// await OutPutTaskAsync(requst).ConfigureAwait(false);
|
|||
// }
|
|||
// else if (entity is AssembleIssueJobDTO)
|
|||
// {
|
|||
// var assemble = entity as AssembleIssueJobDTO;
|
|||
// var first = assemble.Details.FirstOrDefault();
|
|||
// var requst = new AgvRequest();
|
|||
// requst.MatCode = first.ItemCode;
|
|||
// requst.MatQty = first.HandledToQty;
|
|||
// requst.OrderNum = entity.Number;
|
|||
// requst.OrderType = "2";
|
|||
// return await OutPutTaskAsync(requst).ConfigureAwait(false);
|
|||
// }
|
|||
// else if (entity is InjectionIssueJobDTO)
|
|||
// {
|
|||
// var injection = entity as InjectionIssueJobDTO;
|
|||
// var first = injection.Details.FirstOrDefault();
|
|||
// var requst = new AgvRequest();
|
|||
// requst.MatCode = first.ItemCode;
|
|||
// requst.MatQty = first.HandledToQty;
|
|||
// requst.OrderNum = entity.Number;
|
|||
// requst.OrderType = "3";
|
|||
|
|||
// return await OutPutTaskAsync(requst).ConfigureAwait(false);
|
|||
// }
|
|||
// else if (entity is KittingIssueJobDTO)
|
|||
// {
|
|||
// var kitting = entity as KittingIssueJobDTO;
|
|||
// var first = kitting.Details.FirstOrDefault();
|
|||
// var requst = new AgvRequest();
|
|||
// requst.MatCode = first.ItemCode;
|
|||
// requst.MatQty = first.HandledToQty;
|
|||
// requst.OrderNum = entity.Number;
|
|||
// requst.OrderType = "4";
|
|||
|
|||
// return await OutPutTaskAsync(requst).ConfigureAwait(false);
|
|||
// }
|
|||
// else if (entity is SparePartIssueJobDTO)
|
|||
// {
|
|||
// var sparePart = entity as SparePartIssueJobDTO;
|
|||
// var first = sparePart.Details.FirstOrDefault();
|
|||
// var requst = new AgvRequest();
|
|||
// requst.MatCode = first.ItemCode;
|
|||
// requst.MatQty = first.HandledToQty;
|
|||
// requst.OrderNum = entity.Number;
|
|||
// requst.OrderType = "1";
|
|||
|
|||
// await OutPutTaskAsync(requst).ConfigureAwait(false);
|
|||
// }
|
|||
//}
|
|||
[HttpPost("out-put-task")] |
|||
public async Task<AgvResultObject> OutPutTaskAsync(AgvRequest request) |
|||
{ |
|||
var httpclient = _httpClientFactory.CreateClient(); |
|||
_options.Value.Address = string.IsNullOrEmpty(_options.Value.Address) |
|||
? "http://7e42682n64.goho.co:21171/" |
|||
: _options.Value.Address; //测试地址
|
|||
_options.Value.Token = |
|||
string.IsNullOrEmpty(_options.Value.Token) ? string.Empty : _options.Value.Token; //测试token
|
|||
_options.Value.UserName = |
|||
string.IsNullOrEmpty(_options.Value.UserName) ? "" : _options.Value.UserName; //测试用户名
|
|||
_options.Value.Password = |
|||
string.IsNullOrEmpty(_options.Value.Password) ? "" : _options.Value.Password; //测试密码
|
|||
_options.Value.Path = string.IsNullOrEmpty(_options.Value.Path) |
|||
? "zozocnApi/custom/receiveProductionPlan" |
|||
: _options.Value.Path; //测试密码
|
|||
var flag = DateTime.Now.ToString("yyyyMMddHHmmss"); |
|||
// _logger.LogInformation($"标志{flag}开始调用高通WMS:传递值{JsonSerializer.Serialize(main)}");
|
|||
if (!string.IsNullOrEmpty(_options.Value.Token)) |
|||
{ |
|||
var token = _options.Value.Token; |
|||
httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); |
|||
} |
|||
|
|||
if (!string.IsNullOrEmpty(_options.Value.UserName) && !string.IsNullOrEmpty(_options.Value.Password)) |
|||
{ |
|||
var username = _options.Value.UserName; |
|||
var password = _options.Value.Password; |
|||
httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", |
|||
Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}"))); |
|||
} |
|||
|
|||
var client = new AgvJobClient(_options.Value.Address, httpclient, _options.Value.Path); |
|||
var ret = await client.PushOutTask4FWAsync(request).ConfigureAwait(false); |
|||
|
|||
return ret; |
|||
|
|||
} |
|||
|
|||
|
|||
} |
Loading…
Reference in new issue