1、盘点报表函数新增分页功能
2、齐套分拣,调整分拣函数获取当前登录用户方式
This commit is contained in:
@@ -2,11 +2,14 @@
|
|||||||
using System.ArrayExtensions;
|
using System.ArrayExtensions;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Security.Claims;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using JNPF.Common.Const;
|
||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
using JNPF.Common.Enums;
|
using JNPF.Common.Enums;
|
||||||
using JNPF.Common.Extension;
|
using JNPF.Common.Extension;
|
||||||
|
using JNPF.Common.Manager;
|
||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
using JNPF.FriendlyException;
|
using JNPF.FriendlyException;
|
||||||
using JNPF.Systems.Interfaces.System;
|
using JNPF.Systems.Interfaces.System;
|
||||||
@@ -36,14 +39,16 @@ namespace Tnb.WarehouseMgr
|
|||||||
private readonly IWareHouseService _wareHouseService;
|
private readonly IWareHouseService _wareHouseService;
|
||||||
private readonly IBillRullService _billRullService;
|
private readonly IBillRullService _billRullService;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
|
private readonly ICacheManager _cacheManager;
|
||||||
private const string BizTypeId = "26186830379045";
|
private const string BizTypeId = "26186830379045";
|
||||||
|
|
||||||
public WmsSetSortingService(ISqlSugarRepository<WmsSetsortingH> repository, IWareHouseService wareHouseService, IUserManager userManager, IBillRullService billRullService)
|
public WmsSetSortingService(ISqlSugarRepository<WmsSetsortingH> repository, IWareHouseService wareHouseService, IUserManager userManager, IBillRullService billRullService, ICacheManager cacheManager)
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
_wareHouseService = wareHouseService;
|
_wareHouseService = wareHouseService;
|
||||||
_billRullService = billRullService;
|
_billRullService = billRullService;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
|
_cacheManager = cacheManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -53,6 +58,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task PackSortingByAdd(CancellationTokenSource? cts = default)
|
public async Task PackSortingByAdd(CancellationTokenSource? cts = default)
|
||||||
{
|
{
|
||||||
|
var aToken = await _cacheManager.GetAsync("AccessToken");
|
||||||
|
if (aToken.IsNullOrWhiteSpace()) return;
|
||||||
|
var curUser = await GetUserIdentity(aToken);
|
||||||
|
|
||||||
var curDb = _db.CopyNew();
|
var curDb = _db.CopyNew();
|
||||||
string firstLocationId = "27010980724501", secondLocationId = "27010987857941";
|
string firstLocationId = "27010980724501", secondLocationId = "27010987857941";
|
||||||
var endLocation = await curDb.Queryable<BasLocation>().SingleAsync(it => it.id == secondLocationId);
|
var endLocation = await curDb.Queryable<BasLocation>().SingleAsync(it => it.id == secondLocationId);
|
||||||
@@ -144,12 +153,14 @@ namespace Tnb.WarehouseMgr
|
|||||||
carryIds = carryMats.Select(x => x.carry_id).Distinct().ToList();
|
carryIds = carryMats.Select(x => x.carry_id).Distinct().ToList();
|
||||||
|
|
||||||
await curDb.Updateable<WmsCarryH>()
|
await curDb.Updateable<WmsCarryH>()
|
||||||
.SetColumns(it => new WmsCarryH {
|
.SetColumns(it => new WmsCarryH
|
||||||
out_status = ((int)EnumOutStatus.全部出).ToString(),
|
{
|
||||||
collocation_scheme_id = singleSorting.collocation_scheme_id,
|
out_status = ((int)EnumOutStatus.全部出).ToString(),
|
||||||
collocation_scheme_code = singleSorting.collocation_scheme_code,
|
collocation_scheme_id = singleSorting.collocation_scheme_id,
|
||||||
source_id = singleSorting.source_id,
|
collocation_scheme_code = singleSorting.collocation_scheme_code,
|
||||||
source_code = singleSorting.source_code })
|
source_id = singleSorting.source_id,
|
||||||
|
source_code = singleSorting.source_code
|
||||||
|
})
|
||||||
.Where(it => carryIds.Contains(it.id)).ExecuteCommandAsync();
|
.Where(it => carryIds.Contains(it.id)).ExecuteCommandAsync();
|
||||||
|
|
||||||
//await curDb.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.全部出).ToString(), collocation_scheme_id = singleSorting.collocation_scheme_id, collocation_scheme_code = singleSorting.collocation_scheme_code }).Where(it => carryIds.Contains(it.id)).ExecuteCommandAsync();
|
//await curDb.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.全部出).ToString(), collocation_scheme_id = singleSorting.collocation_scheme_id, collocation_scheme_code = singleSorting.collocation_scheme_code }).Where(it => carryIds.Contains(it.id)).ExecuteCommandAsync();
|
||||||
@@ -170,17 +181,17 @@ namespace Tnb.WarehouseMgr
|
|||||||
List<string> locIds = new();
|
List<string> locIds = new();
|
||||||
|
|
||||||
var mid = 6;
|
var mid = 6;
|
||||||
|
|
||||||
if (carrys.Length > mid)
|
if (carrys.Length > mid)
|
||||||
{
|
{
|
||||||
var leftCarrys = carrys[..mid];
|
var leftCarrys = carrys[..mid];
|
||||||
var rightCarrys = carrys[mid..];
|
var rightCarrys = carrys[mid..];
|
||||||
await InnerGenPreTask(leftCarrys, locIds, firstLocationId, singleSorting.id, singleSorting.bill_code, preTasks, endLocation);
|
await InnerGenPreTask(leftCarrys, locIds, firstLocationId, singleSorting.id, singleSorting.bill_code, preTasks, endLocation, curUser);
|
||||||
await InnerGenPreTask(rightCarrys, locIds, secondLocationId, singleSorting.id, singleSorting.bill_code, preTasks, endLocation);
|
await InnerGenPreTask(rightCarrys, locIds, secondLocationId, singleSorting.id, singleSorting.bill_code, preTasks, endLocation, curUser);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await InnerGenPreTask(carrys, locIds, firstLocationId, singleSorting.id, singleSorting.bill_code, preTasks, endLocation);
|
await InnerGenPreTask(carrys, locIds, firstLocationId, singleSorting.id, singleSorting.bill_code, preTasks, endLocation, curUser);
|
||||||
}
|
}
|
||||||
List<WmsPretaskCode> pretaskCodes = new();
|
List<WmsPretaskCode> pretaskCodes = new();
|
||||||
foreach (var pt in preTasks)
|
foreach (var pt in preTasks)
|
||||||
@@ -217,7 +228,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task InnerGenPreTask(WmsCarryH[] carrys, List<string> locIds, string eLocationId, string requireId, string requireCode, List<WmsPretaskH> preTasks, BasLocation endLocation)
|
private async Task InnerGenPreTask(WmsCarryH[] carrys, List<string> locIds, string eLocationId, string requireId, string requireCode, List<WmsPretaskH> preTasks, BasLocation endLocation, ClaimsPrincipal curUser)
|
||||||
{
|
{
|
||||||
foreach (var carry in carrys)
|
foreach (var carry in carrys)
|
||||||
{
|
{
|
||||||
@@ -242,7 +253,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
WmsPretaskH preTask = new()
|
WmsPretaskH preTask = new()
|
||||||
{
|
{
|
||||||
org_id = _userManager.User.OrganizeId,
|
org_id = curUser.FindFirst(ClaimConst.CLAINMORGID)?.Value,
|
||||||
startlocation_id = sPoint?.location_id!,
|
startlocation_id = sPoint?.location_id!,
|
||||||
startlocation_code = sPoint?.location_code!,
|
startlocation_code = sPoint?.location_code!,
|
||||||
endlocation_id = ePoint?.location_id!,
|
endlocation_id = ePoint?.location_id!,
|
||||||
@@ -259,7 +270,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
area_code = it.Key,
|
area_code = it.Key,
|
||||||
require_id = requireId,
|
require_id = requireId,
|
||||||
require_code = requireCode,
|
require_code = requireCode,
|
||||||
create_id = _userManager.UserId,
|
create_id = curUser.FindFirst(ClaimConst.CLAINMUSERID)?.Value!,
|
||||||
create_time = DateTime.Now,
|
create_time = DateTime.Now,
|
||||||
source_id = carry.source_id,
|
source_id = carry.source_id,
|
||||||
source_code = carry.source_code,
|
source_code = carry.source_code,
|
||||||
@@ -301,7 +312,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
x.id = SnowflakeIdHelper.NextId();
|
x.id = SnowflakeIdHelper.NextId();
|
||||||
x.bill_id = input.requireId;
|
x.bill_id = input.requireId;
|
||||||
x.bill_d_id = billDId!;
|
x.bill_d_id = billDId!;
|
||||||
x.org_id = ssds?.Select(xx=>xx.org_id).FirstOrDefault() ?? string.Empty;
|
x.org_id = ssds?.Select(xx => xx.org_id).FirstOrDefault() ?? string.Empty;
|
||||||
x.create_id = _userManager.UserId;
|
x.create_id = _userManager.UserId;
|
||||||
x.create_time = DateTime.Now;
|
x.create_time = DateTime.Now;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Filter;
|
||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
using JNPF.VisualDev;
|
using JNPF.VisualDev;
|
||||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||||
@@ -84,7 +85,19 @@ namespace Tnb.WarehouseMgr
|
|||||||
});
|
});
|
||||||
return stockReport;
|
return stockReport;
|
||||||
});
|
});
|
||||||
return result;
|
|
||||||
|
var pages = result.Skip(input.currentPage * input.pageSize).Take(input.pageSize).ToList();
|
||||||
|
SqlSugarPagedList<WmsStockReportH> pagedList = new()
|
||||||
|
{
|
||||||
|
list = pages,
|
||||||
|
pagination = new()
|
||||||
|
{
|
||||||
|
CurrentPage = input.currentPage,
|
||||||
|
PageSize = input.pageSize,
|
||||||
|
Total = result.Count()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return PageResult<WmsStockReportH>.SqlSugarPageResult(pagedList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user