This commit is contained in:
tongfei
2023-11-15 15:02:41 +08:00
20 changed files with 155 additions and 51 deletions

View File

@@ -94,6 +94,14 @@ namespace WMS.Web.Repositories.Configuration
ent.Property(f => f.SerialNumbers).HasConversion(
v => JsonConvert.SerializeObject(v),
v => JsonConvert.DeserializeObject<List<string>>(v));
ent.Property(f => f.SourceBillNos).HasConversion(
v => JsonConvert.SerializeObject(v),
v => JsonConvert.DeserializeObject<List<string>>(v));
ent.Property(f => f.SaleBillNos).HasConversion(
v => JsonConvert.SerializeObject(v),
v => JsonConvert.DeserializeObject<List<string>>(v));
});
#endregion
@@ -114,9 +122,14 @@ namespace WMS.Web.Repositories.Configuration
ent.HasKey(x => x.Id);
ent.Property(f => f.SourceBillNos).HasConversion(
v => JsonConvert.SerializeObject(v),
v => JsonConvert.DeserializeObject<List<string>>(v));
v => JsonConvert.SerializeObject(v),
v => JsonConvert.DeserializeObject<List<string>>(v));
ent.Property(f => f.SaleBillNos).HasConversion(
v => JsonConvert.SerializeObject(v),
v => JsonConvert.DeserializeObject<List<string>>(v));
});
#endregion
#region

View File

@@ -232,7 +232,7 @@ namespace WMS.Web.Repositories.DependencyInjection
#region
var jobKey_out = new JobKey("OutStockOrderQuartzJob", options.QuartzJobValue);
q.AddJob<InStockOrderQuartzJob>(jobKey_out, j => j.WithDescription("OutStockOrderQuartzJob"));
q.AddJob<OutStockOrderQuartzJob>(jobKey_out, j => j.WithDescription("OutStockOrderQuartzJob"));
q.AddTrigger(t => t
.WithIdentity("OutStockOrderQuartzJobTrigger")
.ForJob(jobKey_out)
@@ -244,7 +244,7 @@ namespace WMS.Web.Repositories.DependencyInjection
#region ops
var jobKey_box = new JobKey("BoxQuartzJob", options.QuartzJobValue);
q.AddJob<InStockOrderQuartzJob>(jobKey_box, j => j.WithDescription("BoxQuartzJob"));
q.AddJob<BoxQuartzJob>(jobKey_box, j => j.WithDescription("BoxQuartzJob"));
q.AddTrigger(t => t
.WithIdentity("BoxQuartzJobTrigger")
.ForJob(jobKey_box)

View File

@@ -82,6 +82,10 @@ namespace WMS.Web.Repositories
/// <returns></returns>
public async Task<(List<OutStockQueryInfoResponse> list, int total)> GetListAsync(OutStockQueryRequest dto)
{
List<int> detailIds = new List<int>();
if (!string.IsNullOrEmpty(dto.SourceBillNo))
detailIds = await _context.OutStockTaskDetails.FromSqlRaw($"SELECT Id FROM t_wms_outstock_details WHERE SourceBillNo like '%{dto.SourceBillNo}%'").Select(s => s.Id).ToListAsync();
List<int> ids = new List<int>();
if (!string.IsNullOrEmpty(dto.Creator))
{
@@ -134,8 +138,8 @@ namespace WMS.Web.Repositories
query = query.Where(w => mIds.Contains(w.detail.MaterialId));
if (ids.Count() > 0)
query = query.Where(w => ids.Contains(w.order.CreatorId));
if (!string.IsNullOrEmpty(dto.SourceBillNo))
query = query.Where(w => EF.Functions.Like(w.order.SourceBillNo, "%" + dto.SourceBillNo + "%"));
if (detailIds.Count()!=0)
query = query.Where(w => detailIds.Contains(w.detail.Id));
if (dto.Type != null)
query = query.Where(w => w.order.Type == (OutStockType)dto.Type);
if (dto.SuccessSync != null)
@@ -160,8 +164,8 @@ namespace WMS.Web.Repositories
CreateTime = s.order.CreateTime.DateToStringSeconds(),
SuccessSync = s.order.SuccessSync,
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.detail.StockCode),
SourceBillNo = s.order.SourceBillNo,
SaleBillNo = s.detail.SaleBillNo,
SourceBillNo =string.Join(",",s.detail.SourceBillNos),
SaleBillNo = string.Join(",", s.detail.SaleBillNos),
DeliveryOrg = _erpBasicDataExtendService.GetOrgName(orgs, s.order.DeliveryOrgId),
ReceiptCustomer = s.order.Type == OutStockType.Sal
? _erpBasicDataExtendService.GetCustomerName(customers, s.order.ReceiptCustomerId)

View File

@@ -216,6 +216,11 @@ namespace WMS.Web.Repositories
/// <returns></returns>
public async Task<(List<OutStockTaskQueryInfoResponse> list, int total)> GetListAsync(OutStockTaskQueryRequest dto)
{
List<int> ids = new List<int>();
if (!string.IsNullOrEmpty(dto.SourceBillNo))
ids = await _context.OutStockTaskDetails.FromSqlRaw($"SELECT Id FROM t_erp_outstock_task_details WHERE SourceBillNo like '%{dto.SourceBillNo}%'").Select(s => s.Id).ToListAsync();
#region erp基础资料
List<int> mIds = new List<int>();
var materials_result = await _erpService.BillQueryForMaterial();
@@ -262,8 +267,8 @@ namespace WMS.Web.Repositories
query = query.Where(w => mIds.Contains(w.detail.MaterialId));
if (dto.Ids.Count() > 0)
query = query.Where(w => dto.Ids.Contains(w.detail.Id));
if (!string.IsNullOrEmpty(dto.SourceBillNo))
query = query.Where(w => w.detail.SourceBillNos.Where(sw => EF.Functions.Like(sw, "%" + dto.SourceBillNo + "%")).Contains(w.order.BillNo));
if (ids.Count() != 0)
query = query.Where(w => ids.Contains(w.detail.Id));
if (dto.Type != null)
query = query.Where(w => w.order.Type == (OutStockType)dto.Type);
if (dto.Status != null)
@@ -291,7 +296,7 @@ namespace WMS.Web.Repositories
OutStockEndTime = s.detail.OutStockEndTime.DateToStringSeconds(),
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.detail.StockCode),
SourceBillNo = string.Join(",", s.detail.SourceBillNos),
SaleBillNo = s.detail.SaleBillNo,
SaleBillNo = string.Join(",", s.detail.SaleBillNos),
DeliveryOrg = _erpBasicDataExtendService.GetOrgName(orgs, s.order.DeliveryOrgId),
ReceiptCustomer = s.order.Type == OutStockType.Sal
? _erpBasicDataExtendService.GetCustomerName(customers, s.order.ReceiptCustomerId)
@@ -317,9 +322,12 @@ namespace WMS.Web.Repositories
return new List<GetOutStockTaskByNoResponse>();
var materials = materials_result.Data.ToList();
List<int> ids = new List<int>();
ids = await _context.OutStockTaskDetails.FromSqlRaw($"SELECT Fid FROM t_erp_outstock_task_details WHERE SourceBillNo like '%{billNo}%'").Select(s => s.Id).ToListAsync();
var list = await _context.OutStockTask.Include(x => x.Details)
.Where(f => (EF.Functions.Like(f.BillNo, "%" + billNo + "%") ||
f.Details.SelectMany(s=>s.SourceBillNos).Where(sw => EF.Functions.Like(sw, "%" + billNo + "%")).Contains(f.BillNo)) &&
ids.Contains(f.Id)) &&
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait))
.OrderByDescending(o => o.Id)
.ToListAsync();
@@ -368,11 +376,22 @@ namespace WMS.Web.Repositories
/// </summary>
/// <param name="sourceBillNos"></param>
/// <returns></returns>
public async Task<List<OutStockTask>> GetListBySourceBillNo(List<string> billNos)
public async Task<List<OutStockTask>> GetListBySourceBillNo(List<string> sourcebillNos)
{
List<int> ids = new List<int>();
string str=$"SELECT Fid FROM t_erp_outstock_task_details WHERE ";
for (int i=0;i<sourcebillNos.Count();i++)
{
if (i == 0)
str += $" SourceBillNo like '%{sourcebillNos[i]}%'";
else
str += $" or SourceBillNo like '%{sourcebillNos[i]}%'";
}
ids = await _context.OutStockTaskDetails.FromSqlRaw(str).Select(s => s.Id).ToListAsync();
var entitys = await _context.OutStockTask
.Include(s => s.Details)
.Where(w => billNos.Contains(w.BillNo))
.Where(w => ids.Contains(w.Id))
.OrderByDescending(o => o.Id)
.ToListAsync();
@@ -417,9 +436,12 @@ namespace WMS.Web.Repositories
public async Task<List<string>> GetOutStockTaskNosByNo(string billNo)
{
List<int> ids = new List<int>();
ids = await _context.OutStockTaskDetails.FromSqlRaw($"SELECT Fid FROM t_erp_outstock_task_details WHERE SourceBillNo like '%{billNo}%'").Select(s => s.Id).ToListAsync();
return await _context.OutStockTask.Include(x => x.Details)
.Where(f => (EF.Functions.Like(f.BillNo, "%" + billNo + "%") ||
f.Details.SelectMany(s => s.SourceBillNos).Where(sw => EF.Functions.Like(sw, "%" + billNo + "%")).Contains(f.BillNo)) &&
ids.Contains(f.Id)) &&
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait))
.OrderByDescending(o => o.Id)
.Select(s => s.BillNo)
@@ -436,5 +458,16 @@ namespace WMS.Web.Repositories
{
return await GetListAsync(dto);
}
public async Task<List<OutStockTask>> GetListByBillNo(List<string> billNos)
{
var entitys = await _context.OutStockTask
.Include(s => s.Details)
.Where(w => billNos.Contains(w.BillNo))
.OrderByDescending(o => o.Id)
.ToListAsync();
return entitys.Clone();
}
}
}