996 lines
32 KiB
C#
996 lines
32 KiB
C#
using AUTS.Domain.Entities;
|
|
using AUTS.Services.Enums;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
using AUTS.Domain.Application;
|
|
using MySql.Data.MySqlClient;
|
|
using AUTS.Services.Manager;
|
|
|
|
namespace AUTS.Services.Cache
|
|
{
|
|
/// <summary>
|
|
/// 缓存
|
|
/// </summary>
|
|
public static class CacheHelp
|
|
{
|
|
#region 公共库缓存键名
|
|
private static readonly string sysDBListKey = "sysManage_DBList";//库列表
|
|
private static readonly string sysCompanyListKey = "sysManage_CompanyList";//客户列表
|
|
private static readonly string sysUserAuthListKey = "sysManage_UserAuthList";//用户权限列表
|
|
private static readonly string sysDBCofinStrListKey = "sysManage_DBCofinStrList";//库连接串列表
|
|
private static readonly string sysCurrencyListKey = "sysManage_CurrencyList";//库连接串列表
|
|
private static readonly string sysSearchKeyKey = "sysManage_SearchKeyList";//库搜索关键词列表
|
|
private static readonly string sysUserOperationKey = "UserOperation_";//用户当前选择库
|
|
private static readonly string sysDBOrderStatusListKey = "sysManage_OrderStatusList";//客户库订单状态列表
|
|
private static readonly string sysDBOUserListKey = "sysUserList";//客户库订单状态列表
|
|
private static readonly string sysDBSnListKey = "sysSNlist";//订单表
|
|
|
|
#endregion
|
|
|
|
#region 客户库缓存键名
|
|
private static readonly string userDBCustomerListKey = "_CustomerList";//客户库客户列表
|
|
private static readonly string userDBProjectListKey = "_ProjectList";//客户库产品列表
|
|
private static readonly string userDBPLineListKey = "_PLineList";//客户库产线列表
|
|
private static readonly string userDBOrderListKey = "_OrderList";//客户库订单列表
|
|
private static readonly string userDBStationListKey = "_StationList";//客户库工作站列表
|
|
private static readonly string userDBOrderInternalListKey = "_OrderInternalList";//客户库内部订单列表
|
|
private static readonly string userDBSnRulesListKey = "_SnRulesList";//客户库内部订单列表
|
|
private static readonly string userDBSnProjectTypeKey = "_ProjectType";//客户库产品类型列表
|
|
private static readonly string userDBSnRepairTypesKey = "_RepairTypes";//维修类型列表
|
|
private static readonly string userDBSnRepairReasonKey = "_SnRepairReason";//维修原因列表
|
|
private static readonly string userDBSnRepairResultsKey = "_RepairResults";//维修结果列表
|
|
|
|
|
|
#endregion
|
|
|
|
#region Hash缓存前缀
|
|
private static readonly string sysServiceListKey = "sysManage_Hash_ServiceList";//Hash缓存前缀
|
|
#endregion
|
|
|
|
#region 公共库部分
|
|
|
|
#region 数据库列表
|
|
|
|
#region 获取写入数据库列表
|
|
/// <summary>
|
|
/// 获取写入数据库列表
|
|
/// </summary>
|
|
/// <returns>返回数据库列表</returns>
|
|
public static List<TBL_UTS_Manage_DBList> GetSysDBList()
|
|
{
|
|
return BaseCacheHelp.GetCache(sysDBListKey, () =>
|
|
{
|
|
var list = new List<TBL_UTS_Manage_DBList>();
|
|
using (var db = new Uts_ManageEntities())
|
|
{
|
|
//取所有
|
|
list = db.TBL_UTS_Manage_DBList.ToList();
|
|
}
|
|
return list;
|
|
});
|
|
}
|
|
#endregion
|
|
|
|
#region 清除数据库列表缓存
|
|
/// <summary>
|
|
/// 清除数据库列表缓存
|
|
/// </summary>
|
|
public static void ClearSysDBList()
|
|
{
|
|
BaseCacheHelp.ClearCache(sysDBListKey);
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 厂家列表
|
|
|
|
#region 获取写入厂家列表
|
|
/// <summary>
|
|
/// 获取写入厂家列表
|
|
/// </summary>
|
|
/// <returns>返回数据库列表</returns>
|
|
public static List<TBL_UTS_Manage_Company> GetCompanyList()
|
|
{
|
|
return BaseCacheHelp.GetCache(sysCompanyListKey, () =>
|
|
{
|
|
var list = new List<TBL_UTS_Manage_Company>();
|
|
using (var db = new Uts_ManageEntities())
|
|
{
|
|
//取所有
|
|
list = db.TBL_UTS_Manage_Company.ToList();
|
|
}
|
|
return list;
|
|
});
|
|
}
|
|
#endregion
|
|
|
|
#region 清除写入厂家列表缓存
|
|
/// <summary>
|
|
/// 清除写入厂家列表缓存
|
|
/// </summary>
|
|
public static void ClearCompanyList()
|
|
{
|
|
BaseCacheHelp.ClearCache(sysCompanyListKey);
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 用户权限列表
|
|
|
|
#region 获取写入用户权限列表
|
|
/// <summary>
|
|
/// 获取写入用户权限列表
|
|
/// </summary>
|
|
/// <returns>返回数据库列表</returns>
|
|
public static List<TBL_UTS_Manage_UserAuth_Operation> GetUserAuthList()
|
|
{
|
|
return BaseCacheHelp.GetCache(sysUserAuthListKey, () =>
|
|
{
|
|
var list = new List<TBL_UTS_Manage_UserAuth_Operation>();
|
|
using (var db = new Uts_ManageEntities())
|
|
{
|
|
//取所有
|
|
list = db.TBL_UTS_Manage_UserAuth_Operation.ToList();
|
|
}
|
|
return list;
|
|
});
|
|
}
|
|
#endregion
|
|
|
|
#region 清除用户权限列表缓存
|
|
/// <summary>
|
|
/// 清除用户权限列表缓存
|
|
/// </summary>
|
|
public static void ClearUserAuthList()
|
|
{
|
|
BaseCacheHelp.ClearCache(sysUserAuthListKey);
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 数据库连接串列表
|
|
|
|
#region 获取写入数据库连接串列表
|
|
/// <summary>
|
|
/// 获取写入厂家列表
|
|
/// </summary>
|
|
/// <returns>返回数据库列表</returns>
|
|
public static List<Domain.Application.DBCofinStrModel> GetDBCofinStrList()
|
|
{
|
|
return BaseCacheHelp.GetCache(sysDBCofinStrListKey, () =>
|
|
{
|
|
//取所有
|
|
var dbList = GetSysDBList();
|
|
|
|
var dbServer = Tool.ConfigHelper.GetConfigString("DBServer");//数据库服务器
|
|
string dbPort = Tool.ConfigHelper.GetConfigString("DBPort");//服务器端口
|
|
|
|
var dbCofinStrlist = new List<Domain.Application.DBCofinStrModel>();
|
|
foreach (var item in dbList)
|
|
{
|
|
MySql.Data.MySqlClient.MySqlConnectionStringBuilder one = new MySql.Data.MySqlClient.MySqlConnectionStringBuilder
|
|
{
|
|
Server = dbServer,
|
|
Database = item.DatabaseName,//数据库名
|
|
UserID = item.DatabaseUser,//用户名
|
|
Password = item.DatabasePassword,//密码
|
|
Port = UInt16.Parse(dbPort),
|
|
Pooling = true
|
|
};
|
|
|
|
var cofinStr = one.ConnectionString;
|
|
dbCofinStrlist.Add(new Domain.Application.DBCofinStrModel
|
|
{
|
|
ID = item.ID,
|
|
CofinStr = cofinStr,
|
|
});
|
|
}
|
|
|
|
return dbCofinStrlist;
|
|
});
|
|
}
|
|
#endregion
|
|
|
|
#region 清除数据库连接串列表缓存
|
|
/// <summary>
|
|
/// 清除数据库连接串列表缓存
|
|
/// </summary>
|
|
public static void ClearSysDBListDBCofinStrList()
|
|
{
|
|
BaseCacheHelp.ClearCache(sysDBCofinStrListKey);
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 搜索关键词列
|
|
|
|
#region 获取搜索关键词列表
|
|
/// <summary>
|
|
/// 获取写入厂家列表
|
|
/// </summary>
|
|
/// <returns>返回数据库列表</returns>
|
|
public static List<TBL_UTS_Manage_SearchKey> GetSearchKeyList()
|
|
{
|
|
return BaseCacheHelp.GetCache(sysSearchKeyKey, () =>
|
|
{
|
|
var list = new List<TBL_UTS_Manage_SearchKey>();
|
|
using (var db = new Uts_ManageEntities())
|
|
{
|
|
//取所有
|
|
list = db.TBL_UTS_Manage_SearchKey.ToList();
|
|
}
|
|
return list;
|
|
});
|
|
}
|
|
#endregion
|
|
|
|
#region 清除搜索关键词列缓存
|
|
/// <summary>
|
|
/// 清除写入厂家列表缓存
|
|
/// </summary>
|
|
public static void ClearSearchKeyList()
|
|
{
|
|
BaseCacheHelp.ClearCache(sysSearchKeyKey);
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 币种列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<Domain.Sys_Currency> GetSysCurrencyList()
|
|
{
|
|
return BaseCacheHelp.GetCache(sysCurrencyListKey, () =>
|
|
{
|
|
|
|
var dbCofinStrlist = new List<Domain.Sys_Currency>();
|
|
|
|
dbCofinStrlist.Add(new Domain.Sys_Currency
|
|
{
|
|
CurrencyName = "人民币",
|
|
Currency = "CNY",
|
|
CurrencySymbol = "¥",
|
|
});
|
|
|
|
dbCofinStrlist.Add(new Domain.Sys_Currency
|
|
{
|
|
CurrencyName = "美元",
|
|
Currency = "USD",
|
|
CurrencySymbol = "$",
|
|
});
|
|
|
|
dbCofinStrlist.Add(new Domain.Sys_Currency
|
|
{
|
|
CurrencyName = "欧元",
|
|
Currency = "EUR",
|
|
CurrencySymbol = "€",
|
|
});
|
|
|
|
dbCofinStrlist.Add(new Domain.Sys_Currency
|
|
{
|
|
CurrencyName = "日元",
|
|
Currency = "JPY",
|
|
CurrencySymbol = "¥",
|
|
});
|
|
|
|
dbCofinStrlist.Add(new Domain.Sys_Currency
|
|
{
|
|
CurrencyName = "新台币",
|
|
Currency = "TWD",
|
|
CurrencySymbol = "NT",
|
|
});
|
|
|
|
return dbCofinStrlist;
|
|
});
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 用户当前选择库
|
|
/// </summary>
|
|
/// <param name="userName"></param>
|
|
/// <param name="dbID"></param>
|
|
/// <returns></returns>
|
|
public static int GetUserOperation(string userName, int dbID = 0)
|
|
{
|
|
if (dbID == 0)
|
|
{
|
|
return BaseCacheHelp.GetCache(sysUserOperationKey + userName, () =>
|
|
{
|
|
return dbID;
|
|
});
|
|
}
|
|
else
|
|
{
|
|
BaseCacheHelp.SetCache(sysUserOperationKey + userName, () =>
|
|
{
|
|
return dbID;
|
|
});
|
|
return dbID;
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
public static DataTable GetTodayData(string key,DataTable data = null)
|
|
{
|
|
return BaseCacheHelp.GetCache(key, () =>
|
|
{
|
|
return data;
|
|
});
|
|
}
|
|
|
|
#region 客户库部分
|
|
|
|
|
|
#region 厂家列表
|
|
|
|
#region 获取写入客户库厂家列表
|
|
|
|
/// <summary>
|
|
/// 获取写入客户库厂家列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<TBL_Customer> GetUserDBCustomerList()
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
|
|
if (onDB != null)
|
|
{
|
|
return BaseCacheHelp.GetCache(onDB.DatabaseName + userDBCustomerListKey, () =>
|
|
{
|
|
//取所有
|
|
var list = new DBUtility.Custom.DALHelperCustom<TBL_Customer>("TBL_Customer").GetList();
|
|
return list;
|
|
});
|
|
}
|
|
return null;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 清除客户库厂家列表缓存
|
|
/// <summary>
|
|
/// 清除客户库厂家列表缓存
|
|
/// </summary>
|
|
public static void ClearUserDBCustomerList()
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
|
|
if (onDB != null)
|
|
{
|
|
BaseCacheHelp.ClearCache(onDB.DatabaseName + userDBCustomerListKey);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
#endregion
|
|
|
|
#region 获取写入维修类型列表
|
|
public static List<TBL_RepairTypes> GetUserDBSnRepairTypesList()
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
if (onDB != null)
|
|
{
|
|
return BaseCacheHelp.GetCache(onDB.DatabaseName + userDBSnRepairTypesKey, () =>
|
|
{
|
|
//取所有
|
|
var list = new DBUtility.Custom.DALHelperCustom<TBL_RepairTypes>("TBL_RepairTypes").GetList();
|
|
return list;
|
|
});
|
|
}
|
|
return null;
|
|
}
|
|
#endregion
|
|
|
|
#region 获取维修原因列表
|
|
public static List<TBL_RepairReason> GetUserDBRepairReasonList()
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
if (onDB != null)
|
|
{
|
|
return BaseCacheHelp.GetCache(onDB.DatabaseName + userDBSnRepairReasonKey, () =>
|
|
{
|
|
//取所有
|
|
var list = new DBUtility.Custom.DALHelperCustom<TBL_RepairReason>("TBL_RepairReason").GetList();
|
|
return list;
|
|
});
|
|
}
|
|
return null;
|
|
}
|
|
#endregion
|
|
#region 获取维修产品结果列表
|
|
public static List<TBL_RepairResults> GetUserDBRepairResultsList()
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
if (onDB != null)
|
|
{
|
|
return BaseCacheHelp.GetCache(onDB.DatabaseName + userDBSnRepairResultsKey, () =>
|
|
{
|
|
//取所有
|
|
var list = new DBUtility.Custom.DALHelperCustom<TBL_RepairResults>("TBL_RepairResults").GetList();
|
|
return list;
|
|
});
|
|
}
|
|
return null;
|
|
}
|
|
#endregion
|
|
|
|
#region 产品列表
|
|
|
|
#region 获取写入客户库产品列表
|
|
|
|
/// <summary>
|
|
/// 获取写入客户库产品列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<TBL_Project> GetUserDBProjectList()
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
string strwhere = string.Empty;
|
|
int userid = Manager.Users.Umodel.ID;
|
|
int dbid = GetUserOperation(Users.Umodel.UserName);//后期修改回来
|
|
if (SqlConnect.ProjectData(userid, dbid).ToString() != "")
|
|
{
|
|
string[] str = SqlConnect.ProjectData(userid, dbid).ToString().Split(',');
|
|
foreach (var item in str)
|
|
{
|
|
strwhere += "ID= " + item + " or ";
|
|
}
|
|
strwhere = strwhere.Substring(0, strwhere.Length - 3);
|
|
}
|
|
|
|
if (onDB != null)
|
|
{
|
|
if (strwhere != "")
|
|
{
|
|
return BaseCacheHelp.GetCache(onDB.DatabaseName + userDBProjectListKey, () =>
|
|
{
|
|
//取所有
|
|
var list = new DBUtility.Custom.DALHelperCustom<TBL_Project>("TBL_Project").GetList(strwhere);
|
|
return list;
|
|
});
|
|
}
|
|
else
|
|
{
|
|
return BaseCacheHelp.GetCache(onDB.DatabaseName + userDBProjectListKey, () =>
|
|
{
|
|
//取所有
|
|
var list = new DBUtility.Custom.DALHelperCustom<TBL_Project>("TBL_Project").GetList();
|
|
return list;
|
|
});
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
public static List<TBL_SnList> GetUserDBPSnlist()
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
if (onDB != null)
|
|
{
|
|
return BaseCacheHelp.GetCache(onDB.DatabaseName + sysDBSnListKey, () =>
|
|
{
|
|
//取所有
|
|
var list = new DBUtility.Custom.DALHelperCustom<TBL_SnList>("TBL_SnList").GetList();
|
|
return list;
|
|
});
|
|
}
|
|
return null;
|
|
}
|
|
|
|
|
|
#region 清除客户库产品列表缓存
|
|
/// <summary>
|
|
/// 清除客户库产品列表缓存
|
|
/// </summary>
|
|
public static void ClearUserDBProjectList()
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
|
|
if (onDB != null)
|
|
{
|
|
BaseCacheHelp.ClearCache(onDB.DatabaseName + userDBProjectListKey);
|
|
}
|
|
}
|
|
public static void ClearUserDBProjectList(string DbName)
|
|
{
|
|
BaseCacheHelp.ClearCache(DbName + userDBProjectListKey);
|
|
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 产线列表
|
|
|
|
#region 获取写入客户产线列表
|
|
|
|
/// <summary>
|
|
/// 获取写入客户产线列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<TBL_ProductionLine> GetUserDBPLineList()
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
|
|
if (onDB != null)
|
|
{
|
|
return BaseCacheHelp.GetCache(onDB.DatabaseName + userDBPLineListKey, () =>
|
|
{
|
|
//取所有
|
|
var list = new DBUtility.Custom.DALHelperCustom<TBL_ProductionLine>("TBL_ProductionLine").GetList();
|
|
return list;
|
|
});
|
|
}
|
|
return null;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 清除客户库产线列表缓存
|
|
/// <summary>
|
|
/// 清除客户库产线列表缓存
|
|
/// </summary>
|
|
public static void ClearUserDBPLineList()
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
|
|
if (onDB != null)
|
|
{
|
|
BaseCacheHelp.ClearCache(onDB.DatabaseName + userDBPLineListKey);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 产品类型列表
|
|
|
|
#region 获取写入客户产品类型列表
|
|
|
|
/// <summary>
|
|
/// 获取写入订单列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<TBL_ProductTypes> GetUserDBProjectTypeList(string dbName = null)
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
|
|
if (onDB != null)
|
|
{
|
|
return BaseCacheHelp.GetCache((dbName ?? onDB.DatabaseName) + userDBSnProjectTypeKey, () =>
|
|
{
|
|
//取所有
|
|
var list = new DBUtility.Custom.DALHelperCustom<TBL_ProductTypes>("TBL_ProductTypes").GetList();
|
|
return list;
|
|
});
|
|
}
|
|
return null;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 清除客户库产品类型列表缓存
|
|
/// <summary>
|
|
/// 清除客户库订单列表缓存
|
|
/// </summary>
|
|
public static void ClearUserDBProjectTypeList()
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
|
|
if (onDB != null)
|
|
{
|
|
BaseCacheHelp.ClearCache(onDB.DatabaseName + userDBSnProjectTypeKey);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 订单列表
|
|
|
|
#region 获取写入客户订单列表
|
|
|
|
/// <summary>
|
|
/// 获取写入客户订单列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<TBL_Orders> GetUserDBOrderList(string dbName = null)
|
|
{
|
|
string strwhere = string.Empty;
|
|
int userid = Manager.Users.Umodel.ID;
|
|
int dbid = GetUserOperation(Users.Umodel.UserName);
|
|
if (SqlConnect.ProjectData(userid, dbid).ToString() != "")
|
|
{
|
|
string[] str = SqlConnect.ProjectData(userid, dbid).ToString().Split(',');
|
|
foreach (var item in str)
|
|
{
|
|
strwhere += "ProductID= " + item + " or ";
|
|
}
|
|
strwhere = strwhere.Substring(0, strwhere.Length - 3);
|
|
}
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
|
|
if (onDB != null)
|
|
{
|
|
if (strwhere != "")
|
|
{
|
|
return BaseCacheHelp.GetCache((dbName ?? onDB.DatabaseName) + userDBOrderListKey, () =>
|
|
{
|
|
//取所有
|
|
var list = new DBUtility.Custom.DALHelperCustom<TBL_Orders>("TBL_Orders").GetList(strwhere);
|
|
if (list == null)
|
|
return new List<TBL_Orders>();
|
|
return list;
|
|
});
|
|
}
|
|
else
|
|
{
|
|
return BaseCacheHelp.GetCache((dbName ?? onDB.DatabaseName) + userDBOrderListKey, () =>
|
|
{
|
|
//取所有
|
|
var list = new DBUtility.Custom.DALHelperCustom<TBL_Orders>("TBL_Orders").GetList();
|
|
if (list == null)
|
|
return new List<TBL_Orders>();
|
|
return list;
|
|
});
|
|
}
|
|
|
|
}
|
|
return null;
|
|
}
|
|
|
|
#endregion
|
|
public static List<TBL_UTS_Manage_User> GeiUserList()
|
|
{
|
|
return BaseCacheHelp.GetCache(sysDBOUserListKey, () =>
|
|
{
|
|
var list = new List<TBL_UTS_Manage_User>();
|
|
using (var db = new Uts_ManageEntities())
|
|
{
|
|
list = db.TBL_UTS_Manage_User.ToList();
|
|
}
|
|
return list;
|
|
});
|
|
}
|
|
|
|
#region 清除客户库订单列表缓存
|
|
/// <summary>
|
|
/// 清除客户库订单列表缓存
|
|
/// </summary>
|
|
public static void ClearUserDBOrderList()
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
|
|
if (onDB != null)
|
|
{
|
|
BaseCacheHelp.ClearCache(onDB.DatabaseName + userDBOrderListKey);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
public static void ClearProductTypes()
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
|
|
if (onDB != null)
|
|
{
|
|
BaseCacheHelp.ClearCache(onDB.DatabaseName + userDBSnProjectTypeKey);
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region 订单状态
|
|
|
|
#region 获取写入客户库订单状态列表
|
|
|
|
/// <summary>
|
|
/// 获取写入客户库订单状态列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<TBL_UTS_Manage_OrderStatus> GetUserDBOrderStatusLis()
|
|
{
|
|
return BaseCacheHelp.GetCache(sysDBOrderStatusListKey, () =>
|
|
{
|
|
//取所有
|
|
var list = new DBUtility.Common.DALHelper<TBL_UTS_Manage_OrderStatus>("TBL_UTS_Manage_OrderStatus").GetList();
|
|
return list;
|
|
});
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 清除客户库订单状态列表缓存
|
|
/// <summary>
|
|
/// 清除客户库订单状态列表缓存
|
|
/// </summary>
|
|
public static void ClearUserDBOrderStatusLis()
|
|
{
|
|
BaseCacheHelp.ClearCache(sysDBOrderStatusListKey);
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 工作站列表
|
|
|
|
#region 获取写入客户工作站列表
|
|
|
|
/// <summary>
|
|
/// 获取写入客户工作站列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<TBL_StationList> GetUserDBStationList()
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
|
|
if (onDB != null)
|
|
{
|
|
return BaseCacheHelp.GetCache(onDB.DatabaseName + userDBStationListKey, () =>
|
|
{
|
|
//取所有
|
|
var list = new DBUtility.Custom.DALHelperCustom<TBL_StationList>("TBL_StationList").GetList();
|
|
if (list != null)
|
|
list = list.Where(e => e.IsValid == 1).OrderBy(x => x.ArtworkOrder).ToList();
|
|
return list;
|
|
});
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public static List<TBL_StationList> GetUserDBStationList(System.Web.HttpContext context)
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer(context);
|
|
|
|
if (onDB != null)
|
|
{
|
|
return BaseCacheHelp.GetCache(onDB.DatabaseName + userDBStationListKey, () =>
|
|
{
|
|
//取所有
|
|
var list = new DBUtility.Custom.DALHelperCustom<TBL_StationList>("TBL_StationList").GetList().Where(e => e.IsValid == 1).ToList();
|
|
|
|
return list;
|
|
});
|
|
}
|
|
return null;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 清除客户库工作站列表缓存
|
|
/// <summary>
|
|
/// 清除客户库工作站列表缓存
|
|
/// </summary>
|
|
public static void ClearUserDBStationList()
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
|
|
if (onDB != null)
|
|
{
|
|
BaseCacheHelp.ClearCache(onDB.DatabaseName + userDBStationListKey);
|
|
}
|
|
}
|
|
|
|
public static void ClearUserDBStationList(string DbName)
|
|
{
|
|
BaseCacheHelp.ClearCache(DbName + userDBStationListKey);
|
|
}
|
|
|
|
public static void ClearUserDBOrderList(string DbName)
|
|
{
|
|
BaseCacheHelp.ClearCache(DbName + userDBOrderListKey);
|
|
}
|
|
public static void ClearUserDBOrderIList(string DbName)
|
|
{
|
|
BaseCacheHelp.ClearCache(DbName + userDBOrderInternalListKey);
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 内部订单列表
|
|
|
|
#region 获取写入内部订单列表
|
|
|
|
/// <summary>
|
|
/// 获取写入客户订单列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<TBL_OrderInternal> GetUserDBOrderInternalList()
|
|
{
|
|
string strwhere = string.Empty;
|
|
int userid = Manager.Users.Umodel.ID;
|
|
int dbid = GetUserOperation(Users.Umodel.UserName);
|
|
if (SqlConnect.ProjectData(userid, dbid).ToString() != "")
|
|
{
|
|
string[] str = SqlConnect.ProjectData(userid, dbid).ToString().Split(',');
|
|
foreach (var item in str)
|
|
{
|
|
strwhere += "ProductID= " + item + " or ";
|
|
}
|
|
strwhere = strwhere.Substring(0, strwhere.Length - 3);
|
|
}
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
|
|
if (onDB != null)
|
|
{
|
|
if(strwhere != "")
|
|
{
|
|
return BaseCacheHelp.GetCache(onDB.DatabaseName + userDBOrderInternalListKey, () =>
|
|
{
|
|
//取所有
|
|
var list = new DBUtility.Custom.DALHelperCustom<TBL_OrderInternal>("TBL_OrderInternal").GetList(strwhere);
|
|
if (list == null)
|
|
return new List<TBL_OrderInternal>();
|
|
|
|
return list;
|
|
});
|
|
}
|
|
else
|
|
{
|
|
return BaseCacheHelp.GetCache(onDB.DatabaseName + userDBOrderInternalListKey, () =>
|
|
{
|
|
//取所有
|
|
var list = new DBUtility.Custom.DALHelperCustom<TBL_OrderInternal>("TBL_OrderInternal").GetList();
|
|
if (list == null)
|
|
return new List<TBL_OrderInternal>();
|
|
|
|
return list;
|
|
});
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 清除客户库内部单列表缓存
|
|
/// <summary>
|
|
/// 清除客户库内部单列表缓存
|
|
/// </summary>
|
|
public static void ClearUserDBOrderInternalList()
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
|
|
if (onDB != null)
|
|
{
|
|
BaseCacheHelp.ClearCache(onDB.DatabaseName + userDBOrderInternalListKey);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 条码规则列表
|
|
|
|
#region 获取写入条码规则列表
|
|
|
|
/// <summary>
|
|
/// 获取写入条码规则列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<TBL_SnRules> GetUserDBSnRulesList()
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
|
|
if (onDB != null)
|
|
{
|
|
return BaseCacheHelp.GetCache(onDB.DatabaseName + userDBSnRulesListKey, () =>
|
|
{
|
|
//取所有
|
|
var list = new DBUtility.Custom.DALHelperCustom<TBL_SnRules>("TBL_SnRules").GetList();
|
|
return list;
|
|
});
|
|
}
|
|
return null;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 清除客户库条码规则列表缓存
|
|
/// <summary>
|
|
/// 清除客户库条码规则列表缓存
|
|
/// </summary>
|
|
public static void ClearUserDBSnRulesList()
|
|
{
|
|
var onDB = Manager.Users.GerOnUserCustomer();
|
|
|
|
if (onDB != null)
|
|
{
|
|
BaseCacheHelp.ClearCache(onDB.DatabaseName + userDBSnRulesListKey);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Hash缓存
|
|
|
|
#region 服务Hash列表(UDP通讯)
|
|
|
|
#region 获取写入服务Hash列表
|
|
/// <summary>
|
|
/// 获取写入服务Hash列表
|
|
/// </summary>
|
|
/// <returns>返回数据库列表</returns>
|
|
public static TBL_UTS_Manage_DataServiceList GetHashService(int sid)
|
|
{
|
|
return BaseCacheHelp.GetHashCache(sysServiceListKey, sid.ToString(), () =>
|
|
{
|
|
var mdoel = new TBL_UTS_Manage_DataServiceList();
|
|
using (var db = new Uts_ManageEntities())
|
|
{
|
|
//取所有
|
|
mdoel = db.TBL_UTS_Manage_DataServiceList.SingleOrDefault(x => x.ID == sid);
|
|
}
|
|
return mdoel;
|
|
});
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 写入服务Hash
|
|
/// <summary>
|
|
/// 写入服务Hash
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
public static void SetHashService(TBL_UTS_Manage_DataServiceList model)
|
|
{
|
|
BaseCacheHelp.SetHashCache(sysServiceListKey, model.ID.ToString(), model);
|
|
}
|
|
#endregion
|
|
|
|
#region 获取服务Hash列表
|
|
public static List<TBL_UTS_Manage_DataServiceList> GetHashServiceList()
|
|
{
|
|
if (BaseCacheHelp.CheckKey(sysServiceListKey))
|
|
{
|
|
return BaseCacheHelp.GetHashAllCache<TBL_UTS_Manage_DataServiceList>(sysServiceListKey).Values.OrderBy(x => x.ID).ToList();
|
|
}
|
|
else
|
|
{
|
|
var list = new List<TBL_UTS_Manage_DataServiceList>();
|
|
using (var db = new Uts_ManageEntities())
|
|
{
|
|
//取所有
|
|
list = db.TBL_UTS_Manage_DataServiceList.OrderBy(x => x.ID).ToList();
|
|
Dictionary<string, TBL_UTS_Manage_DataServiceList> dic = list.ToDictionary(key => key.ID.ToString(), value => value);
|
|
BaseCacheHelp.SetHashCache(sysServiceListKey, dic);
|
|
}
|
|
return list;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
}
|