南骏 池
2025-04-02 5bc70ea9041912fd6239822b32748d55d6fb6f4b
service/Warehouse/MesDepotSectionsManager.cs
@@ -7,14 +7,19 @@
public class MesDepotSectionsManager : Repository<MesDepotSections>
{
    public string GetSectionName(WarehouseQuery query)
    public dynamic GetSectionName(WarehouseQuery query)
    {
        var sectionName = Db.Queryable<MesDepotSections, MesDepots>(
                (a, b) =>
                    new JoinQueryInfos(JoinType.Inner,
                        a.DepotGuid == b.Guid))
                        a.DepotGuid == b.Guid))  // 确保Guid类型正确比较
            .Where((a, b) => a.DepotSectionCode == query.sectionCode)
            .Select((a, b) => a.DepotSectionName).Single();
            .Select((a, b) => new  // 改用匿名类型替代dynamic
            {
                a.DepotSectionName,
                DepotName = b.DepotName,  // 显式指定字段别名
                DepotCode = b.DepotCode
            }).Single();
        if (sectionName == null)
            throw new Exception("库位编码 " + query.sectionCode + " 不存在,请确认!");