Tz2/Assets/Zion/Scripts/TaskPrompt.cs

233 lines
7.0 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 System.Collections;
using System.Collections.Generic;
using DefaultNamespace;
using UnityEngine;
using TMPro;
using static InterfaceManager;
using UnityEngine.UI;
using DefaultNamespace.ProcessMode;
using Framework.Manager;
using MotionFramework;
using Zion.Scripts.ERP.退退;
/// <summary>
/// 任务要求
/// </summary>
public class TaskPrompt : MonoBehaviour
{
/// <summary>
/// 任务要求实例
/// </summary>
public static TaskPrompt Instance;
/// <summary>
/// 关闭任务要求面板按钮
/// </summary>
public Button btnClosePanelTaskPrompt;
/// <summary>
/// 是否处理过
/// </summary>
private bool isHandle = true;
/// <summary>
/// 任务要求展示
/// </summary>
public TMP_InputField taskInput;
public GameObject duihua;
private bool isDuihua = false;
private Framework.Dto.InventoryReversalVoucherAnalyzer returnRevVoucherAnalyzer;
//public GameObject datika;
void Awake()
{
Instance = this;
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("入库") && !MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("借用物资入库"))
{
ChatPanel.isclick = false;
}
else
{
ChatPanel.isclick = true;
}
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("系统入库冲销凭证分析"))
{
ChatPanel.isclick = true;
}
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("月度采购物资入库凭证分析"))
{
ChatPanel.isclick = true;
}
// taskInput = FindObjectByName<TMP_InputField>("InputPanelTaskPrompt");
// btnClosePanelTaskPrompt = FindObjectByName<Button>("btnClosePanelTaskPrompt");
}
/// <summary>
/// 任务要求
/// </summary>
// Start is called before the first frame update
void Start()
{
if (btnClosePanelTaskPrompt != null)
{
//btnClosePanelTaskPrompt.onClick.AddListener(HHH);
}
/*returnRevVoucherAnalyzer = (Framework.Dto.InventoryReversalVoucherAnalyzer)MotionEngine.GetModule<GlobalDataStorage>().materialTaskObj;*/
}
public void HHH()
{
if (!ChatPanel.isclick)
{
ChatPanel.isclick = true;
duihua.SetActive(true);
}
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("代保管出库"))
{
Hide();
}
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("库存物资报废"))
{
Hide();
}
// else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "基建工程延期供应计划调整")
// {
// MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick("任务书");
// TutorialGuideManager.Instance.TriggerNextGuide();
// }
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "1KV电缆终端到货验收入库")
{
if (!isDuihua)
{
duihua.SetActive(true);
isDuihua = true;
}
if (isHandle)
{
isHandle = false;
MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick("任务书");
LoadTriggerNextGuide("PanelTaskPrompt");
}
}
else
{
//打开任务书
if (isHandle)
{
isHandle = false;
MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick("任务书");
LoadTriggerNextGuide("PanelTaskPrompt");
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("新注册仓库的主数据运维流程"))
{
FileComponent.DownloadSingleFile("新注册仓库的主数据运维流程_答题卡1");
MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick("答题卡");
}
// if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "审核合同变更申请")
// {
//
// if (returnRevVoucherAnalyzer.formselection == "合同1")
// {
// FileComponent.DownloadSingleFile("附件2 系统数据-合同执行计划_合同1");
// }
// else if (returnRevVoucherAnalyzer.formselection == "合同2")
// {
// FileComponent.DownloadSingleFile("附件2 系统数据-合同执行计划_合同2");
// }
// }
}
}
//
// // 检查下一个步骤是否包含"发货前"
// string nextStepTitle = MotionFramework.MotionEngine.GetModule<ProcessManager>().GetNextStepTitle();
// if (!string.IsNullOrEmpty(nextStepTitle) && nextStepTitle.Contains("发货前"))
// {
// Debug.Log($"检测到下一个步骤包含'发货前': {nextStepTitle}调用Hide()方法");
// Hide();
// }
gameObject.SetActive(false);
}
private void Hide()
{
MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick("任务书");
RetiredAssetOutboundManager.Instance.Show();
TutorialGuideManager.Instance.HideGuide();
}
public void LoadTriggerNextGuideTaskPrompt()
{
if (btnClosePanelTaskPrompt != null)
{
btnClosePanelTaskPrompt.onClick.RemoveAllListeners();
btnClosePanelTaskPrompt.onClick.AddListener(() =>
{
gameObject.SetActive(false);
//打开任务书
if (isHandle)
{
isHandle = false;
MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick("任务书");
LoadTriggerNextGuide("PanelTaskPrompt");
}
});
}
}
public void LoadHideGuideTaskPrompt()
{
if (btnClosePanelTaskPrompt != null)
{
btnClosePanelTaskPrompt.onClick.RemoveAllListeners();
btnClosePanelTaskPrompt.onClick.AddListener(() =>
{
gameObject.SetActive(false);
//打开任务书
if (isHandle)
{
isHandle = false;
MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick("任务书");
LoadTriggerNextGuide("关闭");;
}
});
}
}
/// <summary>
/// 初始化任务要求
/// </summary>
/// <param name="task"> 任务要求</param>
public void Init(string task)
{
if (taskInput != null)
{
taskInput.text = task;
}
}
}