Tz2/Assets/Zion/Scripts/ERP/ERPCollection.cs

250 lines
6.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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;
/// <summary>
/// ERP交互控制
/// </summary>
public class ERPCollection : MonoBehaviour
{
public static ERPCollection instance;
/// <summary>
/// 打开ERP按钮
/// </summary>
public Button btnOpenERP;
/// <summary>
/// 关闭ERP按钮
/// </summary>
public Button btnCloseERP;
/// <summary>
/// ERP面板
/// </summary>
public Transform PanelERP;
/// <summary>
/// 管理页面
/// </summary>
public Transform PanelGuanLi;
/// <summary>
/// 隐藏按钮列表
/// </summary>
public List<GameObject> hiteObjs;
public List<Column> columns;
public List<ColumnItem> columnsItem = new List<ColumnItem>();
public Button mdmbutton;
public GameObject renwu;
private void Awake()
{
instance = this;
//FileComponent.DownloadSingleFile("附件1500028508全省库存.XLSX");
}
// Start is called before the first frame update
void Start()
{
if (btnOpenERP != null && PanelERP != null)
{
btnOpenERP.onClick.AddListener(btOpenClick);
}
if (MotionEngine.GetModule<GlobalDataStorage>().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<GlobalDataStorage>().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
/// <summary>
/// 关闭只添加事件
/// </summary>
public void OnClickPanelERP()
{
if (btnCloseERP != null && PanelERP != null)
{
btnCloseERP.onClick.RemoveAllListeners();
btnCloseERP.onClick.AddListener(() =>
{
PanelERP.gameObject.SetActive(false);
string str = MotionEngine.GetModule<ProcessManager>().GetCurrentActionTitle();
Debug.Log(str);
if (str.Contains("单据签字") || str.Contains("填写入库单、退库单") || str.Contains("ELP新建运输任务"))
{
LoadTriggerNextGuide(btnCloseERP.name);
return;
}
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("重点物资排产计划制定"))
{
LoadTriggerNextGuide(btnCloseERP.name);
}
else
{
HideGuide();
}
// if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("电力电缆报废系统操作"))
// {
// LoadTriggerNextGuide();return;
// }
// if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("电力电缆调拨物资出库"))
// {
// LoadTriggerNextGuide();return;
// }
// if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("借用物资出库"))
// {
// LoadTriggerNextGuide();return;
// }
//
// LoadTriggerNextGuide();
});
}
}
public void Close()
{
PanelERP.gameObject.SetActive(false);
string str = MotionEngine.GetModule<ProcessManager>().GetCurrentActionTitle();
Debug.Log(str);
if (str.Contains("单据签字") || str.Contains("填写入库单、退库单") || str.Contains("ELP新建运输任务"))
{
LoadTriggerNextGuide(btnCloseERP.name);
return;
}
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("重点物资排产计划制定"))
{
LoadTriggerNextGuide(btnCloseERP.name);
}
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("物资配送履约跟踪表维护"))
{
renwu.SetActive(true);
LoadTriggerNextGuide("关闭");;
}
else
{
TutorialGuideManager.Instance.HideGuide();
//HideGuide();
}
}
private void Update()
{
//string str = MotionEngine.GetModule<ProcessManager>().GetCurrentActionTitle();
//Debug.Log(str);
}
/// <summary>
/// 关闭并显示下一步引导(外部调用)
/// </summary>
public void AddLoadTriggerNextGuide()
{
if (btnCloseERP != null && PanelERP != null)
{
btnCloseERP.onClick.RemoveAllListeners();
btnCloseERP.onClick.AddListener(() =>
{
PanelERP.gameObject.SetActive(false);
LoadTriggerNextGuide(btnCloseERP.name); //下一步引导
});
}
}
/// <summary>
/// 显示下一步引导
/// </summary>
public void LoadTriggerNextGuides()
{
if (btnCloseERP != null && PanelERP != null)
{
btnCloseERP.onClick.RemoveAllListeners();
PanelERP.gameObject.SetActive(false);
LoadTriggerNextGuide(); //下一步引导
}
}
/// <summary>
/// 隐藏当前引导
/// </summary>
public void HideGuide()
{
LoadTriggerNextGuide("关闭");
; //关闭当前引导
}
/// <summary>
/// 关闭并隐藏引导(外部调用)
/// </summary>
public void AddLoadHideGuide()
{
if (btnCloseERP != null && PanelERP != null)
{
btnCloseERP.onClick.RemoveAllListeners();
btnCloseERP.onClick.AddListener(() =>
{
PanelERP.gameObject.SetActive(false);
LoadTriggerNextGuide("关闭");
; //隐藏引导
});
}
}
#endregion
}