从山证v2.3.0拷贝
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
using DotNetDBF;
|
||||
using SocialExplorer.IO.FastDBF;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using YLErp.Modules.TradeMsgOutputModule.Dto;
|
||||
|
||||
namespace YLErp.Modules.TradeMsgOutputModule.Company
|
||||
{
|
||||
/// <summary>
|
||||
/// 东莞持仓PV文件生成服务
|
||||
/// </summary>
|
||||
public class DongWanPVPostionFileGenerateService: BaseDongWanFileGenerateService
|
||||
{
|
||||
private string _fileNamePrefix = "GXGTSXGZSJ";
|
||||
|
||||
public override GenerateDbfFileResult GenerateDbfFile(DateTime valueDate)
|
||||
{
|
||||
var result = new GenerateDbfFileResult();
|
||||
var positionList = new TradePvOutputService().GetTradePositionPV<eod_trade_position>(valueDate);
|
||||
if (positionList == null || positionList.Count == 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
string filePath = "";
|
||||
var dbffile = CreateFile(_fileNamePrefix, valueDate,out filePath);
|
||||
positionList.ForEach(p =>
|
||||
{
|
||||
var orec = new DbfRecord(dbffile.Header) { AllowDecimalTruncate = true };
|
||||
orec["cjrq"] = p.ValueDate.ToString("yyyy-MM-dd");
|
||||
orec["htxh"] = p.TradeNumber;
|
||||
orec["Ywlb"] = GetYWLBByTradeType(p.TradeType);
|
||||
|
||||
orec["qybdsy"] = p.EquitySubjectPV.ToString();
|
||||
orec["gdlvsy"] = p.FixedInterestRatePV.ToString();
|
||||
orec["htsyje"] = p.PV.ToString();
|
||||
orec["Bmdm"] = GetBmdmByAssetGroupName(p.AssetUnitGroupName);
|
||||
dbffile.Write(orec);
|
||||
|
||||
});
|
||||
dbffile.Close();
|
||||
|
||||
var fileName = GetFileName(_fileNamePrefix, valueDate);
|
||||
result.FileName = fileName;
|
||||
//上传Ftp
|
||||
result.FilePath = UploadFile(filePath, fileName);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected override List<DbfColumn> GetDbfFileColumns()
|
||||
{
|
||||
return new List<DbfColumn> {
|
||||
new DbfColumn("cjrq", DbfColumn.DbfColumnType.Date),
|
||||
new DbfColumn("htxh", DbfColumn.DbfColumnType.Character,50,0),
|
||||
new DbfColumn("Ywlb", DbfColumn.DbfColumnType.Character,6,0),
|
||||
new DbfColumn("qybdsy", DbfColumn.DbfColumnType.Number,19,4),
|
||||
new DbfColumn("gdlvsy", DbfColumn.DbfColumnType.Number,19,4),
|
||||
new DbfColumn("htsyje", DbfColumn.DbfColumnType.Number,19,4),
|
||||
new DbfColumn("Bmdm", DbfColumn.DbfColumnType.Character,10,0)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user