1.数据库编译报错

2.修改货架IP接口
This commit is contained in:
hehaibing-1996
2025-03-14 17:39:52 +08:00
parent 549a45dcf0
commit 5441648d49
2 changed files with 48 additions and 1 deletions

View File

@ -15,7 +15,7 @@ namespace WCS.DAL.Db
/// </summary>
public static SqlSugarScope db = new SqlSugarScope(new ConnectionConfig()
{
ConnectionString = $"Data Source={DbPath.DataDbPath};Version=3;journal_mode=WAL;",
ConnectionString = $"Data Source={DbPath.DataDbPath};",
DbType = DbType.Sqlite,//[Sqlite]安装[System.Data.SQLite];
IsAutoCloseConnection = true
}, db =>

View File

@ -223,6 +223,53 @@ namespace WCS.WebApi.Controllers
};
}
}
[Route("updateClientIp")]
[HttpPost(Name = "updateClientIp")]
public async Task<ResponseBase> updateClientIp(RequestBase request)
{
try
{
if (request.UserName != "aaa")
{
return new ResponseBase()
{
Code = 300,
Message = "用户名不对头修改货架的IP。"
};
}
//获取货架 此组后端管的货架
var shelfInfos = DbHelp.db.Queryable<ShelfInfo>()
.Where(t => t.ClientIp.Contains(".225."))
.ToList();
shelfInfos.ForEach(t => t.ClientIp = t.ClientIp.Replace(".225.", ".210."));
var moduleInfos = DbHelp.db.Queryable<ModuleInfo>()
.Where(t => t.CleintIp.Contains(".225."))
.ToList();
moduleInfos.ForEach(t => t.CleintIp = t.CleintIp.Replace(".225.", ".210."));
DbHelp.db.Updateable(moduleInfos).UpdateColumns(t => new { t.CleintIp }).ExecuteCommand();
DbHelp.db.Updateable(shelfInfos).UpdateColumns(t => new { t.ClientIp }).ExecuteCommand();
return new ResponseBase()
{
Code = 200,
Message = "更新库位成功"
};
}
catch (Exception ex)
{
return new ResponseBase()
{
Code = 300,
Message = ex.Message
};
}
}
#endregion
}
}