종합 진행 현황판, 조립 진행 현황판, 라이브러리 UI 기능 개선
This commit is contained in:
@@ -6,6 +6,7 @@ using WI;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace CHN
|
||||
{
|
||||
@@ -25,8 +26,10 @@ namespace CHN
|
||||
private HashSet<string> samples = new();
|
||||
|
||||
public KPIData kpiData;
|
||||
private string dataOrder;
|
||||
public override void AfterAwake()
|
||||
{
|
||||
dataOrder = Resources.Load<TextAsset>("DataOrder").text;
|
||||
machines = FindObjectsByType<Machine>(FindObjectsSortMode.None);
|
||||
|
||||
foreach (var machine in machines)
|
||||
@@ -52,7 +55,7 @@ namespace CHN
|
||||
samples.Add(fileds[i].Name);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
samples.Add(typeFields[i].Name);
|
||||
}
|
||||
@@ -60,7 +63,7 @@ namespace CHN
|
||||
|
||||
public void SetKPIData(MachineKPIData machineKPIData)
|
||||
{
|
||||
foreach(var rows in machineKPIData.data.rows)
|
||||
foreach (var rows in machineKPIData.data.rows)
|
||||
{
|
||||
var id = rows.workcd;
|
||||
var name = GapRemove(id);
|
||||
@@ -89,7 +92,7 @@ namespace CHN
|
||||
|
||||
private void SetMachineData()
|
||||
{
|
||||
foreach(var machine in machines)
|
||||
foreach (var machine in machines)
|
||||
{
|
||||
if (string.IsNullOrEmpty(machine.code))
|
||||
return;
|
||||
@@ -111,13 +114,15 @@ namespace CHN
|
||||
includeFields[machineName].machineInfo = mqttDataTable[machineName];
|
||||
}
|
||||
|
||||
if(kpiDataTable.Count != 0)
|
||||
if (kpiDataTable.Count != 0)
|
||||
{
|
||||
includeFields[machineName].kpiDataInfo = kpiDataTable[machineName];
|
||||
}
|
||||
}
|
||||
|
||||
onKPIInfo.Invoke(includeFields.Values.ToList());
|
||||
var newIncludeFields = SortListByWorkcd(includeFields.Values.ToList());
|
||||
|
||||
onKPIInfo.Invoke(newIncludeFields);
|
||||
}
|
||||
|
||||
public void GetSimpleCompleteData(Machine machine)
|
||||
@@ -211,6 +216,19 @@ namespace CHN
|
||||
|
||||
return usageMQTTData;
|
||||
}
|
||||
|
||||
public List<SimpleField> SortListByWorkcd(List<SimpleField> target)
|
||||
{
|
||||
List<string> workcdOrder = JsonConvert.DeserializeObject<List<string>>(dataOrder);
|
||||
|
||||
Dictionary<string, int> orderMap = workcdOrder
|
||||
.Select((workcd, index) => new { workcd, index })
|
||||
.ToDictionary(x => x.workcd, x => x.index);
|
||||
|
||||
return target
|
||||
.OrderBy(field => orderMap[field.machineName])
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
[Serializable]
|
||||
public class SimpleField
|
||||
@@ -258,4 +276,5 @@ namespace CHN
|
||||
public string moldcd;
|
||||
public string moldseq;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user