You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.1 KiB
C#

2 years ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Khd.Core.Application.Interface;
using Khd.Core.Domain.Dto.webapi;
using Khd.Core.Domain.Models;
using Khd.Core.EntityFramework;
using Masuit.Tools;
using Masuit.Tools.Logging;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.Extensions.DependencyInjection;
using Z.EntityFramework.Plus;
namespace Khd.Core.Application
{
public class WcsTaskApplication : IWcsTaskApplication
{
private readonly DefaultDbContext _dbContext;
public WcsTaskApplication(IServiceProvider serviceProvider)
{
_dbContext = serviceProvider.GetService<DefaultDbContext>();
}
public WcsTask Get(int id)
{
var entity = _dbContext.WcsTask
.Where(c => 1== 1)
.FirstOrDefault();
return entity;
}
public WcsTask Add(WcsTask model)
{
var entity = _dbContext.Add(model);
_dbContext.SaveChanges();
return entity.Entity;
}
public WcsTask Update(WcsTask model)
{
var list = _dbContext.WcsTask.Where(t => t.objid == model.objid).Update(a => model);
return model;
}
/// <summary>
/// 接收agv接收任务通知接口
/// </summary>
/// <param name="agvCallbackDto"></param>
/// <returns></returns>
public ReponseagvCallbackDto AgvCallback(agvCallbackDto agvCallbackDto)
{
ReponseagvCallbackDto reponseagvCallbackDto = new ReponseagvCallbackDto();
//记录日志
LogManager.Info("AgvCallback入参:"+ agvCallbackDto.ToJsonString());
//处理逻辑
//返回请求
reponseagvCallbackDto.code = "0";
reponseagvCallbackDto.message = "成功";
reponseagvCallbackDto.reqCode = reponseagvCallbackDto.reqCode;
return reponseagvCallbackDto;
}
}
}