222 lines
7.3 KiB
C#
222 lines
7.3 KiB
C#
using Cysharp.Threading.Tasks;
|
|
using DefaultNamespace;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
|
|
public class Controlequipmentmanagement : MonoBehaviour
|
|
{
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
/// <summary>
|
|
/// 分配id给小车
|
|
/// </summary>
|
|
public async UniTask Trolleyequipment()
|
|
{
|
|
await UniTask.Delay(3000);
|
|
Debug.Log(MqttManager.Instance.carequipments.Count);
|
|
int number = 1;
|
|
if (MqttManager.Instance.carequipments.Count > 0)
|
|
{
|
|
for (int i = 0; i < MqttManager.Instance.carequipments.Count; i++)
|
|
{
|
|
int index = i;
|
|
index += number;
|
|
if (index < 9)
|
|
{
|
|
GameObject car = transform.Find("AGV" + index).gameObject;
|
|
Debug.Log(car.name);
|
|
Consentmark carinformation = car.AddComponent<Consentmark>();
|
|
Debug.Log(carinformation.ID);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 提升机设备
|
|
/// </summary>
|
|
public async UniTask Hoistequipment()
|
|
{
|
|
await UniTask.Delay(3000);
|
|
Debug.Log(MqttManager.Instance.elvequipments.Count);
|
|
int number = 1;
|
|
if (MqttManager.Instance.elvequipments.Count > 0)
|
|
{
|
|
for (int i = 0; i < MqttManager.Instance.elvequipments.Count; i++)
|
|
{
|
|
int index = i;
|
|
index += number;
|
|
if (index < 8)
|
|
{
|
|
GameObject elv = transform.Find("提升机" + index).gameObject;
|
|
Debug.Log(elv.name);
|
|
Consentmark hoistinformation = elv.transform.GetChild(0).AddComponent<Consentmark>();
|
|
hoistinformation.ID = MqttManager.Instance.elvequipments[index - 1].id;
|
|
Debug.Log(hoistinformation.ID);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 码垛机设备
|
|
/// </summary>
|
|
public async UniTask Palletizer()
|
|
{
|
|
await UniTask.Delay(3000);
|
|
Debug.Log(MqttManager.Instance.dpmequipments.Count);
|
|
int number = 1;
|
|
if (MqttManager.Instance.dpmequipments.Count > 0)
|
|
{
|
|
for (int i = 0; i < MqttManager.Instance.dpmequipments.Count; i++)
|
|
{
|
|
int index = i;
|
|
index += number;
|
|
if (index < 5)
|
|
{
|
|
GameObject dpme = transform.Find("码垛机" + index).gameObject;
|
|
Debug.Log(dpme.name);
|
|
Consentmark palletizerparameters = dpme.transform.GetChild(0).AddComponent<Consentmark>();
|
|
palletizerparameters.ID = MqttManager.Instance.dpmequipments[index - 1].id;
|
|
Debug.Log(palletizerparameters.ID);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// 换电池的系统
|
|
/// </summary>
|
|
public async UniTask Replacebattery()
|
|
{
|
|
await UniTask.Delay(3000);
|
|
Debug.Log(MqttManager.Instance.qcbdequipments.Count);
|
|
int number = 1;
|
|
if (MqttManager.Instance.qcbdequipments.Count > 0)
|
|
{
|
|
for (int i = 0; i < MqttManager.Instance.qcbdequipments.Count; i++)
|
|
{
|
|
int index = i;
|
|
index += number;
|
|
if (index < 3)
|
|
{
|
|
GameObject qcbd = transform.Find("快换电池系统/换电池" + index).gameObject;
|
|
Debug.Log(qcbd.name);
|
|
Consentmark batterychanger = qcbd.AddComponent<Consentmark>();
|
|
batterychanger.ID = MqttManager.Instance.dpmequipments[index - 1].id;
|
|
Debug.Log(batterychanger.ID);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 落地式提升机
|
|
/// </summary>
|
|
public async UniTask Floortype()
|
|
{
|
|
await UniTask.Delay(3000);
|
|
Debug.Log(MqttManager.Instance.feequipments.Count);
|
|
int number = 1;
|
|
if (MqttManager.Instance.feequipments.Count > 0)
|
|
{
|
|
for (int i = 0; i < MqttManager.Instance.feequipments.Count; i++)
|
|
{
|
|
int index = i;
|
|
index += number;
|
|
if (index < 2)
|
|
{
|
|
GameObject feeq = transform.Find("落地式提升机" + index).gameObject;
|
|
Debug.Log(feeq.name);
|
|
Consentmark feechanger = feeq.AddComponent<Consentmark>();
|
|
feechanger.ID = MqttManager.Instance.feequipments[index - 1].id;
|
|
Debug.Log(feechanger.ID);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 加去盖机
|
|
/// </summary>
|
|
public async UniTask Cmequipments()
|
|
{
|
|
await UniTask.Delay(3000);
|
|
Debug.Log(MqttManager.Instance.cmequipments.Count);
|
|
int number = 1;
|
|
if (MqttManager.Instance.cmequipments.Count > 0)
|
|
{
|
|
for (int i = 0; i < MqttManager.Instance.cmequipments.Count; i++)
|
|
{
|
|
int index = i;
|
|
index += number;
|
|
if (index < 2)
|
|
{
|
|
GameObject cmequ = transform.Find("加去盖机" + index).gameObject;
|
|
Debug.Log(cmequ.name);
|
|
Consentmark cmequipment = cmequ.AddComponent<Consentmark>();
|
|
cmequipment.ID = MqttManager.Instance.cmequipments[index - 1].id;
|
|
Debug.Log(cmequipment.ID);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 出库机设备
|
|
/// </summary>
|
|
public async UniTask Deliverymachine()
|
|
{
|
|
await UniTask.Delay(3000);
|
|
Debug.Log(MqttManager.Instance.convoyorequipments.Count);
|
|
int number = 1;
|
|
if (MqttManager.Instance.convoyorequipments.Count > 0)
|
|
{
|
|
for (int i = 0; i < MqttManager.Instance.convoyorequipments.Count; i++)
|
|
{
|
|
int index = i;
|
|
index += number;
|
|
if (index < 19)
|
|
{
|
|
GameObject delivery = transform.Find("输送区域/出库机" + index).gameObject;
|
|
Debug.Log(delivery.name);
|
|
Consentmark outofthe = delivery.AddComponent<Consentmark>();
|
|
outofthe.ID = MqttManager.Instance.convoyorequipments[index - 1].Id;
|
|
Debug.Log(outofthe.ID);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 入库机设备
|
|
/// </summary>
|
|
public async UniTask Warehousingmachine()
|
|
{
|
|
await UniTask.Delay(3000);
|
|
Debug.Log(MqttManager.Instance.exportations.Count);
|
|
int number = 1;
|
|
if (MqttManager.Instance.exportations.Count > 0)
|
|
{
|
|
for (int i = 0; i < MqttManager.Instance.exportations.Count; i++)
|
|
{
|
|
int index = i;
|
|
index += number;
|
|
if (index < 38)
|
|
{
|
|
GameObject warehous = transform.Find("输送区域/入库机" + index).gameObject;
|
|
Debug.Log(warehous.name);
|
|
Consentmark wares = warehous.AddComponent<Consentmark>();
|
|
wares.ID = MqttManager.Instance.exportations[index - 1].Id;
|
|
Debug.Log(wares.ID);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|