|
|
@ -6,6 +6,7 @@ using System.Linq; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using DocumentFormat.OpenXml.Bibliography; |
|
|
|
using DocumentFormat.OpenXml.Office2016.Excel; |
|
|
|
using DocumentFormat.OpenXml.Vml.Office; |
|
|
|
using IdentityModel; |
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
@ -17,9 +18,11 @@ using Org.BouncyCastle.Asn1.Ocsp; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.Data; |
|
|
|
using Volo.Abp.Domain.Entities; |
|
|
|
using Volo.Abp.Identity; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
using Volo.Abp.Users; |
|
|
|
using Win_in.Sfs.Auth.Application.Contracts; |
|
|
|
using Win_in.Sfs.Auth.Users; |
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
|
using Win_in.Sfs.Basedata.Domain; |
|
|
|
using Win_in.Sfs.Basedata.Kittings.Inputs; |
|
|
@ -48,6 +51,8 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
private readonly IUnitOfWorkManager _unitOfWorkManager; |
|
|
|
private readonly ILogger<UnplannedIssueRequestForDongyangAppService> _logger; |
|
|
|
private readonly IExpectOutAppService _expectOutAppService; |
|
|
|
private readonly ISfsUserAppService _sfsUserAppService; |
|
|
|
|
|
|
|
//private readonly IExportImportService _excelService;
|
|
|
|
|
|
|
|
|
|
|
@ -55,7 +60,7 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
IUnplannedIssueRequestManager unplannedIssueRequestManager, |
|
|
|
IDepartmentAppService departmentApp, IBalanceAppService balanceAppService, ILocationAppService locationAppService, IExportImportService excelService, |
|
|
|
ITransactionTypeAclService transactionTypeAclService, IUnplannedIssueJobAppService unplannedIssueJobAppService, IUnitOfWorkManager unitOfWorkManager |
|
|
|
, ILogger<UnplannedIssueRequestForDongyangAppService> logger |
|
|
|
, ILogger<UnplannedIssueRequestForDongyangAppService> logger,ISfsUserAppService sfsUserAppService |
|
|
|
|
|
|
|
|
|
|
|
) : base( repository, unplannedIssueRequestManager, excelService) |
|
|
@ -69,7 +74,10 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
_unitOfWorkManager = unitOfWorkManager; |
|
|
|
_logger = logger; |
|
|
|
_jobrepository= jobrepository; |
|
|
|
_expectOutAppService = expectOutAppService; |
|
|
|
_expectOutAppService = expectOutAppService; |
|
|
|
_sfsUserAppService= sfsUserAppService; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
/// <summary>
|
|
|
|
/// OA创建计划外出库申请
|
|
|
@ -91,18 +99,27 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
entity.AutoAgree = true; |
|
|
|
entity.AutoHandle = true; |
|
|
|
entity.DirectCreateNote = false; |
|
|
|
entity.Worker = input.Worker; |
|
|
|
|
|
|
|
//var userEntity=await _userRepository.FindByNormalizedUserNameAsync(input.Worker).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _unplannedIssueRequestManager.CreateAsync(entity).ConfigureAwait(false); |
|
|
|
|
|
|
|
var dto = ObjectMapper.Map<UnplannedIssueRequest, UnplannedIssueRequestDTO>(entity); |
|
|
|
return dto; |
|
|
|
} |
|
|
|
|
|
|
|
//public virtual async Task<string> GetUserNameByUserAsync(string worker)
|
|
|
|
//{
|
|
|
|
// var userList = await _userRepository.GetListAsync().ConfigureAwait(false);
|
|
|
|
// var userEntity = userList.First(p => p.Name == worker);
|
|
|
|
// return userEntity.UserName;
|
|
|
|
//}
|
|
|
|
|
|
|
|
private async Task SetEntityPropertiesAsync(UnplannedIssueRequest entity) |
|
|
|
{ |
|
|
|
var userName = CurrentUser.GetUserName_New(); |
|
|
|
var name = CurrentUser.GetUserName_New(); |
|
|
|
var name = CurrentUser.GetUserName(); |
|
|
|
if (userName != null) |
|
|
|
{ |
|
|
|
var department = await _departmentApp.GetByUsernameAsync(userName).ConfigureAwait(false); |
|
|
@ -168,7 +185,11 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
request.DeptName = first.DeptName; |
|
|
|
request.BuildDate = DateTime.Now; |
|
|
|
request.OANumber = first.OANumber; |
|
|
|
request.Worker = first.Worker; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await SetEntityPropertiesAsync(request).ConfigureAwait(false); |
|
|
|
List<UnplannedIssueRequestDetail> detailList = new List<UnplannedIssueRequestDetail>(); |
|
|
@ -194,6 +215,17 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
} |
|
|
|
|
|
|
|
request.Details = detailList; |
|
|
|
|
|
|
|
|
|
|
|
var user = await _sfsUserAppService.FindUserByUserNameAsync(first.Worker).ConfigureAwait(false); |
|
|
|
if (string.IsNullOrEmpty(user)) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("没有查到用户"); |
|
|
|
} |
|
|
|
request.Worker = user; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _unplannedIssueRequestManager.CreateAsync(request).ConfigureAwait(false); |
|
|
|
var dto = ObjectMapper.Map<UnplannedIssueRequest, UnplannedIssueRequestDTO>(request); |
|
|
|
return dto; |
|
|
@ -344,6 +376,9 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
unplannedReceiptRequest.AutoHandle = true; |
|
|
|
unplannedReceiptRequest.DirectCreateNote = false; |
|
|
|
unplannedReceiptRequest.BuildDate = DateTime.Now; |
|
|
|
unplannedReceiptRequest.Worker = CurrentUser.GetName(); |
|
|
|
|
|
|
|
|
|
|
|
foreach (var detail in unplannedReceiptRequest.Details) |
|
|
|
{ |
|
|
|
detail.LocationErpCode = detail.FromErpLocationCode; |
|
|
|