修改日志-20240709-2030:

1、修改默认堆场、相机、计量秤图标名称;
2、增加接口日志打印
This commit is contained in:
Afeijia 2024-07-09 20:30:11 +08:00
parent 52bac73a8a
commit 19e8b74416
5 changed files with 141 additions and 135 deletions

View File

@ -66,7 +66,7 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_text: New Text m_text: "\u672A\u77E5\u8BA1\u91CF\u8BBE\u5907"
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 39d48bca937920746ae0cfa602467f63, type: 2} m_fontAsset: {fileID: 11400000, guid: 39d48bca937920746ae0cfa602467f63, type: 2}
m_sharedMaterial: {fileID: 3298889249665915115, guid: 39d48bca937920746ae0cfa602467f63, m_sharedMaterial: {fileID: 3298889249665915115, guid: 39d48bca937920746ae0cfa602467f63,

View File

@ -66,7 +66,7 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_text: "\u554A\u5B9E\u6253\u5B9E\u7684\u6492\u554A\u5B9E\u6253\u5B9E\u7684" m_text: "\u672A\u77E5\u5806\u573A"
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 39d48bca937920746ae0cfa602467f63, type: 2} m_fontAsset: {fileID: 11400000, guid: 39d48bca937920746ae0cfa602467f63, type: 2}
m_sharedMaterial: {fileID: 3298889249665915115, guid: 39d48bca937920746ae0cfa602467f63, m_sharedMaterial: {fileID: 3298889249665915115, guid: 39d48bca937920746ae0cfa602467f63,

View File

@ -282,7 +282,7 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_text: "\u7801\u5934XX\u4E00\u53F7\u6CCA\u4F4D" m_text: "\u672A\u77E5\u76F8\u673A"
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 7189cdc95f54eb84ba6a7b8655aebb40, type: 2} m_fontAsset: {fileID: 11400000, guid: 7189cdc95f54eb84ba6a7b8655aebb40, type: 2}
m_sharedMaterial: {fileID: 1594732787684875815, guid: 7189cdc95f54eb84ba6a7b8655aebb40, m_sharedMaterial: {fileID: 1594732787684875815, guid: 7189cdc95f54eb84ba6a7b8655aebb40,

View File

@ -1,52 +1,52 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
using static UnityEditor.PlayerSettings; using static UnityEditor.PlayerSettings;
/// <summary> /// <summary>
/// 系统初始化 /// 系统初始化
/// </summary> /// </summary>
public class CallForTest : MonoBehaviour public class CallForTest : MonoBehaviour
{ {
public static CallForTest instance; public static CallForTest instance;
/// <summary> /// <summary>
/// 启动参数 /// 启动参数
/// </summary> /// </summary>
[HideInInspector] [HideInInspector]
public List<string> infos = null; public List<string> infos = null;
/// <summary> /// <summary>
/// 启动器传过来的关区编号 /// 启动器传过来的关区编号
/// </summary> /// </summary>
public string customCode; public string customCode;
/// <summary> /// <summary>
/// 海关 /// 海关
/// </summary> /// </summary>
public CustomName customName; public CustomName customName;
/// <summary> /// <summary>
/// 启动器传过来的企业id /// 启动器传过来的企业id
/// </summary> /// </summary>
public string MONITOR_ID; public string MONITOR_ID;
/// <summary> /// <summary>
/// 启动器传过来的服务器IP /// 启动器传过来的服务器IP
/// </summary> /// </summary>
public string ServerIP; public string ServerIP;
[DllImport("user32.dll", EntryPoint = "FindWindow")] [DllImport("user32.dll", EntryPoint = "FindWindow")]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")] [DllImport("user32.dll")]
static extern IntPtr SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint wFlags); static extern IntPtr SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint wFlags);
const uint SWP_SHOWWINDOW = 0x0040; const uint SWP_SHOWWINDOW = 0x0040;
const int HWND_TOPMOST = -1; const int HWND_TOPMOST = -1;
private void Awake() private void Awake()
{ {
instance = this; instance = this;
DontDestroyOnLoad(gameObject); DontDestroyOnLoad(gameObject);
//#if UNITY_EDITOR //#if UNITY_EDITOR
@ -56,79 +56,79 @@ public class CallForTest : MonoBehaviour
//#endif //#endif
Debug.Log(Application.productName); Debug.Log(Application.productName);
IntPtr ptr = FindWindow(null, Application.productName); IntPtr ptr = FindWindow(null, Application.productName);
SetWindowPos(ptr, (IntPtr)HWND_TOPMOST, 0, 0, Screen.width, Screen.height, SWP_SHOWWINDOW); SetWindowPos(ptr, (IntPtr)HWND_TOPMOST, 0, 0, Screen.width, Screen.height, SWP_SHOWWINDOW);
} }
private void OnGUI() private void OnGUI()
{ {
GUI.Label(new Rect(20, Screen.height - 30, 200, 50), "v" + Application.version); GUI.Label(new Rect(20, Screen.height - 30, 200, 50), "v" + Application.version);
} }
private void Start() private void Start()
{ {
//获取启动参数 //获取启动参数
infos = Environment.GetCommandLineArgs().ToList(); infos = Environment.GetCommandLineArgs().ToList();
Debug.Log("Æô¶¯²ÎÊý--------------------------------------------"); Debug.Log("Æô¶¯²ÎÊý--------------------------------------------");
infos.ForEach(info => infos.ForEach(info =>
{ {
Debug.Log(info); Debug.Log(info);
}); });
Debug.Log("启动参数--------------------------------------------"); Debug.Log("启动参数--------------------------------------------");
Debug.Log(""); Debug.Log("");
string code = infos.Find(a => a.StartsWith("code=")); string code = infos.Find(a => a.StartsWith("code="));
string enterprise_code = infos.Find(a => a.StartsWith("enterprise_code=")); string enterprise_code = infos.Find(a => a.StartsWith("enterprise_code="));
string config_value = infos.Find(a => a.StartsWith("config_value=")); string config_value = infos.Find(a => a.StartsWith("config_value="));
if (!string.IsNullOrEmpty(code)) if (!string.IsNullOrEmpty(code))
{ {
customCode = code.Replace("code=", ""); customCode = code.Replace("code=", "");
Debug.Log("启动参数关区:" + customCode); Debug.Log("启动参数关区:" + customCode);
} }
if (!string.IsNullOrEmpty(enterprise_code)) if (!string.IsNullOrEmpty(enterprise_code))
{ {
MONITOR_ID = enterprise_code.Replace("enterprise_code=", ""); MONITOR_ID = enterprise_code.Replace("enterprise_code=", "");
Debug.Log("启动参数企业:" + MONITOR_ID); Debug.Log("启动参数企业:" + MONITOR_ID);
} }
if (!string.IsNullOrEmpty(config_value)) if (!string.IsNullOrEmpty(config_value))
{ {
ServerIP = config_value.Replace("config_value=", ""); ServerIP = config_value.Replace("config_value=", "");
Debug.Log("启动参数服务器:" + ServerIP); Debug.Log("启动参数服务器:" + ServerIP);
} }
if (customCode == "3501") if (customCode == "3501")
{ {
customName = CustomName.; customName = CustomName.;
} }
else if (customCode == "3502" || customCode == "3505") else if (customCode == "3502" || customCode == "3505")
{ {
customName = CustomName.; customName = CustomName.;
} }
else if (customCode == "3503") else if (customCode == "3503")
{ {
customName = CustomName.; customName = CustomName.;
} }
else if (customCode == "3506") else if (customCode == "3506")
{ {
customName = CustomName.; customName = CustomName.;
} }
//加载第二个场景,即企业场景 //加载第二个场景,即企业场景
Debug.Log("准备加载Mainscene"); Debug.Log("准备加载Mainscene");
SceneManager.LoadScene(1); SceneManager.LoadScene(1);
} }
} }
/// <summary> /// <summary>
/// 关区 /// 关区
/// </summary> /// </summary>
public enum CustomName public enum CustomName
{ {
, ,
, ,
, ,
} }

View File

@ -12,7 +12,7 @@ public class Configure
{ {
public string MONITOR_ID { get; set; } public string MONITOR_ID { get; set; }
public Dictionary<string, string> DATA { get;set; } public Dictionary<string, string> DATA { get; set; }
} }
public class ApiManager : Singleton<ApiManager> public class ApiManager : Singleton<ApiManager>
@ -75,7 +75,6 @@ public class ApiManager : Singleton<ApiManager>
{ {
base.Awake(); base.Awake();
//var _ip_str_url = Path.Combine(Application.streamingAssetsPath, "configure.json"); //var _ip_str_url = Path.Combine(Application.streamingAssetsPath, "configure.json");
//StartCoroutine(RequestBase.Get(_ip_str_url, (_data, _error) => //StartCoroutine(RequestBase.Get(_ip_str_url, (_data, _error) =>
//{ //{
@ -107,7 +106,7 @@ public class ApiManager : Singleton<ApiManager>
{ {
if (_error != null) if (_error != null)
{ {
Debug.Log($"<color=#ff0000> {_error} </color>"); Debug.Log($"本地api配置错误<color=#ff0000> {_error} </color>");
} }
else else
{ {
@ -119,9 +118,9 @@ public class ApiManager : Singleton<ApiManager>
var _cam_dic_url = Path.Combine(Application.streamingAssetsPath, "configure_camera.json"); var _cam_dic_url = Path.Combine(Application.streamingAssetsPath, "configure_camera.json");
StartCoroutine(RequestBase.Get(_cam_dic_url, (_data, _error) => StartCoroutine(RequestBase.Get(_cam_dic_url, (_data, _error) =>
{ {
if (_error != null) if (_error != null)
{ {
Debug.Log($"<color=#ff0000> {_error} </color>"); Debug.Log($"本地camera配置错误<color=#ff0000> {_error} </color>");
} }
else else
{ {
@ -141,7 +140,7 @@ public class ApiManager : Singleton<ApiManager>
{ {
if (_error != null) if (_error != null)
{ {
Debug.Log($"<color=#ff0000> {_error} </color>"); Debug.Log($"本地yard配置错误<color=#ff0000> {_error} </color>");
} }
else else
{ {
@ -176,6 +175,7 @@ public class ApiManager : Singleton<ApiManager>
/// <returns></returns> /// <returns></returns>
IEnumerator GetCameraList() IEnumerator GetCameraList()
{ {
Debug.Log("相机接口等待执行");
yield return new WaitUntil(() => { return !string.IsNullOrEmpty(IpAddress) && ApiDic.Count > 0; }); yield return new WaitUntil(() => { return !string.IsNullOrEmpty(IpAddress) && ApiDic.Count > 0; });
var _get_camera_list = IpAddress + ApiDic["GetCameraList"]; var _get_camera_list = IpAddress + ApiDic["GetCameraList"];
@ -193,10 +193,11 @@ public class ApiManager : Singleton<ApiManager>
{ {
if (_error != null) if (_error != null)
{ {
Debug.Log($"<color=#ff0000> {_error} </color>"); Debug.Log($"相机接口错误:<color=#ff0000> {_error} </color>");
} }
else else
{ {
Debug.Log($"相机数据:{_data}");
T_BAS_CAMERA_List = JsonConvert.DeserializeObject<DataBase<List<T_BAS_CAMERA>>>(_data).data; T_BAS_CAMERA_List = JsonConvert.DeserializeObject<DataBase<List<T_BAS_CAMERA>>>(_data).data;
} }
})); }));
@ -210,6 +211,7 @@ public class ApiManager : Singleton<ApiManager>
/// <returns></returns> /// <returns></returns>
IEnumerator GetYardInformation() IEnumerator GetYardInformation()
{ {
Debug.Log("堆场接口等待执行");
yield return new WaitUntil(() => { return !string.IsNullOrEmpty(IpAddress) && ApiDic.Count > 0; }); yield return new WaitUntil(() => { return !string.IsNullOrEmpty(IpAddress) && ApiDic.Count > 0; });
var _get_yard_information = IpAddress + ApiDic["GetYardList"]; var _get_yard_information = IpAddress + ApiDic["GetYardList"];
@ -228,10 +230,11 @@ public class ApiManager : Singleton<ApiManager>
{ {
if (_error != null) if (_error != null)
{ {
Debug.Log($"<color=#ff0000> {_error} </color>"); Debug.Log($"堆场接口错误:<color=#ff0000> {_error} </color>");
} }
else else
{ {
Debug.Log($"堆场数据:{_data}");
T_BAS_YARD_List = JsonConvert.DeserializeObject<DataBase<List<T_BAS_YARD>>>(_data).data; T_BAS_YARD_List = JsonConvert.DeserializeObject<DataBase<List<T_BAS_YARD>>>(_data).data;
} }
})); }));
@ -250,11 +253,11 @@ public class ApiManager : Singleton<ApiManager>
{ {
if (_error != null) if (_error != null)
{ {
Debug.Log($"堆场库存信息接口错误:<color=#ff0000> {_error} </color>");
} }
else else
{ {
Debug.Log(_data); Debug.Log("堆场库存信息数据:" + _data);
var _t_object = JsonConvert.DeserializeObject<DataBase<List<T>>>(_data).data; var _t_object = JsonConvert.DeserializeObject<DataBase<List<T>>>(_data).data;
_callback?.Invoke(_t_object); _callback?.Invoke(_t_object);
} }
@ -270,9 +273,9 @@ public class ApiManager : Singleton<ApiManager>
/// <returns></returns> /// <returns></returns>
IEnumerator GetBeltScale() IEnumerator GetBeltScale()
{ {
Debug.Log("计量秤接口等待执行");
yield return new WaitUntil(() => { return !string.IsNullOrEmpty(IpAddress) && ApiDic.Count > 0; }); yield return new WaitUntil(() => { return !string.IsNullOrEmpty(IpAddress) && ApiDic.Count > 0; });
var _get_belt_scale = IpAddress + ApiDic["GetWeighterList"]; var _get_belt_scale = IpAddress + ApiDic["GetWeighterList"];
#if UNITY_EDITOR #if UNITY_EDITOR
if (CallForTest.instance != null) if (CallForTest.instance != null)
{ {
@ -288,10 +291,11 @@ public class ApiManager : Singleton<ApiManager>
{ {
if (_error != null) if (_error != null)
{ {
Debug.Log($"<color=#ff0000> {_error} </color>"); Debug.Log($"计量秤接口错误:<color=#ff0000> {_error} </color>");
} }
else else
{ {
Debug.Log($"皮带秤数据:{_data}");
T_BAS_ELEC_WEIGHTER_List = JsonConvert.DeserializeObject<DataBase<List<T_BAS_ELEC_WEIGHTER>>>(_data).data; T_BAS_ELEC_WEIGHTER_List = JsonConvert.DeserializeObject<DataBase<List<T_BAS_ELEC_WEIGHTER>>>(_data).data;
} }
})); }));
@ -313,11 +317,11 @@ public class ApiManager : Singleton<ApiManager>
{ {
if (_error != null) if (_error != null)
{ {
Debug.Log($"计量秤实时接口错误:<color=#ff0000> {_error} </color>");
} }
else else
{ {
Debug.Log(_data); Debug.Log("皮带秤实时数据:" + _data);
var _t_object = JsonConvert.DeserializeObject<DataBase<T>>(_data).data; var _t_object = JsonConvert.DeserializeObject<DataBase<T>>(_data).data;
_callback?.Invoke(_t_object); _callback?.Invoke(_t_object);
} }
@ -355,11 +359,11 @@ public class ApiManager : Singleton<ApiManager>
{ {
if (_error != null) if (_error != null)
{ {
Debug.Log($"计量秤历史接口错误:<color=#ff0000> {_error} </color>");
} }
else else
{ {
Debug.Log(_data); Debug.Log("计量秤历史数据:" + _data);
var _t_object = JsonConvert.DeserializeObject<DataBase<List<T>>>(_data).data; var _t_object = JsonConvert.DeserializeObject<DataBase<List<T>>>(_data).data;
_callback?.Invoke(_t_object); _callback?.Invoke(_t_object);
} }
@ -380,10 +384,11 @@ public class ApiManager : Singleton<ApiManager>
{ {
if (_error != null) if (_error != null)
{ {
Debug.Log($"所有计量秤接口错误:<color=#ff0000> {_error} </color>");
} }
else else
{ {
Debug.Log("所有计量秤实时数据:" + _data);
m_OnRtBeltUpdate?.Invoke(_data); m_OnRtBeltUpdate?.Invoke(_data);
} }
})); }));
@ -402,10 +407,11 @@ public class ApiManager : Singleton<ApiManager>
{ {
if (_error != null) if (_error != null)
{ {
Debug.Log($"堆场最新库存接口错误:<color=#ff0000> {_error} </color>");
} }
else else
{ {
Debug.Log("堆场最新库存数据:" + _data);
m_OnYardLastUpdate?.Invoke(_data); m_OnYardLastUpdate?.Invoke(_data);
} }
})); }));
@ -433,11 +439,11 @@ public class ApiManager : Singleton<ApiManager>
{ {
if (_error != null) if (_error != null)
{ {
Debug.Log($"模糊查询接口错误:<color=#ff0000> {_error} </color>");
} }
else else
{ {
Debug.Log(_data); Debug.Log("模糊查询数据:" + _data);
var _t_object = JsonConvert.DeserializeObject<DataBase<List<T>>>(_data).data; var _t_object = JsonConvert.DeserializeObject<DataBase<List<T>>>(_data).data;
_callback?.Invoke(_t_object); _callback?.Invoke(_t_object);
} }