41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using JNPF.Common.Extension;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using NPOI.SS.Formula.Functions;
|
|
using Org.BouncyCastle.Crypto;
|
|
using SqlSugar;
|
|
using Tnb.BasicData.Entities;
|
|
using Tnb.WarehouseMgr.Entities;
|
|
|
|
namespace Tnb.WarehouseMgr
|
|
{
|
|
public class WmsInternalTempTestService : BaseWareHouseService
|
|
{
|
|
private readonly ISqlSugarClient _db;
|
|
public WmsInternalTempTestService(ISqlSugarRepository<BasLocation> repo)
|
|
{
|
|
_db = repo.AsSugarClient();
|
|
}
|
|
/// <summary>
|
|
/// 修改列
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[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)
|
|
{
|
|
var input = loc.location_code.Substring(loc.location_code.Length - 2);
|
|
int num = input.Match(@"\d+").ParseToInt();
|
|
await _db.Updateable<BasLocation>().SetColumns(it => it.loc_column == num).Where(it => it.id == loc.id).ExecuteCommandAsync();
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|