出库任务单增加调入仓库

This commit is contained in:
18942506660
2024-09-20 17:18:25 +08:00
parent 01e7b1da36
commit c8e60d3fa6
10 changed files with 80 additions and 6 deletions

View File

@@ -6,6 +6,7 @@ using Newtonsoft.Json;
using Org.BouncyCastle.Crypto;
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -13,6 +14,7 @@ using WMS.Web.Core;
using WMS.Web.Core.Dto.Erp;
using WMS.Web.Core.Dto.Erp.Customer;
using WMS.Web.Core.Dto.Erp.Org;
using WMS.Web.Core.Dto.Login;
using WMS.Web.Core.Dto.OutStockTask;
using WMS.Web.Core.Help;
using WMS.Web.Domain.Entitys;
@@ -36,10 +38,11 @@ namespace WMS.Web.Repositories
private readonly IErpBasicDataExtendService _erpBasicDataExtendService;
private readonly ILogger<OutStockTaskRepositories> _logger;
private readonly IOutStockRepositories _outStockRepositories;
private readonly IBasicsRepositories _basicsRepositories;
public OutStockTaskRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider,
ISingleDataService singleDataService, ILoginRepositories loginRepositories, IErpService erpService,
IErpBasicDataExtendService erpBasicDataExtendService, ILogger<OutStockTaskRepositories> logger,
IOutStockRepositories outStockRepositories)
IOutStockRepositories outStockRepositories, IBasicsRepositories basicsRepositories)
{
_context = context;
_mapper = mapper;
@@ -50,7 +53,7 @@ namespace WMS.Web.Repositories
_erpBasicDataExtendService = erpBasicDataExtendService;
_logger = logger;
_outStockRepositories = outStockRepositories;
_basicsRepositories = basicsRepositories;
}
/// <summary>
/// 新增
@@ -278,6 +281,13 @@ namespace WMS.Web.Repositories
if (customer_result.IsSuccess)
customers = customer_result.Data.ToList();
List<string> stocks = new List<string>();
if (!string.IsNullOrEmpty(dto.InStock))
{
var r = await _basicsRepositories.GetUcStockAsync(ManagementSystemCode.GLXT0004.ToString(), dto.InStock, companyId);
stocks = r.Select(s => s.Code).ToList();
}
List<int> taskIds = null;
List<int> taskIds_s = new List<int>();
List<int> taskIds_b = new List<int>();
@@ -347,6 +357,10 @@ namespace WMS.Web.Repositories
{
query = query.Where(w => taskIds.Contains(w.order.Id));
}
if (!string.IsNullOrEmpty(dto.InStock))
{
query = query.Where(w => w.detail.ErpDetails.Where(w => stocks.Contains(w.InStockCode)).Any());
}
//组装
int total = await query.CountAsync();
var list = await query.Select(s => new OutStockTaskQueryInfoResponse()
@@ -378,7 +392,8 @@ namespace WMS.Web.Repositories
MaterialNumber = s.detail.MaterialNumber,
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialNumber),
Unit = _erpBasicDataExtendService.GetMaterialUnitName(materials, s.detail.MaterialNumber),
Remark = s.detail.Remark
Remark = s.detail.Remark,
InStock = GetInStock(s.detail.ErpDetails.Select(s => s.InStockCode).ToList(), companyId, s.order.OrgCode)
#endregion
}).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
@@ -578,5 +593,19 @@ namespace WMS.Web.Repositories
return res.Clone();
}
public string GetInStock(List<string> codes, int companyId, string orgCode)
{
var list = codes.Where(w => w != null).ToList();
if (list.Count() == 0) return "";
List<string> names = new List<string>();
foreach (var c in list)
{
var name = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, companyId, c + orgCode);
names.Add(name);
}
if (names.Count() == 0) return "";
return string.Join(",", names);
}
}
}