修改舒文,牌位预览列印
This commit is contained in:
@@ -22,94 +22,14 @@ public class orderdetailController:ApiController
|
||||
public IHttpActionResult GetList([FromBody] Model.ViewModel.pro_order q, int page, int pageSize = 10, string sortBy = "", bool sortDesc = false)
|
||||
{
|
||||
int activity_num = Convert.ToInt32(q.activity_num);
|
||||
|
||||
//現在的牌位預覽只會出現功德主,修改為所有人都會出現
|
||||
//var aIDt = _db.actItems.AsEnumerable().Where(f => f.subject.Contains(q.actItemTxt.Trim())).Select(f => f.num);//品項
|
||||
var OrderList = _db.pro_order.Where(u => u.activity_num == activity_num).Select(j => j.order_no).ToList();
|
||||
var gdzOrderList = _db.pro_order_detail.Where(o => OrderList.Contains(o.order_no) && o.print_id.Contains("主")).Select(o => o.order_no).Distinct().ToList();
|
||||
var qry = _db.pro_order.Where(u => gdzOrderList.Contains(u.order_no)).AsEnumerable();
|
||||
if (!string.IsNullOrEmpty(q.order_no))
|
||||
qry = qry.Where(o => o.order_no.Contains(q.order_no.Trim()));
|
||||
if (!string.IsNullOrEmpty(q.keyin1))
|
||||
qry = qry.Where(o => o.keyin1.Contains(q.keyin1));
|
||||
if (q.f_num.HasValue && q.f_num > 0)
|
||||
qry = qry.Where(o => o.f_num == q.f_num);
|
||||
if (q.activity_num.HasValue && q.activity_num > 0)
|
||||
qry = qry.Where(o => o.activity_num == q.activity_num);
|
||||
if (q.up_time1.HasValue)
|
||||
qry = qry.Where(o => o.up_time >= q.up_time1.Value);
|
||||
if (q.up_time2.HasValue)
|
||||
qry = qry.Where(o => o.up_time < Convert.ToDateTime(q.up_time2.Value).AddDays(1));
|
||||
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()));
|
||||
if (!string.IsNullOrEmpty(q.u_name))
|
||||
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()));
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(q.country))
|
||||
qry = qry.Where(o => o.f_num != 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");
|
||||
}
|
||||
else if (q.country2 == "2")
|
||||
{
|
||||
qry = qry.Where(o => o.f_num != null && o.follower?.country != "158");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (sortBy.Equals("order_no"))
|
||||
{
|
||||
if (sortDesc)
|
||||
qry = qry.OrderByDescending(o => o.order_no);
|
||||
else
|
||||
qry = qry.OrderBy(o => o.order_no);
|
||||
}
|
||||
else if (sortBy.Equals("keyin1_txt"))
|
||||
{
|
||||
if (sortDesc)
|
||||
qry = qry.OrderByDescending(o => o.keyin1);
|
||||
else
|
||||
qry = qry.OrderBy(o => o.keyin1);
|
||||
}
|
||||
else if (sortBy.Equals("up_time"))
|
||||
{
|
||||
if (sortDesc)
|
||||
qry = qry.OrderByDescending(o => o.up_time);
|
||||
else
|
||||
qry = qry.OrderBy(o => o.up_time);
|
||||
}
|
||||
else if (sortBy.Equals("u_name"))
|
||||
{
|
||||
if (sortDesc)
|
||||
qry = qry.OrderByDescending(o => o.follower?.u_name);
|
||||
else
|
||||
qry = qry.OrderBy(o => o.follower?.u_name);
|
||||
}
|
||||
else if (sortBy.Equals("subject"))
|
||||
{
|
||||
if (sortDesc)
|
||||
qry = qry.OrderByDescending(o => o.activity?.subject);
|
||||
else
|
||||
qry = qry.OrderBy(o => o.activity?.subject);
|
||||
}
|
||||
else
|
||||
qry = qry.OrderByDescending(o => o.reg_time);
|
||||
//var OrderList = _db.pro_order.Where(u => u.activity_num == activity_num).Select(j => j.order_no).ToList();
|
||||
//var gdzOrderList = _db.pro_order_detail.Where(o => OrderList.Contains(o.order_no) && o.print_id.Contains("主")).Select(o => o.order_no).Distinct().ToList();
|
||||
//var qry = _db.pro_order.Where(u => gdzOrderList.Contains(u.order_no)).AsEnumerable();
|
||||
var qry = _db.pro_order.Where( u => u.activity_num == activity_num).AsEnumerable();
|
||||
|
||||
qry = qry.OrderByDescending(o => o.reg_time);
|
||||
|
||||
var count = qry.Count(); //pageSize = count;//一次取回??
|
||||
var ret = new
|
||||
@@ -125,7 +45,11 @@ public class orderdetailController:ApiController
|
||||
up_time = x.up_time,
|
||||
keyin1_txt = Model.pro_order.keyin1_value_to_text(x.keyin1),
|
||||
//detail = x.pro_order_detail.Where(u => u.printed_files != null)
|
||||
detail = new { count = x.pro_order_detail.Where(u => u.actItem.act_bom.Count() == 0).Count(),
|
||||
detail = new { count = x.pro_order_detail
|
||||
.Where(u => (u.parent_num != null)
|
||||
|| u.actItem.subject.Contains("牌")
|
||||
|| !string.IsNullOrEmpty(u.f_num_tablet))
|
||||
.Count(),
|
||||
actItem = x.pro_order_detail.Where(u => u.printed_files != null).FirstOrDefault()?.print_id }
|
||||
}),
|
||||
count = count
|
||||
|
||||
Reference in New Issue
Block a user