diff --git a/AMESCoreStudio.Web/Controllers/SPCController.cs b/AMESCoreStudio.Web/Controllers/SPCController.cs index 532ef4d6..3905d0b9 100644 --- a/AMESCoreStudio.Web/Controllers/SPCController.cs +++ b/AMESCoreStudio.Web/Controllers/SPCController.cs @@ -1319,7 +1319,7 @@ namespace AMESCoreStudio.Web.Controllers return Json(new Table() { count = 0, data = null }); } - public async Task GetInspectionResultMastersByQueryAllAsync(int id, string WipNo, string ItemNo, string BarcodeNo, string StatusNo, string sdate, string edate, int page = 0, int limit = 10) + public async Task GetInspectionResultMastersByQueryAllAsync(int type,int id, string WipNo, string ItemNo, string BarcodeNo, string StatusNo, string sdate, string edate, int page = 0, int limit = 10) { //yiru 2022-11-17 //if (id == 0) @@ -1340,7 +1340,7 @@ namespace AMESCoreStudio.Web.Controllers edate = "*"; - var result = await _spcApi.GetInspectionResultMastersByQueryAll( id, WipNo, ItemNo, BarcodeNo, StatusNo, sdate, edate, page , limit ); + var result = await _spcApi.GetInspectionResultMastersByQueryAll(type, id, WipNo, ItemNo, BarcodeNo, StatusNo, sdate, edate, page , limit ); if (result.DataTotal > 0) diff --git a/AMESCoreStudio.Web/HttpApis/AMES/ISPC.cs b/AMESCoreStudio.Web/HttpApis/AMES/ISPC.cs index 2674928b..3db00cc7 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/ISPC.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/ISPC.cs @@ -233,8 +233,8 @@ namespace AMESCoreStudio.Web /// 根据巡檢結果MASTER /// /// - [WebApiClient.Attributes.HttpGet("api/InspectionResultMasters/QueryAll/{id}/{WipNo}/{ItemNo}/{BarcodeNo}/{StatusNo}/{sdate}/{edate}")] - ITask> GetInspectionResultMastersByQueryAll(int id, string WipNo, string ItemNo, string BarcodeNo, string StatusNo, string sdate, string edate, int page = 0, int limit = 10); + [WebApiClient.Attributes.HttpGet("api/InspectionResultMasters/QueryAll/{type}/{id}/{WipNo}/{ItemNo}/{BarcodeNo}/{StatusNo}/{sdate}/{edate}")] + ITask> GetInspectionResultMastersByQueryAll(int type,int id, string WipNo, string ItemNo, string BarcodeNo, string StatusNo, string sdate, string edate, int page = 0, int limit = 10); /// diff --git a/AMESCoreStudio.Web/Views/SPC/SPC005.cshtml b/AMESCoreStudio.Web/Views/SPC/SPC005.cshtml index a4d30631..0ab8e54b 100644 --- a/AMESCoreStudio.Web/Views/SPC/SPC005.cshtml +++ b/AMESCoreStudio.Web/Views/SPC/SPC005.cshtml @@ -256,10 +256,10 @@ btns = btns + '编辑'; else if (item.statusNo == "保存") { btns = btns + '檢視'; - if ($("#Type").val() == 1001) { + if (item.inspectionTypeID == 1001) { btns = btns + 'PDF '; } - if ($("#Type").val() == 1000 || $("#Type").val() == 1002) { + if (item.inspectionTypeID == 1000 || item.inspectionTypeID == 1002) { btns = btns + 'PDF '; } @@ -269,6 +269,12 @@ return btns; } } + ,{ + field: 'inspectionTypeID', + title: '#', + sort: true, + hide: true // 这里设置为隐藏 + } ]]; function PDF(obj) { @@ -349,7 +355,8 @@ var StatusNo = ""; var sdate = ""; var edate = ""; - + var type = ""; + type = $("#Type").val(); form = $("#Form").val(); WipNo = $("#WipNo").val(); ItemNo = $("#ItemNo").val(); @@ -359,7 +366,8 @@ edate = $("#dateEnd").val(); table = hg.table.datatable('test', '巡檢結果維護', '/SPC/GetInspectionResultMastersByQueryAll?' - + 'id=' + form + + 'type=' + type + + '&id=' + form + '&WipNo=' + WipNo + '&ItemNo=' + ItemNo + '&BarcodeNo=' + BarcodeNo diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/InspectionResultMastersController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/InspectionResultMastersController.cs index f4b93892..145c82f9 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/InspectionResultMastersController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/InspectionResultMastersController.cs @@ -314,6 +314,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES /// /// 用FormID获取该巡檢結果资料 /// + /// /// /// /// @@ -323,17 +324,20 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES /// v /// // GET: api/InspectionItems/5 - [HttpGet("QueryAll/{id}/{WipNo}/{ItemNo}/{BarcodeNo}/{StatusNo}/{sdate}/{edate}")] - public async Task> GetInspectionResultMastersByQueryAll(int id, string WipNo, string ItemNo, string BarcodeNo, string StatusNo, string sdate, string edate, int page = 0, int limit = 10) + [HttpGet("QueryAll/{type}/{id}/{WipNo}/{ItemNo}/{BarcodeNo}/{StatusNo}/{sdate}/{edate}")] + public async Task> GetInspectionResultMastersByQueryAll(int type,int id, string WipNo, string ItemNo, string BarcodeNo, string StatusNo, string sdate, string edate, int page = 0, int limit = 10) { ResultModel result = new ResultModel(); var q = from q1 in _context.InspectionResultMasters join q3 in _context.InspectionResultDetails on q1.InspectionID equals q3.InspectionID + join q4 in _context.InspectionForms on q1.InspectionFormID equals q4.InspectionFormID + join q5 in _context.InspectionTypes on q4.InspectionTypeID equals q5.InspectionTypeID // from q3 in j1.DefaultIfEmpty() select new InspectionResultMasterDto { + InspectionTypeID = q5.InspectionTypeID, InspectionID = q1.InspectionID, InspectionFormID = q1.InspectionFormID, BarcodeNo = q1.BarcodeNo, @@ -351,13 +355,15 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES }; - + //yiru 2022-11-17 - // ResultModel result = new ResultModel(); - // IQueryable q = _context.InspectionResultMasters; + // ResultModel result = new ResultModel(); + // IQueryable q = _context.InspectionResultMasters; + if (type.ToString() != "-99" && type.ToString() != "0") + q = q.Where(p => p.InspectionTypeID.Equals(type)); if (id.ToString()!="-99"&&id.ToString()!="0") q = q.Where(p => p.InspectionFormID.Equals(id)); @@ -396,6 +402,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES var q0 = q.GroupBy(q => q.InspectionID).Select(cl => new InspectionResultMasterDto { + InspectionTypeID = cl.Max(m => m.InspectionTypeID), InspectionID = cl.Max(m => m.InspectionID), InspectionFormID = cl.Max(m => m.InspectionFormID), BarcodeNo = cl.Max(m => m.BarcodeNo), diff --git a/AMESCoreStudio.WebApi/DTO/AMES/InspectionResultMasterDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/InspectionResultMasterDto.cs index f574174b..59c8631b 100644 --- a/AMESCoreStudio.WebApi/DTO/AMES/InspectionResultMasterDto.cs +++ b/AMESCoreStudio.WebApi/DTO/AMES/InspectionResultMasterDto.cs @@ -10,6 +10,7 @@ namespace AMESCoreStudio.WebApi.DTO.AMES /// public class InspectionResultMasterDto { + public int InspectionTypeID { get; set; } public int InspectionID { get; set; } public int InspectionFormID { get; set; } public string BarcodeNo { get; set; }