|
|
@ -218,27 +218,53 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES |
|
|
|
public async Task<ResultModel<dynamic>> GetIPQCDetailData(string wipNO, string itemNO, string modelNO, string dateStart, string dateEnd, string weekCode, int page = 0, int limit = 10) |
|
|
|
{ |
|
|
|
ResultModel<dynamic> result = new ResultModel<dynamic>(); |
|
|
|
var q = from q1 in _context.InspectionForms |
|
|
|
join q2 in _context.InspectionItems on q1.InspectionFormID equals q2.InspectionFormID |
|
|
|
join q3 in _context.InspectionResultDetails on q2.InspectionItemID equals q3.InspectionItemID |
|
|
|
join q4 in _context.InspectionResultMasters on q1.InspectionFormID equals q4.InspectionFormID |
|
|
|
join q5 in _context.WipAtts on q4.WipNo equals q5.WipNO |
|
|
|
join q6 in _context.CalendarTables on q1.CreateDate.Date equals q6.TimeID |
|
|
|
join q7 in _context.LineInfoes on q3.LineID equals q7.LineID |
|
|
|
|
|
|
|
var d = _context.InspectionResultDetails; |
|
|
|
|
|
|
|
var q = from q0 in _context.InspectionTypes.Where(w => w.InspectionNo.Contains("IPQC")) |
|
|
|
join q1 in _context.InspectionForms on q0.InspectionTypeID equals q1.InspectionTypeID |
|
|
|
join q4 in _context.InspectionResultMasters.Where(w => w.StatusNo == "C") on q1.InspectionFormID equals q4.InspectionFormID |
|
|
|
join q5 in _context.WipAtts on q4.WipNo equals q5.WipNO into cp5 |
|
|
|
from q5 in cp5.DefaultIfEmpty() |
|
|
|
join q6 in _context.CalendarTables on q4.CreateDate.Date equals q6.TimeID |
|
|
|
|
|
|
|
|
|
|
|
select new |
|
|
|
{ |
|
|
|
q1.InspectionFormID, |
|
|
|
q1.InspectionNo, |
|
|
|
q1.CreateDate, |
|
|
|
q4.InspectionID, |
|
|
|
q4.CreateDate, |
|
|
|
q4.WipNo, |
|
|
|
q5.ItemNO, |
|
|
|
q5.ModelNO, |
|
|
|
q7.LineDesc, |
|
|
|
StationName = q3.Stations.StationName, |
|
|
|
q4.BarcodeNo, |
|
|
|
q3.Result, |
|
|
|
IPQCWeek = q6.WeekOfYear |
|
|
|
}; |
|
|
|
IPQCWeek = q6.WeekOfYear, |
|
|
|
Result = d.Where(w => w.InspectionID == q4.InspectionID && w.Result == "F").Select(s => s.Result).Count() > 0 ? "F" : "P" }; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var q = from q1 in _context.InspectionForms
|
|
|
|
// join q2 in _context.InspectionItems on q1.InspectionFormID equals q2.InspectionFormID
|
|
|
|
// join q3 in _context.InspectionResultDetails on q2.InspectionItemID equals q3.InspectionItemID
|
|
|
|
// join q4 in _context.InspectionResultMasters on q1.InspectionFormID equals q4.InspectionFormID
|
|
|
|
// join q5 in _context.WipAtts on q4.WipNo equals q5.WipNO
|
|
|
|
// join q6 in _context.CalendarTables on q1.CreateDate.Date equals q6.TimeID
|
|
|
|
// join q7 in _context.LineInfoes on q3.LineID equals q7.LineID
|
|
|
|
// select new
|
|
|
|
// {
|
|
|
|
// q1.InspectionFormID,
|
|
|
|
// q1.InspectionNo,
|
|
|
|
// q1.CreateDate,
|
|
|
|
// q4.WipNo,
|
|
|
|
// q5.ItemNO,
|
|
|
|
// q5.ModelNO,
|
|
|
|
// q7.LineDesc,
|
|
|
|
// StationName = q3.Stations.StationName,
|
|
|
|
// q4.BarcodeNo,
|
|
|
|
// q3.Result,
|
|
|
|
// IPQCWeek = q6.WeekOfYear
|
|
|
|
// };
|
|
|
|
|
|
|
|
if (wipNO != null && wipNO != "") |
|
|
|
{ |
|
|
|