|
|
|
@ -11,6 +11,10 @@ using System.Linq; |
|
|
|
using System.Text; |
|
|
|
using TSingSoft.WebPluginFramework.BIPlugins.BLEvents; |
|
|
|
using TSingSoft.WebPluginFramework; |
|
|
|
using BWP.B3Frameworks.Utils; |
|
|
|
using BWP.B3ExportBase.BO; |
|
|
|
using Forks.JsonRpc.Client; |
|
|
|
using Newtonsoft.Json; |
|
|
|
|
|
|
|
namespace BWP.B3QingDaoWanFu.BL |
|
|
|
{ |
|
|
|
@ -23,6 +27,8 @@ namespace BWP.B3QingDaoWanFu.BL |
|
|
|
|
|
|
|
void Stop(string code); |
|
|
|
|
|
|
|
void Start(string code); |
|
|
|
|
|
|
|
void Delete(string code); |
|
|
|
} |
|
|
|
|
|
|
|
@ -30,6 +36,7 @@ namespace BWP.B3QingDaoWanFu.BL |
|
|
|
[ExportID(B3FrameworksConsts.DmoTypeIDBases.B3QingDaoWanFu, B3QingDaoWanFuConsts.DmoTypeIDOffsets.GoodsExport)] |
|
|
|
public class GoodsExportBL : ExportBaseBL<Goods>, IGoodsExportBL |
|
|
|
{ |
|
|
|
const string MethodPath = "/MainSystem/B3ClientService/Rpcs/InterfaceRpc/GoodsRpc/"; |
|
|
|
protected override void BeforeExport(List<long> dmoIDs) |
|
|
|
{ |
|
|
|
Dmos = new List<Goods>(); |
|
|
|
@ -58,22 +65,71 @@ namespace BWP.B3QingDaoWanFu.BL |
|
|
|
return; |
|
|
|
} |
|
|
|
LoadMinDmo(Dmos, dmoIDs); |
|
|
|
} |
|
|
|
|
|
|
|
private string _serverUrl; |
|
|
|
|
|
|
|
scriptHelper.After(); |
|
|
|
protected string ServerUrl |
|
|
|
{ |
|
|
|
get { return _serverUrl; } |
|
|
|
set { _serverUrl = value; } |
|
|
|
} |
|
|
|
|
|
|
|
public void Export(List<long> dmoIDs, long extSystemID) |
|
|
|
{ |
|
|
|
if (dmoIDs.Count == 0) |
|
|
|
throw new Exception("没有要导出的内容"); |
|
|
|
ExtSystemID = extSystemID; |
|
|
|
_serverUrl = InnerBLUtil.GetDmoPropertyByID<string>(Session, typeof(ExtSystem), "Address", extSystemID); |
|
|
|
if (string.IsNullOrEmpty(_serverUrl)) |
|
|
|
throw new Exception("外部系统地址不能为空"); |
|
|
|
BeforeExport(dmoIDs); |
|
|
|
DoExport(dmoIDs); |
|
|
|
} |
|
|
|
|
|
|
|
private void DoExport(List<long> dmoIDs) |
|
|
|
{ |
|
|
|
var scriptHelper = new PythonScriptHelper(string.Empty, Config.Script, this); |
|
|
|
var dmos = Dmos.OrderBy(x => x.ID).ToList(); |
|
|
|
scriptHelper.AddLocalVar("dmos", dmos); |
|
|
|
scriptHelper.Execute(); |
|
|
|
InitRpc(); |
|
|
|
var json = JsonConvert.SerializeObject(dmos); |
|
|
|
RpcFacade.Call<int>(MethodPath + "BatchImport", json); |
|
|
|
BIFactory.MsgBuilder.Append("导出成功!"); |
|
|
|
} |
|
|
|
|
|
|
|
public void UpdateOrInsert(Goods goods) |
|
|
|
{ } |
|
|
|
{ |
|
|
|
RpcFacade.Call<int>(MethodPath + "UpdateOrInsert", JsonConvert.SerializeObject(goods)); |
|
|
|
} |
|
|
|
|
|
|
|
public void Stop(string code) |
|
|
|
{ } |
|
|
|
{ |
|
|
|
RpcFacade.Call<int>(MethodPath + "Stop", code); |
|
|
|
} |
|
|
|
|
|
|
|
public void Start(string code) |
|
|
|
{ |
|
|
|
RpcFacade.Call<int>(MethodPath + "Start", code); |
|
|
|
} |
|
|
|
|
|
|
|
public void Delete(string code) |
|
|
|
{ } |
|
|
|
{ |
|
|
|
RpcFacade.Call<int>(MethodPath + "Delete", code); |
|
|
|
} |
|
|
|
|
|
|
|
void InitRpc() |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
RpcFacade.Init(_serverUrl, "B3QingFu"); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
if (ex.Message != "Can only start once") |
|
|
|
throw; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |