22
schangxiang@126.com
2024-12-09 b5d7c95fefb1c0df40a9623511237d4d4271e5e0
LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsCommonnQuery/WmsCommonnQueryService.cs
@@ -645,5 +645,64 @@
        return package;
    }
    /// <summary>
    /// 根据包号,查询某个包下的板件数据
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPost]
    [ApiDescriptionSettings(Name = "QueryUpiListByPackage")]
    [Description("WmsCommonnQuery/QueryUpiListByPackage")]
    public async Task<List<Mes_BatchOrderUPI_New>> QueryUpiListByPackage(QueryPackageInput input)
    {
        if (input == null || input.PackageCode == null)
        {
            throw Oops.Oh("参数不能为空");
        }
        var package = await _mesPackageGatherRep.AsQueryable().Where(x => x.PackageCode == input.PackageCode).FirstAsync();
        if (package == null)
        {
            throw Oops.Oh($"没有找到包号{input.PackageCode}的汇总数据");
        }
        var upiList = await _mesBatchOrderUpiRep.AsQueryable().Where(x => x.PackageCode == input.PackageCode).ToListAsync();
        return upiList;
    }
    /// <summary>
    /// 根据某个Upi,查询某个包下的板件数据
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPost]
    [ApiDescriptionSettings(Name = "QueryUpiListByUpi")]
    [Description("WmsCommonnQuery/QueryUpiListByUpi")]
    public async Task<List<Mes_BatchOrderUPI_New>> QueryUpiListByUpi(QueryUpiListByUpiInput input)
    {
        if (input == null || input.Upi == null)
        {
            throw Oops.Oh("参数不能为空");
        }
        var singleUpi = await _mesBatchOrderUpiRep.AsQueryable().Where(x => x.UPI == input.Upi).FirstAsync();
        if (singleUpi == null)
        {
            throw Oops.Oh($"没有找到部件条码{input.Upi}的数据");
        }
        var package = await _mesPackageGatherRep.AsQueryable().Where(x => x.PackageCode == singleUpi.PackageCode).FirstAsync();
        if (package == null)
        {
            throw Oops.Oh($"没有找到包号{singleUpi.PackageCode}的汇总数据");
        }
        var upiList = await _mesBatchOrderUpiRep.AsQueryable().Where(x => x.PackageCode == singleUpi.PackageCode).ToListAsync();
        return upiList;
    }
}