huangxiaoqiang
6 天以前 0e674f770d785bfd24b5034456c2502dcc6671d2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#region << 版 本 注 释 >>
/*----------------------------------------------------------------
 * 命名空间:WIDESEAWCS_TaskInfoService
 * 创建者:胡童庆
 * 创建时间:2024/8/2 16:13:36
 * 版本:V1.0.0
 * 描述:
 *
 * ----------------------------------------------------------------
 * 修改人:
 * 修改时间:
 * 版本:V1.0.1
 * 修改说明:
 * 
 *----------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
 
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using NetTaste;
using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Comm.Http;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseServices;
using WIDESEAWCS_Core.Enums;
using WIDESEAWCS_DTO.Enum;
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob.Service;
 
namespace WIDESEAWCS_TaskInfoService
{
    public class Task_HtyService : ServiceBase<Dt_Task_hty, ITask_HtyRepository>, ITask_HtyService
    {
        private readonly IRouterService _routerService;
        private readonly ITaskExecuteDetailService _taskExecuteDetailService;
        private readonly ITaskExecuteDetailRepository _taskExecuteDetailRepository;
        private readonly IMapper _mapper;
        public Task_HtyService(ITask_HtyRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper) : base(BaseDal)
        {
            _routerService = routerService;
            _taskExecuteDetailService = taskExecuteDetailService;
            _taskExecuteDetailRepository = taskExecuteDetailRepository;
            _mapper = mapper;
        }
        public WebResponseContent AddTaskHty(Dt_Task task)
        {
            WebResponseContent content = new WebResponseContent();
            Dt_Task_hty task_Hty = new Dt_Task_hty()
            {
                TaskNum = task.TaskNum,
                AGVName = task.AGVName,
                Roadway = task.Roadway,
                TaskType = task.TaskType,
                TaskState = task.TaskState,
                SourceAddress = task.SourceAddress,
                TargetAddress = task.TargetAddress,
                CurrentAddress = task.CurrentAddress,
                NextAddress = task.NextAddress,
                ExceptionMessage = task.ExceptionMessage,
                Grade = task.Grade,
                Creater = task.Creater,
                TaskId = task.TaskId,
                CreateDate = task.CreateDate,
                Dispatchertime = task.Dispatchertime,
                Remark = task.Remark,
                Modifier = task.Modifier,
                ModifyDate = DateTime.Now,
            };
            BaseDal.AddData(task_Hty);
            return content;
        }
 
        public static List<string> MaterialCuttingOutletList = new List<string>() { "B102", "B202" , "B402" , "A203" , "A403", "A603", "A803"};
        public static List<string> EdgeBandingCuttingOutletList = new List<string>() { "F20", "F21"};
        public static List<string> EdgeSandingCuttingOutletList = new List<string>() { "C13", "F14" };
        public static List<string> DrillingCuttingPositionList = new List<string>() { "Z13", "Z14" };
 
        #region  第四板块
        /// <summary>
        /// 5日内的出入库
        /// </summary>
        /// <returns></returns>
        public WebResponseContent fifteenTotal_quantityndex()
        {
            WebResponseContent content = new WebResponseContent();
            var startDate = DateTime.Today.AddDays(-5); 
            var today = DateTime.Today;
            var dateRange = Enumerable.Range(0, 5).Select(offset => today.AddDays(-offset)); 
 
            var data2 = BaseDal.QueryData(x => x.CreateDate >= startDate && x.CreateDate < today.AddDays(1)).ToList();
 
            var result = dateRange.Reverse().Select(date =>
            {
                // 统计板材下料口
                //var MaterialCuttingOutlet = data2.Where(x => x.CreateDate >= date && x.CreateDate < date.AddDays(1) && MaterialCuttingOutletList.Contains(x.SourceAddress)).Count();
                var MaterialCuttingOutlet = 50;
 
                // 统计封边下料口
                //var EdgeBandingCuttingOutlet = data2.Where(x => x.CreateDate >= date && x.CreateDate < date.AddDays(1) && EdgeBandingCuttingOutletList.Contains(x.SourceAddress)).Count();
                var EdgeBandingCuttingOutlet = 40;
 
                // 统计砂边下料口
                //var EdgeSandingCuttingOutlet = data2.Where(x => x.CreateDate >= date && x.CreateDate < date.AddDays(1) && EdgeSandingCuttingOutletList.Contains(x.SourceAddress)).Count();
                var EdgeSandingCuttingOutlet = 80;
 
                // 统计钻孔下料位
                //var DrillingCuttingPosition = data2.Where(x => x.CreateDate >= date && x.CreateDate < date.AddDays(1) && DrillingCuttingPositionList.Contains(x.SourceAddress)).Count();
                var DrillingCuttingPosition = 30;
 
                return new
                {
                    Date = date.ToString("MM-dd"),
                    MaterialCuttingOutlets = MaterialCuttingOutlet,
                    EdgeBandingCuttingOutlets = EdgeBandingCuttingOutlet,
                    EdgeSandingCuttingOutlets = EdgeSandingCuttingOutlet,
                    DrillingCuttingPositions = DrillingCuttingPosition,
                };
            });
 
            var datat = new
            {
                Daily_statistics = result.ToList(),
            };
            return content.OK(data: datat);
        }
        #endregion
 
 
        
    }
}