8.11
This commit is contained in:
parent
2a8b87d775
commit
d30bdbc931
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -159,10 +159,17 @@ MonoBehaviour:
|
|||
deviceType: 1
|
||||
deviceTypeStr:
|
||||
rackId:
|
||||
shelfId:
|
||||
slotId:
|
||||
devicePosition:
|
||||
machineModel:
|
||||
status: 0
|
||||
conDeviceName:
|
||||
rackType:
|
||||
openFlag:
|
||||
modelNum:
|
||||
occupyNum:
|
||||
residueNum:
|
||||
operationTime: 0
|
||||
directorName:
|
||||
phone:
|
||||
|
|
|
@ -1510,10 +1510,17 @@ MonoBehaviour:
|
|||
deviceType: 1
|
||||
deviceTypeStr:
|
||||
rackId:
|
||||
shelfId:
|
||||
slotId:
|
||||
devicePosition:
|
||||
machineModel:
|
||||
status: 0
|
||||
conDeviceName:
|
||||
rackType:
|
||||
openFlag:
|
||||
modelNum:
|
||||
occupyNum:
|
||||
residueNum:
|
||||
operationTime: 0
|
||||
directorName:
|
||||
phone:
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,12 +4,9 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using UnityEngine.UIElements;
|
||||
using static DeviceQuery;
|
||||
using static GameManager;
|
||||
using static PortQuery;
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
|
@ -63,7 +60,7 @@ public class GameManager : MonoBehaviour
|
|||
/// </summary>
|
||||
public List<DeviceList> TmsCards;
|
||||
|
||||
[Header(""), Header("设备-查询接口")] public PortQuery.Root root_AllPort;
|
||||
[Header(""), Header("端口-查询接口")] public PortQuery.Root root_AllPort;
|
||||
|
||||
/// <summary>
|
||||
/// 场景所有端口
|
||||
|
@ -700,6 +697,74 @@ public class GameManager : MonoBehaviour
|
|||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 根据配置生成线缆
|
||||
/// </summary>
|
||||
[ContextMenu("根据配置生成线缆")]
|
||||
public void FindPortPos()
|
||||
{
|
||||
var pqs = Array.FindAll(GameObject.FindObjectsOfType<PortQuery>(), itme =>
|
||||
{
|
||||
PortQuery pq = itme.GetComponent<PortQuery>();
|
||||
if (!string.IsNullOrEmpty(pq.portList.id))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
//return true;
|
||||
})/*.Select(item => item.gameObject).ToArray()*/;
|
||||
var P_list = FindObjectGroups(pqs.ToList());
|
||||
|
||||
CreateLine createLine = PatternChoose.Inst.transform.Find("画线").GetComponent<CreateLine>();
|
||||
createLine.list7.Clear();
|
||||
foreach (var item in P_list)
|
||||
{
|
||||
createLine.list7.Add(item[0].transform);
|
||||
createLine.list7.Add(item[1].transform);
|
||||
}
|
||||
|
||||
createLine.F7();
|
||||
}
|
||||
|
||||
public List<List<PortQuery>> FindObjectGroups(List<PortQuery> objects)
|
||||
{
|
||||
List<List<PortQuery>> objectGroups = new List<List<PortQuery>>();
|
||||
|
||||
for (int i = 0; i < objects.Count; i++)
|
||||
{
|
||||
PortQuery objectA = objects[i];
|
||||
|
||||
for (int j = i + 1; j < objects.Count; j++)
|
||||
{
|
||||
PortQuery objectB = objects[j];
|
||||
|
||||
if (objectA.portList.conDevice == objectB.portList.deviceId && objectA.portList.port == objectB.portList.conPort &&
|
||||
objectB.portList.conDevice == objectA.portList.deviceId && objectB.portList.port == objectA.portList.conPort)
|
||||
{
|
||||
bool isDuplicate = false;
|
||||
|
||||
foreach (List<PortQuery> group in objectGroups)
|
||||
{
|
||||
if (group.Contains(objectA) || group.Contains(objectB))
|
||||
{
|
||||
isDuplicate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isDuplicate)
|
||||
{
|
||||
List<PortQuery> newGroup = new List<PortQuery>();
|
||||
newGroup.Add(objectA);
|
||||
newGroup.Add(objectB);
|
||||
objectGroups.Add(newGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return objectGroups;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询所有设备
|
||||
|
@ -792,5 +857,6 @@ public class GameManager : MonoBehaviour
|
|||
gzp_cx = ct + "machineRoom/tmsWorkTicket/queryList";
|
||||
jxp_cx = ct + "machineRoom/tmsOverhaulTicket/queryList";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http.Headers;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEditor.PackageManager;
|
||||
using UnityEngine.UI;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
///整合JSON
|
||||
|
|
|
@ -1,39 +1,30 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEditor.Experimental.GraphView;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using static DeviceQuery;
|
||||
using static GameManager;
|
||||
|
||||
public class TOOL : MonoBehaviour
|
||||
{
|
||||
public List<GameObject> gameObjects;
|
||||
Dropdown port;
|
||||
// Start is called before the first frame update
|
||||
[ContextMenu("Start")]
|
||||
|
||||
|
||||
public string port;
|
||||
public string deviceId;
|
||||
public string conDevice;
|
||||
public string conPort;
|
||||
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
//Debug.Log(transform.root.Find("对联设备").name);
|
||||
//GameObject.Instantiate(Resources.Load<GameObject>("古泉站换流站机房/35"));
|
||||
//port = GetComponent<Dropdown>();
|
||||
//port.onValueChanged.AddListener(OnDropdownValueChanged_port);
|
||||
//for (int i = 0; i < port.options.Count; i++)
|
||||
//{
|
||||
// if (i == port.value)
|
||||
// {
|
||||
// port.value = i;
|
||||
|
||||
// }
|
||||
//}
|
||||
//port.value = 0;
|
||||
}
|
||||
|
||||
private void OnDropdownValueChanged_port(int arg0)
|
||||
{
|
||||
Debug.Log("索引改变为" + arg0);
|
||||
Debug.Log("索引改变为" + arg0);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
@ -43,7 +34,7 @@ public class TOOL : MonoBehaviour
|
|||
}
|
||||
|
||||
|
||||
[ContextMenu("重命名")]
|
||||
[ContextMenu("重命名")]
|
||||
public void reName()
|
||||
{
|
||||
if (gameObjects.Count == 0 && gameObjects == null) return;
|
||||
|
@ -63,10 +54,10 @@ public class TOOL : MonoBehaviour
|
|||
deviceQuery.deviceList.type = "1";
|
||||
}
|
||||
|
||||
var U = gameObjects[i].transform.Find("U位");
|
||||
var U = gameObjects[i].transform.Find("U位");
|
||||
if (U == null)
|
||||
{
|
||||
var go = new GameObject("U位");
|
||||
var go = new GameObject("U位");
|
||||
go.transform.SetParent(gameObjects[i].transform);
|
||||
for (int j = 0; j < 42; j++)
|
||||
{
|
||||
|
@ -87,4 +78,11 @@ public class TOOL : MonoBehaviour
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[ContextMenu("寻找物体组")]
|
||||
public void das()
|
||||
{
|
||||
GameManager.Inst.FindPortPos();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ using UnityEngine.UI;
|
|||
[AddComponentMenu("PatternChoose/模式选择")]
|
||||
public class PatternChoose : MonoBehaviour
|
||||
{
|
||||
|
||||
static PatternChoose _inst;
|
||||
public static PatternChoose Inst => _inst;
|
||||
public Button TS_button;
|
||||
public Button RL_button;
|
||||
/// <summary>
|
||||
|
@ -21,7 +22,16 @@ public class PatternChoose : MonoBehaviour
|
|||
Vector3 init_rot;
|
||||
private void Awake()
|
||||
{
|
||||
init_pos=Camera.main.transform.localPosition;
|
||||
if (_inst != null && _inst != this)
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
_inst = this;
|
||||
DontDestroyOnLoad(this.gameObject);
|
||||
}
|
||||
init_pos = Camera.main.transform.localPosition;
|
||||
init_rot = Camera.main.transform.localEulerAngles;
|
||||
}
|
||||
void Start()
|
||||
|
|
|
@ -1,54 +1,293 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Threading.Tasks;
|
||||
using static OnChlickDrag;
|
||||
|
||||
/// <summary>
|
||||
/// 设备-编辑
|
||||
/// </summary>
|
||||
public class RedactDevice : MonoBehaviour
|
||||
{
|
||||
public Root root;
|
||||
public Body mybody;
|
||||
public Root URlreturn;
|
||||
|
||||
public Dropdown type;
|
||||
public Dropdown deviceType;
|
||||
public InputField deviceName;
|
||||
public InputField deviceCode;
|
||||
public Dropdown status;
|
||||
public Dropdown rackType;
|
||||
public Dropdown openFlag;
|
||||
|
||||
#region 机柜的
|
||||
public InputField machineModel;
|
||||
public InputField manufacturer;
|
||||
#endregion
|
||||
public Button save_bt;
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
if (type) type.value = mybody.type;
|
||||
if (deviceType) deviceType.value = mybody.deviceType != null ? int.Parse(mybody.deviceType) : 0;
|
||||
if (deviceName) deviceName.text = mybody.deviceName;
|
||||
if (deviceCode) deviceCode.text = mybody.deviceCode;
|
||||
if (machineModel) machineModel.text = mybody.machineModel;
|
||||
if (status) status.value = int.Parse(mybody.status);
|
||||
if (rackType) rackType.value = mybody.rackType != null ? int.Parse(mybody.rackType) : 0;
|
||||
if (openFlag) openFlag.value = mybody.openFlag != null ? int.Parse(mybody.openFlag) : 2;
|
||||
if (manufacturer) manufacturer.text = mybody.manufacturer;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
save_bt.onClick.AddListener(async () => await saveJson());
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (type) mybody.type = type.value;
|
||||
if (deviceType) mybody.deviceType = deviceType.value == 0 ? null : deviceType.value.ToString();
|
||||
if (deviceName) mybody.deviceName = deviceName.text;
|
||||
if (deviceCode) mybody.deviceCode = deviceCode.text;
|
||||
if (machineModel) mybody.machineModel = machineModel.text;
|
||||
if (status) mybody.status = status.value.ToString();
|
||||
if (rackType) mybody.rackType = rackType.value == 0 ? null : rackType.value.ToString();
|
||||
if (openFlag) mybody.openFlag = openFlag.value == 2 ? null : openFlag.value.ToString();
|
||||
if (manufacturer) mybody.manufacturer = manufacturer.text;
|
||||
}
|
||||
|
||||
public async Task saveJson()
|
||||
{
|
||||
if (string.IsNullOrEmpty(mybody.id)) return;
|
||||
string json = JsonConvert.SerializeObject(mybody);
|
||||
Debug.Log(json);
|
||||
|
||||
var client = new HttpClient();
|
||||
var request = new HttpRequestMessage
|
||||
{
|
||||
Method = HttpMethod.Post,
|
||||
RequestUri = new Uri(GameManager.Inst.Jk_URL.sb_bj),
|
||||
Headers =
|
||||
{
|
||||
{ "X-Token", GameManager.Inst.token },
|
||||
},
|
||||
Content = new StringContent(json)
|
||||
{
|
||||
Headers =
|
||||
{
|
||||
ContentType = new MediaTypeHeaderValue("application/json")
|
||||
}
|
||||
}
|
||||
};
|
||||
using (var response = await client.SendAsync(request))
|
||||
{
|
||||
response.EnsureSuccessStatusCode();
|
||||
var body = await response.Content.ReadAsStringAsync();
|
||||
|
||||
URlreturn = JsonConvert.DeserializeObject<Root>(body);
|
||||
Debug.Log(body);
|
||||
}
|
||||
}
|
||||
|
||||
#region JSON
|
||||
[System.Serializable]
|
||||
public class Root
|
||||
public class Body
|
||||
{
|
||||
/// <summary>
|
||||
/// id
|
||||
/// </summary>
|
||||
public string id ;
|
||||
public string id;
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string deviceName ;
|
||||
public string deviceName;
|
||||
/// <summary>
|
||||
/// 类型:1-机柜;2-设备
|
||||
/// </summary>
|
||||
public int type ;
|
||||
public int type;
|
||||
/// <summary>
|
||||
/// 投运时间
|
||||
/// </summary>
|
||||
public int operationTime ;
|
||||
public int operationTime;
|
||||
/// <summary>
|
||||
/// 是否启用:1-正常;0-禁用
|
||||
/// </summary>
|
||||
public string status ;
|
||||
public string status;
|
||||
/// <summary>
|
||||
/// 负责人
|
||||
/// </summary>
|
||||
public string directorName ;
|
||||
public string directorName;
|
||||
/// <summary>
|
||||
/// 联系电话
|
||||
/// </summary>
|
||||
public string phone ;
|
||||
public string phone;
|
||||
/// <summary>
|
||||
/// 机柜型号
|
||||
/// </summary>
|
||||
public string machineModel ;
|
||||
public string machineModel;
|
||||
/// <summary>
|
||||
/// 机柜位置
|
||||
/// </summary>
|
||||
public string machinePosition ;
|
||||
public string machinePosition;
|
||||
|
||||
/// <summary>
|
||||
/// 编号
|
||||
/// </summary>
|
||||
[Tooltip("编号")] public string deviceCode;
|
||||
/// <summary>
|
||||
/// 类型:1-机柜;2-设备
|
||||
/// </summary>
|
||||
[Tooltip("类型:1-机柜;2-设备")] public string typeStr;
|
||||
/// <summary>
|
||||
/// 设备类型:1-机框;2-机槽;3-板卡
|
||||
/// </summary>
|
||||
[Tooltip("设备类型:1-机框;2-机槽;3-板卡")] public string deviceType;
|
||||
/// <summary>
|
||||
/// 设备类型:1-机框;2-机槽;3-板卡
|
||||
/// </summary>
|
||||
[Tooltip("设备类型:1-机框;2-机槽;3-板卡")] public string deviceTypeStr;
|
||||
/// <summary>
|
||||
/// 所属机柜id
|
||||
/// </summary>
|
||||
[Tooltip("所属机柜id")] public string rackId;
|
||||
/// <summary>
|
||||
/// 所属机框id
|
||||
/// </summary>
|
||||
[Tooltip("所属机框id")] public string shelfId;
|
||||
/// <summary>
|
||||
/// 所属机槽id
|
||||
/// </summary>
|
||||
[Tooltip("所属机槽id")] public string slotId;
|
||||
/// <summary>
|
||||
/// 设备位置
|
||||
/// </summary>
|
||||
[Tooltip("设备位置")] public string devicePosition;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Tooltip("")] public string conDeviceName;
|
||||
/// <summary>
|
||||
/// 机柜类型:1-通信机柜;2-非通信机柜
|
||||
/// </summary>
|
||||
[Tooltip("机柜类型:1-通信机柜;2-非通信机柜")] public string rackType;
|
||||
/// <summary>
|
||||
/// 柜门是否打开:1-开;0-关
|
||||
/// </summary>
|
||||
[Tooltip("柜门是否打开:1-开;0-关")] public string openFlag;
|
||||
/// <summary>
|
||||
/// 模型编号
|
||||
/// </summary>
|
||||
[Tooltip("模型编号")] public string modelNum;
|
||||
/// <summary>
|
||||
/// U位占用数量
|
||||
/// </summary>
|
||||
[Tooltip("U位占用数量")] public string occupyNum;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Tooltip("")] public string residueNum;
|
||||
/// <summary>
|
||||
/// 生产厂家
|
||||
/// </summary>
|
||||
[Tooltip("生产厂家")] public string manufacturer;
|
||||
/// <summary>
|
||||
/// 电源属性
|
||||
/// </summary>
|
||||
[Tooltip("电源属性")] public string powerProperties;
|
||||
/// <summary>
|
||||
/// 维护单位
|
||||
/// </summary>
|
||||
[Tooltip("维护单位")] public string maintenanceUnit;
|
||||
/// <summary>
|
||||
/// 机框高度
|
||||
/// </summary>
|
||||
[Tooltip("机框高度")] public string machineFrameHigh;
|
||||
/// <summary>
|
||||
/// 机框宽度
|
||||
/// </summary>
|
||||
[Tooltip("机框宽度")] public string machineFrameWide;
|
||||
/// <summary>
|
||||
/// 机框厚度
|
||||
/// </summary>
|
||||
[Tooltip("机框厚度")] public string machineFrameThick;
|
||||
/// <summary>
|
||||
/// 插槽数量
|
||||
/// </summary>
|
||||
[Tooltip("插槽数量")] public string slotNum;
|
||||
/// <summary>
|
||||
/// 插槽排列方式
|
||||
/// </summary>
|
||||
[Tooltip("插槽排列方式")] public string slotSort;
|
||||
/// <summary>
|
||||
/// 安装方式
|
||||
/// </summary>
|
||||
[Tooltip("安装方式")] public string installMethod;
|
||||
/// <summary>
|
||||
/// 所属机框
|
||||
/// </summary>
|
||||
[Tooltip("所属机框")] public string affiliationFrame;
|
||||
/// <summary>
|
||||
/// 父插槽名称
|
||||
/// </summary>
|
||||
[Tooltip("父插槽名称")] public string parentSlotName;
|
||||
/// <summary>
|
||||
/// 插槽类型
|
||||
/// </summary>
|
||||
[Tooltip("插槽类型")] public string slotType;
|
||||
/// <summary>
|
||||
/// 占用状态
|
||||
/// </summary>
|
||||
[Tooltip("占用状态")] public string occupyStatus;
|
||||
/// <summary>
|
||||
/// 所属机槽名称
|
||||
/// </summary>
|
||||
[Tooltip("所属机槽名称")] public string affiliationSlot;
|
||||
/// <summary>
|
||||
/// 端口数量
|
||||
/// </summary>
|
||||
[Tooltip("端口数量")] public string portNum;
|
||||
/// <summary>
|
||||
/// 板卡功能
|
||||
/// </summary>
|
||||
[Tooltip("板卡功能")] public string cardFunction;
|
||||
/// <summary>
|
||||
/// 板卡类型
|
||||
/// </summary>
|
||||
[Tooltip("板卡类型")] public string cardType;
|
||||
/// <summary>
|
||||
/// 运行状态
|
||||
/// </summary>
|
||||
[Tooltip("运行状态")] public string runStatus;
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[Tooltip("备注")] public string remark;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class Root
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string code;
|
||||
/// <summary>
|
||||
/// 反馈结果
|
||||
/// </summary>
|
||||
public string message;
|
||||
/// <summary>
|
||||
/// 返回内容
|
||||
/// </summary>
|
||||
public string data;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string serverTime;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
|
|
@ -1,30 +1,26 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
using System.Threading.Tasks;
|
||||
using static PortQuery;
|
||||
using System.Collections.Generic;
|
||||
using Unity.VisualScripting;
|
||||
using System.Reflection;
|
||||
using static UnityEditor.Progress;
|
||||
using System.Linq;
|
||||
/// <summary>
|
||||
/// 端口-编辑
|
||||
/// </summary>
|
||||
public class RedactPort : MonoBehaviour
|
||||
{
|
||||
public Root myroot;
|
||||
public Body mybody;
|
||||
public Root URlreturn;
|
||||
//public PortQuery.Root root;
|
||||
public Button save_bt;
|
||||
|
||||
/// <summary>
|
||||
/// 端口
|
||||
/// </summary>
|
||||
public Dropdown port;
|
||||
//public Dropdown port;
|
||||
public InputField port;
|
||||
/// <summary>
|
||||
/// 编号
|
||||
/// </summary>
|
||||
|
@ -34,9 +30,9 @@ public class RedactPort : MonoBehaviour
|
|||
/// </summary>
|
||||
public InputField portName;
|
||||
/// <summary>
|
||||
/// 端口类型
|
||||
/// 线缆名称
|
||||
/// </summary>
|
||||
public InputField portType;
|
||||
public InputField remark;
|
||||
/// <summary>
|
||||
/// 所属设备
|
||||
/// </summary>
|
||||
|
@ -65,18 +61,18 @@ public class RedactPort : MonoBehaviour
|
|||
{
|
||||
#region 正式
|
||||
initAsync();
|
||||
port.options[1].text = myroot.port;
|
||||
portCode.text = myroot.portCode;
|
||||
portType.text = myroot.portType;
|
||||
deviceId.text = myroot.deviceId;
|
||||
portModel.text = myroot.portModel;
|
||||
status.value = myroot.status;
|
||||
if (!string.IsNullOrEmpty(myroot.conDevice))
|
||||
port.text = mybody.port;
|
||||
portCode.text = mybody.portCode;
|
||||
remark.text = mybody.remark;
|
||||
deviceId.text = mybody.deviceId;
|
||||
portModel.text = mybody.portModel;
|
||||
status.value = mybody.status;
|
||||
if (!string.IsNullOrEmpty(mybody.conDevice))
|
||||
{
|
||||
//自动识别对联设备
|
||||
for (int i = 0; i < conDevice.options.Count; i++)
|
||||
{
|
||||
if (conDevice.options[i].text == myroot.conDevice)
|
||||
if (conDevice.options[i].text == mybody.conDevice)
|
||||
{
|
||||
conDevice.value = 0;
|
||||
conDevice.value = i;
|
||||
|
@ -137,7 +133,7 @@ public class RedactPort : MonoBehaviour
|
|||
{
|
||||
save_bt.onClick.AddListener(async () => await saveJson());
|
||||
conDevice.onValueChanged.AddListener(OnDropdownValueChanged_conDevice);
|
||||
port.onValueChanged.AddListener(OnDropdownValueChanged_port);
|
||||
//port.onValueChanged.AddListener(OnDropdownValueChanged_port);
|
||||
|
||||
}
|
||||
|
||||
|
@ -180,12 +176,12 @@ public class RedactPort : MonoBehaviour
|
|||
conPort.options.Clear();
|
||||
conPort.AddOptions(conPort_list);
|
||||
|
||||
if (string.IsNullOrEmpty(myroot.conPort)) return;
|
||||
if (string.IsNullOrEmpty(mybody.conPort)) return;
|
||||
|
||||
//自动识别端口
|
||||
for (int i = 0; i < conPort.options.Count; i++)
|
||||
{
|
||||
if (conPort.options[i].text == myroot.conPort)
|
||||
if (conPort.options[i].text == mybody.conPort)
|
||||
{
|
||||
conPort.value = i;
|
||||
break;
|
||||
|
@ -195,7 +191,15 @@ public class RedactPort : MonoBehaviour
|
|||
|
||||
private void Update()
|
||||
{
|
||||
|
||||
mybody.port = port.text;
|
||||
mybody.portCode = portCode.text;
|
||||
mybody.portName = portName.text;
|
||||
if (conDevice.value != 0 && conPort.value != 0) mybody.remark = remark.text;
|
||||
mybody.deviceId = deviceId.text;
|
||||
mybody.portModel = portModel.text;
|
||||
mybody.status = status.value;
|
||||
mybody.conDevice = conDevice.options[conDevice.value].text;
|
||||
mybody.conPort = conPort.options[conPort.value].text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -204,15 +208,15 @@ public class RedactPort : MonoBehaviour
|
|||
/// <param name="token"></param>
|
||||
public async Task saveJson()
|
||||
{
|
||||
if (string.IsNullOrEmpty(myroot.id)) return;
|
||||
string json = JsonConvert.SerializeObject(myroot);
|
||||
if (string.IsNullOrEmpty(mybody.id)) return;
|
||||
string json = JsonConvert.SerializeObject(mybody);
|
||||
Debug.Log(json);
|
||||
|
||||
var client = new HttpClient();
|
||||
var request = new HttpRequestMessage
|
||||
{
|
||||
Method = HttpMethod.Post,
|
||||
RequestUri = new Uri("http://wu4ifs.natappfree.cc/machineRoom/port/updateById"),
|
||||
RequestUri = new Uri(GameManager.Inst.Jk_URL.dk_bj),
|
||||
Headers =
|
||||
{
|
||||
{ "X-Token", GameManager.Inst.token },
|
||||
|
@ -229,13 +233,15 @@ public class RedactPort : MonoBehaviour
|
|||
{
|
||||
response.EnsureSuccessStatusCode();
|
||||
var body = await response.Content.ReadAsStringAsync();
|
||||
|
||||
URlreturn = JsonConvert.DeserializeObject<Root>(body);
|
||||
Debug.Log(body);
|
||||
}
|
||||
}
|
||||
|
||||
#region JSON
|
||||
[System.Serializable]
|
||||
public class Root
|
||||
public class Body
|
||||
{
|
||||
/// <summary>
|
||||
/// id
|
||||
|
@ -281,6 +287,44 @@ public class RedactPort : MonoBehaviour
|
|||
/// 备注
|
||||
/// </summary>
|
||||
public string remark;
|
||||
|
||||
/// <summary>
|
||||
/// 所属设备名称
|
||||
/// </summary>
|
||||
public string deviceName;
|
||||
/// <summary>
|
||||
/// 对联设备名称
|
||||
/// </summary>
|
||||
public string conDeviceName;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int createTime;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string createName;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class Root
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string code;
|
||||
/// <summary>
|
||||
/// 反馈结果
|
||||
/// </summary>
|
||||
public string message;
|
||||
/// <summary>
|
||||
/// 返回内容
|
||||
/// </summary>
|
||||
public string data;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string serverTime;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using static ENVQuery;
|
||||
|
||||
/// <summary>
|
||||
/// 机柜-查询
|
||||
|
@ -13,7 +10,7 @@ using static ENVQuery;
|
|||
[AddComponentMenu("机柜查询"), Serializable]
|
||||
public class CabinetQuery : MonoBehaviour
|
||||
{
|
||||
public CabinetList cabinetList=new CabinetList();
|
||||
public CabinetList cabinetList = new CabinetList();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
@ -44,7 +41,7 @@ public class CabinetQuery : MonoBehaviour
|
|||
|
||||
private void Update()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
#region JSON
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using static ENVQuery;
|
||||
|
||||
/// <summary>
|
||||
/// 设备-查询
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using static PortQuery;
|
||||
|
||||
/// <summary>
|
||||
/// »·¾³-²éѯ
|
||||
|
@ -11,7 +9,7 @@ using static PortQuery;
|
|||
[AddComponentMenu("»·¾³²éѯ")]
|
||||
public class ENVQuery : MonoBehaviour
|
||||
{
|
||||
public ENVList eNVList=new ENVList();
|
||||
public ENVList eNVList = new ENVList();
|
||||
|
||||
private async void Start()
|
||||
{
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TreeEditor;
|
||||
using UnityEngine;
|
||||
using static TmsCardQuery;
|
||||
|
||||
/// <summary>
|
||||
/// 端口-查询
|
||||
|
|
|
@ -227,14 +227,59 @@ public class CreateLine : MonoBehaviour
|
|||
[ContextMenu("不同行")]
|
||||
public void F7()
|
||||
{
|
||||
//Creat7(A7, B7, 1);
|
||||
for (int i = 0; i < list7.Count; i++)
|
||||
{
|
||||
if (i != 0 && i % 2 != 0)
|
||||
{
|
||||
Creat7(list7[i - 1], list7[i], (i + 1) / 2);
|
||||
int cjA = CengJi(list7[i - 1].name);
|
||||
int cjB = CengJi(list7[i].name);
|
||||
if (cjA == cjB)
|
||||
{
|
||||
Creat5(list7[i - 1], list7[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Creat7(list7[i - 1], list7[i], cjB);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int CengJi(string s)
|
||||
{
|
||||
int cj = 0;
|
||||
switch (s)
|
||||
{
|
||||
case "A":
|
||||
cj = 0;
|
||||
break;
|
||||
case "B":
|
||||
cj = 1;
|
||||
break;
|
||||
case "C":
|
||||
cj = 2;
|
||||
break;
|
||||
case "D":
|
||||
cj = 3;
|
||||
break;
|
||||
case "E":
|
||||
cj = 4;
|
||||
break;
|
||||
case "F":
|
||||
cj = 5;
|
||||
break;
|
||||
case "G":
|
||||
cj = 6;
|
||||
break;
|
||||
case "H":
|
||||
cj = 7;
|
||||
break;
|
||||
case "I":
|
||||
cj = 8;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return cj;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue