using Muchinfo.MTPClient.Adapter.Abstract;
using Muchinfo.MTPClient.Data;
using Muchinfo.MTPClient.Data.Model.Delivery;
using Muchinfo.MTPClient.Infrastructure.LinkProxy;
using Muchinfo.MTPClient.Infrastructure.Utilities;
using Muchinfo.MTPClient.IService;
using Muchinfo.MTPClient.NetworkCore;
using Muchinfo.MTPClient.Resources;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Muchinfo.MTPClient.Service.Utilities;
using Muchinfo.MTPClient.Data.Enums;
namespace Muchinfo.MTPClient.Service
{
///
/// 交收功能服务接口实现
///
public class DeliveryService : IDeliveryService
{
private DeliveryAdapter _deliveryAdapter;
public DeliveryService()
{
_deliveryAdapter = LinkManager.Instance.TradeAdapterFactory.CreateDeliveryAdapter();
}
///
/// 下交割申报
///
/// 交割内容
/// 成功回应
/// 失败回应
public void DeliveryApplyOrder(DeliveryOrderReqModel deliveryOrder, Action successAction,
Action errorAction)
{
var reqeust = _deliveryAdapter.ToDeliveryApplyReqOrder(deliveryOrder);
var packgage = new TCPPackage() { Content = reqeust, FunCode = FuncCode.FID_DeliveryOrderReq };
LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action((revPackgage) =>
{
var responeEntrity = _deliveryAdapter.ToDeliveryApplyRspOrder(revPackgage.Content);
//if (responeEntrity.RetCode == 0)
//{
// if (successAction != null)
// {
// //todo:生成委托单
// successAction(responeEntrity.Entity);
// }
//}
//else
//{
// if (errorAction != null)
// {
// //RequestFunc = 交割申报
// errorAction(new ErrorEntity() { ReturnCode = responeEntrity.RetCode, ReturnDesc = responeEntrity.RetMessage, RequestFunc = Client_Resource.Resources_Service_DeliveryApply });
// }
//}
}), new Action((errorCode, errorDesc) =>
{ ////通信错误
//if (errorAction != null)
//{
// errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Resources_Service_DeliveryApply });
//}
}));
}
///
/// 查询交收单详情
///
/// 交割单
///
///
public void QueryDeliveryHoldersMoreDetail(uint DeliveryId, Action> successAction, Action errorAction)
{
var queryCommonParams = new List();
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "deliveryid", ParamValue = DeliveryId + string.Empty });
QueryCommonHelper.QueryCommon(QueryStatement.QueryDeliveryHolderDetail, queryCommonParams,
new Action>((orderDetails) =>
{
if (successAction != null)
{
successAction(orderDetails);
}
}), (error) =>
{
if (errorAction != null)
{
//RequestFunc = 查询交收单详情
error.RequestFunc = Client_Resource.Resources_Service_QueryDeliveryHoldersMoreDetail;
errorAction(error);
}
});
}
///
/// 查询提货详情
///
/// 仓单ID
///
///
public void QueryTakeGoodsMoreDetail(long STOREOUTID, Action> successAction, Action errorAction)
{
var queryCommonParams = new List();
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "STOREOUTID", ParamValue = STOREOUTID + string.Empty });
QueryCommonHelper.QueryCommon(QueryStatement.QueryTakeGoodsMoreDetail, queryCommonParams,
new Action>((orderDetails) =>
{
if (successAction != null)
{
successAction(orderDetails);
}
}), (error) =>
{
if (errorAction != null)
{
//RequestFunc = 查询提货详情
error.RequestFunc = Client_Resource.Resources_Service_QueryTakeGoodsMoreDetail;
errorAction(error);
}
});
}
///
/// 查询交割单
///
///
///
///
///
///
public void QueryDeliveryHolders(ulong AccountId, DateTime strarTime, DateTime endTime,
Action> successAction, Action errorAction)
{
var queryCommonParams = new List();
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "accountid", ParamValue = AccountId + string.Empty });
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "startDate", ParamValue = strarTime.ToString("yyyy-MM-dd") });
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "endDate", ParamValue = endTime.Date.ToString("yyyy-MM-dd") });
QueryCommonHelper.QueryCommon(QueryStatement.QueryDeliveryHolder, queryCommonParams,
new Action>((orderDetails) =>
{
//UserManager.UpdateCacheOrder(orderDetails);
if (successAction != null)
{
successAction(orderDetails);
}
}), (error) =>
{
if (errorAction != null)
{
//RequestFunc = 查询交割单
error.RequestFunc = Client_Resource.Resources_Service_QueryDeliveryHolders;
errorAction(error);
}
});
}
///
/// 查询申报单
///
///
///
///
///
///
public void QueryDeliveryEntrustOrders(ulong AccountId, DateTime strarTime, DateTime endTime, Action> successAction, Action errorAction)
{
var queryCommonParams = new List();
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "accointId", ParamValue = AccountId + string.Empty });
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "startDate", ParamValue = strarTime.ToString("yyyy-MM-dd") });
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "endDate", ParamValue = endTime.Date.ToString("yyyy-MM-dd") });
QueryCommonHelper.QueryCommon(QueryStatement.QueryDeliverEntrustOrder, queryCommonParams,
new Action>((orderDetails) =>
{
//UserManager.UpdateCacheOrder(orderDetails);
if (successAction != null)
{
successAction(orderDetails);
}
}), (error) =>
{
if (errorAction != null)
{
//RequestFunc = 查询申报单
error.RequestFunc = Client_Resource.Resources_Service_QueryDeliveryEntrustOrders;
errorAction(error);
}
});
}
///
/// 仓单查询
///
///
///
///
///
///
public void QueryDeliveryWarehouseOrders(SearchWarehouseOrdersType warehouseType,string WRCode, ulong accountId, DateTime strarTime, DateTime endTime,
Action> successAction,
Action errorAction)
{
var queryCommonParams = new List();
if (warehouseType == SearchWarehouseOrdersType.AccountId)
{
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "accountId", ParamValue = accountId + string.Empty });
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "startDate", ParamValue = strarTime.ToString("yyyy-MM-dd") });
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "endDate", ParamValue = endTime.Date.ToString("yyyy-MM-dd") });
}
else
{
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "WRCode", ParamValue = WRCode + string.Empty });
}
QueryCommonHelper.QueryCommon(QueryStatement.SearchDeliveryWarehouseOrder, queryCommonParams,
new Action>((orderDetails) =>
{
UserManager.UpdateCacheOrder(orderDetails);
if (successAction != null)
{
successAction(orderDetails);
}
}), (error) =>
{
if (errorAction != null)
{
//RequestFunc = 仓单查询
error.RequestFunc = Client_Resource.Resources_Service_QueryDeliveryWarehouseOrders;
errorAction(error);
}
});
}
///
/// 仓单配对查询
///
///
///
///
public void QueryDeliveryMatchOrders(uint DeliveryGoodsId, Action> successAction, Action errorAction)
{
var queryCommonParams = new List();
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "DeliveryGoodsId", ParamValue = DeliveryGoodsId + string.Empty });
QueryCommonHelper.QueryCommon(QueryStatement.SearchDeliveryMatchOrder, queryCommonParams,
new Action>((orderDetails) =>
{
UserManager.UpdateCacheOrder(orderDetails);
if (successAction != null)
{
successAction(orderDetails);
}
}), (error) =>
{
if (errorAction != null)
{
//RequestFunc = 仓单配对查询
error.RequestFunc = Client_Resource.Resources_Service_QueryDeliveryMatchOrders;
errorAction(error);
}
});
}
///
/// 提交仓单配对
///
/// 配对仓单内容
/// 成功回应
/// 失败回应
public void SubmitDeliveryMatchOrder(DeliveryOrderMatchReqModel deliveryMatchOrder, Action successAction,
Action errorAction)
{
return;
//var reqeust = _deliveryAdapter.ToDeliveryMatchReqOrder(deliveryMatchOrder);
//var packgage = new TCPPackage() { Content = reqeust, FunCode = FuncCode.FID_DeliveryOrderMatchReq };
//LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action((revPackgage) =>
//{
// var responeEntrity = _deliveryAdapter.ToDeliveryMatchRspOrder(revPackgage.Content);
// if (responeEntrity.RetCode == 0)
// {
// //todo:生成委托单
// successAction(responeEntrity.Entity);
// }
// else
// {
// if (errorAction != null)
// {
// //RequestFunc = 提交仓单配对
// errorAction(new ErrorEntity() { ReturnCode = responeEntrity.RetCode, ReturnDesc = responeEntrity.RetMessage, RequestFunc = Client_Resource.Resources_Service_SubmitDeliveryMatchOrder });
// }
// }
//}), new Action((errorCode, errorDesc) =>
//{ ////通信错误
// if (errorAction != null)
// {
// errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Resources_Service_SubmitDeliveryMatchOrder });
// }
//}));
}
///
/// 查询提货仓单
///
/// 账号
/// 开始时间
/// 结束时间
///
///
public void QueryTakaDeliveryGoodsOrders(ulong AccountId, DateTime strarTime, DateTime endTime,
Action> successAction,
Action errorAction)
{
var queryCommonParams = new List();
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "accountId", ParamValue = AccountId + string.Empty });
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "startDate", ParamValue = strarTime.ToString("yyyy-MM-dd") });
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "endDate", ParamValue = endTime.Date.ToString("yyyy-MM-dd HH:mm:ss") });
QueryCommonHelper.QueryCommon(QueryStatement.SearchTakaDeliveryGoodsQuery, queryCommonParams,
new Action>((orderDetails) =>
{
UserManager.UpdateCacheOrder(orderDetails);
if (successAction != null)
{
successAction(orderDetails);
}
}), (error) =>
{
if (errorAction != null)
{
//RequestFunc = 查询提货仓单
error.RequestFunc = Client_Resource.Resources_Service_QueryTakaDeliveryGoodsOrders;
errorAction(error);
}
});
}
///
/// 提货申请-查询
///
///
///
///
public void QueryTakaDeliveryGoodsOrdersAppy(ulong accountId, Action> successAction, Action errorAction)
{
var queryCommonParams = new List();
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "accountId", ParamValue = accountId + string.Empty });
QueryCommonHelper.QueryCommon(QueryStatement.SearchTakaDeliveryGoodsApply, queryCommonParams,
new Action>((orderDetails) =>
{
UserManager.UpdateCacheOrder(orderDetails);
if (successAction != null)
{
successAction(orderDetails);
}
}), (error) =>
{
if (errorAction != null)
{
//RequestFunc = 提货申请查询
error.RequestFunc = Client_Resource.Resources_Service_QueryTakaDeliveryGoodsOrdersAppy;
errorAction(error);
}
});
}
///
/// 交易商品-交割关系表-配置信息
///
///
///
///
public void QueryDeliveryGoodsRelationConfig(uint goodsId, Action> successAction, Action errorAction)
{
var queryCommonParams = new List();
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "goodsId", ParamValue = goodsId + string.Empty });
QueryCommonHelper.QueryCommon(QueryStatement.SearchDeliveryGoodsRelationConfig, queryCommonParams,
new Action>((configDetails) =>
{
UserManager.UpdateCacheOrder(configDetails);
if (successAction != null)
{
successAction(configDetails);
}
}), (error) =>
{
if (errorAction != null)
{
//RequestFunc = 交易商品配置信息
error.RequestFunc = Client_Resource.Resources_Service_Complete;
errorAction(error);
}
});
}
///
/// 交易商品-交割规则查询
///
///
///
///
///
public void QueryDeliveryRule(uint deliveryGoodsId,uint ruleId, Action> successAction, Action errorAction)
{
var queryCommonParams = new List();
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "deliverygoodsid", ParamValue = deliveryGoodsId + string.Empty });
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "ruleid", ParamValue = ruleId + string.Empty });
QueryCommonHelper.QueryCommon(QueryStatement.queryDeliveryRuleVal, queryCommonParams,
new Action>((ruleDetails) =>
{
UserManager.UpdateCacheOrder(ruleDetails);
if (successAction != null)
{
successAction(ruleDetails);
}
}), (error) =>
{
if (errorAction != null)
{
//RequestFunc = 交割规则查询
error.RequestFunc = Client_Resource.Resources_Service_QueryDeliveryRule;
errorAction(error);
}
});
}
///
/// 提交-提货申请/撤销:OperateType操作类型:1=>申请,2=>撤销
///
/// 提货申请内容
/// 成功回应
/// 失败回应
public void SubmitOutStoreReq(OutStoreReqModel reqModel, Action successAction,
Action errorAction)
{
return;
//var reqeust = _deliveryAdapter.ToOutStoreReq(reqModel);
//var packgage = new TCPPackage() { Content = reqeust, FunCode = FuncCode.FID_OutStoreReq };
//LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action((revPackgage) =>
//{
// var responeEntrity = _deliveryAdapter.ToOutStoreRsp(revPackgage.Content);
// if (responeEntrity.RetCode == 0)
// {
// //todo:生成委托单
// successAction(responeEntrity.Entity);
// }
// else
// {
// if (errorAction != null)
// {
// //RequestFunc = 提货申请
// errorAction(new ErrorEntity() { ReturnCode = responeEntrity.RetCode, ReturnDesc = responeEntrity.RetMessage, RequestFunc = Client_Resource.Resources_Service_SubmitOutStoreReq });
// }
// }
//}), new Action((errorCode, errorDesc) =>
//{ ////通信错误
// if (errorAction != null)
// {
// errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Resources_Service_SubmitOutStoreReq });
// }
//}));
}
///
/// 确认-交收现货付款请求
///
///
///
///
public void SubmitReceiveConfirmReq(ReceiveConfirmReqModel reqModel, Action successAction,
Action errorAction)
{
var reqeust = _deliveryAdapter.ToReceiveConfirmReq(reqModel);
var packgage = new TCPPackage() { Content = reqeust, FunCode = FuncCode.FID_ReceiveConfirmReq };
LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action((revPackgage) =>
{
var responeEntrity = _deliveryAdapter.ToReceiveConfirmRsp(revPackgage.Content);
if (responeEntrity.RetCode == 0)
{
//todo:生成委托单
successAction(responeEntrity.Entity);
}
else
{
if (errorAction != null)
{
//RequestFunc = 交收现货付款请求
errorAction(new ErrorEntity() { ReturnCode = responeEntrity.RetCode, ReturnDesc = responeEntrity.RetMessage, RequestFunc = Client_Resource.Resources_Service_ReceiveConfirmReq });
}
}
}), new Action((errorCode, errorDesc) =>
{ ////通信错误
if (errorAction != null)
{
errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Resources_Service_ReceiveConfirmReq });
}
}));
}
///
/// 查询配对仓单请求
///
/// 查询配对仓单内容
/// 成功回应
/// 失败回应
public void SearchMatchWarehouseReq(WrPairReqModel reqModel, Action successAction,
Action errorAction)
{
return;
//var reqeust = _deliveryAdapter.ToWrPairReq(reqModel);
//var packgage = new TCPPackage() { Content = reqeust, FunCode = FuncCode.FID_WrPairReq };
//LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action((revPackgage) =>
//{
// var responeEntrity = _deliveryAdapter.ToWrPairRsp(revPackgage.Content);
// if (responeEntrity.RetCode == 0)
// {
// //todo:生成委托单
// successAction(responeEntrity.Entity);
// }
// else
// {
// if (errorAction != null)
// {
// //RequestFunc = 查询配对仓单请求
// errorAction(new ErrorEntity() { ReturnCode = responeEntrity.RetCode, ReturnDesc = responeEntrity.RetMessage, RequestFunc = Client_Resource.Resources_Service_SearchMatchWarehouseReq });
// }
// }
//}), new Action((errorCode, errorDesc) =>
//{ ////通信错误
// if (errorAction != null)
// {
// errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Resources_Service_SearchMatchWarehouseReq });
// }
//}));
}
///
/// 查询交割关系表LIST
///
///
///
public void QueryGoodsDeliveryRelationList(Action> successAction, Action errorAction)
{
var queryCommonParams = new List();
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "deliverygoodsid", ParamValue = string.Empty });
QueryCommonHelper.QueryCommon(QueryStatement.SearchGoodsDeliveryRelationList, queryCommonParams,
new Action>((itemDetails) =>
{
if (successAction != null)
{
successAction(itemDetails);
}
}), (error) =>
{
if (errorAction != null)
{
//RequestFunc = 查询交割关系表
error.RequestFunc = Client_Resource.Resources_Service_QueryGoodsDeliveryRelationList;
errorAction(error);
}
});
}
///
/// 查询P+X交割商品信息
///
///
///
public void QueryRelationPAndXGoodsInfoList(Action> successAction, Action errorAction)
{
var queryCommonParams = new List();
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "deliverygoodsid", ParamValue = string.Empty });
QueryCommonHelper.QueryCommon(QueryStatement.SearchRelationPAndXGoodsInfo, queryCommonParams,
new Action>((itemDetails) =>
{
if (successAction != null)
{
successAction(itemDetails);
}
}), (error) =>
{
if (errorAction != null)
{
//RequestFunc = 查询P+X交割商品信息
error.RequestFunc = Client_Resource.Resources_Service_QueryRelationPAndXGoodsInfoList;
errorAction(error);
}
});
}
///
/// 交割成交单查询
///
///
///
///
///
///
public void QueryDeliveryComplete(ulong AccountId, DateTime strarTime, DateTime endTime, Action> successAction, Action errorAction)
{
var queryCommonParams = new List();
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "accountId", ParamValue = AccountId + string.Empty });
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "startDate", ParamValue = strarTime.ToString("yyyy-MM-dd") });
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "endDate", ParamValue = endTime.Date.ToString("yyyy-MM-dd HH:mm:ss") });
QueryCommonHelper.QueryCommon(QueryStatement.SearchDeliveryComplete, queryCommonParams,
new Action>((completes) =>
{
if (successAction != null)
{
successAction(completes);
}
}), (error) =>
{
if (errorAction != null)
{
error.RequestFunc = Client_Resource.Resources_Service_Complete;
errorAction(error);
}
});
}
///
/// 申报点选仓单查询MTP2.0
///
///
///
///
///
public void QueryDeliveryWhRecieptInfo(ulong accountId, uint deliveryGoodsId, Action> successAction, Action errorAction)
{
var queryCommonParams = new List();
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "accountId", ParamValue = accountId + string.Empty });
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "goodsid", ParamValue = deliveryGoodsId + string.Empty });
QueryCommonHelper.QueryCommon(QueryStatement.SearchDeliveryWhRecieptInfo, queryCommonParams,
new Action>((itemDetails) =>
{
if (successAction != null)
{
successAction(itemDetails);
}
}), (error) =>
{
if (errorAction != null)
{
//RequestFunc = 卖交割仓单信息查询
error.RequestFunc = Client_Resource.Resources_Service_QueryDeliveryWhRecieptInfo;
errorAction(error);
}
});
}
///
/// 交割提货个人信息查询请求
///
/// 交割提货个人信息查询请求内容
/// 成功回应
/// 失败回应
public void SearchDepositPersonalInfoReq(DepositPersonalInfoReqModel reqModel, Action successAction,
Action errorAction)
{
return;
//var reqeust = _deliveryAdapter.ToDepositPersonalInfoReq(reqModel);
//var packgage = new TCPPackage() { Content = reqeust, FunCode = FuncCode.FID_DepositPersonalInfoReq };
//LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action((revPackgage) =>
//{
// var responeEntrity = _deliveryAdapter.ToDepositPersonalInfoRsp(revPackgage.Content);
// if (responeEntrity.RetCode == 0)
// {
// //todo:生成委托单
// successAction(responeEntrity.Entity);
// }
// else
// {
// if (errorAction != null)
// {
// //RequestFunc = 交割提货个人信息查询请求
// errorAction(new ErrorEntity() { ReturnCode = responeEntrity.RetCode, ReturnDesc = responeEntrity.RetMessage, RequestFunc = Client_Resource.Resources_Service_SearchDepositPersonalInfoReq });
// }
// }
//}), new Action((errorCode, errorDesc) =>
//{ ////通信错误
// if (errorAction != null)
// {
// errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Resources_Service_SearchDepositPersonalInfoReq });
// }
//}));
}
///
/// 仓单变更流水查询
///
/// 变更操作人
/// 仓单号
///
///
public void SearchWRChangeFlow(uint ChangeOperator, string WRCode, Action> successAction, Action errorAction)
{
var queryCommonParams = new List();
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "ChangeOperator", ParamValue = ChangeOperator + string.Empty });
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "WRCode", ParamValue = WRCode + string.Empty });
QueryCommonHelper.QueryCommon(QueryStatement.SearchWRChangeFlowData, queryCommonParams,
new Action>((itemDetails) =>
{
if (successAction != null)
{
successAction(itemDetails);
}
}), (error) =>
{
if (errorAction != null)
{
//RequestFunc = 仓单变更流水查询
error.RequestFunc = Client_Resource.Resources_Service_SearchWRChangeFlow;
errorAction(error);
}
});
}
///
/// 查询履约计划明细
///
/// 变更操作人
/// 履约计划id
///
///
public void SearchDeliveryPerformDetailPlan(long PlanId, bool isHistory , Action> successAction, Action errorAction)
{
var queryCommonParams = new List();
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "deliveryid", ParamValue = PlanId + string.Empty });
var statement =isHistory?QueryStatement.QueryDeliveryHistoryPerformDetailPlan :QueryStatement.QueryDeliveryPerformDetailPlan;
QueryCommonHelper.QueryCommon(statement, queryCommonParams,
new Action>((itemDetails) =>
{
if (successAction != null)
{
successAction(itemDetails);
}
}), (error) =>
{
if (errorAction != null)
{
//RequestFunc = 查询履约计划明细
error.RequestFunc = Client_Resource.Resources_Service_SearchDeliveryPerformDetailPlan;
errorAction(error);
}
});
}
///
/// 交割关系配置查询
///
/// 交割关系id
///
///
public void SearchRelationPerformConfig(long RelationId, Action> successAction, Action errorAction)
{
var queryCommonParams = new List();
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "RelationId", ParamValue = RelationId + string.Empty });
QueryCommonHelper.QueryCommon(QueryStatement.SearchRelationPerformConfig, queryCommonParams,
new Action>((itemDetails) =>
{
UserManager.UpdateCacheOrder(itemDetails);
if (successAction != null)
{
successAction(itemDetails);
}
}), (error) =>
{
if (errorAction != null)
{
//RequestFunc = 交割关系配置查询
error.RequestFunc = Client_Resource.Resources_Service_SearchRelationPerformConfig;
errorAction(error);
}
});
}
///
/// 查询账号某商品的仓单
///
///
///
///
///
public void QueryDeliveryWarehouseOrders(ulong accountId, uint deliveryGoodsId, Action> successAction, Action errorAction)
{
var queryCommonParams = new List();
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "accountId", ParamValue = accountId + string.Empty });
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "DeliveryGoodsId", ParamValue = deliveryGoodsId+string.Empty });
QueryCommonHelper.QueryCommon(QueryStatement.SearchDeliveryWarehouseOrder, queryCommonParams,
new Action>((orderDetails) =>
{
UserManager.UpdateCacheOrder(orderDetails);
if (successAction != null)
{
successAction(orderDetails);
}
}), (error) =>
{
if (errorAction != null)
{
//RequestFunc = 仓单查询
error.RequestFunc = Client_Resource.Resources_Service_QueryDeliveryWarehouseOrders;
errorAction(error);
}
});
}
///
/// 仓单Id
///
///
///
///
public void QueryDeliveryWarehouseOrders(uint wrid, Action> successAction, Action errorAction)
{
var queryCommonParams = new List();
queryCommonParams.Add(new QueryCommonParam() { ParamKey = "WRID", ParamValue = wrid + string.Empty });
QueryCommonHelper.QueryCommon(QueryStatement.SearchDeliveryWarehouseOrder, queryCommonParams,
new Action>((orderDetails) =>
{
UserManager.UpdateCacheOrder(orderDetails);
if (successAction != null)
{
successAction(orderDetails);
}
}), (error) =>
{
if (errorAction != null)
{
//RequestFunc = 仓单查询
error.RequestFunc = Client_Resource.Resources_Service_QueryDeliveryWarehouseOrders;
errorAction(error);
}
});
}
///
/// 交割申报单查询
///
///
///
///
///
public void QueryDeliveryDeclareByCapitalAccount(string statement, List queryCommonParams,
Action> successAction, Action errorAction)
{
QueryCommonHelper.QueryCommon(statement, queryCommonParams, new Action>((deliveryLst) =>
{
if (successAction != null)
{
successAction(deliveryLst);
}
}), (error) =>
{
if (errorAction != null)
{
error.RequestFunc = Client_Resource.Resources_Service_QueryHoldingDetails;
errorAction(error);
}
});
}
public void QueryDryOrdersByCapitalAccount(string statement, List queryCommonParams,
Action> successAction, Action errorAction)
{
QueryCommonHelper.QueryCommon(statement, queryCommonParams, new Action>((deliveryLst) =>
{
if (successAction != null)
{
successAction(deliveryLst);
}
}), (error) =>
{
if (errorAction != null)
{
error.RequestFunc = Client_Resource.Resources_Service_QueryDeliveryHolders;
errorAction(error);
}
});
}
public void QueryDeliveryWarehouseOrdersNew(uint goodsId, uint deliveryGoodsId, uint tradeProperty,
Action successAction,
Action errorAction)
{
var reqeust = _deliveryAdapter.ToDeliveryWRReq(goodsId, deliveryGoodsId, tradeProperty);
var packgage = new TCPPackage() { Content = reqeust, FunCode = FuncCode.FID_DeliveryWRReq };
LinkManager.Instance.TradeTcpLinkProxy.SendPackage(packgage, new Action((revPackgage) =>
{
var responeEntrity = _deliveryAdapter.ToDeliveryWRRsp(revPackgage.Content);
if (responeEntrity.RetCode == 0)
{
//todo:生成委托单
successAction(responeEntrity.Entity);
}
else
{
if (errorAction != null)
{
//RequestFunc = 交割提货个人信息查询请求
errorAction(new ErrorEntity() { ReturnCode = responeEntrity.RetCode, ReturnDesc = responeEntrity.RetMessage, RequestFunc = Client_Resource.Resources_Service_SearchDepositPersonalInfoReq });
}
}
}), new Action((errorCode, errorDesc) =>
{ ////通信错误
if (errorAction != null)
{
errorAction(new ErrorEntity() { ReturnCode = errorCode, ReturnDesc = errorDesc, RequestFunc = Client_Resource.Resources_Service_SearchDepositPersonalInfoReq });
}
}));
}
}
}