| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- 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
- {
- /// <summary>
- /// 基础数据获取
- /// </summary>
- public class BaseDbCls
- {
- Log lg = Log.GetInstance();
- public bool getBaseDb()
- {
- #region 读取音频文件名称
- List<string> ls = new List<string>();
- 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;
- }
- /// <summary>
- /// 将基础数据全部载入缓存中
- /// </summary>
- /// <returns></returns>
- public bool setBaseDb()
- {
- #region 初始化一次缓存类
-
- PbCache.Load();
- #endregion
- #region 历史皮重计算配置表
-
- #endregion
- #region 期限皮重计算配置表
- //MeterBaseTermTareCountService termTareCountService = new MeterBaseTermTareCountService();
- //RESTfulResult<List<MeterBaseTermTareCount>> rmTe = termTareCountService.doQueryWf(new MeterBaseTermTareCount { valueFlag = "0", typeNo = "001033001" }); //0有效 1无效 //db.doOption<List<MeterBaseHisTareCount>>("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<List<MeterBaseLimitChemical>> 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<List<MeterBaseTimeSpace>> 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<CmmBaseSpotInfoEntity>();
- #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<List<MeterBaseCalibraNumRel>> pbNumRel = new PbModelDbService<List<MeterBaseCalibraNumRel>>();
- RESTfulResult<List<MeterBaseCalibraNumRel>> 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<MeterBaseVideoChild> videoChild = new List<MeterBaseVideoChild>();
- // 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<DhCameraShot> list = new List<DhCameraShot>();
- // 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;
- }
- }
- }
|