using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Core.StlMes.Client.LgCommon;
using System.IO;
using Core.StlMes.Client.LgResMgt.Mcms.entity;
using System.Reflection;
namespace Core.StlMes.Client.LgResMgt.Mcms
{
///
/// 基础数据获取
///
public class BaseDbCls
{
Log lg = Log.GetInstance();
public bool getBaseDb()
{
#region 读取音频文件名称
List ls = new List();
DirectoryInfo folder = new DirectoryInfo(PbCache.path + "\\Sound");
foreach (FileInfo file in folder.GetFiles("*.wav"))
{
ls.Add(file.Name.Replace(".wav", ""));
}
PbCache.voiceInfo = ls;
#endregion
return true;
}
///
/// 将基础数据全部载入缓存中
///
///
public bool setBaseDb()
{
#region 初始化一次缓存类
PbCache.Load();
#endregion
#region 历史皮重计算配置表
#endregion
#region 期限皮重计算配置表
//MeterBaseTermTareCountService termTareCountService = new MeterBaseTermTareCountService();
//RESTfulResult> rmTe = termTareCountService.doQueryWf(new MeterBaseTermTareCount { valueFlag = "0", typeNo = "001033001" }); //0有效 1无效 //db.doOption>("MeterBaseHisTareCountService", "doQueryWf", new object[] { mbhtc }, 0);
//if (rmTe.Succeed && rmTe.Data != null && rmTe.Data.Count > 0)
//{
// PbCache.termTareCount = rmTe.Data[0];
//}
//else
//{
// lg.WriteLog(1, "未找到期限皮重配置信息MeterBaseHisTareCount");
// return false;
//}
#endregion
#region 危化品限载配置
/*
MeterBaseLimitChemicalService limitService = new MeterBaseLimitChemicalService();
RESTfulResult> rmL = limitService.doQueryWf(new MeterBaseLimitChemical { valueFlag = "1" });
if (rmL.Succeed)
{
PbCache.limit = rmL.Data;
}
else
{
lg.WriteLog(5, "未找到危化品限载配置信息MeterBaseLimitChemical");
return false;
}
//*/
#endregion
#region 两次计量时间间隔配置
/*
MeterBaseTimeSpaceService spaceService = new MeterBaseTimeSpaceService();
RESTfulResult> rmS = spaceService.doQueryWf(new MeterBaseTimeSpace { spotTypeNo = "001002001" });//汽车衡
if (rmS.Succeed)
{
PbCache.timeSpace = rmS.Data;
}
else
{
lg.WriteLog(5, "未找到两次计量时间间隔配置信息MeterBaseTimeSpace");
return false;
}
//*/
#endregion
#region 所有计量点数据
PbCache.sportInfos = new List();
#endregion
#region 计量卸货时间
#endregion
#region 校秤计量关联,用于获取是否限制
/*
string sql = @"select base_spot_no baseSpotNo,
base_spot_name baseSpotName,
up_weight upWeight,
is_meter isMeter
from METER_BASE_CALIBRA_NUM_REL
group by base_spot_no, base_spot_name, UP_WEIGHT, is_meter";
PbModelDbService> pbNumRel = new PbModelDbService>();
RESTfulResult> rmNumRel = pbNumRel.executeSqlDataWf(sql);
if (rmNumRel.Succeed && rmNumRel.Data != null && rmNumRel.Data.Count > 0)
{
PbCache.ltBaseCalibraNumRel = rmNumRel.Data;
}
else
{
lg.WriteLog(1, "未找到秤点关联表METER_BASE_CALIBRA_NUM_REL信息");
return false;
}
//*/
#endregion
return true;
}
public bool getSpot()
{
//#region 获取摄像头数据用于截图
//if (PbCache.ltVideoInfo != null && PbCache.ltVideoInfo.Count > 0)
//{
// PbCache.videoInfo = PbCache.ltVideoInfo.Where(s => s.pointid == PbCache.sportInfo.BaseSpotNo).FirstOrDefault();
// List videoChild = new List();
// Type postType = PbCache.videoInfo.GetType();
// PropertyInfo[] postTypeInfos = postType.GetProperties(); //返回为当前 Type 的所有公共属性,PropertyInfo[] PropertyInfo 的所有公共属性的 Type 对象数组
// foreach (PropertyInfo p in postTypeInfos)
// {
// if (p.Name.Contains("position"))
// {
// string str = (string)p.GetValue(PbCache.videoInfo, null);
// if (str != "" && str != null)
// {
// videoChild.Add(
// new MeterBaseVideoChild
// {
// pointid = PbCache.videoInfo.pointid,
// p_ip = str,
// p_rate = "0",//************解码率直接给定了,这里没取配置值*************
// vdo_port = PbCache.videoInfo.vdoPort,
// vdo_pwd = PbCache.videoInfo.vdoPwd,
// vdo_user = PbCache.videoInfo.vdoUser
// }
// );
// }
// }
// }
// PbCache.videoChild = videoChild;
// if (videoChild.Count == 0)
// {
// return false;
// }
// else
// {
// //将摄像头操作类存储再缓存中
// List list = new List();
// foreach (MeterBaseVideoChild child in PbCache.videoChild)
// {
// DhCameraShot cameraShot = new DhCameraShot();
// cameraShot.ip = child.p_ip;
// cameraShot.port = child.vdo_port;
// cameraShot.uid = child.vdo_user;
// cameraShot.pwd = child.vdo_pwd;
// list.Add(cameraShot);
// }
// CarCache.cameraShots = list;
// }
//}
//#endregion
return true;
}
}
}