using Kingdee.BOS; using Kingdee.BOS.App; using Kingdee.BOS.App.Data; using Kingdee.BOS.Contracts; using Kingdee.BOS.Core; using Kingdee.BOS.ServiceHelper; using Kingdee.BOS.Util; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using ExtensionMethods; namespace MonthlyProductionSchedule { [Description("生产计划表-定时任务"), HotUpdate] public class AutoRecordsInventoryPlugIn : IScheduleService { public void Run(Context ctx, Schedule schedule) { var newDate = DateTime.Now; //var year = filter.FilterParameter.CustomFilter["DataHoldYear"].Long2Int(); //var month = filter.FilterParameter.CustomFilter["DataHoldMonth"].Long2Int(); //var date = new DateTime(year, month, 1); var tableName = "TMP" + Guid.NewGuid().ToString("N").ToUpper(); var startDate = newDate.AddDays(1 - newDate.Day); var endDate = startDate.AddMonths(1).AddDays(-1); var year = newDate.Year; var month = newDate.Month; DBServiceHelper.Execute(ctx, $"/*dialect*/ EXEC PROC_PPL_AutoSaveCurrentData {tableName} , {newDate.ToLongFormat()} ,{startDate.ToShortFormat()} ,{endDate.ToShortFormat()} ,{year} ,{month}"); } } }