|
@@ -11,6 +11,7 @@ using System.Threading.Tasks;
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
using SAGA.DotNetUtils.Http;
|
|
|
using SAGA.MBI.Common;
|
|
|
+using SAGA.MBI.DataArrange;
|
|
|
using SAGA.MBI.Model;
|
|
|
using SAGA.MBI.Tools;
|
|
|
|
|
@@ -30,17 +31,16 @@ namespace SAGA.MBI.RequestData
|
|
|
/// <returns></returns>
|
|
|
public static string AddEquipmentPart(string floorid,string equipId, string category, JObject infos)
|
|
|
{
|
|
|
- string url = MBIConst.GoodHandLocalHost + $"component/create?secret={MBIControl.ProjectCur.Password}&projectId={MBIControl.ProjectCur.Id}";
|
|
|
-
|
|
|
- JObject idJObject = new JObject();
|
|
|
- idJObject.Add("floor_id", floorid);
|
|
|
- idJObject.Add("equip_id", equipId);
|
|
|
- idJObject.Add("component_category", category);
|
|
|
- idJObject.Add("infos", infos);
|
|
|
-
|
|
|
- string postData = idJObject.ToString();
|
|
|
- RestClient client = new RestClient(url, HttpVerb.POST, postData);
|
|
|
- string request = client.PostRequest();
|
|
|
+ var addJArray = new JArray();
|
|
|
+ JObject addJObject = new JObject();
|
|
|
+ addJObject.Add("building_id", DalProjectTree.GetBuildingIdByFloor(floorid));
|
|
|
+ addJObject.Add("floor_id", floorid);
|
|
|
+ addJObject.Add("equip_id", equipId);
|
|
|
+ addJObject.Add("component_category", category);
|
|
|
+ addJObject.Add("infos", infos);
|
|
|
+ addJArray.Add(addJObject);
|
|
|
+
|
|
|
+ string request = EquipmentPartRequest.BatchAdd(addJArray);
|
|
|
return request;
|
|
|
}
|
|
|
|
|
@@ -63,5 +63,24 @@ namespace SAGA.MBI.RequestData
|
|
|
string request = client.PostRequest();
|
|
|
return request;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 批量增加设备
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="criterias"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static string BatchAdd(JArray criterias)
|
|
|
+ {
|
|
|
+ string url = MBIConst.DataPlatformLocalHost + $"data-platform-3/component/batch/create?secret={MBIControl.ProjectCur.Password}&projectId={MBIControl.ProjectCur.Id}";
|
|
|
+
|
|
|
+ JObject updateJObject = new JObject();
|
|
|
+ updateJObject.Add("criterias", criterias);
|
|
|
+
|
|
|
+ string postData = updateJObject.ToString();
|
|
|
+ RestClient client = new RestClient(url, HttpVerb.POST, postData);
|
|
|
+ string request = client.PostRequest();
|
|
|
+ return request;
|
|
|
+ }
|
|
|
}
|
|
|
}
|