0
This commit is contained in:
@@ -24,7 +24,7 @@ namespace GZ_LTHPilot_ORDER.ScheduleService
|
||||
/// <summary>
|
||||
/// 查询周期单位:月
|
||||
/// </summary>
|
||||
int Cycle = 6;
|
||||
int Cycle = 12;
|
||||
public void Run(Context ctx, Schedule schedule)
|
||||
{
|
||||
TempTableService tempTableService = new TempTableService(ctx);
|
||||
@@ -35,6 +35,29 @@ namespace GZ_LTHPilot_ORDER.ScheduleService
|
||||
CreateTempTable(ctx, tableName);
|
||||
var advanceAays = GetAdvanceAays(schedule);
|
||||
var planStartDate = DateTime.Now;
|
||||
Dictionary<string, string> orgDict = new Dictionary<string, string>();
|
||||
var orgIdList = orgList.Where(n => n["FORGID"].ToString() != "100302").ToList();
|
||||
orgIdList.ForEach(n => orgDict.Add(n["FNAME"].ToString(), n["FORGID"].ToString()));
|
||||
var saleOrgIds = string.Join(",", orgDict.Values);
|
||||
|
||||
|
||||
|
||||
// 循环查询销售订单执行明细表,每次查询一个月的数据, 将数据插入自定义临时表中
|
||||
var startDate = planStartDate.AddDays(-advanceAays);
|
||||
var endDate = startDate.AddMonths(Cycle);
|
||||
|
||||
// 如果开始时间大于计划开始时间,说明结束了
|
||||
while (startDate <= planStartDate.AddMonths(1))
|
||||
{
|
||||
var receiveAmountList = saleOrderService.GetSaleOrderReceiveAmountByDate(saleOrgIds, startDate, endDate);
|
||||
if (receiveAmountList.Count > 0)
|
||||
{
|
||||
InsertDataToTempTable(ctx, tableName, orgDict, receiveAmountList);
|
||||
|
||||
}
|
||||
startDate = startDate.AddMonths(Cycle);
|
||||
endDate = startDate.AddMonths(Cycle);
|
||||
}
|
||||
foreach (var item in orgList)
|
||||
{
|
||||
// 获取组织Id
|
||||
@@ -43,21 +66,8 @@ namespace GZ_LTHPilot_ORDER.ScheduleService
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// 循环查询销售订单执行明细表,每次查询一个月的数据, 将数据插入自定义临时表中
|
||||
var startDate = planStartDate.AddDays(-advanceAays);
|
||||
var endDate = startDate.AddMonths(Cycle);
|
||||
// 如果开始时间大于计划开始时间,说明结束了
|
||||
while (startDate <= planStartDate)
|
||||
{
|
||||
var receiveAmountList = saleOrderService.GetSaleOrderReceiveAmountByDate(orgId, startDate, endDate);
|
||||
if (receiveAmountList.Count > 0)
|
||||
{
|
||||
InsertDataToTempTable(ctx, tableName, orgId, receiveAmountList);
|
||||
|
||||
}
|
||||
startDate = startDate.AddMonths(Cycle);
|
||||
endDate = startDate.AddMonths(Cycle);
|
||||
}
|
||||
|
||||
}
|
||||
UpdateSaleOrderReceiveAmount(ctx, tableName);
|
||||
tempTableService.DropTempTable(tableName);
|
||||
@@ -94,9 +104,9 @@ FROM
|
||||
/// <param name="orgId"></param>
|
||||
/// <param name="saleExecuteOuts"></param>
|
||||
/// <returns></returns>
|
||||
private int InsertDataToTempTable(Context ctx, string tableName, string orgId, List<SaleExecuteOut> saleExecuteOuts)
|
||||
private int InsertDataToTempTable(Context ctx, string tableName, Dictionary<string, string> orgDict, List<SaleExecuteOut> saleExecuteOuts)
|
||||
{
|
||||
var values = saleExecuteOuts.Select(n => $"({orgId},'{n.FSALEORGNAME}','{n.FBILLNO}',{n.FALLMATCHAMOUNT},'{n.FDate}')").ToList();
|
||||
var values = saleExecuteOuts.Select(n => $"({orgDict[n.FSALEORGNAME]},'{n.FSALEORGNAME}','{n.FBILLNO}',{n.FALLMATCHAMOUNT},'{n.FDate}')").ToList();
|
||||
var index = 0;
|
||||
var line = 0;
|
||||
var pageSize = 100;
|
||||
|
||||
Reference in New Issue
Block a user