|
@ -113,7 +113,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES |
|
|
, string inhouseNo, string date_str, string date_end, string status, string factoryID, string factoryNo, int page = 0, int limit = 10) |
|
|
, string inhouseNo, string date_str, string date_end, string status, string factoryID, string factoryNo, int page = 0, int limit = 10) |
|
|
{ |
|
|
{ |
|
|
var q = from q1 in _context.FqcInhouseMasters |
|
|
var q = from q1 in _context.FqcInhouseMasters |
|
|
//join q2 in _context.FqcInhouseDetails on new { q1.InhouseNo, q1.SeqID } equals new { q2.InhouseNo, q2.SeqID }
|
|
|
join q2 in _context.FqcInhouseDetails on new { q1.InhouseNo, q1.SeqID } equals new { q2.InhouseNo, q2.SeqID } |
|
|
join q3 in _context.FqcResultMasters on q1.InhouseNo equals q3.InhouseNo into j1 |
|
|
join q3 in _context.FqcResultMasters on q1.InhouseNo equals q3.InhouseNo into j1 |
|
|
from q3 in j1.DefaultIfEmpty() |
|
|
from q3 in j1.DefaultIfEmpty() |
|
|
join q4 in _context.WipInfos on q1.WipNo equals q4.WipNO into s |
|
|
join q4 in _context.WipInfos on q1.WipNo equals q4.WipNO into s |
|
@ -123,6 +123,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES |
|
|
select new FqcInhouseMasterDto |
|
|
select new FqcInhouseMasterDto |
|
|
{ |
|
|
{ |
|
|
Werks = q4.Werks, |
|
|
Werks = q4.Werks, |
|
|
|
|
|
SerialNo = q2.SerialNo, |
|
|
FactoryNo = q5.FactoryNo, |
|
|
FactoryNo = q5.FactoryNo, |
|
|
InhouseNo = q1.InhouseNo, |
|
|
InhouseNo = q1.InhouseNo, |
|
|
SeqID = q1.SeqID, |
|
|
SeqID = q1.SeqID, |
|
@ -189,15 +190,33 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES |
|
|
|
|
|
|
|
|
ResultModel<FqcInhouseMasterDto> result = new ResultModel<FqcInhouseMasterDto>(); |
|
|
ResultModel<FqcInhouseMasterDto> result = new ResultModel<FqcInhouseMasterDto>(); |
|
|
|
|
|
|
|
|
|
|
|
var resultQuery = await q.Select(s => new FqcInhouseMasterDto |
|
|
|
|
|
{ |
|
|
|
|
|
Werks = s.Werks, |
|
|
|
|
|
FactoryNo = s.FactoryNo, |
|
|
|
|
|
InhouseNo = s.InhouseNo, |
|
|
|
|
|
SeqID = s.SeqID, |
|
|
|
|
|
WipNo = s.WipNo, |
|
|
|
|
|
ItemNo = s.ItemNo, |
|
|
|
|
|
InhouseQty = s.InhouseQty, |
|
|
|
|
|
ModelNo = s.ModelNo, |
|
|
|
|
|
StatusName = s.StatusName, |
|
|
|
|
|
ProTypeName = s.ProTypeName, |
|
|
|
|
|
CreateDate = s.CreateDate, |
|
|
|
|
|
EndTime = s.EndTime, |
|
|
|
|
|
SpecialNo = s.SpecialNo |
|
|
|
|
|
}).Distinct().ToListAsync(); |
|
|
|
|
|
|
|
|
// 紀錄筆數
|
|
|
// 紀錄筆數
|
|
|
result.DataTotal = q.Count(); |
|
|
result.DataTotal = resultQuery.Count(); |
|
|
|
|
|
|
|
|
// Table 頁數
|
|
|
// Table 頁數
|
|
|
if (page > 0) |
|
|
if (page > 0) |
|
|
{ |
|
|
{ |
|
|
q = q.Skip((page - 1) * limit).Take(limit); |
|
|
resultQuery = resultQuery.Skip((page - 1) * limit).Take(limit).ToList(); |
|
|
} |
|
|
} |
|
|
result.Data = await q.Distinct().ToListAsync(); |
|
|
|
|
|
|
|
|
result.Data = resultQuery; |
|
|
|
|
|
|
|
|
// 判斷結束時間
|
|
|
// 判斷結束時間
|
|
|
result.Data = result.Data.Select(s => { s.EndTime = s.StatusName == "A" ? null : s.EndTime; return s; }) |
|
|
result.Data = result.Data.Select(s => { s.EndTime = s.StatusName == "A" ? null : s.EndTime; return s; }) |
|
@ -207,8 +226,6 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES |
|
|
result.Data = result.Data.Select(s => { s.StatusName = s.StatusName == "P" ? string.IsNullOrWhiteSpace(s.SpecialNo) ? "允收" : "特採允收" : s.StatusName == "R" ? "批退" : "未驗收完成"; return s; }) |
|
|
result.Data = result.Data.Select(s => { s.StatusName = s.StatusName == "P" ? string.IsNullOrWhiteSpace(s.SpecialNo) ? "允收" : "特採允收" : s.StatusName == "R" ? "批退" : "未驗收完成"; return s; }) |
|
|
.ToList(); |
|
|
.ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -317,8 +334,11 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES |
|
|
|
|
|
|
|
|
// 特殊判斷
|
|
|
// 特殊判斷
|
|
|
// 檢查儀器編號 空白時預設帶N/A
|
|
|
// 檢查儀器編號 空白時預設帶N/A
|
|
|
query = query.Select(s => { s.OutfitNo = String.IsNullOrEmpty(s.OutfitNo) ? "N/A" : s.OutfitNo ; |
|
|
query = query.Select(s => |
|
|
return s; }).ToList(); |
|
|
{ |
|
|
|
|
|
s.OutfitNo = String.IsNullOrEmpty(s.OutfitNo) ? "N/A" : s.OutfitNo; |
|
|
|
|
|
return s; |
|
|
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
|
// Proved 空白時 抓開立入庫單人員
|
|
|
// Proved 空白時 抓開立入庫單人員
|
|
|
foreach (var item in query.Where(w => string.IsNullOrWhiteSpace(w.Proved))) |
|
|
foreach (var item in query.Where(w => string.IsNullOrWhiteSpace(w.Proved))) |
|
|