0
This commit is contained in:
parent
dea0808695
commit
a1aee2395a
@ -24,7 +24,7 @@ namespace GZ_LTHPilot_ORDER.ScheduleService
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询周期单位:月
|
/// 查询周期单位:月
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int Cycle = 6;
|
int Cycle = 12;
|
||||||
public void Run(Context ctx, Schedule schedule)
|
public void Run(Context ctx, Schedule schedule)
|
||||||
{
|
{
|
||||||
TempTableService tempTableService = new TempTableService(ctx);
|
TempTableService tempTableService = new TempTableService(ctx);
|
||||||
@ -35,6 +35,29 @@ namespace GZ_LTHPilot_ORDER.ScheduleService
|
|||||||
CreateTempTable(ctx, 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>();
|
||||||
|
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)
|
foreach (var item in orgList)
|
||||||
{
|
{
|
||||||
// 获取组织Id
|
// 获取组织Id
|
||||||
@ -43,21 +66,8 @@ namespace GZ_LTHPilot_ORDER.ScheduleService
|
|||||||
{
|
{
|
||||||
continue;
|
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);
|
UpdateSaleOrderReceiveAmount(ctx, tableName);
|
||||||
tempTableService.DropTempTable(tableName);
|
tempTableService.DropTempTable(tableName);
|
||||||
@ -94,9 +104,9 @@ FROM
|
|||||||
/// <param name="orgId"></param>
|
/// <param name="orgId"></param>
|
||||||
/// <param name="saleExecuteOuts"></param>
|
/// <param name="saleExecuteOuts"></param>
|
||||||
/// <returns></returns>
|
/// <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 index = 0;
|
||||||
var line = 0;
|
var line = 0;
|
||||||
var pageSize = 100;
|
var pageSize = 100;
|
||||||
|
|||||||
@ -80,14 +80,7 @@ namespace GZ_LTHPilot_ORDER.T_IV_SALESIC.ServicePlugIn
|
|||||||
PKValue = "1",
|
PKValue = "1",
|
||||||
Name = "检查开票金额是否超额",
|
Name = "检查开票金额是否超额",
|
||||||
MessageType = MessageType.FatalError,
|
MessageType = MessageType.FatalError,
|
||||||
Message = string.Format($@"
|
Message = string.Format($@"销售订单:'{saleOrderNo}' , 纸质合同号:'{contractNo}', 开票超额。 不满足条件:销售订单价税合计 >= 累计开票金额 + 本次开票金额 - 退货金额。销售订单价税合计:{saleOrderAmount.ToString("0.00")}, 累计开票金额:{saleOrderINVOICEAMOUNT.ToString("0.00")},本次开票金额:{SumALLAMOUNTFOR.ToString("0.00")},退货金额:{saleOrderReturnAmountK3Cloud.ToString("0.00")},K3退货金额:{saleOrderReturnAmountK3.ToString("0.00")}
|
||||||
销售订单:'{saleOrderNo}' , 纸质合同号:'{contractNo}', 开票超额,
|
|
||||||
不满足条件:销售订单价税合计 >= 累计开票金额 + 本次开票金额 - 退货金额。
|
|
||||||
销售订单价税合计:{saleOrderAmount.ToString("0.00")},
|
|
||||||
累计开票金额:{saleOrderINVOICEAMOUNT.ToString("0.00")},
|
|
||||||
本次开票金额:{SumALLAMOUNTFOR.ToString("0.00")},
|
|
||||||
退货金额:{saleOrderReturnAmountK3Cloud.ToString("0.00")},
|
|
||||||
K3退货金额:{saleOrderReturnAmountK3.ToString("0.00")}
|
|
||||||
|
|
||||||
"),
|
"),
|
||||||
SuccessStatus = false
|
SuccessStatus = false
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user