Tz2/Assets/Zion/Scripts/ERP/SAP上下架功能/TransferOutboundSAPManager.cs

68 lines
2.1 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;
using System.Collections;
using System.Collections.Generic;
using DefaultNamespace.ProcessMode;
using MotionFramework;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 转储调拨系统出库SAP管理
/// </summary>
public class TransferOutboundSAPManager : MonoBehaviour
{
public InputField warehouseNumberInput; // 仓库号输入框
public Toggle automationTaskInput; // 自动化任务输入框
public Toggle putawayInput; // 上架操作输入框
public Toggle pickingInput; // 下架操作输入框
public Button queryBt;// 查询按钮
public Button generateTransferOrderBt; // 生成转储单按钮
public Toggle[] toggles;
public GameObject plane;
private void Start()
{
queryBt.onClick.AddListener(delegate
{
// 检查三个 Toggle 是否都为 true
if (automationTaskInput.isOn && putawayInput.isOn && pickingInput.isOn)
{
// 调用需要执行的方法
MotionEngine.GetModule<ProcessManager>().HandleClick(warehouseNumberInput.text);
plane.SetActive(true);
}
});
generateTransferOrderBt.onClick.AddListener(delegate
{
// 检查 toggles 数组中是否有一个 toggle 为 true
if (IsAnyToggleOn(toggles))
{
// 调用需要执行的方法
MotionEngine.GetModule<ProcessManager>().HandleClick("生成转储单");
}
});
}
/// <summary>
/// 检查 Toggle 数组中是否有一个为 true
/// </summary>
/// <param name="toggleArray">Toggle 数组</param>
/// <returns>若有一个为 true 则返回 true否则返回 false</returns>
private bool IsAnyToggleOn(Toggle[] toggleArray)
{
if (toggleArray != null)
{
foreach (Toggle toggle in toggleArray)
{
if (toggle != null && toggle.isOn)
{
return true;
}
}
}
return false;
}
}