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, IMaterialInputService { /// /// 获取AGV上料起点 /// /// public string[] Getstart_AGV_points() { List positions = Context.Queryable() .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; } /// /// 获取AGV上料终点 /// /// public string[] Getend_AGV_points() { List positions = Context.Queryable() .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; } /// /// 获取工单列表 /// /// /// public List 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 WorkorderList = Context.Queryable() .Where(it => it.Year == year) .Where(it => it.Week == week) .Where(it => it.Date == dayOfWeekNumber) .Where(it=>it.Remark3=="是") .ToList(); return WorkorderList; } } }