122
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ZR.Model.MES.mm.Dto;
|
||||
using ZR.Service.mes.mm;
|
||||
using ZR.Service.mes.mm.IService;
|
||||
|
||||
namespace ZR.Admin.WebApi.Controllers.mes.mm
|
||||
{
|
||||
/// <summary>
|
||||
/// 生产投料
|
||||
/// </summary>
|
||||
[Route("mes/mm/materialinput")]
|
||||
|
||||
public class MaterialInputController : BaseController
|
||||
{
|
||||
|
||||
IMaterialInputService materialInputService;
|
||||
|
||||
public MaterialInputController(IMaterialInputService materialInputService)
|
||||
{
|
||||
this.materialInputService = materialInputService;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取AGV 上料 开始起点
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getstartpoints")]
|
||||
public IActionResult Getstart_AGV_points()
|
||||
{
|
||||
var response = materialInputService.Getstart_AGV_points();
|
||||
return SUCCESS(response);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取AGV 上料 终点
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getendpoints")]
|
||||
public IActionResult Getend_AGV_points()
|
||||
{
|
||||
var response = materialInputService.Getend_AGV_points();
|
||||
return SUCCESS(response);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取工单list
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("getworkorderlist")]
|
||||
public IActionResult Getworkorderlist([FromBody] WorkorderqueryDto query)
|
||||
{
|
||||
if(query == null|| query.datetimespan==null)
|
||||
{
|
||||
SUCCESS(null);
|
||||
}
|
||||
var response = materialInputService.Getworkorderlist(query.datetimespan);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
69
ZR.Model/MES/mm/AgvLocation.cs
Normal file
69
ZR.Model/MES/mm/AgvLocation.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using SqlSugar;
|
||||
|
||||
namespace ZR.Model.MES.mm
|
||||
{
|
||||
/// <summary>
|
||||
/// agv位置表
|
||||
/// </summary>
|
||||
[SugarTable("agv_location")]
|
||||
public class AgvLocation
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 区域
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "area_code")]
|
||||
public int? AreaCode { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 区域
|
||||
/// </summary>
|
||||
public string Area { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型(0: 起点,1:终点)
|
||||
/// </summary>
|
||||
public int? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 坐标
|
||||
/// </summary>
|
||||
public string Coordinate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "cREATED_BY")]
|
||||
public string CreatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "cREATED_TIME")]
|
||||
public DateTime? CreatedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "uPDATED_BY")]
|
||||
public string UpdatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "uPDATED_TIME")]
|
||||
public DateTime? UpdatedTime { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
13
ZR.Model/MES/mm/Dto/WorkorderqueryDto.cs
Normal file
13
ZR.Model/MES/mm/Dto/WorkorderqueryDto.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZR.Model.MES.mm.Dto
|
||||
{
|
||||
public class WorkorderqueryDto
|
||||
{
|
||||
public DateTime datetimespan { set; get; }
|
||||
}
|
||||
}
|
||||
18
ZR.Service/mes/mm/IService/IMaterialInputService.cs
Normal file
18
ZR.Service/mes/mm/IService/IMaterialInputService.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.MES.pro;
|
||||
|
||||
namespace ZR.Service.mes.mm.IService
|
||||
{
|
||||
public interface IMaterialInputService
|
||||
{
|
||||
string[] Getstart_AGV_points();
|
||||
string[] Getend_AGV_points();
|
||||
|
||||
List<ProWorkorder_v2> Getworkorderlist(DateTime datetimespan);
|
||||
|
||||
}
|
||||
}
|
||||
94
ZR.Service/mes/mm/MaterialInputService.cs
Normal file
94
ZR.Service/mes/mm/MaterialInputService.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.MES.op.ZR.Model.mes.md;
|
||||
using ZR.Service.MES.op.IService;
|
||||
using ZR.Service;
|
||||
using ZR.Service.mes.mm.IService;
|
||||
|
||||
using ZR.Model.MES.mm;
|
||||
using ZR.Model.MES.pro;
|
||||
using System.Globalization;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace ZR.Service.mes.mm
|
||||
{
|
||||
[AppService(ServiceType = typeof(IMaterialInputService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class MaterialInputService : BaseService<AgvLocation>, IMaterialInputService
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取AGV上料起点
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string[] Getstart_AGV_points()
|
||||
{
|
||||
List<AgvLocation> positions = Context.Queryable<AgvLocation>()
|
||||
.Where(it => it.AreaCode == 2)
|
||||
.Where(it => it.Type == 0)
|
||||
.ToList();
|
||||
|
||||
string[] cors = new string[positions.Count];
|
||||
for (int i = 0; i < positions.Count; i++) cors[i] = positions[i].Coordinate.ToString();
|
||||
|
||||
return cors;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取AGV上料终点
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string[] Getend_AGV_points()
|
||||
{
|
||||
List<AgvLocation> positions = Context.Queryable<AgvLocation>()
|
||||
.Where(it => it.AreaCode == 2)
|
||||
.Where(it => it.Type == 1)
|
||||
.ToList();
|
||||
|
||||
string[] cors = new string[positions.Count];
|
||||
for (int i = 0; i < positions.Count; i++) cors[i] = positions[i].Coordinate.ToString();
|
||||
|
||||
return cors;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取工单列表
|
||||
/// </summary>
|
||||
/// <param name="datetimespan"></param>
|
||||
/// <returns></returns>
|
||||
public List<ProWorkorder_v2> Getworkorderlist(DateTime datetimespan)
|
||||
{
|
||||
|
||||
// 获取年份和周数
|
||||
Calendar calendar = new GregorianCalendar();
|
||||
int year = calendar.GetYear(datetimespan);
|
||||
int week = calendar.GetWeekOfYear(datetimespan, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Sunday);
|
||||
|
||||
// 获取这一周中的第几天
|
||||
DayOfWeek dayOfWeek = datetimespan.DayOfWeek;
|
||||
int dayOfWeekNumber = (int)dayOfWeek + 1; // 将 DayOfWeek 枚举转换为从 1 开始的数字
|
||||
|
||||
Console.WriteLine($"日期:{datetimespan}");
|
||||
Console.WriteLine($"年份:{year}");
|
||||
Console.WriteLine($"周数:{week}");
|
||||
Console.WriteLine($"这一周中的第几天:{dayOfWeekNumber}");
|
||||
|
||||
List<ProWorkorder_v2> WorkorderList = Context.Queryable<ProWorkorder_v2>()
|
||||
.Where(it => it.Year == year)
|
||||
.Where(it => it.Week == week)
|
||||
.Where(it => it.Date == dayOfWeekNumber)
|
||||
.Where(it=>it.Remark3=="是")
|
||||
.ToList();
|
||||
|
||||
|
||||
return WorkorderList;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user