新增K3退货金额、云星空退货金额、整单可开票金额
This commit is contained in:
@@ -5,62 +5,21 @@ using Kingdee.BOS.Contracts;
|
||||
using Kingdee.BOS.Core;
|
||||
using Kingdee.BOS.Util;
|
||||
using Kingdee.K3.FIN.App.Core.Match.Object;
|
||||
using Kingdee.K3.SCM.Common.BusinessEntity.Sales;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace GZ_LTHPilot_ORDER.ScheduleService
|
||||
{
|
||||
[Description("定时刷新销售订单累计开票金额#"), HotUpdate]
|
||||
[Description("刷新所有销售订单累计开票金额#"), HotUpdate]
|
||||
public class SaleOrderSumSicsAmountRefresh : IScheduleService
|
||||
{
|
||||
public void Run(Context ctx, Schedule schedule)
|
||||
{
|
||||
var advanceAays = GetAdvanceAays(schedule);
|
||||
// 提前天的日期
|
||||
var approvedDate = DateTime.Now.Date.AddDays(-advanceAays - 1);
|
||||
// 销售发票服务
|
||||
SaleSicsService saleSicsService = new SaleSicsService(ctx);
|
||||
// TODO 获取前一天的发票数据
|
||||
var sicsList = saleSicsService.GetSaleSiceListByApprovedDate(approvedDate);
|
||||
SaleOrderService saleOrderService = new SaleOrderService(ctx);
|
||||
foreach (var sice in sicsList)
|
||||
{
|
||||
var saleOrgId = sice["FSALEORGID"].ToString();
|
||||
var contractNo = sice["contractNo"].ToString();
|
||||
var saleOrderList = saleOrderService.GetSaleOrderByOrgIdAndContractNo(saleOrgId, contractNo);
|
||||
if (saleOrderList.Count == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var saleOrder = saleOrderList[0];
|
||||
saleSicsService.UpdateSaleOrderSumSicsamountBySaleOrder(saleOrder);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 参数获取提前天
|
||||
/// </summary>
|
||||
/// <param name="schedule"></param>
|
||||
/// <returns></returns>
|
||||
private int GetAdvanceAays(Schedule schedule)
|
||||
{
|
||||
// 参数获取提前天
|
||||
var advanceAaysStr = schedule.Parameters;
|
||||
int advanceAays;
|
||||
try
|
||||
{
|
||||
advanceAays = Convert.ToInt32(advanceAaysStr);
|
||||
if (advanceAays < 0)
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw new Exception("获取参数提前天失败,参数格式为整数,且大于等于0");
|
||||
}
|
||||
return advanceAays;
|
||||
// 刷新所有销售订单累计开票金额#
|
||||
saleSicsService.UpdateSaleOrderSumSicsamountAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user