添加项目文件。

This commit is contained in:
2026-03-16 10:36:47 +08:00
parent aa2e0d4a45
commit 54b11c9c84
309 changed files with 41803 additions and 0 deletions

View File

@@ -0,0 +1,190 @@
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using GroupLine.Com;
using GroupLine.Model;
using NLog;
using System;
using System.Linq;
namespace GroupLine.App.ViewModel
{
public class ReportTimeConfigViewModel : ViewModelBase
{
//日志的实例化
private static Logger _Logger = LogManager.GetCurrentClassLogger();
/// <summary>
/// 当前程序的位置
/// </summary>
private string Location;
private string CurrentRegion = "前组";
private string CurrentCategory = "报表信息";
private string CurrentReportTimeName = "导出时间";
//private string CurrentMachineNameTemplate = "H_RobotHandTemplate.xlsx";
public delegate void PubReportTime(string ReportInfo);
public static event PubReportTime PubReportTimeEvent;
//private IMapper autoMapper;
/// <summary>
/// 实例化函数
/// </summary>
public ReportTimeConfigViewModel()
{
//SearchStartDate = DateTime.Now.AddDays(-1).ToShortDateString();
//SearchEndDate = DateTime.Now.AddDays(10).ToShortDateString();
Location = ConfigHelper.GetValue("Location");
if (Location == "1")
{
CurrentRegion = "前组";
}
else
{
CurrentRegion = "后组";
}
//var config = new MapperConfiguration(cfg => cfg.CreateMap<H_RobotHand, H_RobotHandDto>());
//autoMapper = config.CreateMapper();
var ConfigInfo = FSqlContext.FDb.Select<SystemConfig>().Where(a => a.Region == CurrentRegion && a.Category == CurrentCategory && a.Name == CurrentReportTimeName).ToList();
if (ConfigInfo != null && ConfigInfo.Count() > 0)
{
DayReportTime = ConfigInfo.FirstOrDefault().Value;
}
else
{
DayReportTime = "";
}
}
///// <summary>
///// 列表集合
///// </summary>
//private ObservableCollection<H_RobotHandDto> _ListH_RobotHandDto;
///// <summary>
///// 列表集合
///// </summary>
//public ObservableCollection<H_RobotHandDto> ListH_RobotHandDto
//{
// get { return _ListH_RobotHandDto; }
// set { _ListH_RobotHandDto = value; }
//}
#region "属性"
/// <summary>
/// 每日导出时间
/// </summary>
private string dayReportTime;
public string DayReportTime
{
get { return dayReportTime; }
set { dayReportTime = value; RaisePropertyChanged(() => DayReportTime); }
}
/// <summary>
/// 搜索条件-开始时间
/// </summary>
private string searchStartDate;
public string SearchStartDate
{
get
{
return searchStartDate;
}
set
{
searchStartDate = value;
RaisePropertyChanged(() => SearchStartDate);
}
}
/// <summary>
/// 搜索条件-结束时间
/// </summary>
private string searchEndDate;
public string SearchEndDate
{
get
{
return searchEndDate;
}
set
{
searchEndDate = value;
RaisePropertyChanged(() => SearchEndDate);
}
}
#endregion
#region "搜索命令"
/// <summary>
/// 搜索命令
/// </summary>
private RelayCommand saveCmd;
public RelayCommand SaveCmd
{
get
{
if (saveCmd == null) return new RelayCommand(() => Save());
return saveCmd;
}
set
{
saveCmd = value;
}
}
private void Save()
{
try
{
//发布报表信息
PubReportTimeEvent(DayReportTime);
var ReportConfig = FSqlContext.FDb.Select<SystemConfig>().Where(a => a.Region == CurrentRegion && a.Category == CurrentCategory && a.Name == "导出时间").OrderByDescending(a => a.CreateTime).ToList();
if (ReportConfig != null && ReportConfig.Count > 0)
{
FSqlContext.FDb.Update<SystemConfig>(ReportConfig.FirstOrDefault().Id)
//.Set(a => a.CreateTime, DateTime.Now)// FreeSQL会自动更新时间
.Set(a => a.Value, DayReportTime)
.ExecuteAffrows();
}
else
{
FSqlContext.FDb.Insert<SystemConfig>(new SystemConfig()
{
Region = CurrentRegion,
Category = CurrentCategory,
Name = CurrentReportTimeName,
Value = DayReportTime,
}).ExecuteAffrows();
}
}
catch (Exception ex)
{
_Logger.Error(String.Format("ErrSource : {0} ErrMsg : {1}", ex.StackTrace.ToString(), ex.Message.ToString()));
}
}
#endregion
#region "导出数据"
//OutputDataCmd
#endregion
}
}