This commit is contained in:
yang.lee
2023-12-01 22:42:15 +08:00
parent 9b811fcfaf
commit e5150d209e

View File

@@ -13,7 +13,7 @@ using Tnb.WarehouseMgr.Entities;
namespace Tnb.WarehouseMgr
{
public class WmsInternalTempTestService
public class WmsInternalTempTestService : BaseWareHouseService
{
private readonly ISqlSugarClient _db;
public WmsInternalTempTestService(ISqlSugarRepository<BasLocation> repo)
@@ -24,18 +24,18 @@ namespace Tnb.WarehouseMgr
/// 修改列
/// </summary>
/// <returns></returns>
[HttpPost]
[HttpPost]
public async Task UpdateColAsync()
{
List<BasLocation> list = await _db.Queryable<BasLocation>().Where(it => it.location_code.StartsWith("CP-A", StringComparison.OrdinalIgnoreCase)).OrderBy(i => i.location_code).ToListAsync();
foreach (var loc in list)
{
ReadOnlySpan<char> inputSpan= loc.location_code.AsSpan();
ReadOnlySpan<char> inputSpan = loc.location_code.AsSpan();
ReadOnlySpan<char> lastTwoCharacters = inputSpan.Slice(inputSpan.Length - 2);
int num = lastTwoCharacters.ToString().Match(@"\d+").ParseToInt();
await _db.Updateable<BasLocation>().SetColumns(it => it.loc_column == num).Where(it => it.id==loc.id).ExecuteCommandAsync();
await _db.Updateable<BasLocation>().SetColumns(it => it.loc_column == num).Where(it => it.id == loc.id).ExecuteCommandAsync();
}
}
}
}