Merge pull request '작업 조건/시간 분석 창 재 활성화 시 설비 데이터 정합성 유지' (#120) from dev/jym/250718_00 into main
Reviewed-on: http://220.90.135.190:3000/UVCXR/ChunilENG/pulls/120
This commit was merged in pull request #120.
This commit is contained in:
@@ -151,4 +151,12 @@ public class UI_Calendar : UIBase
|
||||
curDateTime = curDateTime.AddMonths(1);
|
||||
SetCalendar();
|
||||
}
|
||||
public void SetCalendarData(TextMeshProUGUI target, string dateText)
|
||||
{
|
||||
DateTime.TryParseExact(dateText, "yyyyMMdd", CultureInfo.InvariantCulture, DateTimeStyles.None, out var date);
|
||||
curDateTime = date;
|
||||
SetCalendar();
|
||||
|
||||
target.text = date.ToString("yyyy-MM-dd");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,14 +11,18 @@ using System.Linq;
|
||||
|
||||
namespace CHN
|
||||
{
|
||||
public enum DataColumn
|
||||
public class PreviousWorkConditionData
|
||||
{
|
||||
보압,
|
||||
주변온도,
|
||||
주변습도,
|
||||
public string startDate;
|
||||
public string endDate;
|
||||
public WorkItemCodeData itemCodeDatas;
|
||||
public string workItemCode;
|
||||
public int workItemCodeIndex;
|
||||
}
|
||||
public class Panel_WorkConditionAnalysis : PanelBase, ISingle
|
||||
{
|
||||
public Dictionary<string, PreviousWorkConditionData> workConditionDatas = new Dictionary<string, PreviousWorkConditionData>();
|
||||
|
||||
private Button Button_StartDay;
|
||||
private Button Button_EndDay;
|
||||
private TextMeshProUGUI Text_StartDay;
|
||||
@@ -44,10 +48,10 @@ namespace CHN
|
||||
public WorkConditionsData data;
|
||||
public WorkItemCodeData itemCodeData;
|
||||
public Action<string> onClose;
|
||||
|
||||
|
||||
public float fadeTime;
|
||||
|
||||
public string todayDate;
|
||||
public string startDate;
|
||||
public string endDate;
|
||||
public string facilityCode;
|
||||
@@ -66,6 +70,7 @@ namespace CHN
|
||||
|
||||
ui_Calendar.Close();
|
||||
|
||||
todayDate = DateTime.Now.ToString("yyyyMMdd");
|
||||
Text_StartDay.text = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
Text_EndDay.text = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
|
||||
@@ -128,14 +133,49 @@ namespace CHN
|
||||
public void SetFacilityCode(SimpleField simple, Machine machine)
|
||||
{
|
||||
facilityCode = machine.code;
|
||||
|
||||
if (workConditionDatas.ContainsKey(facilityCode))
|
||||
{
|
||||
this.startDate = workConditionDatas[facilityCode].startDate;
|
||||
this.endDate = workConditionDatas[facilityCode].endDate;
|
||||
|
||||
ui_Calendar.SetCalendarData(Text_StartDay, workConditionDatas[facilityCode].startDate);
|
||||
ui_Calendar.SetCalendarData(Text_EndDay, workConditionDatas[facilityCode].endDate);
|
||||
|
||||
DateTime startDate = Convert.ToDateTime(Text_StartDay.text);
|
||||
DateTime endDate = Convert.ToDateTime(Text_EndDay.text);
|
||||
|
||||
string startDateString = startDate.ToString("yyyy-MM-ddTHH:mm:ssZ");
|
||||
string endDateString = endDate.ToString("yyyy-MM-ddTHH:mm:ssZ");
|
||||
|
||||
SetWorkItemCodeDropDown(workConditionDatas[facilityCode].itemCodeDatas);
|
||||
Dropdown_WorkOrderNumber.value = workConditionDatas[facilityCode].workItemCodeIndex;
|
||||
var workItemCode = Dropdown_WorkOrderNumber.options[Dropdown_WorkOrderNumber.value].text;
|
||||
|
||||
onSearchData?.Invoke(startDateString, endDateString, facilityCode, workItemCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.startDate = todayDate;
|
||||
this.endDate = todayDate;
|
||||
|
||||
ui_Calendar.SetCalendarData(Text_StartDay, todayDate);
|
||||
ui_Calendar.SetCalendarData(Text_EndDay, todayDate);
|
||||
|
||||
Dropdown_WorkOrderNumber.ClearOptions();
|
||||
|
||||
ChartDatas.gameObject.SetActive(false);
|
||||
Panel_NotData.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
}
|
||||
public void SetWorkItemCodeDropDown(WorkItemCodeData itemCodeData)
|
||||
{
|
||||
Dropdown_WorkOrderNumber.ClearOptions();
|
||||
this.itemCodeData = itemCodeData;
|
||||
Dropdown_WorkOrderNumber.ClearOptions();
|
||||
|
||||
List<string> data = new List<string>();
|
||||
foreach(var workOrderNumber in itemCodeData.data)
|
||||
foreach(var workOrderNumber in this.itemCodeData.data)
|
||||
{
|
||||
data.Add(workOrderNumber.wordno);
|
||||
}
|
||||
@@ -169,11 +209,13 @@ namespace CHN
|
||||
{
|
||||
Panel_NotData.gameObject.SetActive(true);
|
||||
ChartDatas.gameObject.SetActive(false);
|
||||
return;
|
||||
}
|
||||
Panel_NotData.gameObject.SetActive(false);
|
||||
ChartDatas.gameObject.SetActive(true);
|
||||
|
||||
else
|
||||
{
|
||||
Panel_NotData.gameObject.SetActive(false);
|
||||
ChartDatas.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
data = workConditionsData;
|
||||
|
||||
if (data.data.rows.Length > 0)
|
||||
@@ -181,6 +223,29 @@ namespace CHN
|
||||
ITEMCD.text = data.data.rows[0].ITEMCD;
|
||||
}
|
||||
|
||||
if (!workConditionDatas.ContainsKey(facilityCode))
|
||||
{
|
||||
var newWorkConditionData = new PreviousWorkConditionData();
|
||||
newWorkConditionData.startDate = startDate;
|
||||
newWorkConditionData.endDate = endDate;
|
||||
newWorkConditionData.itemCodeDatas = itemCodeData;
|
||||
newWorkConditionData.workItemCode = Dropdown_WorkOrderNumber.options[Dropdown_WorkOrderNumber.value].text;
|
||||
newWorkConditionData.workItemCodeIndex = Dropdown_WorkOrderNumber.value;
|
||||
|
||||
workConditionDatas.Add(facilityCode, newWorkConditionData);
|
||||
}
|
||||
else
|
||||
{
|
||||
var newWorkConditionData = new PreviousWorkConditionData();
|
||||
newWorkConditionData.startDate = startDate;
|
||||
newWorkConditionData.endDate = endDate;
|
||||
newWorkConditionData.itemCodeDatas = itemCodeData;
|
||||
newWorkConditionData.workItemCode = Dropdown_WorkOrderNumber.options[Dropdown_WorkOrderNumber.value].text;
|
||||
newWorkConditionData.workItemCodeIndex = Dropdown_WorkOrderNumber.value;
|
||||
|
||||
workConditionDatas[facilityCode] = newWorkConditionData;
|
||||
}
|
||||
|
||||
SetDataColumnDropDown();
|
||||
OnDropdownValueChanged(0);
|
||||
}
|
||||
|
||||
@@ -9,8 +9,18 @@ using System.Globalization;
|
||||
|
||||
namespace CHN
|
||||
{
|
||||
public class PreviousWorkTimeData
|
||||
{
|
||||
public string startDate;
|
||||
public string endDate;
|
||||
public WorkItemCodeData itemCodeDatas;
|
||||
public string workItemCode;
|
||||
public int workItemCodeIndex;
|
||||
}
|
||||
public class Panel_WorkTimeAnalysis : PanelBase, ISingle
|
||||
{
|
||||
public Dictionary<string, PreviousWorkTimeData> workTimeDatas = new Dictionary<string, PreviousWorkTimeData>();
|
||||
|
||||
private Button Button_StartDay;
|
||||
private Button Button_EndDay;
|
||||
private TextMeshProUGUI Text_StartDay;
|
||||
@@ -25,11 +35,13 @@ namespace CHN
|
||||
private RectTransform ChartData;
|
||||
public UI_BarChart barChart;
|
||||
|
||||
private WorkItemCodeData itemCodeData;
|
||||
public Action<string, string, string, string> onSearchData;
|
||||
public Action<string> onClose;
|
||||
|
||||
public float fadeTime;
|
||||
|
||||
public string todayDate;
|
||||
public string startDate;
|
||||
public string endDate;
|
||||
public string facilityCode;
|
||||
@@ -46,6 +58,7 @@ namespace CHN
|
||||
|
||||
ui_Calendar.Close();
|
||||
|
||||
todayDate = DateTime.Now.ToString("yyyyMMdd");
|
||||
Text_StartDay.text = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
Text_EndDay.text = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
|
||||
@@ -111,9 +124,44 @@ namespace CHN
|
||||
public void SetFacilityCode(SimpleField simple, Machine machine)
|
||||
{
|
||||
facilityCode = machine.code;
|
||||
|
||||
if (workTimeDatas.ContainsKey(facilityCode))
|
||||
{
|
||||
this.startDate = workTimeDatas[facilityCode].startDate;
|
||||
this.endDate = workTimeDatas[facilityCode].endDate;
|
||||
|
||||
ui_Calendar.SetCalendarData(Text_StartDay, workTimeDatas[facilityCode].startDate);
|
||||
ui_Calendar.SetCalendarData(Text_EndDay, workTimeDatas[facilityCode].endDate);
|
||||
|
||||
DateTime startDate = Convert.ToDateTime(Text_StartDay.text);
|
||||
DateTime endDate = Convert.ToDateTime(Text_EndDay.text);
|
||||
|
||||
string startDateString = startDate.ToString("yyyy-MM-ddTHH:mm:ssZ");
|
||||
string endDateString = endDate.ToString("yyyy-MM-ddTHH:mm:ssZ");
|
||||
|
||||
SetWorkItemCodeDropDown(workTimeDatas[facilityCode].itemCodeDatas);
|
||||
Dropdown_WorkOrderNumber.value = workTimeDatas[facilityCode].workItemCodeIndex;
|
||||
var workItemCode = Dropdown_WorkOrderNumber.options[Dropdown_WorkOrderNumber.value].text;
|
||||
|
||||
onSearchData?.Invoke(startDateString, endDateString, facilityCode, workItemCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.startDate = todayDate;
|
||||
this.endDate = todayDate;
|
||||
|
||||
ui_Calendar.SetCalendarData(Text_StartDay, todayDate);
|
||||
ui_Calendar.SetCalendarData(Text_EndDay, todayDate);
|
||||
|
||||
Dropdown_WorkOrderNumber.ClearOptions();
|
||||
|
||||
ChartData.gameObject.SetActive(false);
|
||||
Panel_NotData.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
public void SetWorkItemCodeDropDown(WorkItemCodeData itemCodeData)
|
||||
{
|
||||
this.itemCodeData = itemCodeData;
|
||||
Dropdown_WorkOrderNumber.ClearOptions();
|
||||
|
||||
List<string> data = new List<string>();
|
||||
@@ -151,16 +199,42 @@ namespace CHN
|
||||
{
|
||||
Panel_NotData.gameObject.SetActive(true);
|
||||
ChartData.gameObject.SetActive(false);
|
||||
return;
|
||||
}
|
||||
Panel_NotData.gameObject.SetActive(false);
|
||||
ChartData.gameObject.SetActive(true);
|
||||
else
|
||||
{
|
||||
Panel_NotData.gameObject.SetActive(false);
|
||||
ChartData.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
|
||||
if (barChartData.Count > 0)
|
||||
{
|
||||
ITEMCD.text = barChartData[0].itemcd;
|
||||
}
|
||||
|
||||
if (!workTimeDatas.ContainsKey(facilityCode))
|
||||
{
|
||||
var newWorkConditionData = new PreviousWorkTimeData();
|
||||
newWorkConditionData.startDate = startDate;
|
||||
newWorkConditionData.endDate = endDate;
|
||||
newWorkConditionData.itemCodeDatas = itemCodeData;
|
||||
newWorkConditionData.workItemCode = Dropdown_WorkOrderNumber.options[Dropdown_WorkOrderNumber.value].text;
|
||||
newWorkConditionData.workItemCodeIndex = Dropdown_WorkOrderNumber.value;
|
||||
|
||||
workTimeDatas.Add(facilityCode, newWorkConditionData);
|
||||
}
|
||||
else
|
||||
{
|
||||
var newWorkConditionData = new PreviousWorkTimeData();
|
||||
newWorkConditionData.startDate = startDate;
|
||||
newWorkConditionData.endDate = endDate;
|
||||
newWorkConditionData.itemCodeDatas = itemCodeData;
|
||||
newWorkConditionData.workItemCode = Dropdown_WorkOrderNumber.options[Dropdown_WorkOrderNumber.value].text;
|
||||
newWorkConditionData.workItemCodeIndex = Dropdown_WorkOrderNumber.value;
|
||||
|
||||
workTimeDatas[facilityCode] = newWorkConditionData;
|
||||
}
|
||||
|
||||
barChart.SetChartData(barChartData);
|
||||
}
|
||||
IEnumerator ScaleUp()
|
||||
|
||||
@@ -98,6 +98,9 @@ public class UI_GraphChart : UIBase, IPointerClickHandler
|
||||
}
|
||||
private void SetDataValue(GraphChartData graphData)
|
||||
{
|
||||
if (graphData.chartData.Count <= 0)
|
||||
return;
|
||||
|
||||
min = graphData.chartData.Min();
|
||||
max = graphData.chartData.Max();
|
||||
ave = graphData.chartData.Average();
|
||||
|
||||
Reference in New Issue
Block a user