功德芳名列印,bug修正
This commit is contained in:
@@ -1053,6 +1053,157 @@ public class activityController : ApiController
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("api/activity/GetActRelaList2")]
|
||||
public IHttpActionResult GetActRelaList2([FromBody] Model.activity q, int page, int pageSize = 100,
|
||||
string sortBy = "", bool sortDesc = false)
|
||||
{ //if pagesize==-1 get all data
|
||||
int this_act_id = q.num;
|
||||
if (this_act_id > 0)
|
||||
{
|
||||
//檢查
|
||||
var prod = _db.activities.Where(o => o.num == this_act_id).FirstOrDefault();
|
||||
if (prod != null)
|
||||
{
|
||||
int kind = prod.kind ?? 0; //分類
|
||||
|
||||
var qry = _db.activity_relating.AsQueryable();
|
||||
qry = qry.Where(o => o.activity_num == this_act_id);
|
||||
qry = qry.OrderBy(o => o.num);
|
||||
//IEnumerable<Model.activity_relating> qry1=qry.AsEnumerable();
|
||||
IEnumerable<Model.activity_relating> qry1 = null;
|
||||
|
||||
//var retD = qry1;
|
||||
var count = qry.Count(); //pageSize = count;//一次取回??
|
||||
if (count > 0)
|
||||
{
|
||||
int i = 1;
|
||||
//已有值
|
||||
if (pageSize > 0)
|
||||
{
|
||||
qry1 = qry.ToPagedList(page, pageSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
qry1 = qry.ToList();
|
||||
}
|
||||
var orderDetails = _db.pro_order_detail
|
||||
.Where(o => o.pro_order.activity_num == this_act_id)
|
||||
.ToList();
|
||||
var ret = new
|
||||
{
|
||||
//list = qry1.ToPagedList(page, pageSize).Select(x => new
|
||||
list = qry1.Select(x => new
|
||||
{
|
||||
id = i++,
|
||||
num = x.num,
|
||||
|
||||
activity_num = x.activity_num,
|
||||
act_item_selected = new
|
||||
{
|
||||
text = x.actItem?.subject,
|
||||
val = x.actItem_num,
|
||||
style = x.actItem.defaultStyle
|
||||
},
|
||||
price = x.price ?? 0,
|
||||
qty = x.qty ?? 0,
|
||||
has_yang_limit = x.has_yang_limit ?? false,
|
||||
has_chao_limit = x.has_yang_limit ?? false,
|
||||
yang_limit_count = x.yang_limit_count ?? 0,
|
||||
chao_limit_count = x.chao_limit_count ?? 0,
|
||||
files = x.actItem?.actItem_files.Select(f => new
|
||||
{
|
||||
num = f.file.num,
|
||||
subject = f.file.subject,
|
||||
list = orderDetails
|
||||
.Where(o => o.actItem_num == x.actItem_num)
|
||||
.OrderBy(o => o.print_id)
|
||||
.ThenBy(o => o.num)
|
||||
.Select(o => new
|
||||
{
|
||||
num = o.num,
|
||||
print_id = o.print_id,
|
||||
order_no = o.order_no,
|
||||
from_id = o.follower1?.u_name,
|
||||
printed_files = o.printed_files,
|
||||
isPrinted = (o.printed_files ?? "").Contains("\"" + f.file.num.ToString() + "\""),
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
count = count,
|
||||
};
|
||||
|
||||
|
||||
if (ret.list == null) throw new HttpResponseException(HttpStatusCode.NotFound);
|
||||
return Ok(ret);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//未有資料
|
||||
//帶分類預設
|
||||
if (kind > 0)
|
||||
{
|
||||
int i = 1;
|
||||
var qry2 = _db.activity_kind_detail.Where(o => o.activity_kind_num == kind);
|
||||
var count2 = qry2.Count(); //pageSize = count2;//一次取回??
|
||||
var qry2List = (pageSize > 0) ? qry2.ToPagedList(page, pageSize).ToList() : qry2.ToList();
|
||||
var ret = new
|
||||
{
|
||||
list = qry2List.Select(x => new
|
||||
{
|
||||
id = i++,
|
||||
num = 0,
|
||||
activity_num = this_act_id,
|
||||
act_item_selected = new
|
||||
{
|
||||
text = x.actItem?.subject,
|
||||
val = x.actItem_num,
|
||||
style = x.actItem.defaultStyle
|
||||
},
|
||||
price = x.price ?? 0,
|
||||
qty = x.qty ?? 0,
|
||||
files = new
|
||||
{
|
||||
num = "",
|
||||
subject = "",
|
||||
list = new
|
||||
{
|
||||
num = "",
|
||||
from_id = "",
|
||||
printed_files = "",
|
||||
isPrinted = false,
|
||||
},
|
||||
},
|
||||
}),
|
||||
count = count2
|
||||
};
|
||||
|
||||
|
||||
if (ret.list == null) throw new HttpResponseException(HttpStatusCode.NotFound);
|
||||
return Ok(ret);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("api/activity/GetActRelaList1")]
|
||||
|
||||
Reference in New Issue
Block a user