12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using Blue;
- using LitJson;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- using UnityEngine;
- public class InspectionService : IInspectionService
- {
- public InspectionInfo InspectionInfo { get; private set; }
- public void OnInit()
- {
- }
- public void Get()
- {
- CoroutineSystem.Instance.StartCoroutine(
- HttpTool.Instance.SendHttp(HttpActionLang.inspection_begin, "", message =>
- {
- JObject jobject = JObject.Parse(message);
- if (jobject["code"].ToString() == "200" && !string.IsNullOrWhiteSpace(jobject["data"].ToString()))
- {
- Debug.LogError("data:" + jobject["data"].ToString());
- InspectionInfo = JsonConvert.DeserializeObject<InspectionInfo>(jobject["data"].ToString());
- /*
- Debug.LogError($"ID:{InspectionInfo.id}");
- foreach (var item in InspectionInfo.items)
- {
- Debug.LogError($"key:{item.Key},Value:{item.Value}");
- }
- Debug.LogError($"Steps:{InspectionInfo.steps.Count}");
- foreach (var item in InspectionInfo.steps)
- {
- Debug.LogError($"key:{item.Key}");
- Debug.LogError($"normal:{item.Value.normal}");
- Debug.LogError($"lable:{item.Value.label}");
- Debug.LogError($"images:{item.Value.images}");
- }
- */
- }
- }));
- }
- /// <summary>
- /// 机房巡检步骤上报
- /// </summary>
- /// <param name="ItemID">检查项目的编号 1-12</param>
- /// <param name="Normal">是否正常</param>
- /// <param name="Outliers">标签</param>
- /// <param name="InspectionId">巡检编号,巡检开始时返回的id</param>
- /// <param name="ImageIds">图片文件ID 最多三个</param>
- public void Set(int ItemID, bool Normal, string Outliers, int InspectionId, string[] ImageIds)
- {
- InspectionStepSet mInspectionStepSet = new InspectionStepSet()
- {
- itemId = ItemID,
- normal = Normal,
- outliers = Outliers,
- inspectionId = InspectionId,
- imageIds = ImageIds
- };
- string JsonString = JsonConvert.SerializeObject(mInspectionStepSet);
- CoroutineSystem.Instance.StartCoroutine(HttpTool.Instance.SendHttp(HttpActionLang.inspection_step, JsonString, message =>
- {
- JObject jobject = JObject.Parse(message);
- if (jobject["code"].ToString() == "200" && !string.IsNullOrWhiteSpace(jobject["data"].ToString()))
- {
- //Debug.LogError($"Message:{message}+finished:{jobject["data"]["finished"]}");
- }
- }));
- }
- }
|