Browse Source

1. TestLog 相關程式上傳

"TestLogConnection": "Data Source=GPMDBN;Initial Catalog=TestAutomate;user id=ipro_mis;password=mmii@2019;Encrypt=False;"
Dapper Version="2.0.151
PTD
Sai 1 year ago
parent
commit
54cb85dfaa
  1. 29
      AMESCoreStudio.Web/Controllers/PCSController.cs
  2. 7
      AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs
  3. 40
      AMESCoreStudio.Web/ViewModels/PCS/PCS009RViewModel.cs
  4. 57
      AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml
  5. 28
      AMESCoreStudio.Web/Views/PCS/PCS009T.cshtml
  6. 4
      AMESCoreStudio.WebApi/Models/AMES/OutfitInfo.cs

29
AMESCoreStudio.Web/Controllers/PCSController.cs

@ -26,6 +26,7 @@ using ClosedXML.Excel;
using Microsoft.VisualBasic;
using AMESCoreStudio.WebApi.Models.SYS;
namespace AMESCoreStudio.Web.Controllers
{
@ -4637,18 +4638,40 @@ namespace AMESCoreStudio.Web.Controllers
});
}
// TestLog
var testLogResult = await _pcsApi.GetTestLogByMSSql(result.BarCodeNo);
foreach (var item in testLogResult)
{
var FileName = (string)item.filename;
var RecordTime = FileName.Split('-')[1];
if (DateTime.TryParseExact(RecordTime, "yyyyMMddHHmmss", null, System.Globalization.DateTimeStyles.None, out DateTime resultDate))
{
RecordTime = resultDate.ToString("yyyy/MM/dd HH:mm:ss");
}
result.testLogs.Add(new TestLog
{
TestId = item.id,
Result = FileName.Contains("PASS") ? "PASS" : "FAIL",
Record_Time = RecordTime,
FileName = FileName,
//FilePath = $@"/TestLog/{(string)item.workOrder}/{FileName}"
});
//SopPath = $@"/DocEsop/{Esop.FirstOrDefault().file_path}"
}
return View(result);
}
public async Task<IActionResult> PCS009T(string id)
public async Task<IActionResult> PCS009T(string sn ,string id)
{
var query = await _pcsApi.GetTestLog("99300023400030");
var query = await _pcsApi.GetTestLogByMSSql(sn);
var result = new List<PCS009TViewModel>();
if (query.Any())
{
var item = query.Where(w => w.id == id).FirstOrDefault();
// 使用反射獲取属性信息並創建列
foreach (var property in query.FirstOrDefault().Children())
foreach (var property in item.Children())
{
var columnName = ((string)property.Name).ToUpper();
var columnValue = property.Value.ToString();

7
AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs

@ -1829,6 +1829,13 @@ namespace AMESCoreStudio.Web
[WebApiClient.Attributes.HttpGet("api/TestLog/{id}")]
ITask<List<dynamic>> GetTestLog(string id);
/// <summary>
/// Test Log 查詢
/// </summary>
/// <returns></returns>
[WebApiClient.Attributes.HttpGet("api/TestLog/ByMSSql/{id}")]
ITask<List<dynamic>> GetTestLogByMSSql(string id);
#endregion
}
}

40
AMESCoreStudio.Web/ViewModels/PCS/PCS009RViewModel.cs

@ -20,6 +20,7 @@ namespace AMESCoreStudio.Web.ViewModels.PCS
KPChanges = new List<BarcodeItemChangeDTO>();
Outfits = new List<Outfit>();
nGInfoDtos = new List<NGInfoDto>();
testLogs = new List<TestLog>();
}
/// <summary>
@ -92,6 +93,14 @@ namespace AMESCoreStudio.Web.ViewModels.PCS
/// </summary>
public List<NGInfoDto> nGInfoDtos { get; set; }
/// <summary>
/// TestLog
/// </summary>
public List<TestLog> testLogs
{
get; set;
}
}
/// <summary>
@ -279,4 +288,35 @@ namespace AMESCoreStudio.Web.ViewModels.PCS
/// </summary>
public string Date { get; set; }
}
/// <summary>
/// TestLog
/// </summary>
public class TestLog
{
/// <summary>
/// TestId
/// </summary>
public int TestId { get; set; }
/// <summary>
/// 結果
/// </summary>
public string Result { get; set; }
/// <summary>
/// 測試時間 RECORD_TIME
/// </summary>
public string Record_Time { get; set; }
/// <summary>
/// 檔案名稱
/// </summary>
public string FileName { get; set; }
/// <summary>
/// 檔案路徑
/// </summary>
public string FilePath { get; set; }
}
}

57
AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml

@ -189,8 +189,6 @@
<th>
過站時間
</th>
<th style="width:70px;">
</th>
</tr>
</thead>
<tbody>
@ -220,17 +218,64 @@
<td>
@DateTime.Parse(index.InputDate).ToString("yyyy/MM/dd HH:mm:ss")
</td>
</tr>
}
</tbody>
</table>
</div>
@if (Model.testLogs.Count != 0)
{
<div class="layui-row">
<fieldset class="layui-elem-field layui-field-title">
<legend style="color: #e18917">TestLog</legend>
</fieldset>
<table class="layui-table" lay-even lay-size="sm">
<thead>
<tr>
<th>
結果
</th>
<th>
測試時間
</th>
<th>
檔案路徑
</th>
<th style="width:70px;"></th>
</tr>
</thead>
<tbody>
@foreach (var index in Model.testLogs)
{
<tr>
<td>
@if (index.Station == "PK1")
@if (index.Result == "FAIL")
{
<span style="color:red">@index.Result</span>
}
else
{
<a class="layui-btn layui-btn-primary layui-border-black layui-btn-sm" onclick="testLog();">測試Log</a>
<span style="color:blue">@index.Result</span>
}
</td>
<td>
@index.Record_Time
</td>
<td>
@index.FileName
@*<a href='@index.FilePath' target='_blank'>@index.FileName</a>*@
</td>
<td>
<a class="layui-btn layui-btn-primary layui-border-black layui-btn-sm" onclick='testLog(@index.TestId);'>測試Log</a>
</td>
</tr>
}
</tbody>
</table>
</div>
}
<div class="layui-row">
<fieldset class="layui-elem-field layui-field-title">
<legend style="color: #e18917">組件清單</legend>
@ -500,7 +545,7 @@
<script type="text/javascript">
// 測試Log
function testLog() {
function testLog(id) {
layui.use('layer', function () {
var layer = layui.layer;
layer.open({
@ -509,7 +554,7 @@
area: ['800px', '400px'],
fixed: false, //不固定
maxmin: true,
content: '/PCS/PCS009T?id=' + @Model.BarCodeNo
content: `/PCS/PCS009T?sn=${@Model.BarCodeNo}&id=${id}`
});
});
};

28
AMESCoreStudio.Web/Views/PCS/PCS009T.cshtml

@ -3,34 +3,6 @@
}
<div class="layui-card-body">
<div class="layui-row">
<div class="layui-col-xs2">
<label class="layui-form-label">工單號碼</label>
</div>
<div class="layui-col-xs3">
<label class="layui-form-label" style="text-align:left">@ViewBag.WipNo</label>
</div>
<div class="layui-col-xs2">
<label class="layui-form-label">內部條碼</label>
</div>
<div class="layui-col-xs5">
<label class="layui-form-label" style="text-align:left">@ViewBag.BarCodeNo</label>
</div>
</div>
<div class="layui-row">
<div class="layui-col-xs2">
<label class="layui-form-label">測試日期</label>
</div>
<div class="layui-col-xs3">
<label class="layui-form-label" style="width:100%;text-align:left">@ViewBag.RecodeTime</label>
</div>
<div class="layui-col-xs2">
<label class="layui-form-label">檔案名稱</label>
</div>
<div class="layui-col-xs5">
<label class="layui-form-label" style="width:100%;text-align:left">@ViewBag.FileName</label>
</div>
</div>
<div class="layui-row">
<table class="layui-table" lay-even>
<thead>

4
AMESCoreStudio.WebApi/Models/AMES/OutfitInfo.cs

@ -279,12 +279,12 @@ namespace AMESCoreStudio.WebApi.Models.AMES
public string ModelNo { get; set; }
/// <summary>
/// 內部條碼
/// PLM料號
/// </summary>
[Column("BARCODE_NO")]
[StringLength(50)]
[DataMember]
[Display(Name = "內部條碼")]
[Display(Name = "PLM料號")]
public string BarcodeNo { get; set; }

Loading…
Cancel
Save