Compare commits

..

No commits in common. "4c1f2399af75e7a3cce8abafd06a9f824f12cd37" and "5d536fdcad23186bef39c015348788a4013da1a1" have entirely different histories.

9 changed files with 140 additions and 289 deletions

View File

@ -38,11 +38,7 @@ bool UActorUEJSComponent::JsMessageDispatch(const FString& message)
OnJsMessageCallbackDelegate.Broadcast(result); OnJsMessageCallbackDelegate.Broadcast(result);
} }
}); });
return Scenario->Load();
const FString rwbs = jsonObject->GetStringField(TEXT("rwbs"));
const FString rq = jsonObject->GetStringField(TEXT("rq"));
const FString bc = jsonObject->GetStringField(TEXT("bc"));
return Scenario->LoadMissionData(rwbs, rq, bc);
} }
else if (TEXT("LoadScenarioTask") == func) { else if (TEXT("LoadScenarioTask") == func) {
@ -56,11 +52,7 @@ bool UActorUEJSComponent::JsMessageDispatch(const FString& message)
}); });
const FString year = jsonObject->GetStringField(TEXT("year")); const FString year = jsonObject->GetStringField(TEXT("year"));
if (year.IsEmpty()) return Scenario->LoadRWBS(TCHAR_TO_UTF8(*year));
{
return false;
}
return Scenario->LoadRWBS(year);
} }
else if (TEXT("SelectScenarioTask") == func) { else if (TEXT("SelectScenarioTask") == func) {
auto Scenario = TDMScenario::Create(); auto Scenario = TDMScenario::Create();
@ -73,10 +65,6 @@ bool UActorUEJSComponent::JsMessageDispatch(const FString& message)
}); });
const FString task = jsonObject->GetStringField(TEXT("task")); const FString task = jsonObject->GetStringField(TEXT("task"));
if (task.IsEmpty())
{
return false;
}
return Scenario->LoadBCSJ(task); return Scenario->LoadBCSJ(task);
} }

View File

@ -12,29 +12,11 @@
#include "DMRunnable.h" #include "DMRunnable.h"
#include "UEDMPlugin.h" #include "UEDMPlugin.h"
struct BCData struct SQLData
{ {
int64 timestamp; int64 timestamp;
int32 bc; int32 bc;
FString yxr; std::string yxr;
int32 count;
FString jx;
};
struct HKBData
{
FString bdid;
FString jx; //型号
FString jh; //机号
FString qc_dh; //编号
FString zy; //阵营
FString dwjc; //单位简称
FString dwdm; //单位代码
FString fxsj_ly; //数据来源
FString hc_dm; //后舱代号
FString hc_xm; //后舱姓名
FString txbg_sk; //体系摧毁时刻
FString rwlx; //执行任务
}; };
FString GBKToUTF8(const char* gbkStr) FString GBKToUTF8(const char* gbkStr)
@ -86,24 +68,22 @@ std::string UTF8ToGBK(const FString& str)
return std::string(gbkStr.begin(), gbkStr.end()); return std::string(gbkStr.begin(), gbkStr.end());
} }
TSharedPtr<FJsonObject> ConvertSQLDataToJson(const BCData& data) TSharedPtr<FJsonObject> ConvertSQLDataToJson(const SQLData& data)
{ {
TSharedPtr<FJsonObject> JsonObject = MakeShareable(new FJsonObject()); TSharedPtr<FJsonObject> JsonObject = MakeShareable(new FJsonObject());
JsonObject->SetNumberField("timestamp", data.timestamp); JsonObject->SetNumberField("timestamp", data.timestamp);
JsonObject->SetNumberField("bc", data.bc); JsonObject->SetNumberField("bc", data.bc);
JsonObject->SetStringField("yxr", data.yxr); JsonObject->SetStringField("yxr", FString(data.yxr.c_str()));
JsonObject->SetNumberField("count", data.count);
JsonObject->SetStringField("jx", data.jx);
return JsonObject; return JsonObject;
} }
FString ConvertSQLDataVectorToJson(const FString& response, const std::vector<BCData>& dataVector) FString ConvertSQLDataVectorToJson(const FString& response, const std::vector<SQLData>& dataVector)
{ {
TArray<TSharedPtr<FJsonValue>> JsonArray; TArray<TSharedPtr<FJsonValue>> JsonArray;
for (const BCData& data : dataVector) for (const SQLData& data : dataVector)
{ {
TSharedPtr<FJsonObject> JsonObject = ConvertSQLDataToJson(data); TSharedPtr<FJsonObject> JsonObject = ConvertSQLDataToJson(data);
JsonArray.Add(MakeShareable(new FJsonValueObject(JsonObject))); JsonArray.Add(MakeShareable(new FJsonValueObject(JsonObject)));
@ -120,6 +100,8 @@ FString ConvertSQLDataVectorToJson(const FString& response, const std::vector<BC
return JsonString; return JsonString;
} }
FString ConvertRWBSVectorToJson(const FString& response, const std::vector<FString>& dataVector) FString ConvertRWBSVectorToJson(const FString& response, const std::vector<FString>& dataVector)
{ {
TArray<TSharedPtr<FJsonValue>> JsonArray; TArray<TSharedPtr<FJsonValue>> JsonArray;
@ -140,51 +122,6 @@ FString ConvertRWBSVectorToJson(const FString& response, const std::vector<FStri
return JsonString; return JsonString;
} }
FString ConvertHKBDataVectorToJson(const FString& response, const std::vector<HKBData>& dataVector)
{
TArray<TSharedPtr<FJsonValue>> JsonArray;
for (const HKBData& data : dataVector)
{
TSharedPtr<FJsonObject> JsonObject = MakeShareable(new FJsonObject());
JsonObject->SetStringField(TEXT("BDID"), data.bdid);
JsonObject->SetStringField(TEXT("型号"), data.jx);
JsonObject->SetStringField(TEXT("机号"), data.jh);
JsonObject->SetStringField(TEXT("编号"), data.qc_dh);
JsonObject->SetStringField(TEXT("阵营"), data.zy);
JsonObject->SetStringField(TEXT("单位简称"), data.dwjc);
JsonObject->SetStringField(TEXT("单位代码"), data.dwdm);
JsonObject->SetStringField(TEXT("数据来源"), data.fxsj_ly);
JsonObject->SetStringField(TEXT("后舱代号"), data.hc_dm);
JsonObject->SetStringField(TEXT("后舱姓名"), data.hc_xm);
JsonObject->SetStringField(TEXT("体系摧毁时刻"), data.txbg_sk);
JsonObject->SetStringField(TEXT("执行任务"), data.rwlx);
FString leftString;
FString rightString;
bool is = data.txbg_sk.Split(" ", &leftString, &rightString);
if (is)
{
JsonObject->SetStringField(TEXT("体系摧毁文本信息"), rightString);
}
JsonObject->SetStringField(TEXT("体系摧毁文本颜色"), FColor(255, 0, 0, 255).ToString());
JsonArray.Add(MakeShareable(new FJsonValueObject(JsonObject)));
}
TSharedPtr<FJsonObject> RootObject = MakeShareable(new FJsonObject());
RootObject->SetArrayField("data", JsonArray);
RootObject->SetStringField("type", response);
FString JsonString;
TSharedRef<TJsonWriter<TCHAR>> Writer = TJsonWriterFactory<TCHAR>::Create(&JsonString);
FJsonSerializer::Serialize(RootObject.ToSharedRef(), Writer);
return JsonString;
}
TDMScenario::TDMScenario() TDMScenario::TDMScenario()
{ {
} }
@ -199,10 +136,11 @@ TSharedPtr<TDMScenario> TDMScenario::Create()
return self; return self;
} }
bool TDMScenario::LoadRWBS(const FString& year) bool TDMScenario::LoadRWBS(const std::string& year)
{ {
FString query = FString::Format(TEXT("select distinct RWBS from kzdk.rw_jbqk where to_char(ksrq, 'yyyy') ='{0}';"), { year }); std::string sSQL = "select distinct RWBS from kzdk.rw_jbqk where to_char(ksrq, 'yyyy') = '" + year + "'";
std::string sSQL = UTF8ToGBK(query);
UE_LOG(LogUEDMPlugin, Log, TEXT("SQL=%s"), UTF8_TO_TCHAR(sSQL.c_str()));
TSharedPtr<FSQLCommand> sqlCommand = MakeShareable(new FSQLCommand); TSharedPtr<FSQLCommand> sqlCommand = MakeShareable(new FSQLCommand);
sqlCommand->Type = ESQLType::SELECT; sqlCommand->Type = ESQLType::SELECT;
@ -246,15 +184,14 @@ bool TDMScenario::LoadRWBS(const FString& year)
} }
dmRunnable->ExcuteSQL(sqlCommand); dmRunnable->ExcuteSQL(sqlCommand);
return true; return true;
} }
bool TDMScenario::LoadBCSJ(const FString& rwbs) bool TDMScenario::LoadBCSJ(const FString& rwbs)
{ {
FString query = FString::Format(TEXT("select a.RQ,a.BC,a.YXR, " FString query = FString::Format(TEXT("select RQ, BC, YXR from kzdk.RW_BCSJ where RWBS = '{0}' order by rq, bc asc;"),
"(select count(b.bdid) from kzdk.rw_fxjc b where b.rwbs = '{0}' and b.rq = a.rq and b.bc = a.bc), " { rwbs });
"(select LISTAGG(distinct c.jx, ',') from kzdk.rw_fxjc c where c.rwbs = '{0}' and c.rq = a.rq and c.bc = a.bc) " std::string sSQL = UTF8ToGBK(query) ;
"from kzdk.RW_BCSJ a where a.RWBS = '{0}' order by a.rq, a.bc asc; "), { rwbs });
std::string sSQL = UTF8ToGBK(query);
TSharedPtr<FSQLCommand> sqlCommand = MakeShareable(new FSQLCommand); TSharedPtr<FSQLCommand> sqlCommand = MakeShareable(new FSQLCommand);
sqlCommand->Type = ESQLType::SELECT; sqlCommand->Type = ESQLType::SELECT;
@ -264,27 +201,21 @@ bool TDMScenario::LoadBCSJ(const FString& rwbs)
sdint8 out_c1 = 0; sdint8 out_c1 = 0;
sdint4 out_c2 = 0; sdint4 out_c2 = 0;
sdbyte out_c3[20] = { 0 }; sdbyte out_c3[20] = { 0 };
sdint4 out_c4 = 0;
sdbyte out_c5[128] = { 0 };
slength out_c1_ind = 0; slength out_c1_ind = 0;
slength out_c2_ind = 0; slength out_c2_ind = 0;
slength out_c3_ind = 0; slength out_c3_ind = 0;
slength out_c4_ind = 0;
slength out_c5_ind = 0;
dpi_bind_col(content, 1, DSQL_C_TIMESTAMP, &out_c1, sizeof(out_c1), &out_c1_ind); dpi_bind_col(content, 1, DSQL_C_TIMESTAMP, &out_c1, sizeof(out_c1), &out_c1_ind);
dpi_bind_col(content, 2, DSQL_C_SLONG, &out_c2, sizeof(out_c2), &out_c2_ind); dpi_bind_col(content, 2, DSQL_C_SLONG, &out_c2, sizeof(out_c2), &out_c2_ind);
dpi_bind_col(content, 3, DSQL_C_NCHAR, &out_c3, sizeof(out_c3), &out_c3_ind); dpi_bind_col(content, 3, DSQL_C_NCHAR, &out_c3, sizeof(out_c3), &out_c3_ind);
dpi_bind_col(content, 4, DSQL_C_SLONG, &out_c4, sizeof(out_c4), &out_c4_ind);
dpi_bind_col(content, 5, DSQL_C_NCHAR, &out_c5, sizeof(out_c5), &out_c5_ind);
ulength row_num = 0; ulength row_num = 0;
std::vector<BCData> tables; std::vector<SQLData> tables;
while (dpi_fetch(content, &row_num) != DSQL_NO_DATA) while (dpi_fetch(content, &row_num) != DSQL_NO_DATA)
{ {
tables.push_back({ out_c1, out_c2, GBKToUTF8((const char*)out_c3), out_c4, GBKToUTF8((const char*)out_c5) }); tables.push_back({ out_c1, out_c2, (char*)out_c3 });
UE_LOG(LogUEDMPlugin, Log, TEXT("RQ=%llu, BC=%d YXR=%s"), out_c1, out_c2, UTF8_TO_TCHAR((char*)out_c3)); UE_LOG(LogUEDMPlugin, Log, TEXT("RQ=%llu, BC=%d YXR=%s"), out_c1, out_c2, UTF8_TO_TCHAR((char*)out_c3));
} }
TSharedPtr<SQLResult> Result = MakeShareable(new SelectResult<BCData>(std::move(tables))); TSharedPtr<SQLResult> Result = MakeShareable(new SelectResult<SQLData>(std::move(tables)));
return Result; return Result;
}; };
@ -295,7 +226,7 @@ bool TDMScenario::LoadBCSJ(const FString& rwbs)
{ {
UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::LoadBCSJ failed, Result is nullptr")); UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::LoadBCSJ failed, Result is nullptr"));
} }
SelectResult<BCData>* sqlData = static_cast<SelectResult<BCData>*>(Result.Get()); SelectResult<SQLData>* sqlData = static_cast<SelectResult<SQLData>*>(Result.Get());
if (!sqlData->succes) if (!sqlData->succes)
{ {
UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::LoadBCSJ failed")); UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::LoadBCSJ failed"));
@ -316,96 +247,47 @@ bool TDMScenario::LoadBCSJ(const FString& rwbs)
return true; return true;
} }
bool TDMScenario::LoadMissionData(const FString& rwbs, const FString& rq, const FString& bc) bool TDMScenario::Load()
{ {
UE_LOG(LogUEDMPlugin, Log, TEXT("LoadMissionData Begin"));
LoadHKBData(rwbs, rq, bc);
LoadDDData(rwbs, rq, bc);
LoadDMMBData(rwbs, rq, bc);
UE_LOG(LogUEDMPlugin, Log, TEXT("LoadMissionData End"));
return true;
}
void TDMScenario::LoadHKBData(const FString& rwbs, const FString& rq, const FString& bc)
{
FString query = FString::Format(TEXT("select bdid, jx, jh, qc_dh, zy, dwjc, dwdm, fxsj_ly, hc_dm, hc_xm, txbg_sk, RWLX from kzdk.RW_FXJC"
" where RWBS = '{0}' and RQ = to_date('{1}', 'yyyy-mm-dd') and BC = {2};"), { rwbs, rq, bc });
std::string sSQL = UTF8ToGBK(query);
TSharedPtr<FSQLCommand> sqlCommand = MakeShareable(new FSQLCommand); TSharedPtr<FSQLCommand> sqlCommand = MakeShareable(new FSQLCommand);
sqlCommand->Type = ESQLType::SELECT; sqlCommand->Type = ESQLType::SELECT;
sqlCommand->SQL = sSQL; sqlCommand->SQL = "select RQ,BC,YXR from kzdk.RW_BCSJ order by rq ,bc asc;";
sqlCommand->select = [](void* content) sqlCommand->select = [](void* content)
{ {
sdbyte out_c1[40] = { 0 }; sdint8 out_c1 = 0;
sdbyte out_c2[30] = { 0 }; sdint4 out_c2 = 0;
sdbyte out_c3[50] = { 0 }; sdbyte out_c3[20] = { 0 };
sdbyte out_c4[20] = { 0 };
sdbyte out_c5[200] = { 0 };
sdbyte out_c6[200] = { 0 };
sdbyte out_c7[200] = { 0 };
sdbyte out_c8[20] = { 0 };
sdbyte out_c9[20] = { 0 };
sdbyte out_c10[30] = { 0 };
dpi_timestamp_t out_c11;
sdbyte out_c12[20] = { 0 };
slength out_c1_ind = 0; slength out_c1_ind = 0;
slength out_c2_ind = 0; slength out_c2_ind = 0;
slength out_c3_ind = 0; slength out_c3_ind = 0;
slength out_c4_ind = 0; dpi_bind_col(content, 1, DSQL_C_TIMESTAMP, &out_c1, sizeof(out_c1), &out_c1_ind);
slength out_c5_ind = 0; dpi_bind_col(content, 2, DSQL_C_SLONG, &out_c2, sizeof(out_c2), &out_c2_ind);
slength out_c6_ind = 0;
slength out_c7_ind = 0;
slength out_c8_ind = 0;
slength out_c9_ind = 0;
slength out_c10_ind = 0;
slength out_c11_ind = 0;
slength out_c12_ind = 0;
dpi_bind_col(content, 1, DSQL_C_NCHAR, &out_c1, sizeof(out_c1), &out_c1_ind);
dpi_bind_col(content, 2, DSQL_C_NCHAR, &out_c2, sizeof(out_c2), &out_c2_ind);
dpi_bind_col(content, 3, DSQL_C_NCHAR, &out_c3, sizeof(out_c3), &out_c3_ind); dpi_bind_col(content, 3, DSQL_C_NCHAR, &out_c3, sizeof(out_c3), &out_c3_ind);
dpi_bind_col(content, 4, DSQL_C_NCHAR, &out_c4, sizeof(out_c4), &out_c4_ind);
dpi_bind_col(content, 5, DSQL_C_NCHAR, &out_c5, sizeof(out_c5), &out_c5_ind);
dpi_bind_col(content, 6, DSQL_C_NCHAR, &out_c6, sizeof(out_c6), &out_c6_ind);
dpi_bind_col(content, 7, DSQL_C_NCHAR, &out_c7, sizeof(out_c7), &out_c7_ind);
dpi_bind_col(content, 8, DSQL_C_NCHAR, &out_c8, sizeof(out_c8), &out_c8_ind);
dpi_bind_col(content, 9, DSQL_C_NCHAR, &out_c9, sizeof(out_c9), &out_c9_ind);
dpi_bind_col(content, 10, DSQL_C_NCHAR, &out_c10, sizeof(out_c10), &out_c10_ind);
dpi_bind_col(content, 11, DSQL_C_TIMESTAMP, &out_c11, sizeof(out_c11), &out_c11_ind);
dpi_bind_col(content, 12, DSQL_C_NCHAR, &out_c12, sizeof(out_c12), &out_c12_ind);
ulength row_num = 0; ulength row_num = 0;
std::vector<HKBData> tables; std::vector<SQLData> tables;
while (dpi_fetch(content, &row_num) != DSQL_NO_DATA) while (dpi_fetch(content, &row_num) != DSQL_NO_DATA)
{ {
tables.push_back({ out_c1, out_c2, (char*)out_c3 });
FString st = FString::Format(TEXT("{0}-{1}-{2} {3}:{4}:{5}"), { out_c11.year, out_c11.month, out_c11.day, out_c11.hour, out_c11.minute, out_c11.second });
tables.push_back({ GBKToUTF8((char*)out_c1), GBKToUTF8((char*)out_c2), GBKToUTF8((char*)out_c3), GBKToUTF8((char*)out_c4),
GBKToUTF8((char*)out_c5), GBKToUTF8((char*)out_c6), GBKToUTF8((char*)out_c7), GBKToUTF8((char*)out_c8),
GBKToUTF8((char*)out_c9), GBKToUTF8((char*)out_c10), st, GBKToUTF8((char*)out_c12) });
UE_LOG(LogUEDMPlugin, Log, TEXT("RQ=%llu, BC=%d YXR=%s"), out_c1, out_c2, UTF8_TO_TCHAR((char*)out_c3)); UE_LOG(LogUEDMPlugin, Log, TEXT("RQ=%llu, BC=%d YXR=%s"), out_c1, out_c2, UTF8_TO_TCHAR((char*)out_c3));
} }
TSharedPtr<SQLResult> Result = MakeShareable(new SelectResult<HKBData>(std::move(tables))); TSharedPtr<SQLResult> Result = MakeShareable(new SelectResult<SQLData>(std::move(tables)));
return Result; return Result;
}; };
TSharedPtr<TDMScenario> self = AsShared(); TSharedPtr<TDMScenario> self = AsShared();
sqlCommand->OnQueryCompleted.BindLambda([self](TSharedPtr<SQLResult> Result) sqlCommand->OnQueryCompleted.BindLambda([self](TSharedPtr<SQLResult> Result)
{ {
SelectResult<HKBData>* sqlData = static_cast<SelectResult<HKBData>*>(Result.Get()); SelectResult<SQLData>* sqlData = static_cast<SelectResult<SQLData>*>(Result.Get());
if (!sqlData->succes) if (!sqlData->succes)
{ {
UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::Query failed")); UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::Load failed"));
return; return;
} }
FString jsonString = ConvertHKBDataVectorToJson(TEXT("HKB-Base"), sqlData->table); FString jsonString = ConvertSQLDataVectorToJson(TEXT("LoadScenarioResponse"), sqlData->table);
bool success = self->OnLoadCompleted.ExecuteIfBound(jsonString); bool success = self->OnQueryCompleted.ExecuteIfBound(jsonString);
UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::Query OnLoadCompleted.ExecuteIfBound %d"), success); UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::Query OnQueryCompleted.ExecuteIfBound %d"), success);
}); });
auto dmRunnable = FUEDMPluginModule::GetDMRunnable(); auto dmRunnable = FUEDMPluginModule::GetDMRunnable();
@ -414,22 +296,32 @@ void TDMScenario::LoadHKBData(const FString& rwbs, const FString& rq, const FStr
UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::Query dm runnable is nullptr")); UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::Query dm runnable is nullptr"));
} }
dmRunnable->ExcuteSQL(sqlCommand); dmRunnable->ExcuteSQL(sqlCommand);
return true;
}
void TDMScenario::LoadMissionData(const FString& rwbs, const FString& rq, const FString& bc)
{
UE_LOG(LogUEDMPlugin, Log, TEXT("LoadMissionData Begin"));
LoadHKBData(rwbs, rq, bc);
LoadDDData(rwbs, rq, bc);
LoadDMMBData(rwbs, rq, bc);
UE_LOG(LogUEDMPlugin, Log, TEXT("LoadMissionData End"));
}
void TDMScenario::LoadHKBData(const FString& rwbs, const FString& rq, const FString& bc)
{
std::string sSQL = "select bdid, jx, jh, qc_dh, zy, dwjc, dwdm, fxsj_ly, hc_dm, hc_xm, txbg_sk, RWLX from kzdk.RW_FXJC where RWBS = " +
std::string(TCHAR_TO_UTF8(*rwbs)) + " and RQ = to_date('" +
std::string(TCHAR_TO_UTF8(*rq)) + "', 'yyyy-mm-dd') and BC = " + std::string(TCHAR_TO_UTF8(*bc));
} }
bool TDMScenario::LoadKkwqsyList(const FString& bdid, const FString& qrxg, const FString& qcdh, const FString& zy) bool TDMScenario::LoadKkwqsyList(const FString& bdid, const FString& qrxg, const FString& qcdh, const FString& zy)
{ {
//FString query = FString::Format(TEXT("select bdid, jx, jh, qc_dh, zy, dwjc, dwdm, fxsj_ly, hc_dm, hc_xm, txbg_sk, RWLX from kzdk.RW_FXJC" std::string sSQL = "select dx, fsbh, GJ_JL, GJ_FW, gj_sk, GJTS, DMZYSK, ZD_JSSK, gjxg_qrmb, dx, MZYXX, FS_JH from kzdk.rw_fxjc_wqsy where sjlx = '空空' and gjxg_qrxg = " +
// " where RWBS = '{0}' and RQ = to_date('{1}', 'yyyy-mm-dd') and BC = {2};"), { rwbs, rq, bc }); std::string(TCHAR_TO_UTF8(*qrxg)) + " and bdid = " +
//std::string sSQL = UTF8ToGBK(query); std::string(TCHAR_TO_UTF8(*bdid));
//TSharedPtr<FSQLCommand> sqlCommand = MakeShareable(new FSQLCommand);
//sqlCommand->Type = ESQLType::SELECT;
//sqlCommand->SQL = sSQL;
//sqlCommand->select = [](void* content)
// std::string sSQL = "select dx, fsbh, GJ_JL, GJ_FW, gj_sk, GJTS, DMZYSK, ZD_JSSK, gjxg_qrmb, dx, MZYXX, FS_JH from kzdk.rw_fxjc_wqsy where sjlx = '空空' and gjxg_qrxg = " +
// std::string(TCHAR_TO_UTF8(*qrxg)) + " and bdid = " +
// std::string(TCHAR_TO_UTF8(*bdid));
return true; return true;
} }

View File

@ -3,9 +3,9 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include <string>
DECLARE_DELEGATE_OneParam(FOnSQLCompleted, FString); DECLARE_DELEGATE_OneParam(FOnSQLCompleted, FString);
DECLARE_DELEGATE_OneParam(FOnLoadCompleted, FString);
/** /**
* *
@ -19,16 +19,17 @@ public:
static TSharedPtr<TDMScenario> Create(); static TSharedPtr<TDMScenario> Create();
// 加载任务标识 // 加载任务标识
bool LoadRWBS(const FString& year); bool LoadRWBS(const std::string& year);
// 加载波次 // 加载波次
bool LoadBCSJ(const FString& rwbs); bool LoadBCSJ(const FString& rwbs);
bool Load();
// 加载任务数据 // 加载任务数据
//rwbs:任务标识 //rwbs:任务标识
//rq:日期 //rq:日期
//bc:波次 //bc:波次
bool LoadMissionData(const FString& rwbs, const FString& rq, const FString& bc); void LoadMissionData(const FString& rwbs, const FString& rq, const FString& bc);
// 加载航空兵数据 // 加载航空兵数据
void LoadHKBData(const FString& rwbs, const FString& rq, const FString& bc); void LoadHKBData(const FString& rwbs, const FString& rq, const FString& bc);
@ -48,5 +49,4 @@ public:
public: public:
FOnSQLCompleted OnQueryCompleted; FOnSQLCompleted OnQueryCompleted;
FOnLoadCompleted OnLoadCompleted;
}; };

View File

@ -8,8 +8,6 @@
#include "DMRunnable.h" #include "DMRunnable.h"
#include "DPI.h" #include "DPI.h"
#include "DMScenario.h"
#define LOCTEXT_NAMESPACE "FUEDMPluginModule" #define LOCTEXT_NAMESPACE "FUEDMPluginModule"
DEFINE_LOG_CATEGORY(LogUEDMPlugin); DEFINE_LOG_CATEGORY(LogUEDMPlugin);
@ -20,14 +18,6 @@ void FUEDMPluginModule::StartupModule()
{ {
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module // This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
dmRunnable_ = new FDMRunnable(); dmRunnable_ = new FDMRunnable();
//auto Scenario = TDMScenario::Create();
//Scenario->OnQueryCompleted.BindLambda([this](const FString& result)
// {
// });
//Scenario->LoadRWBS("2019");
} }
void FUEDMPluginModule::ShutdownModule() void FUEDMPluginModule::ShutdownModule()

View File

@ -21,7 +21,7 @@ bool UUEJSBlueprintFunctionLibrary::JsMessageDispatch(const FString& message)
if (TEXT("LoadTask") == func) if (TEXT("LoadTask") == func)
{ {
auto Scenario = TDMScenario::Create(); auto Scenario = TDMScenario::Create();
//Scenario->Load(); Scenario->Load();
} }
return true; return true;

View File

@ -26,6 +26,8 @@ public:
UPROPERTY(BlueprintAssignable) UPROPERTY(BlueprintAssignable)
FJsMessageCallbackDelegate OnJsMessageCallbackDelegate; FJsMessageCallbackDelegate OnJsMessageCallbackDelegate;
protected: protected:
// Called when the game starts // Called when the game starts
virtual void BeginPlay() override; virtual void BeginPlay() override;
@ -33,4 +35,6 @@ protected:
public: public:
// Called every frame // Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
}; };

View File

@ -8,8 +8,15 @@
<div class="search-area"> <div class="search-area">
<div class="search-item"> <div class="search-item">
<label for="year">年度:</label> <label for="year">年度:</label>
<el-date-picker v-model="year" type="year" placeholder="选择年" format="yyyy" value-format="yyyy" <el-date-picker
@change="handleChangeYear" class="year-picker" /> v-model="year"
type="year"
placeholder="选择年"
format="yyyy"
value-format="yyyy"
@change="handleChangeYear"
class="year-picker"
/>
</div> </div>
<div class="search-item"> <div class="search-item">
<label for="taskName">任务名称:</label> <label for="taskName">任务名称:</label>
@ -27,14 +34,14 @@
<thead> <thead>
<tr> <tr>
<th>日期</th> <th>日期</th>
<th>波次</th> <th>游戏</th>
<th>演戏</th> <th>练习</th>
<th>演飞机</th> <th>数飞行</th>
<th>演机</th> <th>数模</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="(task, index) in tasks" :key="index" @click="getCurrentRow(task)"> <tr v-for="(task, index) in tasks" :key="index">
<td>{{ task.date || 'N/A' }}</td> <td>{{ task.date || 'N/A' }}</td>
<td>{{ task.gameCount || 0 }}</td> <td>{{ task.gameCount || 0 }}</td>
<td>{{ task.practiceDay || 0 }}</td> <td>{{ task.practiceDay || 0 }}</td>
@ -85,8 +92,6 @@ export default {
label: 'J-11,模型-7' label: 'J-11,模型-7'
}, },
], ],
taskRQ: '',
taskBC: '',
}; };
}, },
watch: { watch: {
@ -116,29 +121,8 @@ export default {
}; };
console.log('Confirmed:', data); console.log('Confirmed:', data);
const currentTaskName = this.taskName;
if (!currentTaskName) {
console.warn('Task name is empty');
return;
}
const currentTaskRQ = this.taskRQ;
if (!currentTaskRQ) {
return;
}
const currentTaskBC = this.taskBC;
if (!currentTaskBC) {
return;
}
try { try {
webrtc.webrtc.emitUIInter({ webrtc.webrtc.emitCommand("TaskSelected", data);
command: "LoadScenario",
rwbs: currentTaskName,
rq: currentTaskRQ,
bc: currentTaskBC
});
} catch (error) { } catch (error) {
console.error('Error in emitCommand:', error); console.error('Error in emitCommand:', error);
} }
@ -211,8 +195,8 @@ export default {
date: this.formatTimestamp(Number(item.timestamp)), date: this.formatTimestamp(Number(item.timestamp)),
gameCount: Number(item.bc) || 0, gameCount: Number(item.bc) || 0,
practiceDay: Number(item.yxr) || 0, practiceDay: Number(item.yxr) || 0,
paramFlightCount: Number(item.count) || 0, paramFlightCount: 0,
paramModel: item.jx paramModel: ''
}; };
console.log('Mapped item:', mappedItem); console.log('Mapped item:', mappedItem);
return mappedItem; return mappedItem;
@ -289,13 +273,6 @@ export default {
console.error('Error in emitUIInter:', error); console.error('Error in emitUIInter:', error);
} }
}, },
getCurrentRow(task) {
this.currentRow = task;
console.log('Current Row:', this.currentRow);
this.taskRQ = task.date;
this.taskBC = task.gameCount;
},
}, },
created() { created() {
this.initData(); this.initData();

View File

@ -1865,7 +1865,7 @@ function connect() {
} }
// ws = new WebSocket("ws://localhost/"); // ws = new WebSocket("ws://localhost/");
// ws = new WebSocket(window.location.href.replace('http://', 'ws://').replace('https://', 'wss://')); // ws = new WebSocket(window.location.href.replace('http://', 'ws://').replace('https://', 'wss://'));
let connectionUrl = window.location.href.replace('http://', 'ws://').replace('https://', 'wss://').replace(/:\d+/, ':8000'); let connectionUrl = window.location.href.replace('http://', 'ws://').replace('https://', 'wss://').replace(/:\d+/, '');
console.log(`Creating a websocket connection to: ${connectionUrl}`); console.log(`Creating a websocket connection to: ${connectionUrl}`);
ws = new WebSocket(connectionUrl); ws = new WebSocket(connectionUrl);
ws.attemptStreamReconnection = true; ws.attemptStreamReconnection = true;