baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
Executable
+86
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Shared.Utils
|
||||
{
|
||||
public class CheckDateTime
|
||||
{
|
||||
/// <summary>
|
||||
/// 判断是否是时间类型
|
||||
/// </summary>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsDate(object date)
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime.Parse(date.ToString());
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 转换时间格式(2005-11-5)
|
||||
/// </summary>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
public static string FormatDate(object date)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (IsDate(date))
|
||||
{
|
||||
return Convert.ToDateTime(date).ToShortDateString().ToString();
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 时间比较
|
||||
/// </summary>
|
||||
/// <returns>入口</returns>
|
||||
public static decimal CompareTime(object start, object end)
|
||||
{
|
||||
if (start != null && end != null && IsDate(start.ToString()) && IsDate(end.ToString()))
|
||||
{
|
||||
DateTime startTime = Convert.ToDateTime(start);
|
||||
DateTime endTime = Convert.ToDateTime(end);
|
||||
return DateTime.Compare(startTime, endTime);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 时间差计算
|
||||
/// </summary>
|
||||
/// <returns>入口</returns>
|
||||
public static decimal CalculateMaintTime(object start, object end)
|
||||
{
|
||||
if (start!=null && end!=null && IsDate(start.ToString()) && IsDate(end.ToString()))
|
||||
{
|
||||
DateTime startTime =Convert.ToDateTime(start);
|
||||
DateTime endTime = Convert.ToDateTime(end);
|
||||
if (DateTime.Compare(startTime, endTime) > 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
TimeSpan span = endTime - startTime;
|
||||
return (decimal)span.TotalMinutes;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user