0
This commit is contained in:
parent
ec10996079
commit
d040b97cbc
14
Config/ContextConfig.cs
Normal file
14
Config/ContextConfig.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace GZ_LTHPilot_ORDER.Config
|
||||||
|
{
|
||||||
|
internal class ContextConfig
|
||||||
|
{
|
||||||
|
public static string DefaultUserName = "ERP6";
|
||||||
|
public static int DefaultUserId = 131409;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -332,6 +332,7 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Config\ContextConfig.cs" />
|
||||||
<Compile Include="Models\K3Request\ReportDataParam.cs" />
|
<Compile Include="Models\K3Request\ReportDataParam.cs" />
|
||||||
<Compile Include="Models\K3Result\KingdeeResult.cs" />
|
<Compile Include="Models\K3Result\KingdeeResult.cs" />
|
||||||
<Compile Include="Models\K3Result\ListResult.cs" />
|
<Compile Include="Models\K3Result\ListResult.cs" />
|
||||||
@ -377,6 +378,7 @@
|
|||||||
<Compile Include="SQL\SqlManage.cs" />
|
<Compile Include="SQL\SqlManage.cs" />
|
||||||
<Compile Include="SUB_PPBOM\AuditPOM.cs" />
|
<Compile Include="SUB_PPBOM\AuditPOM.cs" />
|
||||||
<Compile Include="T_IV_SALESIC\UnAuditS_Order.cs" />
|
<Compile Include="T_IV_SALESIC\UnAuditS_Order.cs" />
|
||||||
|
<Compile Include="Utils\ContextUtil.cs" />
|
||||||
<Compile Include="Utils\LogUtil.cs" />
|
<Compile Include="Utils\LogUtil.cs" />
|
||||||
<Compile Include="WebApiService\SaleOrderApiService.cs" />
|
<Compile Include="WebApiService\SaleOrderApiService.cs" />
|
||||||
<Compile Include="XMYSLRB\AfterSave.cs" />
|
<Compile Include="XMYSLRB\AfterSave.cs" />
|
||||||
@ -442,6 +444,7 @@
|
|||||||
</Target>
|
</Target>
|
||||||
<Import Project="packages\SkiaSharp.NativeAssets.Win32.2.88.8\build\net462\SkiaSharp.NativeAssets.Win32.targets" Condition="Exists('packages\SkiaSharp.NativeAssets.Win32.2.88.8\build\net462\SkiaSharp.NativeAssets.Win32.targets')" />
|
<Import Project="packages\SkiaSharp.NativeAssets.Win32.2.88.8\build\net462\SkiaSharp.NativeAssets.Win32.targets" Condition="Exists('packages\SkiaSharp.NativeAssets.Win32.2.88.8\build\net462\SkiaSharp.NativeAssets.Win32.targets')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>copy $(TargetPath) "D:\kingdee\K3Cloud\WebSite\Bin\$(TargetFileName)"</PostBuildEvent>
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@ -3,6 +3,7 @@ using Gatedge.Enpower.BOS.PlugIn.Utils;
|
|||||||
using GZ_LTHPilot_ORDER.Models.VO;
|
using GZ_LTHPilot_ORDER.Models.VO;
|
||||||
using GZ_LTHPilot_ORDER.Service;
|
using GZ_LTHPilot_ORDER.Service;
|
||||||
using GZ_LTHPilot_ORDER.Services;
|
using GZ_LTHPilot_ORDER.Services;
|
||||||
|
using GZ_LTHPilot_ORDER.Utils;
|
||||||
using Kingdee.BOS;
|
using Kingdee.BOS;
|
||||||
using Kingdee.BOS.App;
|
using Kingdee.BOS.App;
|
||||||
using Kingdee.BOS.Contracts;
|
using Kingdee.BOS.Contracts;
|
||||||
@ -27,23 +28,17 @@ namespace GZ_LTHPilot_ORDER.ScheduleService
|
|||||||
/// 查询周期单位:月
|
/// 查询周期单位:月
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int Cycle = 12;
|
int Cycle = 12;
|
||||||
public void Run(Context ctx, Schedule schedule)
|
public void Run(Context oldCtx, Schedule schedule)
|
||||||
{
|
{
|
||||||
var ctxString = JsonConvert.SerializeObject(ctx);
|
var ctxString = JsonConvert.SerializeObject(oldCtx);
|
||||||
Context newCtx = DataCenterService.GetDataCenterContextByID(ctx.DBId);
|
ContextUtil contextUtil = new ContextUtil(oldCtx);
|
||||||
newCtx.UserId = 131409; //服务操作用户暂时记为Administrator
|
var ctx = contextUtil.GetDefaultContext();
|
||||||
newCtx.UserName = "ERP6";
|
TempTableService tempTableService = new TempTableService(ctx);
|
||||||
newCtx.ServiceType = WebType.WebSite;
|
OrgService orgService = new OrgService(ctx);
|
||||||
newCtx.CurrentOrganizationInfo.ID = 1;
|
SaleOrderService saleOrderService = new SaleOrderService(ctx);
|
||||||
|
|
||||||
LogUtil.Log("UserContext", ctxString);
|
|
||||||
|
|
||||||
TempTableService tempTableService = new TempTableService(newCtx);
|
|
||||||
OrgService orgService = new OrgService(newCtx);
|
|
||||||
SaleOrderService saleOrderService = new SaleOrderService(newCtx);
|
|
||||||
var orgList = orgService.GetOrgList();
|
var orgList = orgService.GetOrgList();
|
||||||
var tableName = tempTableService.CreateTempTable();
|
var tableName = tempTableService.CreateTempTable();
|
||||||
CreateTempTable(newCtx, tableName);
|
CreateTempTable(ctx, tableName);
|
||||||
var advanceAays = GetAdvanceAays(schedule);
|
var advanceAays = GetAdvanceAays(schedule);
|
||||||
var planStartDate = DateTime.Now;
|
var planStartDate = DateTime.Now;
|
||||||
Dictionary<string, string> orgDict = new Dictionary<string, string>();
|
Dictionary<string, string> orgDict = new Dictionary<string, string>();
|
||||||
@ -66,14 +61,14 @@ namespace GZ_LTHPilot_ORDER.ScheduleService
|
|||||||
var receiveAmountList = saleOrderService.GetSaleOrderReceiveAmountByDate(saleOrgIds, startDate, endDate);
|
var receiveAmountList = saleOrderService.GetSaleOrderReceiveAmountByDate(saleOrgIds, startDate, endDate);
|
||||||
if (receiveAmountList.Count > 0)
|
if (receiveAmountList.Count > 0)
|
||||||
{
|
{
|
||||||
InsertDataToTempTable(newCtx, tableName, orgDict, receiveAmountList);
|
InsertDataToTempTable(ctx, tableName, orgDict, receiveAmountList);
|
||||||
|
|
||||||
}
|
}
|
||||||
startDate = startDate.AddMonths(Cycle);
|
startDate = startDate.AddMonths(Cycle);
|
||||||
endDate = startDate.AddMonths(Cycle);
|
endDate = startDate.AddMonths(Cycle);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateSaleOrderReceiveAmount(newCtx, tableName);
|
UpdateSaleOrderReceiveAmount(ctx, tableName);
|
||||||
tempTableService.DropTempTable(tableName);
|
tempTableService.DropTempTable(tableName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
38
Utils/ContextUtil.cs
Normal file
38
Utils/ContextUtil.cs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
using GZ_LTHPilot_ORDER.Config;
|
||||||
|
using Kingdee.BOS;
|
||||||
|
using Kingdee.BOS.ServiceHelper;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace GZ_LTHPilot_ORDER.Utils
|
||||||
|
{
|
||||||
|
public class ContextUtil
|
||||||
|
{
|
||||||
|
Context ctx { get; set; }
|
||||||
|
|
||||||
|
public ContextUtil(Context ctx)
|
||||||
|
{
|
||||||
|
this.ctx = ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Context GetDefaultContext()
|
||||||
|
{
|
||||||
|
var userName = ContextConfig.DefaultUserName;
|
||||||
|
var userId = ContextConfig.DefaultUserId;
|
||||||
|
return GetNewContext(userId, userName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Context GetNewContext(long userId, string userName)
|
||||||
|
{
|
||||||
|
Context newCtx = DataCenterService.GetDataCenterContextByID(ctx.DBId);
|
||||||
|
newCtx.UserId = userId;
|
||||||
|
newCtx.UserName = userName;
|
||||||
|
newCtx.ServiceType = WebType.WebSite;
|
||||||
|
newCtx.CurrentOrganizationInfo.ID = 1;
|
||||||
|
return newCtx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user