修复bug
This commit is contained in:
@@ -44,41 +44,6 @@ namespace WMS.Web.Api.Controllers
|
||||
[Route("hj")]
|
||||
public async Task<string> TestHJ()
|
||||
{
|
||||
OutStockTask entity = new OutStockTask()
|
||||
{
|
||||
DeliveryOrgId = 1,
|
||||
ReceiptCustomerId = 1
|
||||
};
|
||||
try
|
||||
{
|
||||
var d = new OutStockTaskDetails();
|
||||
|
||||
d.MaterialId = 1;
|
||||
d.AccruedQty = 1;
|
||||
d.Erp_DetailId = 1;
|
||||
d.SaleBillNo = "sdf34343";
|
||||
d.StockCode = "234";
|
||||
d.SubStockId =234;
|
||||
d.SourceBillNos = new List<string>() { "wwre", "32423" };
|
||||
entity.Details.Add(d);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw ex;
|
||||
}
|
||||
entity.Details.Add(new OutStockTaskDetails()
|
||||
{
|
||||
MaterialId = 1,
|
||||
AccruedQty = 1,
|
||||
Erp_DetailId = 1,
|
||||
SaleBillNo = "ddddd",
|
||||
StockCode = "ddd",
|
||||
SubStockId = 1
|
||||
});
|
||||
|
||||
var b = await _outStockTaskRepositories.Add(entity, true);
|
||||
var bc = await _outStockTaskRepositories.Get(entity.Id);
|
||||
// await _boxService.Sync();
|
||||
//var res = await this._erpService.BillQueryForDeliveryNoticeOutStock(null,DateTime.Now.AddDays(-300));
|
||||
//var result= await this._erpService.BillQueryForPurchaseInStock();
|
||||
|
||||
@@ -34,17 +34,17 @@ namespace WMS.Web.Domain.QuartzJob
|
||||
{
|
||||
//2.记录:开始时间
|
||||
var begindatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
_logger.LogInformation($"出库单-同步金蝶入库单数据:执行开始时间->{begindatetime}");
|
||||
_logger.LogInformation($"箱信息-同步箱信息数据:执行开始时间->{begindatetime}");
|
||||
//3.同步数据
|
||||
var result = await _boxService.Sync();
|
||||
//5.记录:结束时间
|
||||
var enddatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
_logger.LogInformation($"出库单-同步金蝶入库单数据:执行结束时间->{begindatetime}");
|
||||
_logger.LogInformation($"箱信息-同步箱信息数据:执行结束时间->{begindatetime}");
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogInformation($"同步金蝶入库单数据:定时任务执行失败->{ex.Message}");
|
||||
_logger.LogInformation($"同步箱信息数据:定时任务执行失败->{ex.Message}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,10 +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.Contains(dto.SourceBillNo));
|
||||
//query = query.Where(w => EF.Functions.Like(w.detail.SourceBillNos, "%" + 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)
|
||||
@@ -319,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();
|
||||
@@ -419,9 +425,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)
|
||||
|
||||
Reference in New Issue
Block a user