master
nodyang@aliyun.com 1 month ago
parent 1d08175c5c
commit 91a8b511ec

@ -1,91 +1,91 @@
using SQLite;
//using SQLite;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq.Expressions;
using System.Text;
//using System;
//using System.Collections.Generic;
//using System.IO;
//using System.Linq.Expressions;
//using System.Text;
namespace SlnMesnac.RfidUpload.Common
{
/// <summary>
/// SQLite同步方法帮助类
/// 作者:追逐时光者
/// 创建时间2023年11月30日
/// </summary>
/// <typeparam name="T"></typeparam>
public class SqLiteHelper<T> where T : new()
{
private readonly string _databasePath = Path.Combine(Environment.CurrentDirectory, "db.db");
private readonly SQLiteConnection _connection; // SQLite连接对象
//namespace SlnMesnac.RfidUpload.Common
//{
// /// <summary>
// /// SQLite同步方法帮助类
// /// 作者:追逐时光者
// /// 创建时间2023年11月30日
// /// </summary>
// /// <typeparam name="T"></typeparam>
// public class SqLiteHelper<T> where T : new()
// {
// private readonly string _databasePath = Path.Combine(Environment.CurrentDirectory, "db.db");
// private readonly SQLiteConnection _connection; // SQLite连接对象
/// <summary>
/// 构造函数
/// </summary>
public SqLiteHelper()
{
// 创建SQLite连接对象并打开连接
_connection = new SQLiteConnection(_databasePath);
_connection.CreateTable<T>(); // 如果表不存在,则创建该表[不会创建重复的表]
}
// /// <summary>
// /// 构造函数
// /// </summary>
// public SqLiteHelper()
// {
// // 创建SQLite连接对象并打开连接
// _connection = new SQLiteConnection(_databasePath);
// _connection.CreateTable<T>(); // 如果表不存在,则创建该表[不会创建重复的表]
// }
/// <summary>
/// 数据插入
/// </summary>
/// <param name="item">要插入的数据项</param>
/// <returns></returns>
public int Insert(T item)
{
return _connection.Insert(item);
}
// /// <summary>
// /// 数据插入
// /// </summary>
// /// <param name="item">要插入的数据项</param>
// /// <returns></returns>
// public int Insert(T item)
// {
// return _connection.Insert(item);
// }
/// <summary>
/// 数据删除
/// </summary>
/// <param name="id">要删除的数据的主键ID</param>
/// <returns></returns>
public int Delete(int id)
{
return _connection.Delete<T>(id);
}
// /// <summary>
// /// 数据删除
// /// </summary>
// /// <param name="id">要删除的数据的主键ID</param>
// /// <returns></returns>
// public int Delete(int id)
// {
// return _connection.Delete<T>(id);
// }
/// <summary>
/// 数据更新
/// </summary>
/// <param name="item">要更新的数据项</param>
/// <returns></returns>
public int Update(T item)
{
return _connection.Update(item);
}
// /// <summary>
// /// 数据更新
// /// </summary>
// /// <param name="item">要更新的数据项</param>
// /// <returns></returns>
// public int Update(T item)
// {
// return _connection.Update(item);
// }
/// <summary>
/// 根据条件查询记录
/// </summary>
/// <param name="predExpr">查询条件</param>
/// <returns></returns>
public List<T> Query(Expression<Func<T, bool>> predExpr)
{
return _connection.Table<T>().Where(predExpr).ToList();
}
// /// <summary>
// /// 根据条件查询记录
// /// </summary>
// /// <param name="predExpr">查询条件</param>
// /// <returns></returns>
// public List<T> Query(Expression<Func<T, bool>> predExpr)
// {
// return _connection.Table<T>().Where(predExpr).ToList();
// }
/// <summary>
/// 查询所有数据
/// </summary>
/// <returns></returns>
public List<T> QueryAll()
{
return _connection.Table<T>().ToList();
}
// /// <summary>
// /// 查询所有数据
// /// </summary>
// /// <returns></returns>
// public List<T> QueryAll()
// {
// return _connection.Table<T>().ToList();
// }
/// <summary>
/// 根据条件查询单条记录
/// </summary>
/// <param name="predExpr">查询条件</param>
/// <returns></returns>
public T QuerySingle(Expression<Func<T, bool>> predExpr)
{
return _connection.Table<T>().Where(predExpr).FirstOrDefault();
}
}
}
// /// <summary>
// /// 根据条件查询单条记录
// /// </summary>
// /// <param name="predExpr">查询条件</param>
// /// <returns></returns>
// public T QuerySingle(Expression<Func<T, bool>> predExpr)
// {
// return _connection.Table<T>().Where(predExpr).FirstOrDefault();
// }
// }
//}

@ -34,7 +34,9 @@ namespace SlnMesnac.RfidUpload.Model.apiParam
public List<Object> @object { get; set; }
public string code { get; set; }
public string body { get; set; }
public string code { get; set; }
public string csbCode { get; set; }
public string message { get; set; }
}

@ -90,16 +90,7 @@ namespace SlnMesnac.RfidUpload.UI
}
#endregion
#region 测试数据
// 初始化数据源
var institutions = new List<Institution>
{
new Institution { No = "1", stationOrgCode = "001", stationOrgName = "机构A" },
new Institution { No = "2", stationOrgCode = "002", stationOrgName = "机构B" },
};
InstitutionList.ItemsSource = institutions;
#endregion
}
catch (Exception ex)
{

@ -135,49 +135,22 @@ namespace SlnMesnac.RfidUpload.UI.viewModel
return;
}
#region 正式启用
//CsbResult res = csbHandleBusiness.transferOrderFfjhByCsb("", _startDate.Value.ToString(), _endDate.Value.ToString());
//MessageBox.Show(res.message);
//if (res.code == "200")
//{
// if (res.@object != null && res.@object.Count > 0)
// {
// List<TransferOrderInfo> institutionList = res.@object.ConvertAll(item => JsonConvert.DeserializeObject<TransferOrderInfo>(item.ToString()));
// TransferOrderInfoItems = new ObservableCollection<TransferOrderInfo>(institutionList);
// }
//}
#endregion
#region 测试启用
result res = new result()
CsbResult res = csbHandleBusiness.transferOrderFfjhByCsb("", _startDate.Value.ToString(), _endDate.Value.ToString());
MessageBox.Show(res.message);
if (res.code == "200")
{
status = "1",
msg = "测试",
@object = new List<TransferOrderInfo>()
if (res.@object != null && res.@object.Count > 0)
{
new TransferOrderInfo()
{
dbdh = "123",
jsdw = "123",
ffjhNo = "jh123",
ffjhscrq = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
},
new TransferOrderInfo()
{
dbdh = "324",
jsdw = "456",
ffjhNo = "jh456",
ffjhscrq = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
}
List<TransferOrderInfo> institutionList = res.@object.ConvertAll(item => JsonConvert.DeserializeObject<TransferOrderInfo>(item.ToString()));
TransferOrderInfoItems = new ObservableCollection<TransferOrderInfo>(institutionList);
}
};
if (res.@object != null)
{
TransferOrderInfoItems = new ObservableCollection<TransferOrderInfo>(res.@object);
}
#endregion
}

@ -16,8 +16,6 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using ApiServer = SlnMesnac.RfidUpload.TouchSocket.ApiServer;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using System.Windows;
using System.Threading;

@ -15,7 +15,11 @@ using System.ServiceModel.Channels;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using NewLife;
using Newtonsoft.Json;
using static SlnMesnac.RfidUpload.UI.SelectRouterWindow;
using NewLife.Log;
using Newtonsoft.Json.Linq;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
@ -133,49 +137,56 @@ namespace SlnMesnac.RfidUpload.UI.viewModel
return;
}
#region 正式启用
//CsbResult res = csbHandleBusiness.transferOrderFfjhByCsb(_drj, _startDate.Value.ToString(), _endDate.Value.ToString());
//MessageBox.Show(res.message);
//if (res.code == "200")
//{
// if (res.@object != null && res.@object.Count > 0)
// {
// List<TransferOrderInfo> institutionList = res.@object.ConvertAll(item => JsonConvert.DeserializeObject<TransferOrderInfo>(item.ToString()));
// TransferOrderInfoItems = new ObservableCollection<TransferOrderInfo>(institutionList);
// }
//}
#endregion
CsbResult res = csbHandleBusiness.transferOrderFfjhByCsb(_drj, _startDate.Value.ToString(), _endDate.Value.ToString());
MessageBox.Show(res.message);
if (res.code == "200")
{
#region 测试
result res = new result()
{
status = "1",
msg = "测试",
@object = new List<TransferOrderInfo>()
JObject job = JObject.Parse(res.body);
string str = job["retBody"]?["object"]?.ToString();
if (!str.IsNullOrEmpty())
{
new TransferOrderInfo()
{
dbdh = "123",
jsdw = "123",
ffjhNo = "jh123",
ffjhscrq = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
},
new TransferOrderInfo()
{
dbdh = "324",
jsdw = "456",
ffjhNo = "jh456",
ffjhscrq = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
}
List<TransferOrderInfo> institutionList = JsonConvert.DeserializeObject<List<TransferOrderInfo>>(str);
TransferOrderInfoItems = new ObservableCollection<TransferOrderInfo>(institutionList);
}
};
if (res.@object != null)
{
TransferOrderInfoItems = new ObservableCollection<TransferOrderInfo>(res.@object);
}
#endregion
//#region 测试
//result res = new result()
//{
// status = "1",
// msg = "测试",
// @object = new List<TransferOrderInfo>()
// {
// new TransferOrderInfo()
// {
// dbdh = "123",
// jsdw = "123",
// ffjhNo = "jh123",
// ffjhscrq = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
// },
// new TransferOrderInfo()
// {
// dbdh = "324",
// jsdw = "456",
// ffjhNo = "jh456",
// ffjhscrq = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
// }
// }
//};
//if (res.@object != null)
//{
// TransferOrderInfoItems = new ObservableCollection<TransferOrderInfo>(res.@object);
//}
//#endregion
}
/// <summary>

Loading…
Cancel
Save