using DefaultNamespace.ProcessMode;
using System.Collections;
using System.Collections.Generic;
using DefaultNamespace;
using MotionFramework;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
using static InterfaceManager;
using Cysharp.Threading.Tasks;
using Framework.Manager;
///
/// ERP交互控制
///
public class ERPCollection : MonoBehaviour
{
public static ERPCollection instance;
///
/// 打开ERP按钮
///
public Button btnOpenERP;
///
/// 关闭ERP按钮
///
public Button btnCloseERP;
///
/// ERP面板
///
public Transform PanelERP;
///
/// 管理页面
///
public Transform PanelGuanLi;
///
/// 隐藏按钮列表
///
public List hiteObjs;
public List columns;
public List columnsItem = new List();
public Button mdmbutton;
public GameObject renwu;
private void Awake()
{
instance = this;
//FileComponent.DownloadSingleFile("附件1:500028508全省库存.XLSX");
}
// Start is called before the first frame update
void Start()
{
if (btnOpenERP != null && PanelERP != null)
{
btnOpenERP.onClick.AddListener(btOpenClick);
}
if (MotionEngine.GetModule().ExamName == "新注册仓库的主数据运维流程")
{
mdmbutton.gameObject.SetActive(true);
mdmbutton.onClick.AddListener(btOpenClick);
}
else
{
mdmbutton.gameObject.SetActive(false);
}
OnClickPanelERP();
}
public void DisPanel()
{
}
async void btOpenClick()
{
btnOpenERP.enabled = false;
if (MotionEngine.GetModule().ExamName == "新注册仓库的主数据运维流程")
{
PanelGuanLi.gameObject.SetActive(true);
LoadTriggerNextGuide(mdmbutton.name);
}
else
{
PanelERP.gameObject.SetActive(true);
LoadTriggerNextGuide(btnOpenERP.name);
}
// PanelERP.gameObject.SetActive(true);
hiteObjs.ForEach(x => x.gameObject.SetActive(false));
columns.ForEach(x => x.ifShow = false);
await UniTask.Delay(200);
await UniTask.Delay(200);
btnOpenERP.enabled = true;
}
#region 关闭按钮事件
///
/// 关闭只添加事件
///
public void OnClickPanelERP()
{
if (btnCloseERP != null && PanelERP != null)
{
btnCloseERP.onClick.RemoveAllListeners();
btnCloseERP.onClick.AddListener(() =>
{
PanelERP.gameObject.SetActive(false);
string str = MotionEngine.GetModule().GetCurrentActionTitle();
Debug.Log(str);
if (str.Contains("单据签字") || str.Contains("填写入库单、退库单") || str.Contains("ELP新建运输任务"))
{
LoadTriggerNextGuide(btnCloseERP.name);
return;
}
else if (MotionEngine.GetModule().ExamName.Contains("重点物资排产计划制定"))
{
LoadTriggerNextGuide(btnCloseERP.name);
}
else
{
HideGuide();
}
// if (MotionEngine.GetModule().ExamName.Contains("电力电缆报废系统操作"))
// {
// LoadTriggerNextGuide();return;
// }
// if (MotionEngine.GetModule().ExamName.Contains("电力电缆调拨物资出库"))
// {
// LoadTriggerNextGuide();return;
// }
// if (MotionEngine.GetModule().ExamName.Contains("借用物资出库"))
// {
// LoadTriggerNextGuide();return;
// }
//
// LoadTriggerNextGuide();
});
}
}
public void Close()
{
PanelERP.gameObject.SetActive(false);
string str = MotionEngine.GetModule().GetCurrentActionTitle();
Debug.Log(str);
if (str.Contains("单据签字") || str.Contains("填写入库单、退库单") || str.Contains("ELP新建运输任务"))
{
LoadTriggerNextGuide(btnCloseERP.name);
return;
}
else if (MotionEngine.GetModule().ExamName.Contains("重点物资排产计划制定"))
{
LoadTriggerNextGuide(btnCloseERP.name);
}
else if (MotionEngine.GetModule().ExamName.Contains("物资配送履约跟踪表维护"))
{
renwu.SetActive(true);
LoadTriggerNextGuide("关闭");;
}
else
{
TutorialGuideManager.Instance.HideGuide();
//HideGuide();
}
}
private void Update()
{
//string str = MotionEngine.GetModule().GetCurrentActionTitle();
//Debug.Log(str);
}
///
/// 关闭并显示下一步引导(外部调用)
///
public void AddLoadTriggerNextGuide()
{
if (btnCloseERP != null && PanelERP != null)
{
btnCloseERP.onClick.RemoveAllListeners();
btnCloseERP.onClick.AddListener(() =>
{
PanelERP.gameObject.SetActive(false);
LoadTriggerNextGuide(btnCloseERP.name); //下一步引导
});
}
}
///
/// 显示下一步引导
///
public void LoadTriggerNextGuides()
{
if (btnCloseERP != null && PanelERP != null)
{
btnCloseERP.onClick.RemoveAllListeners();
PanelERP.gameObject.SetActive(false);
LoadTriggerNextGuide(); //下一步引导
}
}
///
/// 隐藏当前引导
///
public void HideGuide()
{
LoadTriggerNextGuide("关闭");
; //关闭当前引导
}
///
/// 关闭并隐藏引导(外部调用)
///
public void AddLoadHideGuide()
{
if (btnCloseERP != null && PanelERP != null)
{
btnCloseERP.onClick.RemoveAllListeners();
btnCloseERP.onClick.AddListener(() =>
{
PanelERP.gameObject.SetActive(false);
LoadTriggerNextGuide("关闭");
; //隐藏引导
});
}
}
#endregion
}