This commit is contained in:
Administrator
2025-08-08 10:21:37 +08:00
parent 6bab550029
commit ec10996079
4 changed files with 30 additions and 17 deletions

View File

@@ -1,4 +1,5 @@
using DocumentFormat.OpenXml.Bibliography;
using Gatedge.Enpower.BOS.PlugIn.Utils;
using GZ_LTHPilot_ORDER.Models.VO;
using GZ_LTHPilot_ORDER.Service;
using GZ_LTHPilot_ORDER.Services;
@@ -10,6 +11,7 @@ using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Util;
using Kingdee.BOS.WebApi.FormService;
using Kingdee.K3.FIN.App.Core.Match.Object;
using Newtonsoft.Json;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
@@ -27,12 +29,21 @@ namespace GZ_LTHPilot_ORDER.ScheduleService
int Cycle = 12;
public void Run(Context ctx, Schedule schedule)
{
TempTableService tempTableService = new TempTableService(ctx);
OrgService orgService = new OrgService(ctx);
SaleOrderService saleOrderService = new SaleOrderService(ctx);
var ctxString = JsonConvert.SerializeObject(ctx);
Context newCtx = DataCenterService.GetDataCenterContextByID(ctx.DBId);
newCtx.UserId = 131409; //服务操作用户暂时记为Administrator
newCtx.UserName = "ERP6";
newCtx.ServiceType = WebType.WebSite;
newCtx.CurrentOrganizationInfo.ID = 1;
LogUtil.Log("UserContext", ctxString);
TempTableService tempTableService = new TempTableService(newCtx);
OrgService orgService = new OrgService(newCtx);
SaleOrderService saleOrderService = new SaleOrderService(newCtx);
var orgList = orgService.GetOrgList();
var tableName = tempTableService.CreateTempTable();
CreateTempTable(ctx, tableName);
CreateTempTable(newCtx, tableName);
var advanceAays = GetAdvanceAays(schedule);
var planStartDate = DateTime.Now;
Dictionary<string, string> orgDict = new Dictionary<string, string>();
@@ -55,14 +66,14 @@ namespace GZ_LTHPilot_ORDER.ScheduleService
var receiveAmountList = saleOrderService.GetSaleOrderReceiveAmountByDate(saleOrgIds, startDate, endDate);
if (receiveAmountList.Count > 0)
{
InsertDataToTempTable(ctx, tableName, orgDict, receiveAmountList);
InsertDataToTempTable(newCtx, tableName, orgDict, receiveAmountList);
}
startDate = startDate.AddMonths(Cycle);
endDate = startDate.AddMonths(Cycle);
}
UpdateSaleOrderReceiveAmount(ctx, tableName);
UpdateSaleOrderReceiveAmount(newCtx, tableName);
tempTableService.DropTempTable(tableName);
}