Files
GateDge2023_ljy/08.昶东/EastChanger/Synchron2Customs.cs
PastSaid c31957eb64 a
2024-03-18 11:42:45 +08:00

68 lines
2.3 KiB
C#

using EastChanger.STK_Inventory;
using EastChanger.STK_StockCountGain;
using EastChanger.STK_StockCountLoss;
using Kingdee.BOS;
using Kingdee.BOS.Contracts;
using Kingdee.BOS.Core;
using Kingdee.BOS.Log;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EastChanger
{
public class Synchron2Customs : IScheduleService
{
public void Run(Context ctx, Schedule schedule)
{
try
{
var paramList = new List<string>();
if (!schedule.Parameters.IsNullOrEmpty())
paramList = schedule.Parameters
.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries)
.ToList();
Logger.Info(schedule.Name, "执行同步数据至海关start...");
foreach (var param in paramList)
{
ISynchonService service = null;
switch (param)
{
case "STK_Inventory"://即时库存明细
service = new STKInventoryService(ctx);
break;
case "STK_MISCELLANEOUS"://其他入库单
break;
case "STK_MisDelivery"://其他出库单
break;
case "STK_StockCountGain"://盘盈单
service = new STKStockCountGainService(ctx);
break;
case "STK_StockCountLoss"://盘亏单
service = new STKStockCountLossService(ctx);
break;
}
if (service == null)
continue;
Logger.Info(schedule.Name, $"{service.ModuleCnName}数据同步start...");
service.HandleSyncData(null, null, 0);
Logger.Info(schedule.Name, $"{service.ModuleCnName}数据同步end...");
}
}
catch (Exception ex)
{
Logger.Error(schedule.Name, ex.Message, ex);
}
finally
{
Logger.Info(schedule.Name, "执行同步数据至海关end...");
}
}
}
}