合并代码
This commit is contained in:
68
ScheduleService/SaleOrderSumSicsAmountRefresh.cs
Normal file
68
ScheduleService/SaleOrderSumSicsAmountRefresh.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using DocumentFormat.OpenXml.Bibliography;
|
||||
using GZ_LTHPilot_ORDER.Service;
|
||||
using Kingdee.BOS;
|
||||
using Kingdee.BOS.Contracts;
|
||||
using Kingdee.BOS.Core;
|
||||
using Kingdee.BOS.Util;
|
||||
using Kingdee.K3.FIN.App.Core.Match.Object;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace GZ_LTHPilot_ORDER.ScheduleService
|
||||
{
|
||||
[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)
|
||||
{
|
||||
//var errInfo = string.Format("纸质合同号:{0},没有找到对应的销售订单,请检查销售订单是否已审核,或者被作废", contractNo);
|
||||
//throw new Exception(errInfo);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user