138 lines
4.2 KiB
C#
138 lines
4.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using WI;
|
|
using UnityEngine.UI;
|
|
using TMPro;
|
|
using System;
|
|
|
|
namespace CHN
|
|
{
|
|
public class Panel_WorkTimeAnalysis : PanelBase, ISingle
|
|
{
|
|
private Button Button_StartDay;
|
|
private Button Button_EndDay;
|
|
private TextMeshProUGUI Text_StartDay;
|
|
private TextMeshProUGUI Text_EndDay;
|
|
private TMP_Dropdown Dropdown_Facility;
|
|
private TMP_InputField InputField_WorkOrderNumber;
|
|
private Button Button_Search;
|
|
private Button Button_Close;
|
|
private TextMeshProUGUI ITEMCD;
|
|
|
|
private UI_Calendar ui_Calendar;
|
|
private RectTransform ChartData;
|
|
public UI_BarChart barChart;
|
|
private Panel_Effect effect;
|
|
|
|
public Action<string, string, string, string> onSearchData;
|
|
public Action<string> onClose;
|
|
|
|
public float fadeTime;
|
|
public override void AfterAwake()
|
|
{
|
|
ui_Calendar = transform.GetComponentInChildren<UI_Calendar>(true);
|
|
barChart = transform.GetComponentInChildren<UI_BarChart>();
|
|
|
|
Button_Close.onClick.AddListener(OnClickCloseButton);
|
|
Button_StartDay.onClick.AddListener(OnClickStartDayBtn);
|
|
Button_EndDay.onClick.AddListener(OnClickEndDayBtn);
|
|
Button_Search.onClick.AddListener(OnClickSearchBtn);
|
|
|
|
ui_Calendar.Close();
|
|
|
|
Text_StartDay.text = DateTime.Now.ToString("yyyy-MM-dd");
|
|
Text_EndDay.text = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
|
ChartData.gameObject.SetActive(false);
|
|
gameObject.transform.localScale = Vector3.zero;
|
|
}
|
|
|
|
public void Open()
|
|
{
|
|
effect.ActivePanel(gameObject);
|
|
gameObject.SetActive(true);
|
|
gameObject.transform.SetAsLastSibling();
|
|
|
|
StopAllCoroutines();
|
|
StartCoroutine(ScaleUp());
|
|
}
|
|
public void Close()
|
|
{
|
|
effect.DeactivePanel(gameObject);
|
|
gameObject.SetActive(false);
|
|
gameObject.transform.localScale = Vector3.zero;
|
|
}
|
|
public void OnClickCloseButton()
|
|
{
|
|
onClose?.Invoke("ÀÛ¾÷ ½Ã°£ ºÐ¼®");
|
|
}
|
|
|
|
private void OnClickStartDayBtn()
|
|
{
|
|
ui_Calendar.Open(Text_StartDay);
|
|
}
|
|
private void OnClickEndDayBtn()
|
|
{
|
|
ui_Calendar.Open(Text_EndDay);
|
|
}
|
|
|
|
public void SetFacilityDropDown(WorkConditionFacilityData facilityData)
|
|
{
|
|
Dropdown_Facility.ClearOptions();
|
|
string[] data = facilityData.data;
|
|
|
|
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;
|
|
}
|
|
|
|
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;
|
|
string WO = InputField_WorkOrderNumber.text;
|
|
|
|
onSearchData?.Invoke(startDateString, endDateString, MCHCD, WO);
|
|
}
|
|
public void SetWorkTimeData(List<BarChartData> barChartData)
|
|
{
|
|
ChartData.gameObject.SetActive(true);
|
|
|
|
if (barChartData.Count > 0)
|
|
{
|
|
ITEMCD.text = barChartData[0].itemcd;
|
|
}
|
|
|
|
barChart.SetChartData(barChartData);
|
|
}
|
|
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;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|