/// <summary> /// 加载配置 /// </summary> void LoadAppConfig() { txtAppIdentifier.Text = commonAppConfig.AppIdentifier; txtSelfConnStr.Text = commonAppConfig.SelfConnStr; chbStartup.Checked = (commonDAO.GetAppletConfigString("开机启动") == "1"); txtJxSamplerMachineCode.Text = commonDAO.GetAppletConfigString("采样机设备编码"); if (txtJxSamplerMachineCode.Text.Contains("1")) { txtSqlConnStr.Text = commonDAO.GetCommonAppletConfigString("#1汽车机械采样机接口连接字符串"); } else if (txtJxSamplerMachineCode.Text.Contains("2")) { txtSqlConnStr.Text = commonDAO.GetCommonAppletConfigString("#2汽车机械采样机接口连接字符串"); } // IO控制器 SelectedComboBoxItem(cmbIocerCom, commonDAO.GetAppletConfigInt32("IO控制器_串口").ToString()); SelectedComboBoxItem(cmbIocerBandrate, commonDAO.GetAppletConfigInt32("IO控制器_波特率").ToString()); SelectedComboBoxItem(cmbIocerDataBits, commonDAO.GetAppletConfigInt32("IO控制器_数据位").ToString()); SelectedComboBoxItem(cmbIocerStopBits, commonDAO.GetAppletConfigInt32("IO控制器_停止位").ToString()); SelectedComboBoxItem(cmbIocerParity, commonDAO.GetAppletConfigInt32("IO控制器_校验位").ToString()); SelectedComboBoxItem(cmbInductorCoil1Port, commonDAO.GetAppletConfigInt32("IO控制器_地感1端口").ToString()); SelectedComboBoxItem(cmbInductorCoil2Port, commonDAO.GetAppletConfigInt32("IO控制器_地感2端口").ToString()); SelectedComboBoxItem(cmbGate1UpPort, commonDAO.GetAppletConfigInt32("IO控制器_道闸1升杆端口").ToString()); SelectedComboBoxItem(cmbGate1DownPort, commonDAO.GetAppletConfigInt32("IO控制器_道闸1降杆端口").ToString()); SelectedComboBoxItem(cmbAffirmPort, commonDAO.GetAppletConfigInt32("IO控制器_确认按钮端口").ToString()); // 车号识别 iptxtRwer1.Value = commonDAO.GetAppletConfigString("车号识别1_IP地址"); // LED显示屏 iptxtLED1IP.Value = commonDAO.GetAppletConfigString("LED显示屏1_IP地址"); }
private DcDbers() { BeltSampler_Dber = new SqlServerDapperDber(commonDAO.GetCommonAppletConfigString("皮带采样机接口连接字符串")); AutoCupboard_Dber = new SqlServerDapperDber(commonDAO.GetCommonAppletConfigString("智能存样柜接口连接字符串")); PneumaticTransfer_Dber = new SqlServerDapperDber(commonDAO.GetCommonAppletConfigString("气动传输接口连接字符串")); CarJXSampler_Dber = new OracleDapperDber(commonDAO.GetCommonAppletConfigString("汽车机械采样机接口连接字符串")); TurnCarWeighterMutualDber = new OracleDapperDber(string.Format(commonDAO.GetCommonAppletConfigString("翻车衡数据库连接字符串"), DateTime.Now.Year)); }
private DcDbers() { try { BuyFuel_SelfDber_IP = commonDAO.GetCommonAppletConfigString("入场煤数据库IP"); } catch { } try { Sale_SelfDber_IP = commonDAO.GetCommonAppletConfigString("销售煤数据库IP"); } catch { } }
private void FrmSetting_Load(object sender, EventArgs e) { try { labelX1.ForeColor = Color.Red; labelX4.ForeColor = Color.Red; txtAppIdentifier.Text = CommonAppConfig.GetInstance().AppIdentifier; txtSelfConnStr.Text = CommonAppConfig.GetInstance().SelfConnStr; //电子秤 SelectedComboItem("COM" + commonDAO.GetAppletConfigInt32("电子秤串口"), cmbLibra_COM); SelectedComboItem(commonDAO.GetAppletConfigString("电子秤波特率"), cmbLibra_Bandrate); SelectedComboItem(commonDAO.GetAppletConfigString("电子秤数据位"), cmbDataBits); SelectedComboItem(commonDAO.GetAppletConfigString("电子秤停止位"), cmbParity); dInputLibraWeight.Value = commonDAO.GetAppletConfigDouble("电子秤最小重量"); chkIsUseWeight.Checked = Convert.ToBoolean(commonDAO.GetAppletConfigInt32("启用称重")); cmbMake.Text = commonDAO.GetCommonAppletConfigString(CommonAppConfig.GetInstance().AppIdentifier + "对应制样机"); // 全局参数 Old_Param = (cmbLibra_COM.SelectedIndex + 1).ToString() + (cmbLibra_Bandrate.SelectedItem as ComboItem).Text + (cmbDataBits.SelectedItem as ComboItem).Text + (cmbParity.SelectedItem as ComboItem).Text + dInputLibraWeight.Value.ToString() + chkIsUseWeight.Checked.ToString() + cmbMake.Text; } catch (Exception ex) { MessageBoxEx.Show("参数初始化失败" + ex.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
/// <summary> /// 发送采样计划,若存在则更新 /// </summary> /// <param name="view_TrainTipperQueue"></param> /// <returns></returns> public bool SendSamplePlan(View_TrainTipperQueue view_TrainTipperQueue) { CmcsInFactoryBatch inFactoryBatch = Dbers.GetInstance().SelfDber.Get <CmcsInFactoryBatch>(view_TrainTipperQueue.InFactoryBatchId); if (inFactoryBatch == null) { throw new ArgumentNullException("inFactoryBatchId", "未找到Id=" + view_TrainTipperQueue.InFactoryBatchId + "的批次"); } CmcsFuelKind fuelKind = Dbers.GetInstance().SelfDber.Get <CmcsFuelKind>(inFactoryBatch.FuelKindId); List <View_TrainTipperQueue> list = trainTipperDAO.GetView_TrainTipperQueueBy(view_TrainTipperQueue.TrainSampleSchemeId); InfBeltSamplePlan oldBeltSamplePlan = Dbers.GetInstance().SelfDber.Entity <InfBeltSamplePlan>("where InFactoryBatchId=:InFactoryBatchId and SampleCode=:SampleCode", new { InFactoryBatchId = view_TrainTipperQueue.InFactoryBatchId, SampleCode = view_TrainTipperQueue.YuSampleCode }); if (oldBeltSamplePlan == null) { Log4Neter.Info(this.trainTipper.EquipmentName + " - 向[" + this.trainBeltSampler.EquipmentCode + "]发送采样计划,采样码:" + view_TrainTipperQueue.YuSampleCode); return(Dbers.GetInstance().SelfDber.Insert <InfBeltSamplePlan>(new InfBeltSamplePlan { DataFlag = 0, InterfaceType = this.trainBeltSampler.InterfaceType, InFactoryBatchId = view_TrainTipperQueue.InFactoryBatchId, SampleCode = view_TrainTipperQueue.YuSampleCode, FuelKindName = fuelKind != null ? fuelKind.Name : string.Empty, CarCount = list.Count, Mt = 0, TicketWeight = list.Sum(a => a.TicketQty), SampleType = eEquInfSampleType.到集样罐.ToString(), GatherType = commonDAO.GetCommonAppletConfigString(this.trainBeltSampler.EquipmentCode + "集样方式") }) > 0); } else { Log4Neter.Info(this.trainTipper.EquipmentName + " - 向[" + this.trainBeltSampler.EquipmentCode + "]更新采样计划,采样码:" + view_TrainTipperQueue.YuSampleCode); oldBeltSamplePlan.DataFlag = 0; oldBeltSamplePlan.FuelKindName = fuelKind != null ? fuelKind.Name : string.Empty; oldBeltSamplePlan.CarCount = list.Count; oldBeltSamplePlan.Mt = 0; oldBeltSamplePlan.TicketWeight = list.Sum(a => a.TicketQty); oldBeltSamplePlan.SampleType = eEquInfSampleType.到集样罐.ToString(); oldBeltSamplePlan.GatherType = commonDAO.GetCommonAppletConfigString(this.trainBeltSampler.EquipmentCode + "集样方式"); return(Dbers.GetInstance().SelfDber.Update(oldBeltSamplePlan) > 0); } }
/// <summary> /// 加载配置 /// </summary> void LoadAppConfig() { txtAppIdentifier.Text = commonAppConfig.AppIdentifier; txtSelfConnStr.Text = commonAppConfig.SelfConnStr; chbStartup.Checked = (commonDAO.GetAppletConfigString("开机启动") == "1"); txtJxSamplerMachineCode.Text = commonDAO.GetCommonAppletConfigString("火车采样机设备编码"); }
private void FrmSetting_Load(object sender, EventArgs e) { try { labelX1.ForeColor = Color.Red; labelX4.ForeColor = Color.Red; labelX12.ForeColor = Color.Red; labelX11.ForeColor = Color.Red; labelX25.ForeColor = Color.Red; labelX30.ForeColor = Color.Red; txtAppIdentifier.Text = CommonAppConfig.GetInstance().AppIdentifier; txtSelfConnStr.Text = CommonAppConfig.GetInstance().SelfConnStr; SelectedComboItem(commonDAO.GetCommonAppletConfigString(CommonAppConfig.GetInstance().AppIdentifier + "对应制样机"), cmbMake); //电子秤 SelectedComboItem("COM" + commonDAO.GetAppletConfigInt32("电子秤串口"), cmbLibra_COM); SelectedComboItem(commonDAO.GetAppletConfigString("电子秤波特率"), cmbLibra_Bandrate); SelectedComboItem(commonDAO.GetAppletConfigString("电子秤数据位"), cmbDataBits); SelectedComboItem(commonDAO.GetAppletConfigString("电子秤停止位"), cmbParity); dInputLibraWeight.Value = commonDAO.GetAppletConfigDouble("电子秤最小重量"); chkIsUseWeight.Checked = Convert.ToBoolean(commonDAO.GetAppletConfigInt32("启用称重")); dobBarrelWeight.Value = commonDAO.GetAppletConfigDouble("人工样桶重量"); //电子天平 SelectedComboItem("COM" + commonDAO.GetAppletConfigInt32("电子天平串口"), cmbLibramin_COM); SelectedComboItem(commonDAO.GetAppletConfigString("电子天平波特率"), cmbLibramin_Bandrate); SelectedComboItem(commonDAO.GetAppletConfigString("电子天平数据位"), cmbminDataBits); SelectedComboItem(commonDAO.GetAppletConfigString("电子天平停止位"), cmbminParity); dInputLibraminWeight.Value = commonDAO.GetAppletConfigDouble("电子天平最小重量"); chkminIsUseWeight.Checked = Convert.ToBoolean(commonDAO.GetAppletConfigInt32("电子天平启用称重")); // 读卡器 iptxtIP.Value = commonDAO.GetAppletConfigString("读卡器IP"); txtPort.Text = commonDAO.GetAppletConfigString("读卡器端口"); SelectedComboItem(commonDAO.GetAppletConfigString("读卡器扇区"), cmbSecNumber); SelectedComboItem(commonDAO.GetAppletConfigString("读卡器块区"), cmbBlockNumber); //样罐 db2Weight.Value = commonDAO.GetCommonAppletConfigDouble("0.2mm样罐重"); db3Weight.Value = commonDAO.GetCommonAppletConfigDouble("3mm样罐重"); db6Weight.Value = commonDAO.GetCommonAppletConfigDouble("6mm样罐重"); db2OverWeight.Value = commonDAO.GetCommonAppletConfigDouble("0.2mm超差重"); db3OverWeight.Value = commonDAO.GetCommonAppletConfigDouble("3mm超差重"); db6OverWeight.Value = commonDAO.GetCommonAppletConfigDouble("6mm超差重"); // 全局参数 Old_Param = (cmbLibra_COM.SelectedIndex + 1).ToString() + (cmbLibra_Bandrate.SelectedItem as ComboItem).Text + (cmbDataBits.SelectedItem as ComboItem).Text + (cmbParity.SelectedItem as ComboItem).Text + dInputLibraWeight.Value.ToString() + chkIsUseWeight.Checked.ToString(); } catch (Exception ex) { MessageBoxEx.Show("参数初始化失败" + ex.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
public void InitFrom() { this.IsUseWeight = Convert.ToBoolean(commonDAO.GetAppletConfigInt32("启用称重")); this._CodePrinter = new CodePrinter(printDocument1); // 获取全自动制样机 this.AutoMaker = commonDAO.GetCMEquipmentByMachineCode(commonDAO.GetCommonAppletConfigString(CommonAppConfig.GetInstance().AppIdentifier + "对应制样机")); }
/// <summary> /// 执行所有任务 /// </summary> void ExecuteAllTask() { DataHandlerDAO dataHandlerDAO = DataHandlerDAO.GetInstance(); SqlServerDapperDber qgcDapperDber = new SqlServerDapperDber(commonDAO.GetCommonAppletConfigString("全过程接口连接字符串")); taskSimpleScheduler.StartNewTask("同步全过程基础信息", () => { dataHandlerDAO.SyncBaseInfoForCHLGL(this.rTxtOutputer.Output, qgcDapperDber); //dataHandlerDAO.SyncBaseInfoForDYJH(this.rTxtOutputer.Output, qgcDapperDber); dataHandlerDAO.SyncBaseInfoForGYS(this.rTxtOutputer.Output, qgcDapperDber); //dataHandlerDAO.SyncBaseInfoForCHYSH(this.rTxtOutputer.Output, qgcDapperDber); dataHandlerDAO.SyncBaseInfoForKB(this.rTxtOutputer.Output, qgcDapperDber); dataHandlerDAO.SyncBaseInfoForMZ(this.rTxtOutputer.Output, qgcDapperDber); dataHandlerDAO.SyncBaseInfoForDYJHK(this.rTxtOutputer.Output, qgcDapperDber); dataHandlerDAO.SyncBaseInfoForYAPFK(this.rTxtOutputer.Output, qgcDapperDber); dataHandlerDAO.SyncBaseInfoForQCLMYGP(this.rTxtOutputer.Output, qgcDapperDber); dataHandlerDAO.SyncBaseInfoForWZJHCL(this.rTxtOutputer.Output, qgcDapperDber); dataHandlerDAO.SyncBaseInfoForJLMZ(this.rTxtOutputer.Output, qgcDapperDber); dataHandlerDAO.SyncBaseInfoForJLPZ(this.rTxtOutputer.Output, qgcDapperDber); dataHandlerDAO.SyncBaseInfoForcCLGLLSPZ(this.rTxtOutputer.Output, qgcDapperDber); }, 10000, OutputError); taskSimpleScheduler.StartNewTask("处理集控首页数据", () => { dataHandlerDAO.HandleHomePageData(this.rTxtOutputer.Output); }, 10000, OutputError); //初始化Api string ip = commonDAO.GetCommonAppletConfigString("海康平台地址"); int port = commonDAO.GetCommonAppletConfigInt32("海康协议端口号"); string Appkey = commonDAO.GetCommonAppletConfigString("海康Appkey"); string Secret = commonDAO.GetCommonAppletConfigString("海康Secret"); HttpUtillib.SetPlatformInfo(Appkey, Secret, ip, port, false); taskSimpleScheduler.StartNewTask("同步门禁数据", () => { dataHandlerDAO.SyncDoorEventData(this.rTxtOutputer.Output); }, 60000, OutputError); }
///// <summary> ///// 保存定硫仪数据 ///// </summary> ///// <param name="output"></param> ///// <returns></returns> //public int SaveToSulfurStdAssay_CSKY(Action<string, eOutputType> output) //{ // int res = 0; // //定硫仪 // foreach (V_STAD entity in dcDbersDAO.CSKY_Clims_SelfDber.Entities<V_STAD>(" where TEST_TIME_END>=@TEST_TIME_END and SAMPLE_NO is not null", new { TEST_TIME_END = DateTime.Now.AddDays(-Convert.ToInt32(commonDAO.GetAppletConfigString("化验设备数据读取天数"))).Date })) // { // CmcsSulfurStdAssay item = Dbers.GetInstance().SelfDber.Entity<CmcsSulfurStdAssay>("where PKID=:PKID", new { PKID = entity.ID + entity.APP_CODE }); // if (item == null) // { // item = new CmcsSulfurStdAssay(); // item.SampleNumber = entity.SAMPLE_NO; // item.FacilityNumber = entity.APP_Name; // item.ContainerWeight = 0; // item.SampleWeight = 0; // item.Stad = entity.STAD; // item.AssayUser = entity.TEST_Man; // item.AssayTime = entity.PF_DATE; // item.OrderNumber = 0; // item.IsEffective = 0; // item.PKID = entity.ID + entity.APP_CODE; // item.DataType = "有效数据"; // res += Dbers.GetInstance().SelfDber.Insert<CmcsSulfurStdAssay>(item); // } // else // { // item.SampleNumber = entity.SAMPLE_NO; // item.FacilityNumber = entity.APP_Name; // item.ContainerWeight = 0; // item.SampleWeight = 0; // item.Stad = entity.STAD; // item.AssayUser = entity.TEST_Man; // item.AssayTime = entity.PF_DATE; // item.OrderNumber = 0; // item.DataType = "有效数据"; // res += Dbers.GetInstance().SelfDber.Update<CmcsSulfurStdAssay>(item); // } // } // output(string.Format("同步开元定硫数据 {0} 条", res), eOutputType.Important); // return res; //} ///// <summary> ///// 保存量热仪数据 ///// </summary> ///// <param name="output"></param> ///// <returns></returns> //public int SaveToHeatAssay_CSKY(Action<string, eOutputType> output) //{ // int res = 0; // //量热仪 // foreach (V_QBAD entity in dcDbersDAO.CSKY_Clims_SelfDber.Entities<V_QBAD>(" where TEST_TIME_END>=@TEST_TIME_END and SAMPLE_NO is not null", new { TEST_TIME_END = DateTime.Now.AddDays(-Convert.ToInt32(commonDAO.GetAppletConfigString("化验设备数据读取天数"))).Date })) // { // CmcsHeatStdAssay item = Dbers.GetInstance().SelfDber.Entity<CmcsHeatStdAssay>("where PKID=:PKID", new { PKID = entity.ID + entity.APP_CODE }); // if (item == null) // { // item = new CmcsHeatStdAssay(); // item.SampleNumber = entity.SAMPLE_NO; // item.FacilityNumber = entity.APP_Name; // item.ContainerWeight = 0; // item.SampleWeight = entity.SAMPLE_WEIGHT; // item.Qbad = entity.QBAD; // item.AssayUser = entity.TEST_MAN; // item.AssayTime = entity.PF_DATE; // item.IsEffective = 0; // item.PKID = entity.ID + entity.APP_CODE; // item.DataType = "有效数据"; // res += Dbers.GetInstance().SelfDber.Insert<CmcsHeatStdAssay>(item); // } // else // { // item.SampleNumber = entity.SAMPLE_NO; // item.FacilityNumber = entity.APP_Name; // item.ContainerWeight = 0; // item.SampleWeight = entity.SAMPLE_WEIGHT; // item.Qbad = entity.QBAD; // item.AssayUser = entity.TEST_MAN; // item.AssayTime = entity.PF_DATE; // item.DataType = "有效数据"; // res += Dbers.GetInstance().SelfDber.Update<CmcsHeatStdAssay>(item); // } // } // output(string.Format("同步开元量热数据 {0} 条", res), eOutputType.Important); // return res; //} ///// <summary> ///// 保存水分仪数据 ///// </summary> ///// <param name="output"></param> ///// <returns></returns> //public int SaveToMoistureAssay_CSKY(Action<string, eOutputType> output) //{ // int res = 0; // foreach (V_MT entity in dcDbersDAO.CSKY_Clims_SelfDber.Entities<V_MT>(" where TEST_TIME_END>=@TEST_TIME_END and SAMPLE_NO is not null", new { TEST_TIME_END = DateTime.Now.AddDays(-Convert.ToInt32(commonDAO.GetAppletConfigString("化验设备数据读取天数"))).Date })) // { // CmcsMoistureStdAssay item = Dbers.GetInstance().SelfDber.Entity<CmcsMoistureStdAssay>("where PKID=:PKID", new { PKID = entity.ID + entity.APP_CODE }); // if (item == null) // { // item = new CmcsMoistureStdAssay(); // item.SampleNumber = entity.SAMPLE_NO; // item.FacilityNumber = entity.APP_Name; // item.ContainerWeight = 0; // item.SampleWeight = entity.SAMPLE_WEIGHT; // item.ContainerWeight = entity.C_WEIGHT; // item.WaterPer = entity.MT; // item.AssayUser = entity.TEST_MAN; // item.IsEffective = 0; // item.PKID = entity.ID + entity.APP_CODE; // item.AssayTime = entity.TEST_TIME_START; // item.WaterType = "全水分"; // item.DataType = "有效数据"; // res += Dbers.GetInstance().SelfDber.Insert<CmcsMoistureStdAssay>(item); // } // else // { // item.SampleNumber = entity.SAMPLE_NO; // item.FacilityNumber = entity.APP_Name; // item.ContainerWeight = 0; // item.SampleWeight = entity.SAMPLE_WEIGHT; // item.ContainerWeight = entity.C_WEIGHT; // item.WaterPer = entity.MT; // item.AssayUser = entity.TEST_MAN; // item.IsEffective = 0; // item.AssayTime = entity.TEST_TIME_START; // item.WaterType = "全水分"; // item.DataType = "有效数据"; // res += Dbers.GetInstance().SelfDber.Update<CmcsMoistureStdAssay>(item); // } // } // output(string.Format("同步开元全水数据 {0} 条", res), eOutputType.Important); // res = 0; // foreach (V_Mad entity in dcDbersDAO.CSKY_Clims_SelfDber.Entities<V_Mad>(" where TEST_TIME_END>=@TEST_TIME_END and SAMPLE_NO is not null", new { TEST_TIME_END = DateTime.Now.AddDays(-Convert.ToInt32(commonDAO.GetAppletConfigString("化验设备数据读取天数"))).Date })) // { // CmcsMoistureStdAssay item = Dbers.GetInstance().SelfDber.Entity<CmcsMoistureStdAssay>("where PKID=:PKID", new { PKID = entity.ID + entity.APP_CODE }); // if (item == null) // { // item = new CmcsMoistureStdAssay(); // item.SampleNumber = entity.SAMPLE_NO; // item.FacilityNumber = entity.APP_Name; // item.ContainerWeight = 0; // item.SampleWeight = entity.SAMPLE_WEIGHT; // item.WaterPer = entity.MAD; // item.AssayUser = entity.TEST_MAN; // item.IsEffective = 0; // item.PKID = entity.ID + entity.APP_CODE; // item.AssayTime = entity.TEST_TIME_START; // item.WaterType = "内水"; // item.DataType = "有效数据"; // res += Dbers.GetInstance().SelfDber.Insert<CmcsMoistureStdAssay>(item); // } // else // { // item.SampleNumber = entity.SAMPLE_NO; // item.FacilityNumber = entity.APP_Name; // item.ContainerWeight = 0; // item.SampleWeight = entity.SAMPLE_WEIGHT; // item.WaterPer = entity.MAD; // item.AssayUser = entity.TEST_MAN; // item.IsEffective = 0; // item.AssayTime = entity.TEST_TIME_START; // item.WaterType = "内水"; // item.DataType = "有效数据"; // res += Dbers.GetInstance().SelfDber.Update<CmcsMoistureStdAssay>(item); // } // } // output(string.Format("同步开元内水数据 {0} 条", res), eOutputType.Important); // return res; //} ///// <summary> ///// 保存工分仪数据 ///// </summary> ///// <param name="output"></param> ///// <returns></returns> //public int SaveToProximateAssay_SCKY(Action<string, eOutputType> output) //{ // int res = 0; // foreach (V_Gyfx entity in dcDbersDAO.CSKY_Clims_SelfDber.Entities<V_Gyfx>(" where mTEST_TIME_END>=@TEST_TIME_END and mSAMPLE_NO is not null", new { TEST_TIME_END = DateTime.Now.AddDays(-Convert.ToInt32(commonDAO.GetAppletConfigString("化验设备数据读取天数"))).Date })) // { // CmcsProximateStdAssay item = Dbers.GetInstance().SelfDber.Entity<CmcsProximateStdAssay>("where PKID=:PKID", new { PKID = entity.mID + entity.mAPP_CODE }); // if (item == null) // { // item = new CmcsProximateStdAssay(); // item.SampleNumber = entity.mSAMPLE_NO; // item.FacilityNumber = entity.mAPP_Name; // item.ContainerWeight = entity.mM_WEIGHT; // item.SampleWeight = entity.mSAMPLE_WEIGHT; // item.Mad = entity.Mad; // item.Vad = entity.Vad; // item.Aad = entity.Aad; // item.AssayUser = entity.mTEST_MAN; // item.IsEffective = 0; // item.PKID = entity.mID + entity.mAPP_CODE; // item.AssayTime = entity.mTEST_TIME_START; // res += Dbers.GetInstance().SelfDber.Insert<CmcsProximateStdAssay>(item); // } // else // { // item.SampleNumber = entity.mSAMPLE_NO; // item.FacilityNumber = entity.mAPP_Name; // item.ContainerWeight = entity.mM_WEIGHT; // item.SampleWeight = entity.mSAMPLE_WEIGHT; // item.Mad = entity.Mad; // item.Vad = entity.Vad; // item.Aad = entity.Aad; // item.AssayUser = entity.mTEST_MAN; // item.IsEffective = 0; // item.AssayTime = entity.mTEST_TIME_START; // res += Dbers.GetInstance().SelfDber.Update<CmcsProximateStdAssay>(item); // } // } // output(string.Format("同步开元工分仪数据 {0} 条", res), eOutputType.Important); // return res; //} ///// <summary> ///// 保存灰熔融数据 ///// </summary> ///// <param name="output"></param> ///// <returns></returns> //public int SaveToAshAssay_SCKY(Action<string, eOutputType> output) //{ // int res = 0; // foreach (V_FCA entity in dcDbersDAO.CSKY_Clims_SelfDber.Entities<V_FCA>(" where TEST_TIME_END>=@TEST_TIME_END and SAMPLE_NO is not null", new { TEST_TIME_END = DateTime.Now.AddDays(-Convert.ToInt32(commonDAO.GetAppletConfigString("化验设备数据读取天数"))).Date })) // { // CmcsAshStdAssay item = Dbers.GetInstance().SelfDber.Entity<CmcsAshStdAssay>("where PKID=:PKID", new { PKID = entity.ID + entity.APP_CODE }); // if (item == null) // { // item = new CmcsAshStdAssay(); // item.SampleNumber = entity.SAMPLE_NO; // item.FacilityNumber = entity.APP_Name; // item.ContainerWeight = 0; // item.SampleWeight = entity.SAMPLE_WEIGHT; // item.DT = entity.DT; // item.FT = entity.FT; // item.ST = entity.ST; // item.HT = entity.HT; // item.AssayUser = ""; // item.IsEffective = 0; // item.PKID = entity.ID + entity.APP_CODE; // item.AssayTime = entity.TEST_TIME_START; // item.DataType = "有效数据"; // res += Dbers.GetInstance().SelfDber.Insert<CmcsAshStdAssay>(item); // } // else // { // item.SampleNumber = entity.SAMPLE_NO; // item.FacilityNumber = entity.APP_Name; // item.ContainerWeight = 0; // item.SampleWeight = entity.SAMPLE_WEIGHT; // item.DT = entity.DT; // item.FT = entity.FT; // item.ST = entity.ST; // item.HT = entity.HT; // item.AssayUser = ""; // item.IsEffective = 0; // item.AssayTime = entity.TEST_TIME_START; // item.DataType = "有效数据"; // res += Dbers.GetInstance().SelfDber.Update<CmcsAshStdAssay>(item); // } // } // output(string.Format("同步开元灰熔融数据 {0} 条", res), eOutputType.Important); // return res; //} ///// <summary> ///// 保存碳氢仪数据 ///// </summary> ///// <param name="output"></param> ///// <returns></returns> //public int SaveToHadAssay_SCKY(Action<string, eOutputType> output) //{ // int res = 0; // foreach (V_Had entity in dcDbersDAO.CSKY_Clims_SelfDber.Entities<V_Had>(" where TEST_TIME_END>=@TEST_TIME_END and SAMPLE_NO is not null", new { TEST_TIME_END = DateTime.Now.AddDays(-Convert.ToInt32(commonDAO.GetAppletConfigString("化验设备数据读取天数"))).Date })) // { // CmcsHadStdAssay item = Dbers.GetInstance().SelfDber.Entity<CmcsHadStdAssay>("where PKID=:PKID", new { PKID = entity.ID + entity.APP_CODE }); // if (item == null) // { // item = new CmcsHadStdAssay(); // item.SampleNumber = entity.SAMPLE_NO; // item.FacilityNumber = entity.APP_Name; // item.SampleWeight = entity.SAMPLE_WEIGHT; // item.Had = entity.HAD; // item.AssayUser = ""; // item.IsEffective = 0; // item.PKID = entity.ID + entity.APP_CODE; // item.AssayTime = entity.TEST_TIME_START; // item.DataType = "有效数据"; // res += Dbers.GetInstance().SelfDber.Insert<CmcsHadStdAssay>(item); // } // else // { // item.SampleNumber = entity.SAMPLE_NO; // item.FacilityNumber = entity.APP_Name; // item.SampleWeight = entity.SAMPLE_WEIGHT; // item.Had = entity.HAD; // item.AssayUser = ""; // item.IsEffective = 0; // item.PKID = entity.ID + entity.APP_CODE; // item.AssayTime = entity.TEST_TIME_START; // item.DataType = "有效数据"; // res += Dbers.GetInstance().SelfDber.Update<CmcsHadStdAssay>(item); // } // } // output(string.Format("同步开元碳氢仪数据 {0} 条", res), eOutputType.Important); // return res; //} #endregion #region 读取化验设备运行状态 public void ReadHyMachine(Action <string, eOutputType> output) { int res = 0; string path = commonDAO.GetCommonAppletConfigString("化验设备状态XML路径"); #region 读取XML //将XML文件加载进来 XDocument document = XDocument.Load(path); //获取到XML的根元素进行操作 XElement ele = document.Root; //XElement ele = root.Element("CommonAppConfig"); //获取标签的值 XElement shuxing = ele.Element("LRY1"); res += commonDAO.SetSignalDataValue("化验室网络管理", "量热仪1_运行状态", shuxing.Value) ? 1 : 0; shuxing = ele.Element("LRY2"); res += commonDAO.SetSignalDataValue("化验室网络管理", "量热仪2_运行状态", shuxing.Value) ? 1 : 0; shuxing = ele.Element("LRY3"); res += commonDAO.SetSignalDataValue("化验室网络管理", "量热仪3_运行状态", shuxing.Value) ? 1 : 0; shuxing = ele.Element("LRY4"); res += commonDAO.SetSignalDataValue("化验室网络管理", "量热仪4_运行状态", shuxing.Value) ? 1 : 0; shuxing = ele.Element("DLY1"); res += commonDAO.SetSignalDataValue("化验室网络管理", "定硫仪1_运行状态", shuxing.Value) ? 1 : 0; shuxing = ele.Element("DLY2"); res += commonDAO.SetSignalDataValue("化验室网络管理", "定硫仪2_运行状态", shuxing.Value) ? 1 : 0; shuxing = ele.Element("DLY3"); res += commonDAO.SetSignalDataValue("化验室网络管理", "定硫仪3_运行状态", shuxing.Value) ? 1 : 0; shuxing = ele.Element("GFY1"); res += commonDAO.SetSignalDataValue("化验室网络管理", "工分仪1_运行状态", shuxing.Value) ? 1 : 0; shuxing = ele.Element("GFY2"); res += commonDAO.SetSignalDataValue("化验室网络管理", "工分仪2_运行状态", shuxing.Value) ? 1 : 0; shuxing = ele.Element("GFY3"); res += commonDAO.SetSignalDataValue("化验室网络管理", "工分仪3_运行状态", shuxing.Value) ? 1 : 0; shuxing = ele.Element("GFY4"); res += commonDAO.SetSignalDataValue("化验室网络管理", "工分仪4_运行状态", shuxing.Value) ? 1 : 0; shuxing = ele.Element("SFY1"); res += commonDAO.SetSignalDataValue("化验室网络管理", "水分仪1_运行状态", shuxing.Value) ? 1 : 0; shuxing = ele.Element("SFY2"); res += commonDAO.SetSignalDataValue("化验室网络管理", "水分仪2_运行状态", shuxing.Value) ? 1 : 0; shuxing = ele.Element("SFY3"); res += commonDAO.SetSignalDataValue("化验室网络管理", "水分仪3_运行状态", shuxing.Value) ? 1 : 0; shuxing = ele.Element("HRY1"); res += commonDAO.SetSignalDataValue("化验室网络管理", "灰融仪1_运行状态", shuxing.Value) ? 1 : 0; shuxing = ele.Element("HRY2"); res += commonDAO.SetSignalDataValue("化验室网络管理", "灰融仪2_运行状态", shuxing.Value) ? 1 : 0; shuxing = ele.Element("TQY1"); res += commonDAO.SetSignalDataValue("化验室网络管理", "碳氢仪1_运行状态", shuxing.Value) ? 1 : 0; shuxing = ele.Element("TQY2"); res += commonDAO.SetSignalDataValue("化验室网络管理", "碳氢仪2_运行状态", shuxing.Value) ? 1 : 0; output("同步设备状态" + res.ToString() + "条", eOutputType.Normal); #endregion }
private void FrmSetting_Load(object sender, EventArgs e) { try { txtCommonMake.Text = commonDAO.GetCommonAppletConfigString(CommonAppConfig.GetInstance().AppIdentifier + "对应制样机"); txtCommonAppConfig.Text = CommonAppConfig.GetInstance().AppIdentifier; // 全局参数 Old_Param = txtCommonMake.Text; } catch (Exception ex) { MessageBoxEx.Show("参数初始化失败" + ex.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
private DcDbers() { BeltSampler_Dber = new SqlServerDapperDber(commonDAO.GetCommonAppletConfigString("皮带采样机接口连接字符串")); AutoCupboard_Dber = new SqlServerDapperDber(commonDAO.GetCommonAppletConfigString("智能存样柜接口连接字符串")); PneumaticTransfer_Dber = new SqlServerDapperDber(commonDAO.GetCommonAppletConfigString("气动传输接口连接字符串")); WeightBridger_Dber = new SqlServerDapperDber(commonDAO.GetCommonAppletConfigString("轨道衡数据库连接字符串")); CarJXSampler_Dber1 = new SqlServerDapperDber(commonDAO.GetCommonAppletConfigString("#1汽车机械采样机接口连接字符串")); CarJXSampler_Dber2 = new SqlServerDapperDber(commonDAO.GetCommonAppletConfigString("#2汽车机械采样机接口连接字符串")); WeightBridger_Dber1 = new AccessDapperDber(string.Format(commonDAO.GetAppletConfigString("轨道衡数据库连接字符串1"), DateTime.Now.Year)); }
/// <summary> /// 加载配置 /// </summary> void LoadAppConfig() { #region 绑定语音类型 List <string> arrVoices = voiceSpeaker.GetVoices(); for (int i = 0; i < arrVoices.Count; i++) { DataItem comboitem = new DataItem(arrVoices[i]); cmbVoiceName.Items.Add(comboitem); } cmbVoiceName.SelectedIndex = 0; #endregion txtAppIdentifier.Text = commonAppConfig.AppIdentifier; txtSelfConnStr.Text = commonAppConfig.SelfConnStr; chbStartup.Checked = (commonDAO.GetAppletConfigString("开机启动") == "1"); intPoundIndex.Value = commonDAO.GetAppletConfigInt32("磅编号"); //公共配置 chkAutoPrint.Checked = (commonDAO.GetCommonAppletConfigString("自动打印磅单") == "1"); chkITMS.Checked = (commonDAO.GetCommonAppletConfigString("启用智能调运") == "1"); chkPaperWorkPass.Checked = (commonDAO.GetCommonAppletConfigString("启用证件到期") == "1"); chkOutFactoryITMS.Checked = (commonDAO.GetCommonAppletConfigString("启用出厂天线") == "1"); dbiSampleWayCount.Value = commonDAO.GetCommonAppletConfigInt32("采样通道车数"); chkSampleWayCount.Checked = (commonDAO.GetCommonAppletConfigString("启用采样通道车数") == "1"); dbiFactoryCount.Value = commonDAO.GetCommonAppletConfigInt32("厂内总车数"); chkFactoryCount.Checked = (commonDAO.GetCommonAppletConfigString("启用厂内总车数") == "1"); txtTicketDiff.Value = commonDAO.GetCommonAppletConfigDouble("净重超差限值"); chkTicketDiff.Checked = (commonDAO.GetCommonAppletConfigString("启用净重超差限值") == "1"); txtTareCoefficient.Value = commonDAO.GetCommonAppletConfigDouble("皮重排查系数"); chkTareCoefficient.Checked = (commonDAO.GetCommonAppletConfigString("启用皮重排查系数") == "1"); // IO控制器 SelectedComboBoxItem(cmbIocerCom, commonDAO.GetAppletConfigInt32("IO控制器_串口").ToString()); SelectedComboBoxItem(cmbIocerBandrate, commonDAO.GetAppletConfigInt32("IO控制器_波特率").ToString()); SelectedComboBoxItem(cmbIocerDataBits, commonDAO.GetAppletConfigInt32("IO控制器_数据位").ToString()); SelectedComboBoxItem(cmbIocerStopBits, commonDAO.GetAppletConfigInt32("IO控制器_停止位").ToString()); SelectedComboBoxItem(cmbIocerParity, commonDAO.GetAppletConfigInt32("IO控制器_校验位").ToString()); SelectedComboBoxItem(cmbInductorCoil1Port, commonDAO.GetAppletConfigInt32("IO控制器_地感1端口").ToString()); SelectedComboBoxItem(cmbInductorCoil2Port, commonDAO.GetAppletConfigInt32("IO控制器_地感2端口").ToString()); SelectedComboBoxItem(cmbInductorCoil3Port, commonDAO.GetAppletConfigInt32("IO控制器_地感3端口").ToString()); SelectedComboBoxItem(cmbInductorCoil4Port, commonDAO.GetAppletConfigInt32("IO控制器_地感4端口").ToString()); SelectedComboBoxItem(cmbGate1UpPort, commonDAO.GetAppletConfigInt32("IO控制器_道闸1升杆端口").ToString()); SelectedComboBoxItem(cmbGate1DownPort, commonDAO.GetAppletConfigInt32("IO控制器_道闸1降杆端口").ToString()); SelectedComboBoxItem(cmbGate2UpPort, commonDAO.GetAppletConfigInt32("IO控制器_道闸2升杆端口").ToString()); SelectedComboBoxItem(cmbGate2DownPort, commonDAO.GetAppletConfigInt32("IO控制器_道闸2降杆端口").ToString()); SelectedComboBoxItem(cmbSignalLight1Port, commonDAO.GetAppletConfigInt32("IO控制器_信号灯1端口").ToString()); SelectedComboBoxItem(cmbSignalLight2Port, commonDAO.GetAppletConfigInt32("IO控制器_信号灯2端口").ToString()); // 入厂读卡器 cmbRwer1Ip.Value = commonDAO.GetAppletConfigString("读卡器1_Ip"); cmbRwer1Port.Value = commonDAO.GetAppletConfigInt32("读卡器1_端口"); // 出厂读卡器 cmbRwer2Ip.Value = commonDAO.GetAppletConfigString("读卡器2_Ip"); cmbRwer2Port.Value = commonDAO.GetAppletConfigInt32("读卡器2_端口"); //室内发卡器 SelectedComboBoxItem(cmbRwer2Com, commonDAO.GetAppletConfigInt32("读卡器2_串口").ToString()); txtRwerTagStartWith.Text = commonDAO.GetAppletConfigString("读卡器_标签过滤"); // LED显示屏 iptxtLED1IP.Value = commonDAO.GetAppletConfigString("LED显示屏1_IP地址"); iptxtLED2IP.Value = commonDAO.GetAppletConfigString("LED显示屏2_IP地址"); // 语音 SelectedComboBoxItem(cmbVoiceName, commonDAO.GetAppletConfigString("语音包").ToString()); sldVoiceRate.Value = commonDAO.GetAppletConfigInt32("语速"); sldVoiceVolume.Value = commonDAO.GetAppletConfigInt32("音量"); lblVoiceRate.Text = sldVoiceRate.Value.ToString(); lblVoiceVolume.Text = sldVoiceVolume.Value.ToString(); }
/// <summary> /// ¼ÓÔØÅäÖà /// </summary> void LoadAppConfig() { txtAppIdentifier.Text = commonAppConfig.AppIdentifier; txtSelfConnStr.Text = commonAppConfig.SelfConnStr; chbStartup.Checked = (commonDAO.GetAppletConfigString("¿ª»úÆô¶¯") == "1"); chkIsNormal.Checked = commonDAO.GetCommonAppletConfigString("ÊÇ·ñPDAÈ·ÈÏ") == "1"; // IO¿ØÖÆÆ÷ iptxtIOIP.Value = commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_IPµØÖ·"); txtIOPort.Text = commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_¶Ë¿Ú"); SelectedComboBoxItem(cmbInductorCoil1Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µØ¸Ð1¶Ë¿Ú")); SelectedComboBoxItem(cmbInductorCoil2Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µØ¸Ð2¶Ë¿Ú")); SelectedComboBoxItem(cmbInductorCoil3Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µØ¸Ð3¶Ë¿Ú")); SelectedComboBoxItem(cmbInductorCoil4Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µØ¸Ð4¶Ë¿Ú")); SelectedComboBoxItem(cmbInfraredSensor1Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_¶ÔÉä1¶Ë¿Ú")); SelectedComboBoxItem(cmbInfraredSensor2Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_¶ÔÉä2¶Ë¿Ú")); SelectedComboBoxItem(cmbGate1UpPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µÀÕ¢1Éý¸Ë¶Ë¿Ú")); SelectedComboBoxItem(cmbGate1DownPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µÀÕ¢1½µ¸Ë¶Ë¿Ú")); SelectedComboBoxItem(cmbGate2UpPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µÀÕ¢2Éý¸Ë¶Ë¿Ú")); SelectedComboBoxItem(cmbGate2DownPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µÀÕ¢2½µ¸Ë¶Ë¿Ú")); SelectedComboBoxItem(cmbSignalLight1Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_ÐźŵÆ1¶Ë¿Ú")); SelectedComboBoxItem(cmbSignalLight2Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_ÐźŵÆ2¶Ë¿Ú")); SelectedComboBoxItem(cmbButtonSensorPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_°´Å¥¶Ë¿Ú")); // µØ°õÒDZí SelectedComboBoxItem(cmbWberCom, commonDAO.GetAppletConfigString("µØ°õÒDZí_´®¿Ú")); SelectedComboBoxItem(cmbWberBandrate, commonDAO.GetAppletConfigString("µØ°õÒDZí_²¨ÌØÂÊ")); SelectedComboBoxItem(cmbWberDataBits, commonDAO.GetAppletConfigString("µØ°õÒDZí_Êý¾Ýλ")); SelectedComboBoxItem(cmbWberStopBits, commonDAO.GetAppletConfigString("µØ°õÒDZí_ֹͣλ")); SelectedComboBoxItem(cmbWberParity, commonDAO.GetAppletConfigString("µØ°õÒDZí_УÑéλ")); dbtxtMinWeight.Value = commonDAO.GetAppletConfigDouble("µØ°õÒDZí_×îС³ÆÖØ"); dbGrossTareDiffent.Value = commonDAO.GetCommonAppletConfigDouble("ëƤÖزî"); // LEDÏÔʾÆÁ iptxtLED1IP.Value = commonDAO.GetAppletConfigString("LEDÏÔʾÆÁ1_IPµØÖ·"); // ¶Á¿¨Æ÷Íø¿Ú iptxtRwerIP.Value = commonDAO.GetAppletConfigString("¶Á¿¨Æ÷1_IPµØÖ·"); txtRwerPort.Text = commonDAO.GetAppletConfigString("¶Á¿¨Æ÷1_¶Ë¿Ú"); txtRwerTagStartWith.Text = commonDAO.GetAppletConfigString("¶Á¿¨Æ÷_±êÇ©¹ýÂË"); SelectedComboBoxItem(cmbRwerPower, commonDAO.GetAppletConfigString("¶Á¿¨Æ÷1_¹¦ÂÊ")); //ÉãÏñ»ú //chbUseCamera.Checked = commonDAO.GetAppletConfigString("ÉãÏñ»úÆôÓÃ") == "1"; //CmcsCamare video1 = commonDAO.SelfDber.Entity<CmcsCamare>("where EquipmentCode=:EquipmentCode", new { EquipmentCode = commonAppConfig.AppIdentifier + "ÉãÏñÍ·1" }); //if (video1 != null) //{ // iptxtCamera1IP.Value = video1.Ip; // txtCamera1Port.Text = video1.Port.ToString(); // txtCamera1UserName.Text = video1.UserName; // txtCamera1Pwd.Text = video1.Password; // txtCamera1Channel.Text = video1.Channel.ToString(); //} //CmcsCamare video2 = commonDAO.SelfDber.Entity<CmcsCamare>("where EquipmentCode=:EquipmentCode", new { EquipmentCode = commonAppConfig.AppIdentifier + "ÉãÏñÍ·2" }); //if (video2 != null) //{ // iptxtCamera2IP.Value = video2.Ip; // txtCamera2Port.Text = video2.Port.ToString(); // txtCamera2UserName.Text = video2.UserName; // txtCamera2Pwd.Text = video2.Password; // txtCamera2Channel.Text = video2.Channel.ToString(); //} //жú¹µLED iptxtUnloadLED1.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ1_IPµØÖ·"); iptxtUnloadLED2.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ2_IPµØÖ·"); iptxtUnloadLED3.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ3_IPµØÖ·"); iptxtUnloadLED4.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ4_IPµØÖ·"); iptxtUnloadLED5.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ5_IPµØÖ·"); iptxtUnloadLED6.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ6_IPµØÖ·"); iptxtUnloadLED7.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ7_IPµØÖ·"); iptxtUnloadLED8.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ8_IPµØÖ·"); CmcsUnLoadLED unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=1"); if (unLoadLed != null) { txtUnload1Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED1.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=2"); if (unLoadLed != null) { txtUnload2Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED2.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=3"); if (unLoadLed != null) { txtUnload3Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED3.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=4"); if (unLoadLed != null) { txtUnload4Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED4.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=5"); if (unLoadLed != null) { txtUnload5Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED5.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=6"); if (unLoadLed != null) { txtUnload6Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED6.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=7"); if (unLoadLed != null) { txtUnload7Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED7.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=8"); if (unLoadLed != null) { txtUnload8Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED8.Value = unLoadLed.IP; } }
/// <summary> /// 注册指纹 /// </summary> private void RegistFinger() { if (!IsConnect) { ShowInfomation("请先打开设备..."); return; } //生成特征A if (GetFinger(1) != 1) { return; } Thread.Sleep(200); //生成特征B if (GetFinger(2) != 1) { return; } Thread.Sleep(200); /****************合成模板*********/ ret = Fingerdll.ZAZRegModule(hHandle, nDevAddr); //合并特征 if (ret != 0) { ShowInfomation(Fingerdll.ZAZErr2Strt(ret)); return; } else { ShowInfomation("合成指纹模板成功"); } Thread.Sleep(200); //本例以存在在指纹设备库中进行 //ret = Fingerdll.ZAZStoreChar(hHandle, nDevAddr, 1, FingerIndex); //存放模板 //StrFile = System.Windows.Forms.Application.StartupPath + "\\FTmpelet.dat"; #region 存储指纹到服务器 CmcsFinger userfinger = new CmcsFinger(); InvokeEx(() => { StrFile = commonDAO.GetCommonAppletConfigString("指纹识别数据存放路径"); userfinger = fingerIdentifyDAO.GetFinerByFingerName(this.User.PartyId, cmbFingerName.Text); if (userfinger == null) { userfinger = new CmcsFinger(); userfinger.FingerName = cmbFingerName.Text; } StrFile = Path.Combine(StrFile, this.User.UserAccount); if (!File.Exists(StrFile)) { Directory.CreateDirectory(StrFile); } StrFile = Path.Combine(StrFile, userfinger.Id + ".dat"); userfinger.FingerUrl = StrFile; #endregion //将指纹信息写入到dat文件 ret = Fingerdll.ZAZUpChar2File(hHandle, nDevAddr, 1, strFile); if (ret != 0) { ShowInfomation(Fingerdll.ZAZErr2Strt(ret)); return; } else { if (fingerIdentifyDAO.InsertFinger(this.User, userfinger) && File.Exists(StrFile)) { ShowInfomation("存储指纹成功"); //showFpdb();显示当前设备指纹存储信息 FingerIndex++; BindData(); return; } } }); }
private void btnSubmit_Click(object sender, EventArgs e) { List <InfBalanceRecordDetail> details = new List <InfBalanceRecordDetail>(); foreach (GridRow item in superGridControl2.PrimaryGrid.Rows) { InfBalanceRecordDetail entity = item.DataItem as InfBalanceRecordDetail; if (Convert.ToBoolean(item.Cells["clmDetailCheck"].Value)) { details.Add(entity); } } if (details.Count == 0) { MessageBoxEx.Show("请选择数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } try { int res = 0; SqlServerDapperDber sqlServerDapper = new SqlServerDapperDber(commonDAO.GetCommonAppletConfigString("开元天平接口数据连接字符串")); foreach (InfBalanceRecordDetail detail in details) { TPWeight weight = sqlServerDapper.Entity <TPWeight>("where S_NO=@S_NO and TP_Type=@TP_Type", new { S_NO = detail.TheBalanceRecord.AssayCode + "-" + detail.GGCode, TP_Type = detail.TheBalanceRecord.AssayType }); if (weight == null) { weight = new TPWeight(); weight.S_NO = detail.TheBalanceRecord.AssayCode + "-" + detail.GGCode; weight.TP_Type = detail.TheBalanceRecord.AssayType; weight.Weight = detail.Weight; weight.TP_NO = detail.TheBalanceRecord.MachineCode; weight.Stateop = 1; weight.SortNumber = detail.GGCode; weight.GG_NO = detail.GGCode; weight.Sample_NO = detail.TheBalanceRecord.AssayCode; weight.CreateTime = DateTime.Now; weight.Creator = detail.CreateUser; sqlServerDapper.Insert(weight); detail.SyncFlag = 1; commonDAO.SelfDber.Update(detail); res++; } else { if (MessageBoxEx.Show("该化验编码重量已提交,是否覆盖!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning) == DialogResult.OK) { weight.S_NO = detail.TheBalanceRecord.AssayCode + "-" + detail.GGCode; weight.TP_Type = detail.TheBalanceRecord.AssayType; weight.Weight = detail.Weight; weight.TP_NO = detail.TheBalanceRecord.MachineCode; weight.Stateop = 1; weight.GG_NO = detail.GGCode; weight.Sample_NO = detail.TheBalanceRecord.AssayCode; sqlServerDapper.Update(weight); res++; } } } MessageBoxEx.Show("成功提交" + res + "条数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); LoadBalanceDetailList(superGridControl2, this.CurrentAssay.Id); } catch (Exception ex) { MessageBoxEx.Show("提交失败:" + Environment.NewLine + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// 加载配置 /// </summary> void LoadAppConfig() { #region 绑定语音类型 List <string> arrVoices = voiceSpeaker.GetVoices(); for (int i = 0; i < arrVoices.Count; i++) { DataItem comboitem = new DataItem(arrVoices[i]); cmbVoiceName.Items.Add(comboitem); } cmbVoiceName.SelectedIndex = 0; #endregion txtAppIdentifier.Text = commonAppConfig.AppIdentifier; txtSelfConnStr.Text = commonAppConfig.SelfConnStr; chbStartup.Checked = (commonDAO.GetAppletConfigString("开机启动") == "1"); chkUseRwer.Checked = (commonDAO.GetAppletConfigString("启用读卡器") == "1"); chkUseCamera.Checked = (commonDAO.GetAppletConfigString("启用识别相机") == "1"); //公共配置 chkAutoPrint.Checked = (commonDAO.GetCommonAppletConfigString("自动打印磅单") == "1"); chkOnWayMonitor.Checked = (commonDAO.GetCommonAppletConfigString("启用在途监控") == "1"); dbiSampleWayCount.Value = commonDAO.GetCommonAppletConfigInt32("采样通道车数"); chkSampleWayCount.Checked = (commonDAO.GetCommonAppletConfigString("启用采样通道车数") == "1"); txtTicketDiff.Value = commonDAO.GetCommonAppletConfigDouble("净重超差限值"); chkTicketDiff.Checked = (commonDAO.GetCommonAppletConfigString("启用净重超差限值") == "1"); txtSamplerCodes.Text = commonDAO.GetCommonAppletConfigString("采样机编号"); txtWeighterCodes.Text = commonDAO.GetCommonAppletConfigString("汽车衡编号"); // IO控制器 SelectedComboBoxItem(cmbIocerCom, commonDAO.GetAppletConfigInt32("IO控制器_串口").ToString()); SelectedComboBoxItem(cmbIocerBandrate, commonDAO.GetAppletConfigInt32("IO控制器_波特率").ToString()); SelectedComboBoxItem(cmbIocerDataBits, commonDAO.GetAppletConfigInt32("IO控制器_数据位").ToString()); SelectedComboBoxItem(cmbIocerStopBits, commonDAO.GetAppletConfigInt32("IO控制器_停止位").ToString()); SelectedComboBoxItem(cmbIocerParity, commonDAO.GetAppletConfigInt32("IO控制器_校验位").ToString()); SelectedComboBoxItem(cmbInductorCoil1Port, commonDAO.GetAppletConfigInt32("IO控制器_地感1端口").ToString()); SelectedComboBoxItem(cmbInductorCoil2Port, commonDAO.GetAppletConfigInt32("IO控制器_地感2端口").ToString()); SelectedComboBoxItem(cmbInductorCoil3Port, commonDAO.GetAppletConfigInt32("IO控制器_地感3端口").ToString()); SelectedComboBoxItem(cmbInductorCoil4Port, commonDAO.GetAppletConfigInt32("IO控制器_地感4端口").ToString()); SelectedComboBoxItem(cmbGate1UpPort, commonDAO.GetAppletConfigInt32("IO控制器_道闸1升杆端口").ToString()); SelectedComboBoxItem(cmbGate1DownPort, commonDAO.GetAppletConfigInt32("IO控制器_道闸1降杆端口").ToString()); SelectedComboBoxItem(cmbGate2UpPort, commonDAO.GetAppletConfigInt32("IO控制器_道闸2升杆端口").ToString()); SelectedComboBoxItem(cmbGate2DownPort, commonDAO.GetAppletConfigInt32("IO控制器_道闸2降杆端口").ToString()); SelectedComboBoxItem(cmbSignalLight1Port, commonDAO.GetAppletConfigInt32("IO控制器_信号灯1端口").ToString()); SelectedComboBoxItem(cmbSignalLight2Port, commonDAO.GetAppletConfigInt32("IO控制器_信号灯2端口").ToString()); // 读卡器 ip_Rwer1.Value = commonDAO.GetAppletConfigString("读卡器1_IP地址"); SelectedComboBoxItem(cmbip_Rwer1Port, commonDAO.GetAppletConfigInt32("读卡器1_功率").ToString()); SelectedComboBoxItem(cmbRwer2, commonDAO.GetAppletConfigInt32("读卡器2_串口").ToString()); SelectedComboBoxItem(cmbip_Rwer2Port, commonDAO.GetAppletConfigInt32("读卡器2_功率").ToString()); txtRwerTagStartWith.Text = commonDAO.GetAppletConfigString("读卡器_标签过滤"); // LED显示屏 iptxtLED1IP.Value = commonDAO.GetAppletConfigString("LED显示屏1_IP地址"); // 语音 SelectedComboBoxItem(cmbVoiceName, commonDAO.GetAppletConfigString("语音包").ToString()); sldVoiceRate.Value = commonDAO.GetAppletConfigInt32("语速"); sldVoiceVolume.Value = commonDAO.GetAppletConfigInt32("音量"); lblVoiceRate.Text = sldVoiceRate.Value.ToString(); lblVoiceVolume.Text = sldVoiceVolume.Value.ToString(); }
/// <summary> /// 处理集控首页信号信息 /// </summary> /// <param name="output"></param> public void SyncHomePageSignalData(Action <string, eOutputType> output) { int count = 0, count1 = 0, count2 = 0; count = commonDAO.SelfDber.Count <CmcsTrainCarriagePass>("where Direction='进厂' and(MachineCode='2' or MachineCode='3') and trunc(PassTime)=trunc(sysdate)"); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_HomePage_1, eSignalDataName.火车入厂车数.ToString(), count.ToString()); count = commonDAO.SelfDber.Count <CmcsTrainCarriagePass>("where Direction='出厂' and(MachineCode='2' or MachineCode='3') and trunc(PassTime)=trunc(sysdate)"); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_HomePage_1, eSignalDataName.火车出厂车数.ToString(), count.ToString()); count1 = commonDAO.SelfDber.Count <CmcsTransport>("where TrackCode='#2' and GrossQty>0 and trunc(InFactoryTime)=trunc(sysdate)"); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_TrunOver_1, eSignalDataName.已翻车数.ToString(), count1.ToString()); count2 = commonDAO.SelfDber.Count <CmcsTransport>("where TrackCode='#4' and GrossQty>0 and trunc(InFactoryTime)=trunc(sysdate)"); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_TrunOver_2, eSignalDataName.已翻车数.ToString(), count2.ToString()); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_HomePage_1, eSignalDataName.火车翻车车数.ToString(), (count1 + count2).ToString()); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_HomePage_1, eSignalDataName.来船量.ToString(), "无"); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_HomePage_1, eSignalDataName.汽车转运车数.ToString(), "无"); count = commonDAO.SelfDber.Count <CmcsBuyFuelTransport>("where trunc(InFactoryTime)=trunc(sysdate)"); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_HomePage_1, eSignalDataName.汽车入厂车数.ToString(), count.ToString()); count = commonDAO.SelfDber.Count <CmcsBuyFuelTransport>("where trunc(InFactoryTime)=trunc(sysdate) and GrossWeight>0"); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_HomePage_1, eSignalDataName.汽车采样称重车数.ToString(), count.ToString()); count = commonDAO.SelfDber.Count <CmcsBuyFuelTransport>("where trunc(InFactoryTime)=trunc(sysdate) and TareWeight>0"); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_HomePage_1, eSignalDataName.汽车回皮车数.ToString(), count.ToString()); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_HomePage_1, eSignalDataName.汽车出厂车数.ToString(), count.ToString()); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_HomePage_1, eSignalDataName.制样合批数.ToString(), "无"); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_HomePage_1, eSignalDataName.存样数.ToString(), "无"); count = commonDAO.SelfDber.Count <CmcsRCAssay>("where trunc(CreationTime)=trunc(sysdate) and AssayPle is null"); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_HomePage_1, eSignalDataName.待化验数.ToString(), count.ToString()); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_PDCYJ_1, "PLC连接状态", commonDAO.TestPing(commonDAO.GetCommonAppletConfigString("2PA皮带采样机PLCIP")) ? "1" : "0"); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_PDCYJ_2, "PLC连接状态", commonDAO.TestPing(commonDAO.GetCommonAppletConfigString("2PB皮带采样机PLCIP")) ? "1" : "0"); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_HCRCCHSB1, "连接状态", commonDAO.TestPing(commonDAO.GetCommonAppletConfigString("#1车号识别IP")) ? "1" : "0"); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_HCRCCHSB2, "连接状态", commonDAO.TestPing(commonDAO.GetCommonAppletConfigString("#2车号识别IP")) ? "1" : "0"); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_HCRCCHSB3, "连接状态", commonDAO.TestPing(commonDAO.GetCommonAppletConfigString("#3车号识别IP")) ? "1" : "0"); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_HCRCCHSB4, "连接状态", commonDAO.TestPing(commonDAO.GetCommonAppletConfigString("#4车号识别IP")) ? "1" : "0"); commonDAO.SetSignalDataValue(GlobalVars.MachineCode_HCRCCHSB5, "连接状态", commonDAO.TestPing(commonDAO.GetCommonAppletConfigString("#5车号识别IP")) ? "1" : "0"); }