134 lines
4.1 KiB
C#
134 lines
4.1 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
|
||
namespace CapMachine.Core
|
||
{
|
||
/// <summary>
|
||
/// 产线规则帮助方法
|
||
/// </summary>
|
||
public class FileHelper
|
||
{
|
||
/// <summary>
|
||
/// 获取文件路径
|
||
/// </summary>
|
||
/// <param name="DcInfo"></param>
|
||
/// <returns></returns>
|
||
public static string GetFullFilePath(string FileRootPath, string DcInfo, string ExtInfo)
|
||
{
|
||
return $@"{FileRootPath}\{DateTime.Now.ToString("yyyy")}\{DcInfo}\{GetFileName(DcInfo)}{ExtInfo}.csv";
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取本地文件路径
|
||
/// </summary>
|
||
/// <param name="DcInfo"></param>
|
||
/// <returns></returns>
|
||
public static string GetLocalFullFilePath(string FileRootPath, string DcInfo, string ExtInfo)
|
||
{
|
||
return $@"{FileRootPath}\{DateTime.Now.ToString("yyyy")}\{DcInfo}\{GetFileName(DcInfo)}{ExtInfo}.csv";
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取文件路径
|
||
/// </summary>
|
||
/// <param name="DcInfo"></param>
|
||
/// <returns></returns>
|
||
public static string GetFilePath(string FileRootPath)
|
||
{
|
||
return $@"{FileRootPath}\{DateTime.Now.ToString("yyyy")}\";
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取试验工况文件路径
|
||
/// </summary>
|
||
/// <param name="DcInfo"></param>
|
||
/// <returns></returns>
|
||
public static string GetExpFilePath(string FileRootPath, string ExpName)
|
||
{
|
||
return $@"{FileRootPath}\{ExpName}";
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取CSV文件路径
|
||
/// 对于一个试验来说,如果时间很长的话,则一天一个CSV文件
|
||
/// </summary>
|
||
/// <param name="DcInfo"></param>
|
||
/// <returns></returns>
|
||
public static string GetCSVPath(string FileExpRootPath)
|
||
{
|
||
//return $@"{FileRootPath}\{DateTime.Now.ToString("yyyy")}\{DateTime.Now.ToString("MM-dd HHmm")}{workCond}.csv";
|
||
return $@"{FileExpRootPath}\{DateTime.Now.ToString("yyyy-MM-dd")}.csv";
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取CSV文件名称
|
||
/// </summary>
|
||
/// <param name="DcInfo"></param>
|
||
/// <returns></returns>
|
||
public static string GetFileName(string DcInfo)
|
||
{
|
||
return $"{DateTime.Now.ToString("yy")}{DcInfo}";
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取CSV文件名称
|
||
/// </summary>
|
||
/// <param name="DcInfo"></param>
|
||
/// <returns></returns>
|
||
public static string GetFileName(string DcInfo, string ExtInfo)
|
||
{
|
||
return $"{DateTime.Now.ToString("yy")}{DcInfo}{ExtInfo}.csv";
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取Title文件-在本地盘 F盘中
|
||
/// </summary>
|
||
/// <param name="Dcinfo"></param>
|
||
/// <returns></returns>
|
||
public static string GetTitlePath(string Dcinfo, string fileRootPath)
|
||
{
|
||
//return fileRootPath + @"\Title\Title" + Dcinfo + ".csv";
|
||
//return "F:" + @"\Title\Title" + Dcinfo + ".csv";
|
||
//return "D:" + @"\DCM\Title\Title" + Dcinfo + ".csv";
|
||
return "F:" + @"\Title\Title" + Dcinfo + ".csv";
|
||
}
|
||
|
||
///// <summary>
|
||
///// 获取UI显示名称信息
|
||
///// </summary>
|
||
///// <param name="DcInfo"></param>
|
||
///// <returns></returns>
|
||
//public static string GetUIShowInfo(int DataInof)
|
||
//{
|
||
// return $"{GetMonthInfo()} {GetDayInfo()}{GetClassInfo()}-{DataInof}";
|
||
//}
|
||
|
||
//public static int StartHour = 6;
|
||
//public static int EndHour = 18;
|
||
|
||
///// <summary>
|
||
///// 获取白班和夜班的信息
|
||
///// </summary>
|
||
///// <returns></returns>
|
||
//public static string GetClassInfo()
|
||
//{
|
||
// var NowTimeHour = DateTime.Now.Hour;
|
||
// if (NowTimeHour >= StartHour && NowTimeHour <= EndHour)
|
||
// {
|
||
// return "-";
|
||
// }
|
||
// else
|
||
// {
|
||
// return ":";
|
||
// }
|
||
|
||
//}
|
||
|
||
|
||
|
||
}
|
||
}
|