/// <summary> /// 同步全过程基础信息(汽车来煤预归批) /// </summary> public void SyncBaseInfoForQCLMYGP(Action <string, eOutputType> output, SqlServerDapperDber sqlDapperDber) { int res = 0; try { foreach (View_rlgl_cygl_qclmygp qgc_qclmygp in sqlDapperDber.Entities <View_rlgl_cygl_qclmygp>()) { if (commonDAO.SelfDber.Get <View_rlgl_cygl_qclmygp>(qgc_qclmygp.Dbid.ToString()) != null) { commonDAO.SelfDber.Update <View_rlgl_cygl_qclmygp>(qgc_qclmygp); } else { commonDAO.SelfDber.Insert <View_rlgl_cygl_qclmygp>(qgc_qclmygp); } res++; } } catch (Exception ex) { output("同步汽车来煤预归批报错," + ex.Message, eOutputType.Error); } output(string.Format("同步汽车来煤预归批{0}条", res), eOutputType.Normal); }
/// <summary> /// 同步全过程基础信息(验票反馈表) /// </summary> public void SyncBaseInfoForYAPFK(Action <string, eOutputType> output, SqlServerDapperDber sqlDapperDber) { int res = 0; try { foreach (View_rlgl_chlgl_yapfk qgc_dyjh in commonDAO.SelfDber.Entities <View_rlgl_chlgl_yapfk>("where issync=0")) { if (sqlDapperDber.Insert(new View_rlgl_chlgl_yapfk_QGC() { Yptime = qgc_dyjh.Yptime, Chph = qgc_dyjh.Chph, Cyjbm = qgc_dyjh.Cyjbm, Kfl = qgc_dyjh.Kfl, Dybh = qgc_dyjh.Dybh, Rfid_xlh = qgc_dyjh.Rfid_xlh }) > 0) { res++; //更新同步状态 qgc_dyjh.IsSync = 1; commonDAO.SelfDber.Update(qgc_dyjh); } } } catch (Exception ex) { output("同步验票反馈报错," + ex.Message, eOutputType.Error); } output(string.Format("同步验票反馈{0}条", res), eOutputType.Normal); }
/// <summary> /// 同步全过程基础信息(调运计划卡) /// </summary> public void SyncBaseInfoForDYJHK(Action <string, eOutputType> output, SqlServerDapperDber sqlDapperDber) { int res = 0; try { foreach (View_dyjhk qgc_dyjh in sqlDapperDber.Entities <View_dyjhk>()) { if (commonDAO.SelfDber.Get <View_dyjhk>(qgc_dyjh.Dbid.ToString()) != null) { commonDAO.SelfDber.Update <View_dyjhk>(qgc_dyjh); } else { commonDAO.SelfDber.Insert <View_dyjhk>(qgc_dyjh); } res++; } } catch (Exception ex) { output("同步调运计划卡报错," + ex.Message, eOutputType.Error); } output(string.Format("同步调运计划卡{0}条", res), eOutputType.Normal); }
/// <summary> /// 同步全过程物资车信息(物资车信息) /// </summary> public void SyncBaseInfoForWZJHCL(Action <string, eOutputType> output, SqlServerDapperDber sqlDapperDber) { int res = 0; try { foreach (View_rlgl_wzjh_cl qgc_wzjhcl in sqlDapperDber.Entities <View_rlgl_wzjh_cl>()) { if (commonDAO.SelfDber.Get <View_rlgl_wzjh_cl>(qgc_wzjhcl.Dbid.ToString()) != null) { commonDAO.SelfDber.Update <View_rlgl_wzjh_cl>(qgc_wzjhcl); } else { commonDAO.SelfDber.Insert <View_rlgl_wzjh_cl>(qgc_wzjhcl); } res++; } } catch (Exception ex) { output("同步物资车信息报错," + ex.Message, eOutputType.Error); } output(string.Format("同步物资车信息{0}条", res), eOutputType.Normal); }
/// <summary> /// 同步全过程基础信息(轻车计量反馈) /// </summary> public void SyncBaseInfoForJLPZ(Action <string, eOutputType> output, SqlServerDapperDber sqlDapperDber) { int res = 0; try { foreach (View_rlgl_jlgl_pz qgc_pz in commonDAO.SelfDber.Entities <View_rlgl_jlgl_pz>("where issync=0")) { if (sqlDapperDber.Insert(new View_rlgl_jlgl_pz_QGC() { Chph = qgc_pz.Chph, Mpph = qgc_pz.Mpph, Mztime = qgc_pz.Mztime, Rfid_xlh = qgc_pz.Rfid_xlh, Pz = qgc_pz.Pz }) > 0) { res++; //更新同步状态 qgc_pz.Issync = 1; commonDAO.SelfDber.Update(qgc_pz); } } } catch (Exception ex) { output("同步轻车计量反馈报错," + ex.Message, eOutputType.Error); } output(string.Format("同步轻车计量反馈{0}条", res), eOutputType.Normal); }
/// <summary> /// 同步全过程基础信息(更换挂车记录) /// </summary> public void SyncBaseInfoForcCLGLLSPZ(Action <string, eOutputType> output, SqlServerDapperDber sqlDapperDber) { int res = 0; try { foreach (View_chlgl_lspz qgc_lspz in sqlDapperDber.Entities <View_chlgl_lspz>()) { if (commonDAO.SelfDber.Get <View_chlgl_lspz>(qgc_lspz.Chlgl_id.ToString()) != null) { commonDAO.SelfDber.Update <View_chlgl_lspz>(qgc_lspz); } else { commonDAO.SelfDber.Insert <View_chlgl_lspz>(qgc_lspz); } res++; } } catch (Exception ex) { output("同步更换挂车记录报错," + ex.Message, eOutputType.Error); } output(string.Format("同步更换挂车记录{0}条", res), eOutputType.Normal); }
private void FrmAutoMt_Load(object sender, EventArgs e) { this.Text = "在线全水接口业务"; equDber = new SqlServerDapperDber(CommonDAO.GetInstance().GetCommonAppletConfigString("#1在线全水分析接口连接字符串")); Bind_tb_testresult_6550(); Bind_YQ_Status(); Bind_TB_YQ_ERRORCODE(); }
/// <summary> /// 同步全过程基础信息(车辆基本信息) /// </summary> public void SyncBaseInfoForCHLGL(Action <string, eOutputType> output, SqlServerDapperDber sqlDapperDber) { int res = 0; try { foreach (View_rlgl_chlgl_chlgl qgc_chlgl in sqlDapperDber.Entities <View_rlgl_chlgl_chlgl>()) { if (commonDAO.SelfDber.Get <View_rlgl_chlgl_chlgl>(qgc_chlgl.Dbid.ToString()) != null) { commonDAO.SelfDber.Update <View_rlgl_chlgl_chlgl>(qgc_chlgl); } else { commonDAO.SelfDber.Insert <View_rlgl_chlgl_chlgl>(qgc_chlgl); } CmcsAutotruck cmcsAutotruck = commonDAO.SelfDber.Entity <CmcsAutotruck>("where CarNumber=:CarNumber", new { CarNumber = qgc_chlgl.Chph }); if (cmcsAutotruck == null) { commonDAO.SelfDber.Insert(new CmcsAutotruck() { CarNumber = qgc_chlgl.Chph, EPCCardId = qgc_chlgl.Rfid_xlh, CarMaxWeight = qgc_chlgl.Hzl, Is_hmd = qgc_chlgl.Is_hmd, BX_EndDate = qgc_chlgl.Bx_enddate, Xshzh_EndDate = qgc_chlgl.Xshzh_enddate, Zgzh_EndDate = qgc_chlgl.Zgzh_enddate, IsUse = 1, CarType = qgc_chlgl.Cllx == 965 ? "入厂煤" : "其他物资" }); } else { cmcsAutotruck.CarNumber = qgc_chlgl.Chph; cmcsAutotruck.EPCCardId = qgc_chlgl.Rfid_xlh; cmcsAutotruck.CarMaxWeight = qgc_chlgl.Hzl; cmcsAutotruck.Is_hmd = qgc_chlgl.Is_hmd; cmcsAutotruck.BX_EndDate = qgc_chlgl.Bx_enddate; cmcsAutotruck.Xshzh_EndDate = qgc_chlgl.Xshzh_enddate; cmcsAutotruck.Zgzh_EndDate = qgc_chlgl.Zgzh_enddate; cmcsAutotruck.IsUse = 1; cmcsAutotruck.CarType = qgc_chlgl.Cllx == 965 ? "入厂煤" : "其他物资"; commonDAO.SelfDber.Update(cmcsAutotruck); } res++; } } catch (Exception ex) { output("同步车辆基本信息报错," + ex.Message, eOutputType.Error); } output(string.Format("同步车辆基本信息{0}条", res), eOutputType.Normal); }
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 void FrmAutoCupboard_NCGM_Load(object sender, EventArgs e) { this.Text = "智能存样柜接口业务"; equDber = new SqlServerDapperDber(CommonDAO.GetInstance().GetCommonAppletConfigString("智能存样柜接口连接字符串")); Bind_Tb_AlarmDataRecord(); Bind_tb_bolt(); Bind_tb_preaction(); Bind_tb_status(); Bind_tb_state(); Bind_tb_action(); }
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)); }
private void FrmTrainSampler_Load(object sender, EventArgs e) { this.Text = "全自动制样机接口业务"; equDber = new SqlServerDapperDber(CommonDAO.GetInstance().GetCommonAppletConfigString("#1火车机械采样机接口连接字符串")); Bind_EquTbHCQSCYJBarrel(); Bind_EquTbHCQSCYJCmd(); Bind_EquTbHCQSCYJPlan(); Bind_EquTbHCQSCYJPlanDetail(); Bind_EquTbHCQSCYJUnloadResult(); Bind_EquTbHCQSCYJError(); Bind_EquTbHCQSCYJSignal(); }
/// <summary> /// 同步全过程基础信息(公司信息) /// </summary> public void SyncBaseInfoForGS(Action <string, eOutputType> output, SqlServerDapperDber sqlDapperDber) { int res = 0; try { foreach (View_rlgl_dygl_gs qgc_gs in sqlDapperDber.Entities <View_rlgl_dygl_gs>()) { if (commonDAO.SelfDber.Get <View_rlgl_dygl_gs>(qgc_gs.Dbid.ToString()) != null) { commonDAO.SelfDber.Update <View_rlgl_dygl_gs>(qgc_gs); } else { commonDAO.SelfDber.Insert <View_rlgl_dygl_gs>(qgc_gs); } CmcsSupplier cmcsSupplier = commonDAO.SelfDber.Entity <CmcsSupplier>("where PkId=:PkId", new { PkId = qgc_gs.Dbid }); if (cmcsSupplier == null) { commonDAO.SelfDber.Insert(new CmcsSupplier() { PkId = qgc_gs.Dbid, TaxregCode = qgc_gs.Taxnumber, Name = qgc_gs.Corpname, ShortName = qgc_gs.Corpshortname, Code = qgc_gs.Gys, Is_fhdw = qgc_gs.Is_fhdw, is_shhdw = qgc_gs.Is_shhdw }); } else { cmcsSupplier.PkId = qgc_gs.Dbid; cmcsSupplier.TaxregCode = qgc_gs.Taxnumber; cmcsSupplier.Name = qgc_gs.Corpname; cmcsSupplier.ShortName = qgc_gs.Corpshortname; cmcsSupplier.Code = qgc_gs.Gys; cmcsSupplier.Is_fhdw = qgc_gs.Is_fhdw; cmcsSupplier.is_shhdw = qgc_gs.Is_shhdw; commonDAO.SelfDber.Update(cmcsSupplier); } res++; } } catch (Exception ex) { output("同步公司信息报错," + ex.Message, eOutputType.Error); } output(string.Format("同步公司信息{0}条", res), eOutputType.Normal); }
/// <summary> /// 同步全过程基础信息(货物信息) /// </summary> public void SyncBaseInfoForHW(Action <string, eOutputType> output, SqlServerDapperDber sqlDapperDber) { int res = 0; try { foreach (View_rlgl_dygl_hw qgc_hw in sqlDapperDber.Entities <View_rlgl_dygl_hw>()) { if (commonDAO.SelfDber.Get <View_rlgl_dygl_hw>(qgc_hw.Dbid.ToString()) != null) { commonDAO.SelfDber.Update <View_rlgl_dygl_hw>(qgc_hw); } else { commonDAO.SelfDber.Insert <View_rlgl_dygl_hw>(qgc_hw); } CmcsFuelKind cmcsFuelKind = commonDAO.SelfDber.Entity <CmcsFuelKind>("where PkId=:PkId", new { PkId = qgc_hw.Dbid }); if (cmcsFuelKind == null) { commonDAO.SelfDber.Insert(new CmcsFuelKind() { ParentId = "-1", PkId = qgc_hw.Dbid, Code = qgc_hw.Productcode, Name = qgc_hw.Productname, Mzbh = qgc_hw.Mzbh, WLType = qgc_hw.Wltype }); } else { cmcsFuelKind.PkId = qgc_hw.Dbid; cmcsFuelKind.Code = qgc_hw.Productcode; cmcsFuelKind.Name = qgc_hw.Productname; cmcsFuelKind.Mzbh = qgc_hw.Mzbh; cmcsFuelKind.WLType = qgc_hw.Wltype; commonDAO.SelfDber.Update(cmcsFuelKind); } res++; } } catch (Exception ex) { output("同步货物信息报错," + ex.Message, eOutputType.Error); } output(string.Format("同步货物信息{0}条", res), eOutputType.Normal); }
private void btn_Db_Click(object sender, EventArgs e) { try { this.dber = new SqlServerDapperDber(this.txt_DB.Text); if (CommonDAO.GetInstance().TestPing(this.dber.Connection.DataSource)) { OutputRunInfo(rtxtOutput, "连接成功"); } } catch (Exception ex) { OutputRunInfo(rtxtOutput, "连接失败:" + ex.Message, eOutputType.Error); } }
/// <summary> /// 同步全过程基础信息(煤种信息) /// </summary> public void SyncBaseInfoForMZ(Action <string, eOutputType> output, SqlServerDapperDber sqlDapperDber) { int res = 0; try { foreach (View_mz qgc_mz in sqlDapperDber.Entities <View_mz>()) { if (commonDAO.SelfDber.Get <View_mz>(qgc_mz.Dbid.ToString()) != null) { commonDAO.SelfDber.Update <View_mz>(qgc_mz); } else { commonDAO.SelfDber.Insert <View_mz>(qgc_mz); } CmcsFuelKind cmcsFuelKind = commonDAO.SelfDber.Entity <CmcsFuelKind>("where PkId=:PkId", new { PkId = qgc_mz.Dbid }); if (cmcsFuelKind == null) { commonDAO.SelfDber.Insert(new CmcsFuelKind() { ParentId = "-1", PkId = qgc_mz.Dbid, Code = qgc_mz.Mzbm, Name = qgc_mz.Mzmc, IsStop = int.Parse(qgc_mz.Is_valid) }); } else { cmcsFuelKind.ParentId = "-1"; cmcsFuelKind.PkId = qgc_mz.Dbid; cmcsFuelKind.Code = qgc_mz.Mzbm; cmcsFuelKind.Name = qgc_mz.Mzmc; cmcsFuelKind.IsStop = int.Parse(qgc_mz.Is_valid); commonDAO.SelfDber.Update(cmcsFuelKind); } res++; } } catch (Exception ex) { output("同步煤种信息报错," + ex.Message, eOutputType.Error); } output(string.Format("同步煤种信息{0}条", res), eOutputType.Normal); }
/// <summary> /// 同步全过程基础信息(承运商信息) /// </summary> public void SyncBaseInfoForCHYSH(Action <string, eOutputType> output, SqlServerDapperDber sqlDapperDber) { int res = 0; try { foreach (View_rlgl_dygl_chysh qgc_chysh in sqlDapperDber.Entities <View_rlgl_dygl_chysh>()) { if (commonDAO.SelfDber.Get <View_rlgl_dygl_chysh>(qgc_chysh.Dbid.ToString()) != null) { commonDAO.SelfDber.Update <View_rlgl_dygl_chysh>(qgc_chysh); } else { commonDAO.SelfDber.Insert <View_rlgl_dygl_chysh>(qgc_chysh); } CmcsTransportCompany cmcsTransportCompany = commonDAO.SelfDber.Entity <CmcsTransportCompany>("where PkId=:PkId", new { PkId = qgc_chysh.Dbid }); if (cmcsTransportCompany == null) { commonDAO.SelfDber.Insert(new CmcsTransportCompany() { PkId = qgc_chysh.Dbid, ShipperTaxNumber = qgc_chysh.Shippertaxnumber, Name = qgc_chysh.Shipername, PlanNo = qgc_chysh.Planno, Code = qgc_chysh.Gys }); } else { cmcsTransportCompany.PkId = qgc_chysh.Dbid; cmcsTransportCompany.ShipperTaxNumber = qgc_chysh.Shippertaxnumber; cmcsTransportCompany.Name = qgc_chysh.Shipername; cmcsTransportCompany.PlanNo = qgc_chysh.Planno; cmcsTransportCompany.Code = qgc_chysh.Gys; commonDAO.SelfDber.Update(cmcsTransportCompany); } res++; } } catch (Exception ex) { output("同步承运商信息报错," + ex.Message, eOutputType.Error); } output(string.Format("同步承运商信息{0}条", res), eOutputType.Normal); }
private void FrmBeltSampler_Load(object sender, EventArgs e) { dtInputStart.Value = DateTime.Now.Date; dtInputEnd.Value = dtInputStart.Value.AddDays(1); dtInputStart1.Value = DateTime.Now.Date; dtInputEnd1.Value = dtInputStart1.Value.AddDays(1); dtInputStart2.Value = DateTime.Now.Date; dtInputEnd2.Value = dtInputStart2.Value.AddDays(1); this.Text = "皮带采样机接口业务"; equDber = new SqlServerDapperDber(CommonDAO.GetInstance().GetCommonAppletConfigString("皮带采样机接口连接字符串")); Bind_KY_CYJ_P_RECORD(); Bind_KY_CYJ_P_BARREL(); Bind_KY_CYJ_P_Alarm(); }
private void FrmAutoMaker_Load(object sender, EventArgs e) { dtInputStart.Value = DateTime.Now.Date; dtInputEnd.Value = dtInputStart.Value.AddDays(1); dtInputStart1.Value = DateTime.Now.Date; dtInputEnd1.Value = dtInputStart1.Value.AddDays(1); dtInputStart2.Value = DateTime.Now.Date; dtInputEnd2.Value = dtInputStart2.Value.AddDays(1); dtInputStart3.Value = DateTime.Now.Date; dtInputEnd3.Value = dtInputStart3.Value.AddDays(1); this.Text = "全自动制样机接口业务"; equDber = new SqlServerDapperDber(CommonDAO.GetInstance().GetCommonAppletConfigString("#1全自动制样机接口连接字符串")); Bind_ZY_Record_Tb(); Bind_tb_AlarmDataRecord(); Bind_tb_ZY_OperateRecord(); Bind_tb_DataRecord(); }
/// <summary> /// 执行所有任务 /// </summary> void ExecuteAllTask() { #region 气动传输 taskSimpleScheduler.StartNewTask("气动传输-快速同步", () => { SqlServerDapperDber PneumaticTransfer_Dber = new SqlServerDapperDber(CommonDAO.GetInstance().GetCommonAppletConfigString("气动传输接口连接字符串")); EquPneumaticTransferDAO dAO = new EquPneumaticTransferDAO(GlobalVars.MachineCode_QD, PneumaticTransfer_Dber); if (CommonDAO.GetInstance().TestPing(dAO.EquDber.Connection.DataSource)) { dAO.SyncCYGError(this.rTxtOutputer.Output); dAO.SyncQDCSCmd(this.rTxtOutputer.Output); dAO.SyncQDCSRecord(this.rTxtOutputer.Output); dAO.SyncSignalDatal(this.rTxtOutputer.Output); } else { rTxtOutputer.Output(dAO.MachineCode + "网络不通", eOutputType.Warn); } }, 5000, OutputError); #endregion }
/// <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> /// EquAutoMakerDAO /// </summary> /// <param name="machineCode">制样机编码</param> /// <param name="equDber">第三方数据库访问对象</param> public EquAutoMakerDAO(string machineCode, SqlServerDapperDber equDber) { this.MachineCode = machineCode; this.EquDber = equDber; }
/// <summary> /// /// </summary> /// <param name="machineCode"></param> /// <param name="equDber"></param> public EquBeltSamplerDAO(string type, SqlServerDapperDber equDber) { this.Type = type; this.EquDber = equDber; }
/// <summary> /// 执行所有任务 /// </summary> void ExecuteAllTask() { SqlServerDapperDber BeltSampler_Dber_Out = null; EquBeltSamplerDAO beltSamplerDAO_Out = null; taskSimpleScheduler.StartNewTask("出场皮带采样机快速同步", () => { BeltSampler_Dber_Out = new SqlServerDapperDber(CommonDAO.GetInstance().GetCommonAppletConfigString("出场皮带采样机接口连接字符串")); beltSamplerDAO_Out = new EquBeltSamplerDAO("出场", BeltSampler_Dber_Out); if (CommonDAO.GetInstance().TestPing(BeltSampler_Dber_Out.Connection.DataSource)) { beltSamplerDAO_Out.SyncSignal(this.rTxtOutputer.Output); beltSamplerDAO_Out.SyncError(this.rTxtOutputer.Output); beltSamplerDAO_Out.SyncBarrel(this.rTxtOutputer.Output); beltSamplerDAO_Out.SyncPlan(this.rTxtOutputer.Output); beltSamplerDAO_Out.SyncUnloadCmd(this.rTxtOutputer.Output); beltSamplerDAO_Out.SyncCmd(this.rTxtOutputer.Output); beltSamplerDAO_Out.SyncUnloadResult(this.rTxtOutputer.Output); } else { rTxtOutputer.Output("出场皮带采样机网络不通"); } }, 3000, OutputError); this.taskSimpleScheduler.StartNewTask("出场皮带采样机运行状态-心跳", () => { if (CommonDAO.GetInstance().TestPing(BeltSampler_Dber_Out.Connection.DataSource)) { beltSamplerDAO_Out.SyncHeartbeatSignal(); } else { rTxtOutputer.Output("出场皮带采样机网络不通"); } }, 30000, OutputError); #region 入场 SqlServerDapperDber BeltSampler_Dber_In = null; EquBeltSamplerDAO beltSamplerDAO_In = null; taskSimpleScheduler.StartNewTask("入场皮带采样机快速同步", () => { BeltSampler_Dber_In = new SqlServerDapperDber(CommonDAO.GetInstance().GetCommonAppletConfigString("入场皮带采样机接口连接字符串")); beltSamplerDAO_In = new EquBeltSamplerDAO("入场", BeltSampler_Dber_In); if (CommonDAO.GetInstance().TestPing(BeltSampler_Dber_In.Connection.DataSource)) { beltSamplerDAO_In.SyncSignal(this.rTxtOutputer.Output); beltSamplerDAO_In.SyncError(this.rTxtOutputer.Output); beltSamplerDAO_In.SyncBarrel(this.rTxtOutputer.Output); beltSamplerDAO_In.SyncPlan(this.rTxtOutputer.Output); beltSamplerDAO_In.SyncUnloadCmd(this.rTxtOutputer.Output); beltSamplerDAO_In.SyncCmd(this.rTxtOutputer.Output); beltSamplerDAO_In.SyncUnloadResult(this.rTxtOutputer.Output); } else { rTxtOutputer.Output("入场皮带采样机网络不通"); } }, 3000, OutputError); this.taskSimpleScheduler.StartNewTask("入场皮带采样机运行状态-心跳", () => { if (CommonDAO.GetInstance().TestPing(BeltSampler_Dber_In.Connection.DataSource)) { beltSamplerDAO_In.SyncHeartbeatSignal(); } else { rTxtOutputer.Output("入场皮带采样机网络不通"); } }, 30000, OutputError); #endregion }
private void FrmCarSampler_Load(object sender, EventArgs e) { this.Text = "全自动制样机接口业务"; equDber = new SqlServerDapperDber(CommonDAO.GetInstance().GetCommonAppletConfigString("汽车机械采样机接口连接字符串")); Bind_SAMPLE_INTERFACE_DATA(); }
/// <summary> /// 同步全过程基础信息(供应商信息) /// </summary> public void SyncBaseInfoForGYS(Action <string, eOutputType> output, SqlServerDapperDber sqlDapperDber) { int res = 0; try { foreach (View_gys qgc_gys in sqlDapperDber.Entities <View_gys>()) { if (commonDAO.SelfDber.Get <View_gys>(qgc_gys.Dbid.ToString()) != null) { commonDAO.SelfDber.Update <View_gys>(qgc_gys); } else { commonDAO.SelfDber.Insert <View_gys>(qgc_gys); } CmcsSupplier cmcsSupplier = commonDAO.SelfDber.Entity <CmcsSupplier>("where PkId=:PkId", new { PkId = qgc_gys.Dbid }); if (cmcsSupplier == null) { commonDAO.SelfDber.Insert(new CmcsSupplier() { PkId = qgc_gys.Dbid, Name = qgc_gys.Gysqc, ShortName = qgc_gys.Gysjc, Code = qgc_gys.Gysbm, IsStop = int.Parse(qgc_gys.Is_valid) }); } else { cmcsSupplier.PkId = qgc_gys.Dbid; cmcsSupplier.Name = qgc_gys.Gysqc; cmcsSupplier.ShortName = qgc_gys.Gysjc; cmcsSupplier.Code = qgc_gys.Gysbm; cmcsSupplier.IsStop = int.Parse(qgc_gys.Is_valid); commonDAO.SelfDber.Update(cmcsSupplier); } CmcsTransportCompany cmcsTransportCompany = commonDAO.SelfDber.Entity <CmcsTransportCompany>("where PkId=:PkId", new { PkId = qgc_gys.Dbid }); if (cmcsTransportCompany == null) { commonDAO.SelfDber.Insert(new CmcsTransportCompany() { PkId = qgc_gys.Dbid, Name = qgc_gys.Gysqc, IsStop = int.Parse(qgc_gys.Is_valid), Code = qgc_gys.Gysbm }); } else { cmcsTransportCompany.PkId = qgc_gys.Dbid; cmcsTransportCompany.Name = qgc_gys.Gysqc; cmcsTransportCompany.IsStop = int.Parse(qgc_gys.Is_valid); cmcsTransportCompany.Code = qgc_gys.Gysbm; commonDAO.SelfDber.Update(cmcsTransportCompany); } res++; } } catch (Exception ex) { output("同步供应商信息报错," + ex.Message, eOutputType.Error); } output(string.Format("同步供应商信息{0}条", res), eOutputType.Normal); }
/// <summary> /// EquAutoMakerDAO /// </summary> /// <param name="equDber">第三方数据库访问对象</param> public EquPackagingBatchDAO(SqlServerDapperDber equDber) { this.EquDber = equDber; }
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> /// <param name="machineCode">设备编码</param> /// <param name="equDber">第三方数据库访问对象</param> public EquPneumaticTransferDAO(string machineCode, SqlServerDapperDber equDber) { this.MachineCode = machineCode; this.EquDber = equDber; }
/// <summary> /// EquCarJXSamplerDAO /// </summary> /// <param name="machineCode">设备编码</param> /// <param name="equDber">第三方数据库访问对象</param> public EquTrainJXSamplerDAO(string machineCode, SqlServerDapperDber equDber) { this.MachineCode = machineCode; this.EquDber = equDber; }