From ff95bd9bf4cd14ae74dfb7940510b070cb4f0c3f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com>
Date: Mon, 6 Jan 2025 16:45:28 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BD=99=E6=96=99=E5=9B=9E=E5=BA=93=E6=8E=A5?=
=?UTF-8?q?=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/Jobs/IssueJobController.cs | 17 +++++
.../IssueJobs/IIssueJobAppService.cs | 3 +
.../AssembleIssueJobAppService.cs | 3 +-
.../Jobs/IssueJobs/IssueJobAppService.cs | 63 ++++++++++++++++++-
4 files changed, 84 insertions(+), 2 deletions(-)
diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobController.cs
index 3826740d3..29febe161 100644
--- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobController.cs
+++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobController.cs
@@ -50,6 +50,23 @@ public class IssueJobController : AbpController
var result = await _issueJobAppService.GetAsync(id).ConfigureAwait(false);
return Ok(result);
}
+ ///
+ /// 余料回库
+ ///
+ ///
+ ///
+ [HttpPost("NotifyOutTaskBack4FW")]
+ public async Task CallReturn(AgvRequestBack jobdto)
+ {
+ return await _issueJobAppService.CallReturn(jobdto).ConfigureAwait(false);
+
+ }
+
+
+
+
+
+
///
/// 获取列表
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/IssueJobs/IIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/IssueJobs/IIssueJobAppService.cs
index d496a4530..820822a98 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/IssueJobs/IIssueJobAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/IssueJobs/IIssueJobAppService.cs
@@ -23,4 +23,7 @@ public interface IIssueJobAppService
///
Task SaveDetail_SplitPackingAsync(SplitPacking_UpdateJobDetailInput input);
+
+ Task CallReturn(AgvRequestBack jobdto);
+
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs
index 83ec2f564..ab614d38b 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs
@@ -51,12 +51,13 @@ public class AssembleIssueJobAppService
private readonly IAssembleIssueNoteAppService _assembleIssueNoteAppService;
private readonly IExpectOutAppService _expectOutAppService;
private readonly IHttpClientFactory _httpClientFactory;
+ private readonly IOptions _agvOptions;
private readonly ITransferLibRequestAppService _transferLibRequestAppService;
private readonly IOptions _options;
private readonly ICurrentUser _currentUser;
private readonly UnitOfWorkManager _unitOfWorkManager;
- private readonly IOptions _agvOptions;
+
private readonly ILogger _logger;
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/IssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/IssueJobAppService.cs
index 21627669b..29124570a 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/IssueJobAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/IssueJobAppService.cs
@@ -2,6 +2,9 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
+using System.Net.Http.Headers;
+using System.Net.Http;
+using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
@@ -15,6 +18,9 @@ using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
+using Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy;
+using Win_in.Sfs.Wms.Store.Options;
+using Microsoft.Extensions.Options;
namespace Win_in.Sfs.Wms.Store.Application;
@@ -26,14 +32,69 @@ public class IssueJobAppService
IIssueJobAppService
{
private readonly IIssueJobManager _issueJobManager;
+ private readonly IHttpClientFactory _httpClientFactory;
+ private readonly IOptions _agvOptions;
public IssueJobAppService(
- IIssueJobRepository repository, IIssueJobManager issueJobManager
+ IIssueJobRepository repository, IIssueJobManager issueJobManager,IHttpClientFactory httpClientFactory, IOptions agvOptions
) : base(repository, issueJobManager)
{
_issueJobManager = issueJobManager;
+ _httpClientFactory = httpClientFactory;
+ _agvOptions = agvOptions;
}
+ ///
+ /// 余料回库
+ ///
+ ///
+ ///
+ [HttpPost("NotifyOutTaskBack4FW")]
+ public async Task CallReturn(AgvRequestBack jobdto)
+ {
+ var client = await GetAgvJobClient().ConfigureAwait(false);
+ var ret = await client.NotifyOutTaskBack4FWAsync(jobdto).ConfigureAwait(false);
+ return ret;
+ }
+ private async Task GetAgvJobClient()
+ {
+
+ var httpclient = _httpClientFactory.CreateClient();
+ _agvOptions.Value.Address = string.IsNullOrEmpty(_agvOptions.Value.Address)
+ ? "http://7e42682n64.goho.co:21171/"
+ : _agvOptions.Value.Address; //测试地址
+ _agvOptions.Value.Token =
+ string.IsNullOrEmpty(_agvOptions.Value.Token) ? string.Empty : _agvOptions.Value.Token; //测试token
+ _agvOptions.Value.UserName =
+ string.IsNullOrEmpty(_agvOptions.Value.UserName) ? "" : _agvOptions.Value.UserName; //测试用户名
+ _agvOptions.Value.Password =
+ string.IsNullOrEmpty(_agvOptions.Value.Password) ? "" : _agvOptions.Value.Password; //测试密码
+ _agvOptions.Value.Path = string.IsNullOrEmpty(_agvOptions.Value.Path)
+ ? "zozocnApi/custom/receiveProductionPlan"
+ : _agvOptions.Value.Path; //测试密码
+ var flag = DateTime.Now.ToString("yyyyMMddHHmmss");
+
+ if (!string.IsNullOrEmpty(_agvOptions.Value.Token))
+ {
+ var token = _agvOptions.Value.Token;
+ httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ }
+
+ if (!string.IsNullOrEmpty(_agvOptions.Value.UserName) && !string.IsNullOrEmpty(_agvOptions.Value.Password))
+ {
+ var username = _agvOptions.Value.UserName;
+ var password = _agvOptions.Value.Password;
+ httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic",
+ Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}")));
+ }
+
+ var client = new AgvJobClient(_agvOptions.Value.Address, httpclient, _agvOptions.Value.Path);
+ return client;
+ }
+
+
+
+
///
/// 根据物品和库位 检查是否存在发料任务
///