69 lines
2.4 KiB
C#
69 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using WCS.BLL.DbModels;
|
|
using WCS.BLL.Tool;
|
|
using WCS.DAL.Db;
|
|
using WCS.DAL.DbModels;
|
|
|
|
namespace WCS.BLL.Manager
|
|
{
|
|
//AGV动作相关
|
|
public static class AGVManager
|
|
{
|
|
public static object lockFlag = new object();
|
|
/// <summary>
|
|
/// 产生AGV点到点搬运任务
|
|
/// </summary>
|
|
public static AGVResponseModel GenAgvSchedulingTask(LocationInfo startLocation, LocationInfo endLocation, string shelfCode, string createUser)
|
|
{
|
|
var url = @"http://192.168.18.150:8181/rcms/services/rest/hikRpcService/genAgvSchedulingTask";
|
|
var startPositionCodePathItem = new PositionCodePathItem()
|
|
{
|
|
positionCode = startLocation.RcsStoreCode,
|
|
};
|
|
var endPositionCodePathItem = new PositionCodePathItem()
|
|
{
|
|
positionCode = endLocation.RcsStoreCode,
|
|
};
|
|
List<PositionCodePathItem> positionCodePathItems = new List<PositionCodePathItem>();
|
|
|
|
positionCodePathItems.Add(startPositionCodePathItem);
|
|
positionCodePathItems.Add((endPositionCodePathItem));
|
|
|
|
//任务只允许一个一个发送
|
|
lock (lockFlag)
|
|
{
|
|
var body = new AGVRequestModel()
|
|
{
|
|
positionCodePath = positionCodePathItems,
|
|
};
|
|
|
|
var response = ApiHelp.GetDataFromHttp<AGVResponseModel>(url, body, "POST", true);
|
|
if (response.code == "0" && response.message == "成功")
|
|
{
|
|
//生成任务数据
|
|
var task = new AgvTask()
|
|
{
|
|
ShelfCode = shelfCode,
|
|
RequestCode = body.reqCode,
|
|
TaskCode = body.taskCode,
|
|
TaskType = "GenAgvSchedulingTask",
|
|
StratLocationId = startLocation.Id,
|
|
StartLocationCode = startLocation.LocationCode,
|
|
EndLocationId = endLocation.Id,
|
|
EndLocationCode = endLocation.LocationCode,
|
|
CreateUser = createUser
|
|
};
|
|
DbHelp.db.Insertable(task).ExecuteCommand();
|
|
}
|
|
|
|
return response;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|