没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
翻译|使用教程|编辑:莫成敏|2019-10-25 11:22:46.807|阅读 163 次
概述:VARCHART XGantt是用于工业4.0项目管理、交互式的甘特图绝佳解决方案,世界级甘特图大师。本教程介绍如何使用日历(.NET版本内容),文章内容较多,本文描述了使用日历的最后一部分内容——如何使用日历计算。
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
相关链接:
VARCHART XGantt是一个交互式的甘特图控件,其模块化的设计让您可以创建满足您和您的客户所需求的应用程序。相较于其他甘特图控件,VARCHART XGantt稳定性高,开发时间长,各大行业的知名公司都在使用它。本文主要描述了如何使用日历教程中的如何使用日历进行计算的内容,现在就跟着小编来了解一下吧~
如何使用日历进行计算
日历中的计算不一定在时间范围内可见。对象Calendar的AddDuration方法从开始日期和指定的工作时间单位数计算最终日期,同时考虑到非工作时间。传递负号的时间单位将导致从给定的结束日期开始计算开始日期。 CalcDuration方法是AddDuration方法的补充,它从给定的开始日期和结束日期计算工作时间单位(持续时间)数。
计算方法如何工作
请注意:指定为天、小时、分钟或秒的工作时间单位必须与VcGantt对象的属性TimeUnit定义的时间单位相对应。
AddDuration方法可确保所计算的日期始终位于工作时间间隔内。同时,如果源值位于非工作时间内,则后向计算不一定提供与前向计算的源值相等的结果。
计算的有限可逆性
以交互方式创建或修改活动时,VARCHART XGantt会自动注意活动无法在非工作时间内开始或结束。如果希望通过API创建或修改节点时行为保持一致,则需要通过手动更正开始日期或结束日期来确保这一点。为此,位于非工作时间中的开始日期需要移动到下一个工作时间间隔的开始,并且结束日期对应于上一个工作时间间隔的结束。有一些方法可以确定间隔的极限。
示例代码C#
if (calendar.IsWorkTime(startDate) == false) startDate = calendar.GetNextIntervalBorder(startDate); if (calendar.IsWorkTime(endDate) == false) endDate = calendar.GetStartOfInterval(endDate);
示例代码VB.NET
If calendar.IsWorkTime(startDate) = False Then startDate = calendar.GetNextIntervalBorder(startDate) End If If calendar.IsWorkTime(endDate) = False Then endDate = calendar.GetStartOfInterval(endDate) End If
夏令时
VARCHART XGantt自动支持夏令时。在中欧,DST从3月的最后一个星期日开始,到10月的最后一个星期日结束。在夏令时开始时,时钟从2:00 h延迟到3:00 h,在时钟结束时从3:00 h延迟到2:00 h。
开始夏令时:
夏令时结束:
如果将TimeUnit设置为小时,则在夏时制的开始日期,方法calcDuration检索23小时的时间跨度,而在最后一天,则返回25小时。如果设置为天,则两种情况下的时间跨度均为1天。
检索时间间隔的限制
Calendar对象用于检索时间间隔GetStartOfInterval、GetNextIntervalBorder和GetPreviousIntervalBorder的限制的方法允许迭代工作时间间隔和非工作时间间隔。返回的结果是相对的,并以方法作为参数传递的参考日期为参考。
可以通过Calendar对象的IsWorkTime方法检查日期是否在工作时间或非工作时间。尽管新间隔的开始日期等于上一个间隔的结束日期,但是开始日期始终属于新间隔(向右打开)。
方法GetEndOfPreviousWorkTime和GetStartOfNextWorkTime不提供新的选项,而只是简化了工作时间间隔的处理。
在下面的编程示例中,将检索日历的时间间隔并将其写入文件。此外,计算给定期间内可用的工作时间:
示例代码C#
void writeCalendarIntervalsToFile (string filename, VcCalendar calendar, DateTime startDate, DateTime endDate, bool listWorkIntervals, bool listNonWorkIntervals) { TextWriter tw = new StreamWriter(Path.GetDirectoryName(Application.ExecutablePath) + filename); tw.WriteLine("Time Intervals of {0} between \r\n{1} - {2}\r\n", calendar.Name, startDate, endDate); DateTime tmpStartDate = startDate; while (tmpStartDate < endDate) { DateTime nextStartDate = calendar.GetNextIntervalBorder(tmpStartDate); if (tmpStartDate == nextStartDate) nextStartDate = endDate; if (nextStartDate > endDate) nextStartDate = endDate; if (calendar.IsWorktime(tmpStartDate)) if (listWorkIntervals) tw.WriteLine("{0} - {1} WorkInterval", tmpStartDate, nextStartDate); else if (listNonWorkIntervals) tw.WriteLine("{0} - {1} NonWorkInterval", tmpStartDate, nextStartDate); tmpStartDate = nextStartDate; } int totalWorkTime = calendar.CalcDuration(startDate, endDate); tw.WriteLine("Total work time: {0} Units", totalWorkTime); tw.Close(); }
示例代码VB.NET
Private Sub writeCalendarIntervalsToFile(ByVal filename As String, ByVal calendar As VcCalendar, ByVal startDate As DateTime, ByVal endDate As DateTime, ByVal listWorkIntervals As Boolean, ByVal listNonWorkIntervals As Boolean) Dim tw As TextWriter = New StreamWriter(Path.GetDirectoryName(Application.ExecutablePath) + filename) tw.WriteLine("Time Intervals of {0} between \r\n{1} - {2}\r\n", calendar.Name, startDate, endDate) Dim tmpStartDate As DateTime = startDate While tmpStartDate < endDate Dim nextStartDate As DateTime = calendar.GetNextIntervalBorder(tmpStartDate) if (tmpStartDate = nextStartDate) nextStartDate = endDate if (nextStartDate > endDate) nextStartDate = endDate if (calendar.IsWorktime(tmpStartDate)) if (listWorkIntervals) tw.WriteLine("{0} - {1} WorkInterval", tmpStartDate, nextStartDate) else if (listNonWorkIntervals) tw.WriteLine("{0} - {1} NonWorkInterval", tmpStartDate, nextStartDate) tmpStartDate = nextStartDate End While Dim totalWorkTime As Integer = calendar.CalcDuration(startDate,endDate) tw.WriteLine("Total work time: {0} Units", totalWorkTime) tw.Close() End Sub
请注意:日历中的时间间隔可以精确地指定为秒,并且最多可以包含137年(以秒为单位)的间隔。
将时间间隔写入文件的代码
示例代码C#
writeCalendarIntervalsToFile("CalenderIntervals.txt", calendar, vcGantt1.TimeScaleStart, vcGantt1.TimeScaleEnd, true, true); Time Intervals of CompanyCalendar_1 between 01.01.2011 00:00:00 - 01.01.2012 00:00:00 01.01.2011 00:00:00 - 02.01.2011 00:00:00 non-work time 02.01.2011 00:00:00 - 03.01.2011 00:00:00 non-work time 03.01.2011 00:00:00 - 03.01.2011 08:00:00 non-work time 03.01.2011 08:00:00 - 03.01.2011 12:00:00 work time 03.01.2011 12:00:00 - 03.01.2011 13:00:00 non-work time 03.01.2011 13:00:00 - 03.01.2011 17:00:00 work time 03.01.2011 17:00:00 - 04.01.2011 00:00:00 non-work time 04.01.2011 00:00:00 - 04.01.2011 08:00:00 non-work time 04.01.2011 08:00:00 - 04.01.2011 12:00:00 work time 04.01.2011 12:00:00 - 04.01.2011 13:00:00 non-work time 04.01.2011 13:00:00 - 04.01.2011 17:00:00 work time 04.01.2011 17:00:00 - 05.01.2011 00:00:00 non-work time ... 30.12.2011 00:00:00 - 30.12.2011 08:00:00 non-work time 30.12.2011 08:00:00 - 30.12.2011 12:00:00 work time 30.12.2011 12:00:00 - 30.12.2011 13:00:00 non-work time 30.12.2011 13:00:00 - 30.12.2011 17:00:00 work time 30.12.2011 17:00:00 - 31.12.2011 00:00:00 non-work time 31.12.2011 00:00:00 - 01.01.2012 00:00:00 non-work time Total work time: 2064 Units
将时间间隔写入文件的代码
示例代码VB.NET
writeCalendarIntervalsToFile("CalenderIntervals.txt", calendar, vcGantt1.TimeScaleStart, vcGantt1.TimeScaleEnd, True, True) Time Intervals of CompanyCalendar_1 between 01.01.2011 00:00:00 - 01.01.2012 00:00:00 01.01.2011 00:00:00 - 02.01.2011 00:00:00 non-work time 02.01.2011 00:00:00 - 03.01.2011 00:00:00 non-work time 03.01.2011 00:00:00 - 03.01.2011 08:00:00 non-work time 03.01.2011 08:00:00 - 03.01.2011 12:00:00 work time 03.01.2011 12:00:00 - 03.01.2011 13:00:00 non-work time 03.01.2011 13:00:00 - 03.01.2011 17:00:00 work time 03.01.2011 17:00:00 - 04.01.2011 00:00:00 non-work time 04.01.2011 00:00:00 - 04.01.2011 08:00:00 non-work time 04.01.2011 08:00:00 - 04.01.2011 12:00:00 work time 04.01.2011 12:00:00 - 04.01.2011 13:00:00 non-work time 04.01.2011 13:00:00 - 04.01.2011 17:00:00 work time 04.01.2011 17:00:00 - 05.01.2011 00:00:00 non-work time ... 30.12.2011 00:00:00 - 30.12.2011 08:00:00 non-work time 30.12.2011 08:00:00 - 30.12.2011 12:00:00 work time 30.12.2011 12:00:00 - 30.12.2011 13:00:00 non-work time 30.12.2011 13:00:00 - 30.12.2011 17:00:00 work time 30.12.2011 17:00:00 - 31.12.2011 00:00:00 non-work time 31.12.2011 00:00:00 - 01.01.2012 00:00:00 non-work time Total work time: 2064 Units
本教程内容就是这样了,希望对您有所帮助!您可以继续关注我们了解更多甘特图半岛权威十大直营(官方)网站相关的文章资讯,您也可以下载VARCHART XGantt试用版体验一下~
相关内容推荐:
VARCHART XGantt用户手册(.NET版):如何使用日历(上)
VARCHART XGantt用户手册(.NET版):如何使用日历(中)
想要购买VARCHART XGantt正版授权,或了解更多产品信息请点击
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@wqylolg.cn
在本文中,将介绍一个新集成演示,包括 DHTMLX Grid 和 Pivot,并将重点介绍DHTMLX的开发团队使用这些小部件创建 JavaScript 数据透视网格时使用的一些技术技巧。
解析PDF意味着从 PDF 文件中提取结构化或非结构化数据。由于 PDF 的结构复杂,因此这可能具有挑战性。在本文中,我们将学习如何使用 Aspose.PDF for Python 在 Python 中解析 PDF。在本指南结束时,您将能够使用 Python 从 PDF 文档中提取文本、表格和图像。
单元格边框是指在单元格或单元格区域周围添加的线条。它们可用于不同的目的,如分隔工作表中的部分、吸引读者注意重要的单元格或使工作表看起来更美观。本文将介绍如何使用 Spire.XLS for .NET 在 C# 中添加或删除 Excel 单元格边框。
Excel 中的切片器是一种简单易用的工具,可以帮助用户过滤数据,让数据分析变得更加直观,交互性更强。这篇文章将介绍如何使用 Spire.XLS for .NET 在 C# 中添加、修改和删除 Excel 切片器。
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@wqylolg.cn
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢