This commit is contained in:
2025-11-12 16:20:51 +08:00
parent 5ae262205c
commit cd05ad2305
3 changed files with 42 additions and 47 deletions

View File

@@ -199,7 +199,7 @@ public class apporderController : ApiController
string sortBy = "", bool sortDesc = false)
{
var qry = _db.pro_order.AsQueryable();
var qry = _db.pro_order.AsEnumerable();
//var aIDt = _db.actItems.Where(f => f.subject.Contains(q.actItemTxt.Trim())).Select(f => f.num);//品項
@@ -218,32 +218,32 @@ public class apporderController : ApiController
if (!string.IsNullOrEmpty(q.address))
qry = qry.Where(o => o.address.Contains(q.address.Trim()));
if (!string.IsNullOrEmpty(q.subject))
qry = qry.Where(o => o.activity_num.HasValue && o.activity.subject.Contains(q.subject?.Trim()));
qry = qry.Where(o => o.activity_num.HasValue && o.activity.subject.Contains(q.subject.Trim()));
if (!string.IsNullOrEmpty(q.u_name))
qry = qry.Where(o => o.f_num.HasValue && o.follower.u_name.Contains(q.u_name?.Trim()));
qry = qry.Where(o => o.f_num.HasValue && o.follower.u_name.Contains(q.u_name.Trim()));
if (!string.IsNullOrEmpty(q.introducerTxt))
qry = qry.Where(o => o.introducer.HasValue && o.follower1.u_name.Contains(q.introducerTxt?.Trim()));
qry = qry.Where(o => o.introducer.HasValue && o.follower1.u_name.Contains(q.introducerTxt.Trim()));
if (!string.IsNullOrEmpty(q.actItemTxt))
{
//qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.order_no == o.order_no && aIDt.ToArray().Contains(f2.actItem_num?.ToString())).Count() > 0);
// qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.order_no == o.order_no && aIDt.Any(x => x == f2.actItem_num)).Count() > 0);
qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.actItem_num.HasValue && f2.actItem.subject.Contains(q.actItemTxt?.Trim())).Count() > 0);
qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.actItem_num.HasValue && f2.actItem.subject.Contains(q.actItemTxt.Trim())).Count() > 0);
}
if (!string.IsNullOrEmpty(q.country))
qry = qry.Where(o => o.f_num != null && o.follower?.country == q.country);
qry = qry.Where(o => o.f_num != null && o.follower != null && o.follower.country == q.country);
if (!string.IsNullOrEmpty(q.country2))
{
if (q.country2 == "1")
{
qry = qry.Where(o => o.f_num != null && o.follower?.country == "158");
qry = qry.Where(o => o.f_num != null && o.follower != null && o.follower.country == "158");
}
else if (q.country2 == "2")
{
qry = qry.Where(o => o.f_num != null && o.follower?.country != "158");
qry = qry.Where(o => o.f_num != null && o.follower != null && o.follower.country != "158");
}
}