增加配置库位编码接口

This commit is contained in:
hehaibing-1996
2025-06-06 14:33:30 +08:00
parent b64103e6f3
commit c78f0bfbe8
3 changed files with 95 additions and 1 deletions

View File

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Kdbndp;
using Microsoft.AspNetCore.Mvc;
using NPOI.SS.Formula.Functions;
using SqlSugar;
using WCS.BLL.DbModels;
@ -786,5 +787,55 @@ namespace WCS.WebApi.Controllers
};
}
}
/// <summary>
/// 配置库位编码
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("setStoreCode")]
[HttpPost(Name = "setStoreCode")]
public async Task<ResponseBase> setStoreCode(SetBoardIdRequest request)
{
try
{
var errorList = new List<string>();
//1.获取所有液晶标签货架
var shelfs = ShelfManager.Shelves.Where(t => t.ShelfTypeName == "液晶标签货架")
.WhereIF(!string.IsNullOrEmpty(request.IPPort), t => t.ClientIp == request.IPPort)
.Select(t => t as MXL4Shelf)
.ToList();
shelfs.ForEach(t =>
{
t.MXL4Modules.ForEach(m =>
{
try
{
m.SendStoreCode(m.ModuleCode, t.TcpCleint);
}
catch (Exception ex)
{
errorList.Add($"模组{m.ModuleCode}更新库位ID失败原因{ex.Message}");
}
});
});
return new ResponseCommon
{
Code = 200,
Message = "success",
Data = errorList
};
}
catch (Exception ex)
{
return new ResponseCommon
{
Code = 300,
Message = "操作失败:" + ex.Message,
};
}
}
}
}