This commit is contained in:
PastSaid
2024-03-11 09:04:46 +08:00
parent 5e2781182d
commit 6dd1816c96
47 changed files with 18825 additions and 624 deletions

View File

@@ -44,7 +44,7 @@ namespace EastChanger
/// </summary>
/// <param name="dataJson"></param>
/// <returns></returns>
public string Execute(string dataJson)
public string DoSubmit(string dataJson)
{
//对json字符串进行url编码
var requestData = EncryptHelper.UrlEncode(dataJson);
@@ -66,6 +66,38 @@ namespace EastChanger
return result;
}
/// <summary>
/// 根据账册分类后设置申报信息表头
/// </summary>
/// <returns></returns>
protected Dictionary<string, Dictionary<string, object>> GetDeclInfos()
{
var newDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
var ledgerSql = @"SELECT * FROM V_LEDGER_INFO";
var ledgerInfos = DBUtils.ExecuteDynamicObject(_context, $"/*dialect*/{ledgerSql}");
var groupList = ledgerInfos.GroupBy(x => x["FBOOKNUM"].ToString()).ToList();
//var lInfo = ledgerInfos[0];
var resultData = new Dictionary<string, Dictionary<string, object>>();
foreach (var item in groupList)
{
var main = new Dictionary<string, object>();
resultData.Add(item.Key, main);
var lInfo = item.ToList()[0];
main.Add("entCusCode", lInfo["FENTCUSCODE"]);
main.Add("entCreditCode", lInfo["FENTCREDITCODE"]);
main.Add("entName", lInfo["FENTNAME"]);
main.Add("declaEntCusCode", lInfo["FDECLAENTCUSCODE"]);
main.Add("declaEntCreditCode", lInfo["FDECLAENTCREDITCODE"]);
main.Add("declaEntName", lInfo["FDECLAENTNAME"]);
main.Add("customsCode", lInfo["FCUSTOMSCODE"]);
main.Add("bookNum", lInfo["FBOOKNUM"]);
}
return resultData;
}
/// <summary>
/// 处理接口回调信息
/// </summary>

View File

@@ -63,11 +63,16 @@
</ItemGroup>
<ItemGroup>
<Compile Include="BaseService.cs" />
<Compile Include="ISynchonService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="sfj4Class.cs" />
<Compile Include="SignUtil.cs" />
<Compile Include="STK_Inventory\ListEventPlugInEx.cs" />
<Compile Include="STK_Inventory\STKInventoryService.cs" />
<Compile Include="STK_Miscellaneous\STKMiscellaneousService.cs" />
<Compile Include="STK_StockCountGain\STKStockCountGainService.cs" />
<Compile Include="STK_StockCountLoss\STKStockCountLossService.cs" />
<Compile Include="Synchron2Customs.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Extensions\ExtensionMethods.csproj">
@@ -82,13 +87,11 @@
<ItemGroup>
<Content Include="SQLServer\0.海关接口请求参数.sql" />
<Content Include="SQLServer\1.账册信息视图.sql" />
<Content Include="SQLServer\2.1.库存明细同步接口回填.sql" />
<Content Include="SQLServer\2.明细信息关联视图.sql" />
</ItemGroup>
<ItemGroup>
<Folder Include="STK_MISCELLANEOUS\" />
<Folder Include="STK_MisDelivery\" />
<Folder Include="STK_StockCountGain\" />
<Folder Include="STK_StockCountLoss\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,15 @@
using Kingdee.BOS.Core.DynamicForm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EastChanger
{
public interface ISynchonService
{
string ModuleCnName { get; }
void HandleSyncData(List<string> idList, IOperationResult opResult);
}
}

View File

@@ -4,6 +4,47 @@ GO
CREATE VIEW V_CUSTOMS_API_REQUEST_PARAMETE AS
SELECT
1 AS 'NO'
,'STK_Inventory' AS 'ModuleName'
,'http://tsjgqy.zheport.com/api/' AS 'appUrl' --<EFBFBD><EFBFBD>ʽ
,'4257290a253c480e8425efabecefc39d' AS 'appKey' --<EFBFBD><EFBFBD>ʽ
,'E3002B57-66DE-4D81-A3BE-F088CBF79485' AS 'appKeySecret' --<EFBFBD><EFBFBD>ʽ
--,'http://119.146.223.48:39082/api/' AS 'appUrl' --<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
--,'437268ee6e1a44b6ba135eea1614f94d' AS 'appKey'
--,'72CD0295-2312-4B08-9A4C-2A338A0EE9BF' AS 'appKeySecret'
UNION
SELECT
2 AS 'NO'
,'STK_MISCELLANEOUS' AS 'ModuleName'
--,'http://tsjgqy.zheport.com/api/' AS 'appUrl' --<EFBFBD><EFBFBD>ʽ
--,'4257290a253c480e8425efabecefc39d' AS 'appKey' --<EFBFBD><EFBFBD>ʽ
--,'E3002B57-66DE-4D81-A3BE-F088CBF79485' AS 'appKeySecret' --<EFBFBD><EFBFBD>ʽ
,'http://119.146.223.48:39082/api/' AS 'appUrl' --<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
,'437268ee6e1a44b6ba135eea1614f94d' AS 'appKey'
,'72CD0295-2312-4B08-9A4C-2A338A0EE9BF' AS 'appKeySecret'
UNION
SELECT
3 AS 'NO'
,'STK_MisDelivery' AS 'ModuleName'
--,'http://tsjgqy.zheport.com/api/' AS 'appUrl' --<EFBFBD><EFBFBD>ʽ
--,'4257290a253c480e8425efabecefc39d' AS 'appKey' --<EFBFBD><EFBFBD>ʽ
--,'E3002B57-66DE-4D81-A3BE-F088CBF79485' AS 'appKeySecret' --<EFBFBD><EFBFBD>ʽ
,'http://119.146.223.48:39082/api/' AS 'appUrl' --<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
,'437268ee6e1a44b6ba135eea1614f94d' AS 'appKey'
,'72CD0295-2312-4B08-9A4C-2A338A0EE9BF' AS 'appKeySecret'
UNION
SELECT
4 AS 'NO'
,'STK_StockCountGain' AS 'ModuleName'
--,'http://tsjgqy.zheport.com/api/' AS 'appUrl' --<EFBFBD><EFBFBD>ʽ
--,'4257290a253c480e8425efabecefc39d' AS 'appKey' --<EFBFBD><EFBFBD>ʽ
--,'E3002B57-66DE-4D81-A3BE-F088CBF79485' AS 'appKeySecret' --<EFBFBD><EFBFBD>ʽ
,'http://119.146.223.48:39082/api/' AS 'appUrl' --<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
,'437268ee6e1a44b6ba135eea1614f94d' AS 'appKey'
,'72CD0295-2312-4B08-9A4C-2A338A0EE9BF' AS 'appKeySecret'
UNION
SELECT
5 AS 'NO'
,'STK_StockCountLoss' AS 'ModuleName'
--,'http://tsjgqy.zheport.com/api/' AS 'appUrl' --<EFBFBD><EFBFBD>ʽ
--,'4257290a253c480e8425efabecefc39d' AS 'appKey' --<EFBFBD><EFBFBD>ʽ
--,'E3002B57-66DE-4D81-A3BE-F088CBF79485' AS 'appKeySecret' --<EFBFBD><EFBFBD>ʽ

View File

@@ -12,24 +12,34 @@ CREATE PROCEDURE PROC_INSERT_STK_SYNC_RECORD
AS
BEGIN
UPDATE T_STK_INVENTORY set FBILLNO = @itemNo ,FSTATUS = @status WHERE FID = @oId
UPDATE T_STK_INVENTORY set FBILLNO = @itemNo ,FSTATUS = @status WHERE FID = @oId;
INSERT INTO T_STK_INVENTORY_COPY (
/*<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ*/
DBCC CHECKIDENT('z_STK_SYNC_RECORD', NORESEED)
/*<EFBFBD>ڶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ*/
DECLARE @FID bigint
SELECT @FID=ISNULL(MAX(FID),100001)+1 FROM t_STK_SYNC_RECORD
SELECT @FID
/*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD>Աȵ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>͵ڶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>*/
DBCC CHECKIDENT('z_STK_SYNC_RECORD', RESEED, @FID)
INSERT INTO T_STK_SYNC_RECORD (
FID,FSTOCKORGID,FKEEPERTYPEID,FKEEPERID,FOWNERTYPEID,FOWNERID,
FSTOCKID,FSTOCKLOCID,FAUXPROPID,FSTOCKSTATUSID,FLOT,FBOMID,FMTONO,
FPROJECTNO,FPRODUCEDATE,FEXPIRYDATE,FBASEUNITID,FBASEQTY,FBASELOCKQTY,
FSECQTY,FSECLOCKQTY,FSTOCKUNITID,FMATERIALID,FQTY,FLOCKQTY,FSECUNITID
,FOBJECTTYPEID
,FBASEAVBQTY,FAVBQTY,FSECAVBQTY,FUPDATETIME,FISEFFECTIVED,FBILLNO,FSTATUS
,FITEMNO,FOSTKID,FDeclaId,FSyncId
) SELECT
@NID,FSTOCKORGID,FKEEPERTYPEID,FKEEPERID,FOWNERTYPEID,FOWNERID,
,FBASEAVBQTY,FAVBQTY,FSECAVBQTY,FUPDATETIME,FISEFFECTIVED
,FITEMNO,FOSTKID,FDeclaId,FSyncId,FSyncDateTime
)
SELECT
@FID,FSTOCKORGID,FKEEPERTYPEID,FKEEPERID,FOWNERTYPEID,FOWNERID,
FSTOCKID,FSTOCKLOCID,FAUXPROPID,FSTOCKSTATUSID,FLOT,FBOMID,FMTONO,
FPROJECTNO,FPRODUCEDATE,FEXPIRYDATE,FBASEUNITID,FBASEQTY,FBASELOCKQTY,
FSECQTY,FSECLOCKQTY,FSTOCKUNITID,FMATERIALID,FQTY,FLOCKQTY,FSECUNITID
,'ke9dee1ad634f41fca88bb9296d86117d'
,FBASEAVBQTY,FAVBQTY,FSECAVBQTY,FUPDATETIME,FISEFFECTIVED,FBILLNO,FSTATUS
,@itemNo,FID,@declaId,@syncId
,FBASEAVBQTY,FAVBQTY,FSECAVBQTY,FUPDATETIME,FISEFFECTIVED
,@itemNo,FID,@declaId,@syncId,getdate()
FROM T_STK_INVENTORY
WHERE FID = @oId

View File

@@ -34,4 +34,4 @@ FROM
LEFT JOIN T_BAS_FLEXVALUESDETAIL t6 on t6.FID = t0.FSTOCKLOCID
LEFT JOIN T_BAS_FLEXVALUESENTRY t5 ON t5.FENTRYID = t6.FF100001 OR t5.FENTRYID = t6.FF100002
WHERE t0.FBASEQTY != 0
AND t0.FSTATUS != 1
--AND t0.FSTATUS != 1

View File

@@ -21,9 +21,14 @@ namespace EastChanger.STK_Inventory
//同步海关信息
if (e.BarItemKey.Equals("ImmediateInventory"))
{
opResult = new OperationResult();
var list = this.ListView.SelectedRowsInfo;
if (!list.Any())
{
this.View.ShowErrMessage("请选择需要同步的单据");
return;
}
opResult = new OperationResult();
var fidList = list.Select(x => x.PrimaryKeyValue).Distinct().ToList();
STKInventoryService service = new STKInventoryService(this.Context);
service.HandleSyncData(fidList, opResult);

View File

@@ -16,12 +16,15 @@ namespace EastChanger.STK_Inventory
/// <summary>
/// 即时库存明细
/// </summary>
public class STKInventoryService : BaseService
public class STKInventoryService : BaseService, ISynchonService
{
public STKInventoryService(Context context) : base(context, "supvWarehouse.save", "即时库存明细")
{
}
public string ModuleCnName => _moduleCnName;
/// <summary>
/// 处理请求数据
/// </summary>
@@ -60,7 +63,7 @@ WHERE 1 = 1
var whereSql = "";
if (idList != null && idList.Any())
whereSql = string.Format(" AND t0.ID IN ({0}) ", string.Join("','", idList));
whereSql = string.Format(" AND t0.ID IN ('{0}') ", string.Join("','", idList));
var toSql = string.Format(headSql, whereSql);
List<Dictionary<string, object>> itemList = new List<Dictionary<string, object>>();
@@ -105,7 +108,7 @@ WHERE 1 = 1
main.Add("itemList", itemList);
var dataJson = JsonUtil.Serialize(main);
var result = this.Execute(dataJson);
var result = this.DoSubmit(dataJson);
if (!result.IsNullOrEmpty())
{
JToken resData = JsonUtil.DeserializeObject<JToken>(result);
@@ -118,7 +121,8 @@ WHERE 1 = 1
JArray rtnItemList = null;
if (rtnFlag)
rtnItemList = data["rtnObj"]["entity"]["itemList"] as JArray;
//rtnItemList = data["rtnObj"]["entity"]["itemList"] as JArray;
rtnItemList = data.SelectToken("rtnObj.entity.itemList") as JArray;
foreach (var kv in oIdList)
{
@@ -129,8 +133,8 @@ WHERE 1 = 1
var index = kv.Value - 1;
var rtnItem = rtnItemList[index];
var rItemNo = rtnItem["itemNo"].ToString();
var declaId = rtnItemList["declaId"].ToString();
var syncId = rtnItemList["id"].ToString();
var declaId = rtnItem["declaId"].ToString();
var syncId = rtnItem["id"].ToString();
//UpdateStkInventoryInfo(id, 1, itemNo, declaId, syncId);
InserSyncRecord(id, 1, itemNo, declaId, syncId);
}
@@ -148,38 +152,6 @@ WHERE 1 = 1
}
/// <summary>
/// 根据账册分类后设置申报信息表头
/// </summary>
/// <returns></returns>
private Dictionary<string, Dictionary<string, object>> GetDeclInfos()
{
var newDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
var ledgerSql = @"SELECT * FROM V_LEDGER_INFO";
var ledgerInfos = DBUtils.ExecuteDynamicObject(_context, $"/*dialect*/{ledgerSql}");
var groupList = ledgerInfos.GroupBy(x => x["FBOOKNUM"].ToString()).ToList();
//var lInfo = ledgerInfos[0];
var resultData = new Dictionary<string, Dictionary<string, object>>();
foreach (var item in groupList)
{
var main = new Dictionary<string, object>();
resultData.Add(item.Key, main);
var lInfo = item.ToList()[0];
main.Add("entCusCode", lInfo["FENTCUSCODE"]);
main.Add("entCreditCode", lInfo["FENTCREDITCODE"]);
main.Add("entName", lInfo["FENTNAME"]);
main.Add("declaEntCusCode", lInfo["FDECLAENTCUSCODE"]);
main.Add("declaEntCreditCode", lInfo["FDECLAENTCREDITCODE"]);
main.Add("declaEntName", lInfo["FDECLAENTNAME"]);
main.Add("customsCode", lInfo["FCUSTOMSCODE"]);
main.Add("bookNum", lInfo["FBOOKNUM"]);
}
return resultData;
}
/// <summary>
/// 同步完成后更新即时库存明细信息
/// </summary>
@@ -197,8 +169,11 @@ WHERE 1 = 1
/// <summary>
/// 同步完成后记录当前即时库存明细信息
/// </summary>
/// <param name="OId"></param>
/// <param name="oId"></param>
/// <param name="status"></param>
/// <param name="itemNo"></param>
/// <param name="declaId"></param>
/// <param name="syncId"></param>
private void InserSyncRecord(string oId, int status, string itemNo, string declaId, string syncId)
{
var newId = Guid.NewGuid();

View File

@@ -0,0 +1,26 @@
using Kingdee.BOS;
using Kingdee.BOS.Core.DynamicForm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EastChanger.STK_Miscellaneous
{
/// <summary>
/// 其他入库单
/// </summary>
public class STKMiscellaneousService : BaseService, ISynchonService
{
public STKMiscellaneousService(Context context) : base(context, "supvMaterialStorage.save", "其他入库单")
{
}
public string ModuleCnName => _moduleCnName;
public void HandleSyncData(List<string> idList, IOperationResult opResult)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,147 @@
using ExtensionMethods;
using Kingdee.BOS;
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Util;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EastChanger.STK_StockCountGain
{
/// <summary>
/// 盘盈单
/// </summary>
public class STKStockCountGainService : BaseService, ISynchonService
{
public STKStockCountGainService(Context context, string apiName = "supvInventoryProfitLoss.save", string moduleCnName = "盘盈单") : base(context, apiName, moduleCnName)
{
}
public string ModuleCnName => this._moduleCnName;
public void HandleSyncData(List<string> idList, IOperationResult opResult)
{
var declInfos = GetDeclInfos();
var headSql = @"
SELECT
t0.ID
,t0.declaCode
,t0.status
,t0.materialWarehouse
,t0.LEDGERID
,t0.FENTRYID
,t0.FBOOKNUM
,t0.FCUSTOMSCODE
,t0.FLEDGERSTOCKID
,t0.code
,t0.name
,t0.specificationsModels
,t0.calcUnit
,t0.cunit
,t0.warehouseCd
,t0.warehousePosiCd
,t0.itemNo
,t0.reduceable
,t0.inputMan
,t0.declaType
FROM
V_IMMEDIATE_INVENTORY t0
WHERE 1 = 1
{0}
";
var whereSql = "";
if (idList != null && idList.Any())
whereSql = string.Format(" AND t0.ID IN ({0}) ", string.Join("','", idList));
var toSql = string.Format(headSql, whereSql);
List<Dictionary<string, object>> itemList = new List<Dictionary<string, object>>();
var dbList = DBUtils.ExecuteDynamicObject(_context, $"/*dialect*/{toSql}");
if (dbList != null && dbList.Any())
{
var groupList = dbList.GroupBy(x => x["FBOOKNUM"].ToString());
int no = 0;
foreach (var bookEntity in groupList)
{
no++;
var bookNum = bookEntity.Key;
foreach (var entity in bookEntity)
{
var item = new Dictionary<string, object>();
item.Add("itemNo", entity["itemNo"].ToSafeTurnString());
item.Add("code", entity["code"].ToSafeTurnString());
item.Add("name", entity["name"].ToSafeTurnString());
item.Add("specificationsModels", entity["specificationsModels"].ToSafeTurnString());
item.Add("calcUnit", entity["calcUnit"].ToSafeTurnString());
item.Add("cunit", entity["cunit"].ToSafeTurnString());
item.Add("reduceable", entity["reduceable"].ToSafeTurnString());
item.Add("materialWarehouse", entity["materialWarehouse"].ToSafeTurnString());
item.Add("warehouseCd", entity["warehouseCd"].ToSafeTurnString());
item.Add("warehousePosiCd", entity["warehousePosiCd"].ToSafeTurnString());
itemList.Add(item);
}
var oIdList = bookEntity.ToDictionary(k => k["ID"].ToString(), v => v["itemNo"].Long2Int());
var main = declInfos[bookNum];
var newDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//no 补位序号防止一秒内多次执行生成相同的itemNo
string itemNo = $"CD{DateTime.Now:yyMMddHHmmss}{no:D2}";
main.Add("compileDate", newDate);
main.Add("inputMan", _context.UserName);
main.Add("declaType", "00");
main.Add("busiType", "03");
main.Add("inputDate", newDate);
main.Add("declaDate", newDate);
main.Add("declaCode", itemNo);
main.Add("itemList", itemList);
var dataJson = JsonUtil.Serialize(main);
var result = this.DoSubmit(dataJson);
if (!result.IsNullOrEmpty())
{
JToken resData = JsonUtil.DeserializeObject<JToken>(result);
var code = resData["code"].Long2Int();
if (code == 0)
{
var data = resData["data"];
var rtnFlag = data["rtnFlag"].Long2Int() == 0;
var rtnMessage = data["rtnMessage"].ToString();
JArray rtnItemList = null;
if (rtnFlag)
rtnItemList = data["rtnObj"]["entity"]["itemList"] as JArray;
foreach (var kv in oIdList)
{
var id = kv.Key;
var msg = $"明细ID:{id},{rtnMessage}。";
if (rtnFlag)
{
var index = kv.Value - 1;
var rtnItem = rtnItemList[index];
var rItemNo = rtnItem["itemNo"].ToString();
var declaId = rtnItemList["declaId"].ToString();
var syncId = rtnItemList["id"].ToString();
//UpdateStkInventoryInfo(id, 1, itemNo, declaId, syncId);
//InserSyncRecord(id, 1, itemNo, declaId, syncId);
}
ExecuteOperateResult(opResult, itemNo, msg, rtnFlag);
}
}
else
{
ExecuteOperateResult(opResult, itemNo, resData["msg"].ToString(), false);
}
}
}
}
}
}
}

View File

@@ -0,0 +1,26 @@
using Kingdee.BOS;
using Kingdee.BOS.Core.DynamicForm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EastChanger.STK_StockCountLoss
{
/// <summary>
/// 盘亏单
/// </summary>
public class STKStockCountLossService : BaseService, ISynchonService
{
public STKStockCountLossService(Context context) : base(context, "", "海关信息同步")
{
}
public string ModuleCnName => throw new NotImplementedException();
public void HandleSyncData(List<string> idList, IOperationResult opResult)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,60 @@
using EastChanger.STK_Inventory;
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"://其他入库单
case "STK_MisDelivery"://其他出库单
case "STK_StockCountGain"://盘盈单
case "STK_StockCountLoss"://盘亏单
break;
}
if (service == null)
continue;
Logger.Info(schedule.Name, $"{service.ModuleCnName}数据同步start...");
service.HandleSyncData(null, null);
Logger.Info(schedule.Name, $"{service.ModuleCnName}数据同步end...");
}
}
catch (Exception ex)
{
Logger.Error(schedule.Name, ex.Message, ex);
}
finally
{
Logger.Info(schedule.Name, "执行同步数据至海关end...");
}
}
}
}