agv配料
This commit is contained in:
@@ -4,6 +4,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model;
|
||||
using ZR.Model.MES.mm;
|
||||
using ZR.Model.MES.mm.Dto;
|
||||
using ZR.Model.MES.pro;
|
||||
|
||||
@@ -17,5 +19,15 @@ namespace ZR.Service.mes.mm.IService
|
||||
List<ProWorkorder_v2> Getworkorderlist(DateTime datetimespan);
|
||||
int Generatetask(IngredientTaskDto task,string name);
|
||||
|
||||
|
||||
List<MmIngredientTask> GetIngredientTask(IngredientTaskQueryDto queryParams);
|
||||
|
||||
List<MmIngredientTask> GetIngredientTaskSon(string taskId);
|
||||
|
||||
string[] Getfabgopoints();
|
||||
|
||||
string AGV_schedule(string start_point, string end_point);
|
||||
string EmergencyStopAgv(string reqCode);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,10 @@ using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
using ZR.Model.MES.mm.Dto;
|
||||
using SqlSugar;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using ZR.Model;
|
||||
using ZR.Model.MES.wms;
|
||||
using System.Text.Json;
|
||||
using Infrastructure;
|
||||
|
||||
namespace ZR.Service.mes.mm
|
||||
{
|
||||
@@ -153,7 +157,7 @@ namespace ZR.Service.mes.mm
|
||||
|
||||
MmIngredientTask ingredientTask = new MmIngredientTask();
|
||||
ingredientTask.AgvPosition = task.agv_position;
|
||||
ingredientTask.TaskId = taskid;
|
||||
ingredientTask.TaskId = taskid.ToString();
|
||||
ingredientTask.Workorder = item.workorder;
|
||||
ingredientTask.Partnumber = item.partnumber;
|
||||
ingredientTask.PreviousNumber = item.previousNumber;
|
||||
@@ -171,6 +175,116 @@ namespace ZR.Service.mes.mm
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取配料任务
|
||||
/// </summary>
|
||||
/// <param name="queryParams"></param>
|
||||
/// <returns></returns>
|
||||
public List<MmIngredientTask> GetIngredientTask(IngredientTaskQueryDto queryParams)
|
||||
{
|
||||
// 获取当天的开始时间
|
||||
DateTime startOfDay = queryParams.datetimespan.Date;
|
||||
// 获取当天的结束时间
|
||||
DateTime endOfDay = startOfDay.AddDays(1).AddTicks(-1);
|
||||
return Context.Queryable<MmIngredientTask>()
|
||||
.Where(it => it.CreatedTime > startOfDay && it.CreatedTime < endOfDay)
|
||||
.GroupBy(it => it.TaskId)
|
||||
.Select(it => new MmIngredientTask()
|
||||
{
|
||||
TaskId = it.TaskId,
|
||||
AgvPosition = SqlFunc.AggregateMax(it.AgvPosition),
|
||||
CreatedTime = SqlFunc.AggregateMax(it.CreatedTime)
|
||||
})
|
||||
.ToList();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取配料任务(son) 详细情况
|
||||
/// </summary>
|
||||
/// <param name="taskId"></param>
|
||||
/// <returns></returns>
|
||||
public List<MmIngredientTask> GetIngredientTaskSon(string taskId)
|
||||
{
|
||||
return Context.Queryable<MmIngredientTask>().Where(it => it.TaskId == taskId).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取车间上料终点
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string[] Getfabgopoints()
|
||||
{
|
||||
return Context.Queryable<MmAgvLocation>().Where(it => it.AreaCode == 3).Where(it => it.Status == 0)
|
||||
.Select(it => it.Coordinate).ToArray();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// agv从仓库到车间 进料
|
||||
/// </summary>
|
||||
/// <param name="start_point"></param>
|
||||
/// <param name="end_point"></param>
|
||||
/// <returns></returns>
|
||||
public string AGV_schedule(string start_point, string end_point)
|
||||
{
|
||||
string url = "https://192.168.60.1:443/rcms/services/rest/hikRpcService/genAgvSchedulingTask";
|
||||
AGVtask_third task = new AGVtask_third();
|
||||
task.reqCode = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
task.taskTyp = "F01";
|
||||
task.positionCodePath = new List<AGV_location_third>
|
||||
{
|
||||
new AGV_location_third()
|
||||
{
|
||||
positionCode=start_point,
|
||||
type="00"
|
||||
|
||||
},
|
||||
new AGV_location_third()
|
||||
{
|
||||
positionCode=end_point,
|
||||
type="00"
|
||||
|
||||
}
|
||||
};
|
||||
task.podDir = "0";
|
||||
task.priority = "1";
|
||||
|
||||
string postData = JsonSerializer.Serialize(task);
|
||||
string response = HttpHelper.HttpPost(url, postData);
|
||||
|
||||
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 紧急终止AGV
|
||||
/// </summary>
|
||||
/// <param name="reqCode"></param>
|
||||
public string EmergencyStopAgv(string reqCode)
|
||||
{
|
||||
string url = "https://192.168.60.1:443/rcms/services/rest/hikRpcService/cancelTask";
|
||||
AGVtask_cancel_third req = new AGVtask_cancel_third();
|
||||
req.reqCode = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
req.forceCancel = "0";
|
||||
req.taskCode = reqCode;
|
||||
string postData = JsonSerializer.Serialize(req);
|
||||
|
||||
|
||||
|
||||
|
||||
string response = HttpHelper.HttpPost(url, postData);
|
||||
|
||||
return response;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZR.Service.mes.mm
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[SugarTable("mm_fk_workorder_ingredient")]
|
||||
public class MmFkWorkorderIngredient
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工单号
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_workorder")]
|
||||
public string FkWorkorder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否完成配料
|
||||
/// </summary>
|
||||
public int? Isingredient { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 剩余的待上件数量
|
||||
/// </summary>
|
||||
public int? Remian { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// CreatedBy
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "cREATED_BY")]
|
||||
public string CreatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// CreatedTime
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "cREATED_TIME")]
|
||||
public DateTime? CreatedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// UpdatedBy
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "uPDATED_BY")]
|
||||
public string UpdatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// UpdatedTime
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "uPDATED_TIME")]
|
||||
public DateTime? UpdatedTime { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user