From fdfbd83b401ad7c3dda2999bb7078d8fe2929c7e Mon Sep 17 00:00:00 2001 From: Yiru Date: Sun, 25 Feb 2024 18:45:32 +0800 Subject: [PATCH] =?UTF-8?q?Lab002=E9=A1=AF=E7=A4=BA=E5=8F=83=E6=95=B8?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E6=94=B9=E7=82=BA=E4=B9=9D=E5=AE=AE=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/LABController.cs | 29 ++++- .../ViewModels/LAB/LAB002ViewModel.cs | 49 ++++++++ AMESCoreStudio.Web/Views/LAB/LAB002C.cshtml | 111 ++++++++++++++++-- AMESCoreStudio.Web/Views/LAB/LAB002U.cshtml | 111 ++++++++++++++++-- AMESCoreStudio.Web/Views/LAB/LAB002V.cshtml | 44 +++++-- 5 files changed, 316 insertions(+), 28 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/LABController.cs b/AMESCoreStudio.Web/Controllers/LABController.cs index d69530a5..c245b773 100644 --- a/AMESCoreStudio.Web/Controllers/LABController.cs +++ b/AMESCoreStudio.Web/Controllers/LABController.cs @@ -229,10 +229,35 @@ namespace AMESCoreStudio.Web.Controllers public async Task GetLabelTemplatebyMatnrAsync(int id) { var result = await _labApi.GetLabelTemplatebyMatnr(id); - // var result = await _labApi.GetLabelParams(); + // var result = await _labApi.GetLabelParams(); + List models = new List(); if (result.Count > 0) { - return Json(new Table() { code = 0, msg = "", data = result, count = result.Count }); + for (int i = 0; i < result.Count; i += 3) + { + Label002Model newItem = new Label002Model(); + + newItem.LABEL_FIELD_ID1 = result[i].labeL_FIELD_ID; + newItem.LABEL_FIELD_NAME1 = result[i].labeL_FIELD_NAME; + newItem.DATA_V1 = result[i].data; + + if (i + 1 < result.Count) + { + newItem.LABEL_FIELD_ID2 = result[i + 1].labeL_FIELD_ID; + newItem.LABEL_FIELD_NAME2 = result[i + 1].labeL_FIELD_NAME; + newItem.DATA_V2 = result[i + 1].data; + } + + if (i + 2 < result.Count) + { + newItem.LABEL_FIELD_ID3 = result[i + 2].labeL_FIELD_ID; + newItem.LABEL_FIELD_NAME3 = result[i + 2].labeL_FIELD_NAME; + newItem.DATA_V3 = result[i + 2].data; + } + + models.Add(newItem); + } + return Json(new Table() { code = 0, msg = "", data = models, count = models.Count }); } return Json(new Table() { count = 0, data = null }); diff --git a/AMESCoreStudio.Web/ViewModels/LAB/LAB002ViewModel.cs b/AMESCoreStudio.Web/ViewModels/LAB/LAB002ViewModel.cs index 1b1ee94e..205ed1e8 100644 --- a/AMESCoreStudio.Web/ViewModels/LAB/LAB002ViewModel.cs +++ b/AMESCoreStudio.Web/ViewModels/LAB/LAB002ViewModel.cs @@ -31,4 +31,53 @@ namespace AMESCoreStudio.Web.ViewModels.LAB public double Value { get; set; } } + public class Label002Model + { + /// + /// 欄位ID + /// + public int LABEL_FIELD_ID1 { get; set; } + + /// + /// 欄位名稱 + /// + public string LABEL_FIELD_NAME1 { get; set; } + + /// + /// 欄位勾選 + /// + public string DATA_V1 { get; set; } + + /// + /// 欄位ID + /// + public int LABEL_FIELD_ID2 { get; set; } + + /// + /// 欄位名稱 + /// + public string LABEL_FIELD_NAME2 { get; set; } + + /// + /// 欄位勾選 + /// + public string DATA_V2 { get; set; } + + /// + /// 欄位ID + /// + public int LABEL_FIELD_ID3 { get; set; } + + /// + /// 欄位名稱 + /// + public string LABEL_FIELD_NAME3 { get; set; } + + /// + /// 欄位勾選 + /// + public string DATA_V3 { get; set; } + } + + } diff --git a/AMESCoreStudio.Web/Views/LAB/LAB002C.cshtml b/AMESCoreStudio.Web/Views/LAB/LAB002C.cshtml index 6fce6de9..f6c8efa0 100644 --- a/AMESCoreStudio.Web/Views/LAB/LAB002C.cshtml +++ b/AMESCoreStudio.Web/Views/LAB/LAB002C.cshtml @@ -117,10 +117,7 @@
-@*備註*@ - + @section Scripts{ @section Scripts{