2025-02-20 09:59:37 +09:00
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using WI;
|
|
|
|
|
|
using UnityEngine.UI;
|
2025-03-05 16:36:33 +09:00
|
|
|
|
using TMPro;
|
|
|
|
|
|
using System;
|
2025-03-05 18:49:48 +09:00
|
|
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Menu;
|
|
|
|
|
|
using System.Globalization;
|
2025-04-08 18:23:36 +09:00
|
|
|
|
using System.Linq;
|
2025-02-20 09:59:37 +09:00
|
|
|
|
|
|
|
|
|
|
namespace CHN
|
|
|
|
|
|
{
|
2025-03-10 16:42:23 +09:00
|
|
|
|
public enum DataColumn
|
|
|
|
|
|
{
|
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
|
|
|
|
|
<EFBFBD>ֺ<EFBFBD><EFBFBD>µ<EFBFBD>,
|
|
|
|
|
|
<EFBFBD>ֺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
|
|
|
|
|
}
|
2025-03-12 12:04:19 +09:00
|
|
|
|
public class Panel_WorkConditionAnalysis : PanelBase, ISingle
|
2025-02-20 09:59:37 +09:00
|
|
|
|
{
|
2025-03-05 16:36:33 +09:00
|
|
|
|
private Button Button_StartDay;
|
|
|
|
|
|
private Button Button_EndDay;
|
|
|
|
|
|
private TextMeshProUGUI Text_StartDay;
|
|
|
|
|
|
private TextMeshProUGUI Text_EndDay;
|
|
|
|
|
|
private TMP_Dropdown Dropdown_Facility;
|
2025-04-01 18:15:10 +09:00
|
|
|
|
private TMP_Dropdown Dropdown_WorkOrderNumber;
|
|
|
|
|
|
//private TMP_InputField InputField_WorkOrderNumber;
|
2025-03-05 16:36:33 +09:00
|
|
|
|
private Button Button_Search;
|
|
|
|
|
|
private Button Button_Close;
|
2025-04-07 14:20:09 +09:00
|
|
|
|
private RectTransform Panel_NotData;
|
2025-03-10 16:42:23 +09:00
|
|
|
|
private TextMeshProUGUI ITEMCD;
|
2025-04-01 18:15:10 +09:00
|
|
|
|
|
2025-03-10 16:42:23 +09:00
|
|
|
|
private TMP_Dropdown Dropdown_DataColumn;
|
2025-03-05 16:36:33 +09:00
|
|
|
|
|
|
|
|
|
|
private UI_Calendar ui_Calendar;
|
2025-03-10 16:42:23 +09:00
|
|
|
|
public UI_GraphChart mainChart;
|
|
|
|
|
|
public UI_GraphChart[] subCharts;
|
|
|
|
|
|
private RectTransform ChartDatas;
|
|
|
|
|
|
private RectTransform SubCharts;
|
|
|
|
|
|
|
|
|
|
|
|
public Action<string, string, string, string> onSearchData;
|
|
|
|
|
|
public Action<string> onChangedDropdownValue;
|
|
|
|
|
|
public Dictionary<string, int> dropdownValues = new Dictionary<string, int>();
|
2025-02-20 09:59:37 +09:00
|
|
|
|
|
2025-03-10 16:42:23 +09:00
|
|
|
|
public WorkConditionsData data;
|
2025-03-12 12:04:19 +09:00
|
|
|
|
public Action<string> onClose;
|
2025-03-20 18:43:00 +09:00
|
|
|
|
public Panel_Effect effect;
|
|
|
|
|
|
|
|
|
|
|
|
public float fadeTime;
|
2025-04-01 18:15:10 +09:00
|
|
|
|
|
|
|
|
|
|
public string startDate;
|
|
|
|
|
|
public string endDate;
|
|
|
|
|
|
public Action<string, string, string> onDateData;
|
|
|
|
|
|
public Action<string, string> onFacilityCodeData;
|
|
|
|
|
|
|
2025-02-20 09:59:37 +09:00
|
|
|
|
public override void AfterAwake()
|
|
|
|
|
|
{
|
2025-03-10 16:42:23 +09:00
|
|
|
|
ui_Calendar = transform.GetComponentInChildren<UI_Calendar>(true);
|
2025-04-01 18:15:10 +09:00
|
|
|
|
ui_Calendar.onSelectDate += SetDayData;
|
2025-04-08 18:23:36 +09:00
|
|
|
|
mainChart = transform.GetComponentsInChildren<UI_GraphChart>().Where(a => a.isMainChart).FirstOrDefault();
|
2025-03-10 16:42:23 +09:00
|
|
|
|
subCharts = SubCharts.GetComponentsInChildren<UI_GraphChart>();
|
|
|
|
|
|
|
2025-03-20 18:43:00 +09:00
|
|
|
|
Button_Close.onClick.AddListener(OnClickCloseButton);
|
2025-03-05 16:36:33 +09:00
|
|
|
|
Button_StartDay.onClick.AddListener(OnClickStartDayBtn);
|
|
|
|
|
|
Button_EndDay.onClick.AddListener(OnClickEndDayBtn);
|
2025-03-05 18:49:48 +09:00
|
|
|
|
Button_Search.onClick.AddListener(OnClickSearchBtn);
|
2025-03-05 16:36:33 +09:00
|
|
|
|
|
|
|
|
|
|
ui_Calendar.Close();
|
|
|
|
|
|
|
|
|
|
|
|
Text_StartDay.text = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
|
|
|
Text_EndDay.text = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
|
|
|
|
2025-03-10 16:42:23 +09:00
|
|
|
|
ChartDatas.gameObject.SetActive(false);
|
2025-03-20 18:43:00 +09:00
|
|
|
|
gameObject.transform.localScale = Vector3.zero;
|
2025-04-01 18:15:10 +09:00
|
|
|
|
|
|
|
|
|
|
Dropdown_Facility.ClearOptions();
|
|
|
|
|
|
Dropdown_WorkOrderNumber.ClearOptions();
|
2025-03-20 18:43:00 +09:00
|
|
|
|
}
|
|
|
|
|
|
public void Open()
|
|
|
|
|
|
{
|
2025-04-07 15:19:27 +09:00
|
|
|
|
effect.ActivePanel();
|
2025-03-20 18:43:00 +09:00
|
|
|
|
gameObject.SetActive(true);
|
|
|
|
|
|
gameObject.transform.SetAsLastSibling();
|
|
|
|
|
|
|
|
|
|
|
|
StopAllCoroutines();
|
|
|
|
|
|
StartCoroutine(ScaleUp());
|
2025-02-20 09:59:37 +09:00
|
|
|
|
}
|
2025-03-12 12:04:19 +09:00
|
|
|
|
public void Close()
|
2025-03-20 18:43:00 +09:00
|
|
|
|
{
|
2025-04-07 15:19:27 +09:00
|
|
|
|
effect.DeactivePanel();
|
2025-04-09 11:08:50 +09:00
|
|
|
|
ui_Calendar.Close();
|
2025-03-20 18:43:00 +09:00
|
|
|
|
gameObject.SetActive(false);
|
|
|
|
|
|
gameObject.transform.localScale = Vector3.zero;
|
|
|
|
|
|
}
|
|
|
|
|
|
public void OnClickCloseButton()
|
2025-03-05 18:49:48 +09:00
|
|
|
|
{
|
2025-03-12 12:04:19 +09:00
|
|
|
|
onClose?.Invoke("<22>۾<EFBFBD> <20><><EFBFBD><EFBFBD> <20>м<EFBFBD>");
|
2025-03-10 16:42:23 +09:00
|
|
|
|
}
|
|
|
|
|
|
private void OnClickStartDayBtn()
|
|
|
|
|
|
{
|
|
|
|
|
|
ui_Calendar.Open(Text_StartDay);
|
|
|
|
|
|
}
|
|
|
|
|
|
private void OnClickEndDayBtn()
|
|
|
|
|
|
{
|
|
|
|
|
|
ui_Calendar.Open(Text_EndDay);
|
|
|
|
|
|
}
|
2025-04-01 18:15:10 +09:00
|
|
|
|
private void SetDayData(TextMeshProUGUI targetText)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(targetText == Text_StartDay)
|
|
|
|
|
|
{
|
|
|
|
|
|
var startDateData = Convert.ToDateTime(targetText.text);
|
|
|
|
|
|
startDate = startDateData.ToString("yyyyMMdd");
|
|
|
|
|
|
}
|
|
|
|
|
|
else if(targetText == Text_EndDay)
|
|
|
|
|
|
{
|
|
|
|
|
|
var endDateData = Convert.ToDateTime(targetText.text);
|
|
|
|
|
|
endDate = endDateData.ToString("yyyyMMdd");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!startDate.Equals(string.Empty) && !endDate.Equals(string.Empty))
|
|
|
|
|
|
{
|
|
|
|
|
|
onDateData?.Invoke("<22>۾<EFBFBD> <20><><EFBFBD><EFBFBD> <20>м<EFBFBD>", startDate, endDate);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-03-05 18:49:48 +09:00
|
|
|
|
|
2025-03-10 16:42:23 +09:00
|
|
|
|
public void SetFacilityDropDown(WorkConditionFacilityData facilityData)
|
|
|
|
|
|
{
|
2025-03-05 18:49:48 +09:00
|
|
|
|
Dropdown_Facility.ClearOptions();
|
2025-03-10 16:42:23 +09:00
|
|
|
|
string[] data = facilityData.data;
|
2025-03-05 18:49:48 +09:00
|
|
|
|
|
|
|
|
|
|
List<TMP_Dropdown.OptionData> optionList = new List<TMP_Dropdown.OptionData>();
|
|
|
|
|
|
|
|
|
|
|
|
foreach (string str in data)
|
|
|
|
|
|
{
|
|
|
|
|
|
optionList.Add(new TMP_Dropdown.OptionData(str));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Dropdown_Facility.AddOptions(optionList);
|
|
|
|
|
|
Dropdown_Facility.value = 0;
|
2025-04-01 18:15:10 +09:00
|
|
|
|
|
|
|
|
|
|
onFacilityCodeData?.Invoke("<22>۾<EFBFBD> <20><><EFBFBD><EFBFBD> <20>м<EFBFBD>", Dropdown_Facility.options[Dropdown_Facility.value].text);
|
|
|
|
|
|
}
|
|
|
|
|
|
public void SetWorkItemCodeDropDown(WorkItemCodeData itemCodeData)
|
|
|
|
|
|
{
|
|
|
|
|
|
Dropdown_WorkOrderNumber.ClearOptions();
|
|
|
|
|
|
|
|
|
|
|
|
List<string> data = new List<string>();
|
|
|
|
|
|
foreach(var workOrderNumber in itemCodeData.data)
|
|
|
|
|
|
{
|
|
|
|
|
|
data.Add(workOrderNumber.wordno);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
List<TMP_Dropdown.OptionData> optionList = new List<TMP_Dropdown.OptionData>();
|
|
|
|
|
|
foreach (string str in data)
|
|
|
|
|
|
{
|
|
|
|
|
|
optionList.Add(new TMP_Dropdown.OptionData(str));
|
|
|
|
|
|
}
|
|
|
|
|
|
Dropdown_WorkOrderNumber.AddOptions(optionList);
|
|
|
|
|
|
Dropdown_WorkOrderNumber.value = 0;
|
2025-03-05 18:49:48 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnClickSearchBtn()
|
|
|
|
|
|
{
|
|
|
|
|
|
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");
|
|
|
|
|
|
string MCHCD = Dropdown_Facility.options[Dropdown_Facility.value].text;
|
2025-04-01 18:15:10 +09:00
|
|
|
|
string WO = Dropdown_WorkOrderNumber.options[Dropdown_WorkOrderNumber.value].text;
|
2025-03-05 18:49:48 +09:00
|
|
|
|
|
2025-03-10 16:42:23 +09:00
|
|
|
|
onSearchData?.Invoke(startDateString, endDateString, MCHCD, WO);
|
2025-03-05 16:36:33 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-12 09:55:47 +09:00
|
|
|
|
//public void SetChartLabels(List<string> chartLabels)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// mainChart.SetChartLabels(chartLabels);
|
|
|
|
|
|
//}
|
2025-03-10 16:42:23 +09:00
|
|
|
|
public void SetWorkConditionsData(WorkConditionsData workConditionsData)
|
|
|
|
|
|
{
|
2025-04-01 18:15:10 +09:00
|
|
|
|
if (workConditionsData.data.count == "0")
|
|
|
|
|
|
{
|
2025-04-07 14:20:09 +09:00
|
|
|
|
Panel_NotData.gameObject.SetActive(true);
|
2025-04-01 18:15:10 +09:00
|
|
|
|
ChartDatas.gameObject.SetActive(false);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-04-07 14:20:09 +09:00
|
|
|
|
Panel_NotData.gameObject.SetActive(false);
|
2025-03-10 16:42:23 +09:00
|
|
|
|
ChartDatas.gameObject.SetActive(true);
|
|
|
|
|
|
|
|
|
|
|
|
data = workConditionsData;
|
2025-03-12 09:55:47 +09:00
|
|
|
|
|
|
|
|
|
|
if (data.data.rows.Length > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
ITEMCD.text = data.data.rows[0].ITEMCD;
|
|
|
|
|
|
}
|
2025-03-10 16:42:23 +09:00
|
|
|
|
|
|
|
|
|
|
SetDataColumnDropDown();
|
|
|
|
|
|
OnDropdownValueChanged(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
public void SetChartData(Dictionary<string, GraphChartData> mainChart)
|
|
|
|
|
|
{
|
|
|
|
|
|
var value = Dropdown_DataColumn.value;
|
|
|
|
|
|
var optionName = Dropdown_DataColumn.options[value].text;
|
|
|
|
|
|
|
|
|
|
|
|
this.mainChart.SetChartData(optionName, mainChart[optionName]);
|
|
|
|
|
|
}
|
|
|
|
|
|
public void SetSubChartDatas(Dictionary<string, GraphChartData> subCharts)
|
|
|
|
|
|
{
|
|
|
|
|
|
var subChartNames = new List<string>();
|
|
|
|
|
|
var subChartValue = new List<int>();
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var option in Dropdown_DataColumn.options)
|
|
|
|
|
|
{
|
|
|
|
|
|
var optionName = option.text;
|
|
|
|
|
|
|
|
|
|
|
|
if (mainChart.graphName != optionName)
|
|
|
|
|
|
{
|
|
|
|
|
|
subChartNames.Add(optionName);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < subCharts.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.subCharts[i].SetChartData(subChartNames[i], subCharts[subChartNames[i]]);
|
|
|
|
|
|
this.subCharts[i].onClickChart += OnClickChart;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void SetDataColumnDropDown()
|
|
|
|
|
|
{
|
2025-03-11 10:23:44 +09:00
|
|
|
|
dropdownValues.Clear();
|
2025-03-10 16:42:23 +09:00
|
|
|
|
Dropdown_DataColumn.ClearOptions();
|
|
|
|
|
|
List<TMP_Dropdown.OptionData> optionList = new List<TMP_Dropdown.OptionData>();
|
|
|
|
|
|
optionList.Add(new TMP_Dropdown.OptionData("<22><><EFBFBD><EFBFBD> (Peak)"));
|
|
|
|
|
|
optionList.Add(new TMP_Dropdown.OptionData("<22>ֺ<EFBFBD> <20><><EFBFBD><EFBFBD>"));
|
|
|
|
|
|
optionList.Add(new TMP_Dropdown.OptionData("<22>ֺ<EFBFBD> <20>µ<EFBFBD>"));
|
|
|
|
|
|
optionList.Add(new TMP_Dropdown.OptionData("<22><><EFBFBD><EFBFBD>Ŭ Ÿ<><C5B8>"));
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < optionList.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
dropdownValues.Add(optionList[i].text, i);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Dropdown_DataColumn.AddOptions(optionList);
|
|
|
|
|
|
Dropdown_DataColumn.onValueChanged.AddListener(OnDropdownValueChanged);
|
|
|
|
|
|
|
|
|
|
|
|
Dropdown_DataColumn.value = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
private void OnClickChart(string graphName)
|
|
|
|
|
|
{
|
|
|
|
|
|
Dropdown_DataColumn.value = dropdownValues[graphName];
|
|
|
|
|
|
}
|
|
|
|
|
|
private void OnDropdownValueChanged(int arg0)
|
|
|
|
|
|
{
|
|
|
|
|
|
var optionName = Dropdown_DataColumn.options[arg0].text;
|
|
|
|
|
|
onChangedDropdownValue?.Invoke(optionName);
|
2025-02-20 09:59:37 +09:00
|
|
|
|
}
|
2025-03-20 18:43:00 +09:00
|
|
|
|
IEnumerator ScaleUp()
|
|
|
|
|
|
{
|
|
|
|
|
|
float timer = 0f;
|
|
|
|
|
|
float percent = 0f;
|
|
|
|
|
|
|
|
|
|
|
|
while (percent < 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
timer += Time.deltaTime;
|
|
|
|
|
|
percent = timer / fadeTime;
|
|
|
|
|
|
transform.localScale = Vector3.Lerp(transform.localScale, Vector3.one, percent);
|
|
|
|
|
|
|
|
|
|
|
|
yield return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2025-02-20 09:59:37 +09:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|