BiDecisionOhterService.cs
4.12 KB
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
using Hh.Mes.Common.log;
using Hh.Mes.POJO.Entity;
using Hh.Mes.POJO.Response;
using Hh.Mes.Service.Repository;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Hh.Mes.Service
{
public partial class BiDecisionService : RepositorySqlSugar<sys_user>
{
/// <summary>
/// 供应商列表
/// </summary>
public dynamic GetSuppliersInfo()
{
var response = new Response();
return ExceptionsHelp.Instance.ExecuteT(() =>
{
var options = new List<dynamic>
{
new { value = "00000000-0000-0000-0000-000000000000", label = "全部" }
};
var list = base.Context.Queryable<base_project_client_info>().Select(x => new
{
value = x.keys,
label = x.clientName
}).ToList();
var finalList = options.Concat(list).ToList();
response.Result = finalList;
response.Count = finalList.Count;
return response;
}, catchRetrunValue: "GetSuppliersInfo");
}
/// <summary>
/// 供应商对应的项目
/// </summary>
public dynamic GeteProjectInfoByClientInfoKeys(Guid clientInfoKeys)
{
var response = new Response();
return ExceptionsHelp.Instance.ExecuteT(() =>
{
var expression = Expressionable.Create<base_project>()
.AndIF(clientInfoKeys != Guid.Empty, (x) => x.projectClientInfoKeys == clientInfoKeys)
.ToExpression();
var list = base.Context.Queryable<base_project>()
.Where(expression)
.Select(x => new
{
value = x.projectCode,
label = x.projectName
}).ToList();
response.Result = list;
response.Count = list.Count;
return response;
}, catchRetrunValue: "list");
}
/// <summary>
/// 时间公告方法
/// </summary>
/// <param name="inputDate">输入时间 格式:年月日 2025-06-01</param>
/// <param name="monthStart">月开始</param>
/// <param name="monthEnd">月结束</param>
/// <param name="monthStart90">月开始减去90</param>
/// <param name="monthEnd90">月结束减去90</param>
/// <param name="monthStart7">月开始减去7</param>
/// <param name="monthEnd7">月结束减去7</param>
public void CalculateDateRanges(DateTime inputDate, out DateTime monthStart7, out DateTime monthEnd7, out DateTime monthStart, out DateTime monthEnd,
out DateTime monthStart90, out DateTime monthEnd90)
{
DateTime now = DateTime.Now;
// 计算本月起始时间(当月第一天00:00:00)
monthStart = new DateTime(inputDate.Year, inputDate.Month, 1, 0, 0, 0);
// 本月
if (inputDate.Year == now.Year && inputDate.Month == now.Month)
{
// 当前月结束
monthEnd = new DateTime(inputDate.Year, inputDate.Month, inputDate.Day, 23, 59, 59);
}
else
{
//月结束
DateTime nextMonth = monthStart.AddMonths(1);
monthEnd = nextMonth.AddDays(-1).AddHours(23).AddMinutes(59).AddSeconds(59);
}
// 计算90天前的日期
monthStart90 = inputDate.AddMonths(-3).AddHours(0).AddMinutes(0).AddSeconds(0);
monthEnd90 = inputDate.AddHours(23).AddMinutes(59).AddSeconds(59);
// 计算7天前的日期
monthStart7 = inputDate.AddDays(-6).AddHours(0).AddMinutes(0).AddSeconds(0);
monthEnd7 = inputDate.AddHours(23).AddMinutes(59).AddSeconds(59);
}
}
}