/// <summary> /// 生成抽查样 /// </summary> /// <param name="assay">原化验记录</param> /// <param name="UserName">操作人</param> /// <param name="assayPoint">化验指标</param> /// <param name="PreFix">化验类型</param> /// <returns></returns> public bool CreateSpotAssay(CmcsRCAssay entity, string userName, string userAccount, string assayPoint, string PreFix, ref CmcsRCAssay assay) { try { assay = new CmcsRCAssay(); assay.AssayPoint = assayPoint; assay.AssayType = "三级编码化验"; assay.SendDate = GlobalVars.ServerNowDateTime; //assay.AssayDate = GlobalVars.ServerNowDateTime; CmcsRCMake make = entity.TheRcMake; if (make.TheRcSampling != null && make.TheRcSampling.TheInFactoryBatch != null) { assay.InFactoryBatchId = make.TheRcSampling.TheInFactoryBatch.Id; } assay.MakeId = make.Id; assay.IsRelieve = 1; assay.AssayPle = userName; assay.AssayCode = CommonDAO.GetInstance().CreateNewAssayCode(DateTime.Now); assay.AssayWay = PreFix; assay.Remark = "由化验室接样程序手动生成"; assay.ParentId = entity.Id; assay.BackBatchDate = entity.BackBatchDate; CmcsFuelQuality quality_new = new CmcsFuelQuality(); CmcsRCAssay assay_new = CommonDAO.GetInstance().SelfDber.Entity <CmcsRCAssay>("where MakeId=:MakeId order by CreateDate desc", new { MakeId = make.Id }); if (assay_new != null) { quality_new = (CmcsFuelQuality)Clone(assay_new.TheFuelQuality); } quality_new.CreateDate = quality_new.OperDate = DateTime.Now; if (assayPoint.Contains("全水分") || assayPoint.Contains("全指标") || assayPoint.Contains("日常分析")) { quality_new.Mar = 0; } if (assayPoint.Contains("空干基水分") || assayPoint.Contains("全指标") || assayPoint.Contains("日常分析")) { quality_new.Mad = 0; quality_new.FCad = 0; } if (assayPoint.Contains("灰分") || assayPoint.Contains("全指标") || assayPoint.Contains("日常分析")) { quality_new.Aad = 0; quality_new.Ad = 0; quality_new.Aar = 0; quality_new.FCad = 0; } if (assayPoint.Contains("挥发分") || assayPoint.Contains("全指标") || assayPoint.Contains("日常分析")) { quality_new.Vad = 0; quality_new.Vdaf = 0; quality_new.Vd = 0; quality_new.Var = 0; quality_new.FCad = 0; } if (assayPoint.Contains("全硫") || assayPoint.Contains("全指标") || assayPoint.Contains("日常分析")) { quality_new.Stad = 0; quality_new.Star = 0; quality_new.Std = 0; quality_new.Sd = 0; } if (assayPoint.Contains("热值") || assayPoint.Contains("全指标") || assayPoint.Contains("日常分析")) { quality_new.QbAd = 0; quality_new.Qgrad = 0; quality_new.Qgrar = 0; quality_new.Qgrd = 0; quality_new.QCal = 0; quality_new.QJ = 0; } if (assayPoint.Contains("氢值") || assayPoint.Contains("全指标") || assayPoint.Contains("日常分析")) { quality_new.Hd = 0; quality_new.Had = 0; quality_new.Har = 0; } if (assayPoint.Contains("灰熔融") || assayPoint.Contains("全指标")) { quality_new.DT = 0; quality_new.HT = 0; quality_new.FT = 0; quality_new.ST = 0; } quality_new.Id = Guid.NewGuid().ToString(); quality_new.CreateUser = userAccount; quality_new.OperUser = userAccount; assay.FuelQualityId = quality_new.Id; Dbers.GetInstance().SelfDber.Insert(quality_new); Dbers.GetInstance().SelfDber.Insert(assay); return(true); } catch (Exception) { return(false); } }
void Search(string input) { List <CmcsSupplier> list = CommonDAO.GetInstance().GetSupplierByNameOrChs(input.Trim(), sqlWhere); superGridControl1.PrimaryGrid.DataSource = list; }
/// <summary> /// /// </summary> /// <param name="strQuery"></param> /// <param name="dbName"></param> /// <returns></returns> public object GetScalarValueByQuery(string strQuery, string dbName) { _objDAO = new CommonDAO(); return(_objDAO.GetScalarValueByQuery(strQuery, dbName)); }
/// <summary> /// 同步轨道衡过衡数据,并在火车出厂后将皮重回写 /// </summary> /// <param name="output"></param> /// <returns></returns> public int SyncLwCarsInfo(Action <string, eOutputType> output) { int res = 0; DataTable result = getData(DcDbers.GetInstance().WeightBridger_Dber1); foreach (DataRow row in result.Rows) { string pKId = getDateTime(row["时间"].ToString()) + "-" + row["车号"].ToString(); //时间+车号组装成唯一标识 CmcsTrainWeightRecord trainWeightRecord = Dbers.GetInstance().SelfDber.Entity <CmcsTrainWeightRecord>("where PKID=:PKID", new { PKID = pKId }); if (trainWeightRecord == null) { res += Dbers.GetInstance().SelfDber.Insert <CmcsTrainWeightRecord>( new CmcsTrainWeightRecord { PKID = pKId, OrderNumber = Convert.ToInt32(row["序号"].ToString()), SupplierName = row["供煤单位"].ToString(), MineName = row["矿点"].ToString(), FuelKind = row["煤种"].ToString(), StationName = row["发站"].ToString(), MachineCode = row["设备编号"].ToString(), TrainNumber = row["车号"].ToString(), TrainType = row["车型"].ToString(), TicketWeight = Convert.ToDecimal(row["票重"]), GrossWeight = Convert.ToDecimal(row["毛重"]), SkinWeight = Convert.ToDecimal(row["皮重"]), StandardWeight = Convert.ToDecimal(row["净重"]), Speed = Convert.ToDecimal(row["车速"]), MesureMan = row["过衡人"].ToString(), ArriveTime = Convert.ToDateTime(getDateTime(row["入厂时间"].ToString())), GrossTime = Convert.ToDateTime(getDateTime(row["毛重时间"].ToString())), SkinTime = Convert.ToDateTime(getDateTime(row["皮重时间"].ToString())), LeaveTime = Convert.ToDateTime(getDateTime(row["出厂时间"].ToString())), UnloadTime = Convert.ToDateTime(getDateTime(row["卸车时间"].ToString())), TrainTipperMachineCode = row["翻车机编号"].ToString(), IsTurnover = row["翻车标识"].ToString(), DataFlag = 0 } ); } else { trainWeightRecord.OrderNumber = Convert.ToInt32(row["序号"].ToString()); if (!String.IsNullOrEmpty(row["车号"].ToString())) { trainWeightRecord.TrainNumber = row["车号"].ToString(); } trainWeightRecord.SupplierName = row["供煤单位"].ToString(); trainWeightRecord.MineName = row["矿点"].ToString(); trainWeightRecord.FuelKind = row["煤种"].ToString(); trainWeightRecord.StationName = row["发站"].ToString(); trainWeightRecord.MachineCode = row["设备编号"].ToString(); trainWeightRecord.TrainType = row["车型"].ToString(); trainWeightRecord.TicketWeight = Convert.ToDecimal(row["票重"]); trainWeightRecord.GrossWeight = Convert.ToDecimal(row["毛重"]); trainWeightRecord.SkinWeight = Convert.ToDecimal(row["皮重"]); trainWeightRecord.StandardWeight = Convert.ToDecimal(row["净重"]); trainWeightRecord.Speed = Convert.ToDecimal(row["车速"]); trainWeightRecord.MesureMan = row["过衡人"].ToString(); trainWeightRecord.ArriveTime = Convert.ToDateTime(getDateTime(row["入厂时间"].ToString())); trainWeightRecord.GrossTime = Convert.ToDateTime(getDateTime(row["毛重时间"].ToString())); trainWeightRecord.SkinTime = Convert.ToDateTime(getDateTime(row["皮重时间"].ToString())); trainWeightRecord.LeaveTime = Convert.ToDateTime(getDateTime(row["出厂时间"].ToString())); trainWeightRecord.UnloadTime = Convert.ToDateTime(getDateTime(row["卸车时间"].ToString())); trainWeightRecord.TrainTipperMachineCode = row["翻车机编号"].ToString(); trainWeightRecord.IsTurnover = row["翻车标识"].ToString(); trainWeightRecord.DataFlag = 0; res += Dbers.GetInstance().SelfDber.Update <CmcsTrainWeightRecord>(trainWeightRecord); } if (res > 0 && String.IsNullOrEmpty(row["车号"].ToString())) { CommonDAO.GetInstance().SaveSysMessage(eMessageType.轨道衡.ToString(), "车号为空请补录!", eMessageType.轨道衡.ToString()); } } output(string.Format("同步轨道衡数据 {0} 条(第三方 > 集中管控)", res), eOutputType.Normal); return(res); }
private void superGridControl1_CellMouseDown(object sender, DevComponents.DotNetBar.SuperGrid.GridCellMouseEventArgs e) { CmcsBuyFuelTransport entity = Dbers.GetInstance().SelfDber.Get <CmcsBuyFuelTransport>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString()); if (entity == null || entity.SerialNumber == "合计") { return; } switch (superGridControl1.PrimaryGrid.Columns[e.GridCell.ColumnIndex].Name) { case "clmPrint": if (entity.SuttleWeight <= 0) { MessageBoxEx.Show("净重异常,禁止打印", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } if (entity.ProfitWeight > 0 && entity.ProfitWeight >= Convert.ToDecimal(CommonDAO.GetInstance().GetAppletConfigDouble("盈异常吨数"))) { MessageBoxEx.Show("盈吨异常", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } if (entity.ProfitWeight < 0 && entity.ProfitWeight >= Convert.ToDecimal(CommonDAO.GetInstance().GetAppletConfigDouble("亏异常吨数"))) { MessageBoxEx.Show("亏吨异常", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } FrmPrint_Oper frmPrint = new FrmPrint_Oper(entity.Id, false); if (frmPrint.ShowDialog() == DialogResult.OK) { BindData(); } break; case "clmShow": FrmBuyFuelTransport_Oper frmShow = new FrmBuyFuelTransport_Oper(entity.Id, false); if (frmShow.ShowDialog() == DialogResult.OK) { BindData(); } break; case "clmEdit": FrmBuyFuelTransport_Oper frmEdit = new FrmBuyFuelTransport_Oper(entity.Id, true); if (frmEdit.ShowDialog() == DialogResult.OK) { BindData(); } break; case "clmDelete": // 查询正在使用该记录的车数 if (MessageBoxEx.Show("确定要删除该记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { CommonDAO.GetInstance().SaveAppletLog(eAppletLogLevel.Warn, "删除入厂煤运输记录", string.Format("车号:{0};毛重:{1};皮重:{2};矿点:{3};操作人:{4}", entity.CarNumber, entity.GrossWeight, entity.TareWeight, entity.MineName, SelfVars.LoginUser.UserName)); CommonDAO.GetInstance().RemoveDeduct(entity.Id); Dbers.GetInstance().SelfDber.Delete <CmcsBuyFuelTransport>(entity.Id); CommonDAO.GetInstance().RemoveUnFinishTransport(entity.Id); } catch (Exception) { MessageBoxEx.Show("该记录正在使用中,禁止删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } BindData(); } break; case "clmPic": if (Dbers.GetInstance().SelfDber.Entities <CmcsTransportPicture>(String.Format(" where TransportId='{0}'", entity.Id)).Count > 0) { FrmTransportPicture frmPic = new FrmTransportPicture(entity.Id, entity.CarNumber); if (frmPic.ShowDialog() == DialogResult.OK) { BindData(); } } else { MessageBoxEx.Show("暂无抓拍图片!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; } }
private static void GetBoxDatas(CommonDAO commonDAO, string machineCode, List <HtmlDataItem> datas) { string value = ""; datas.Add(new HtmlDataItem(machineCode + "_共有仓位", commonDAO.GetSignalDataValue(machineCode, "共有仓位"), eHtmlDataItemType.svg_text)); datas.Add(new HtmlDataItem(machineCode + "_已存仓位", commonDAO.GetSignalDataValue(machineCode, "已存仓位"), eHtmlDataItemType.svg_text)); datas.Add(new HtmlDataItem(machineCode + "_未存仓位", commonDAO.GetSignalDataValue(machineCode, "未存仓位"), eHtmlDataItemType.svg_text)); datas.Add(new HtmlDataItem(machineCode + "_存样率", commonDAO.GetSignalDataValue(machineCode, "存样率"), eHtmlDataItemType.svg_text)); datas.Add(new HtmlDataItem(machineCode + "_大瓶已存仓位", commonDAO.GetSignalDataValue(machineCode, "大瓶已存仓位"), eHtmlDataItemType.svg_text)); datas.Add(new HtmlDataItem(machineCode + "_小瓶已存仓位", commonDAO.GetSignalDataValue(machineCode, "小瓶已存仓位"), eHtmlDataItemType.svg_text)); datas.Add(new HtmlDataItem(machineCode + "_大瓶仓位", commonDAO.GetSignalDataValue(machineCode, "大瓶仓位"), eHtmlDataItemType.svg_text)); datas.Add(new HtmlDataItem(machineCode + "_小瓶仓位", commonDAO.GetSignalDataValue(machineCode, "小瓶仓位"), eHtmlDataItemType.svg_text)); string sql2 = @"select (b.configvalue) from cmcstbappletconfig b where b.configname = '存样柜超期天数'"; DataTable dt1 = commonDAO.SelfDber.ExecuteDataTable(sql2); int configvalue = 90; if (dt1 != null && dt1.Rows.Count > 0) { configvalue = Convert.ToInt32(dt1.Rows[0][0].ToString()); } string sql = string.Format(@"select (select count(0) from inftbcygsam d where d.machinecode = '#1智能存样柜' and d.areanumber = 1 and d.isnew = 1) a1, (select count(0) from inftbcygsam d where d.machinecode = '#1智能存样柜' and d.areanumber = 2 and d.isnew = 1) a2, (select count(0) from inftbcygsam d where d.machinecode = '#1智能存样柜' and d.areanumber = 1 and d.isnew = 1 and d.updatetime + {0} < sysdate) a3, (select count(0) from inftbcygsam d where d.machinecode = '#1智能存样柜' and d.areanumber = 2 and d.isnew = 1 and d.updatetime + {0} < sysdate) a4, (select count(0) from inftbcygsam d where d.machinecode = '#2智能存样柜' and d.areanumber = 1 and d.isnew = 1) b1, (select count(0) from inftbcygsam d where d.machinecode = '#2智能存样柜' and d.areanumber = 2 and d.isnew = 1) b2 , (select count(0) from inftbcygsam d where d.machinecode = '#2智能存样柜' and d.areanumber = 1 and d.isnew = 1 and d.updatetime + {0} < sysdate) b3, (select count(0) from inftbcygsam d where d.machinecode = '#2智能存样柜' and d.areanumber = 2 and d.isnew = 1 and d.updatetime + {0} < sysdate) b4 from dual ", configvalue); DataTable dt = commonDAO.GetSqlDatas(sql); if (dt != null && dt.Rows.Count > 0) { datas.Add(new HtmlDataItem(machineCode + "_a1", "已存:" + dt.Rows[0]["a1"].ToString() + " 超期:" + dt.Rows[0]["a3"].ToString() + " 仓位:520", eHtmlDataItemType.svg_text)); datas.Add(new HtmlDataItem(machineCode + "_a2", "已存:" + dt.Rows[0]["a2"].ToString() + " 超期:" + dt.Rows[0]["a4"].ToString() + " 仓位:520", eHtmlDataItemType.svg_text)); datas.Add(new HtmlDataItem(machineCode + "_b1", "已存:" + dt.Rows[0]["b1"].ToString() + " 超期:" + dt.Rows[0]["b3"].ToString() + " 仓位:520", eHtmlDataItemType.svg_text)); datas.Add(new HtmlDataItem(machineCode + "_b2", "已存:" + dt.Rows[0]["b2"].ToString() + " 超期:" + dt.Rows[0]["b4"].ToString() + " 仓位:520", eHtmlDataItemType.svg_text)); datas.Add(new HtmlDataItem("div1-1", value, dt.Rows[0]["a1"].ToString(), "ShowDiv", eHtmlDataItemType.key_value)); datas.Add(new HtmlDataItem("div1-2", value, dt.Rows[0]["a2"].ToString(), "ShowDiv", eHtmlDataItemType.key_value)); datas.Add(new HtmlDataItem("div1-3", value, dt.Rows[0]["b1"].ToString(), "ShowDiv", eHtmlDataItemType.key_value)); datas.Add(new HtmlDataItem("div1-4", value, dt.Rows[0]["b2"].ToString(), "ShowDiv", eHtmlDataItemType.key_value)); } // sql = string.Format(@"select t.endtime,t.makecode,t.sampletype,t.result from inftbqdcsrecord t // where to_char(t.endtime,'yyyy-mm-dd' ) = to_char(sysdate,'yyyy-mm-dd') // order by endtime desc "); // dt = commonDAO.GetSqlDatas(sql); //string str = ""; //if (dt != null && dt.Rows.Count > 0) //{ // foreach (DataRow dr in dt.Rows) // { // str += dr["endtime"].ToString() + "," + dr["makecode"].ToString() + "," + dr["sampletype"].ToString() + "," + dr["result"].ToString() + "|"; // } //} //datas.Add(new HtmlDataItem("传输记录", str, eHtmlDataItemType.svg_text)); value = commonDAO.GetSignalDataValue(machineCode, eSignalDataName.序状态.ToString()); if ("|就绪待机|自动|".Contains("|" + value + "|")) { datas.Add(new HtmlDataItem(machineCode + "_系统", "#00c000", eHtmlDataItemType.svg_color)); } else if ("|正在运行|正在卸样|手动|".Contains("|" + value + "|")) { datas.Add(new HtmlDataItem(machineCode + "_系统", "#ff0000", eHtmlDataItemType.svg_color)); } else if ("|发生故障|".Contains("|" + value + "|")) { datas.Add(new HtmlDataItem(machineCode + "_系统", "#ffff00", eHtmlDataItemType.svg_color)); } else { datas.Add(new HtmlDataItem(machineCode + "_系统", "#c0c0c0", eHtmlDataItemType.svg_color)); } }
private void superGridControl1_CellMouseDown(object sender, DevComponents.DotNetBar.SuperGrid.GridCellMouseEventArgs e) { CmcsBuyFuelTransport entity = Dbers.GetInstance().SelfDber.Get <CmcsBuyFuelTransport>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString()); switch (superGridControl1.PrimaryGrid.Columns[e.GridCell.ColumnIndex].Name) { case "clmShow": FrmBuyFuelTransport_Oper frmShow = new FrmBuyFuelTransport_Oper(entity.Id, false); if (frmShow.ShowDialog() == DialogResult.OK) { BindData(); } break; case "clmEdit": FrmBuyFuelTransport_Oper frmEdit = new FrmBuyFuelTransport_Oper(entity.Id, true); if (frmEdit.ShowDialog() == DialogResult.OK) { BindData(); } break; case "clmDelete": if (entity.GrossWeight > 0 || entity.TareWeight > 0) { MessageBoxEx.Show("该记录已有重量,禁止删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (MessageBoxEx.Show("确定要删除该记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { CommonDAO.GetInstance().SaveAppletLog(eAppletLogLevel.Warn, "删除入场煤运输记录:", string.Format("车号:{0};毛重:{1};皮重:{2};矿点:{3};操作人:{4}", entity.CarNumber, entity.GrossWeight, entity.TareWeight, entity.MineName, SelfVars.LoginUser.UserName)); if (QueuerDAO.GetInstance().DeleteTransport(entity.Id)) { CommonDAO.GetInstance().InsertWaitForHandleEvent("汽车智能化_删除入厂煤运输记录", entity.Id); } } catch (Exception) { MessageBoxEx.Show("该记录正在使用中,禁止删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } BindData(); } break; case "clmPic": if (Dbers.GetInstance().SelfDber.Entities <CmcsTransportPicture>(String.Format(" where TransportId='{0}'", entity.Id)).Count > 0) { FrmTransportPicture frmPic = new FrmTransportPicture(entity.Id, entity.CarNumber); if (frmPic.ShowDialog() == DialogResult.OK) { BindData(); } } else { MessageBoxEx.Show("暂无抓拍图片!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; } }
/// <summary> /// 同步车号识别数据 /// </summary> /// <param name="output"></param> /// <returns></returns> public void SyncTrainRecognitionInfo(Action <string, eOutputType> output) { CmcsTrainRecognition train = Dbers.GetInstance().SelfDber.Entity <CmcsTrainRecognition>("where Status=0 and MachineCode=1 order by CrossTime desc"); CommonDAO.GetInstance().SetSignalDataValue(GlobalVars.MachineCode_Recognition_1, eSignalDataName.当前车号.ToString(), train != null ? train.CarNumber : ""); CmcsTrainRecognition train2 = Dbers.GetInstance().SelfDber.Entity <CmcsTrainRecognition>("where Status=0 and MachineCode=2 order by CrossTime desc"); CommonDAO.GetInstance().SetSignalDataValue(GlobalVars.MachineCode_Recognition_2, eSignalDataName.当前车号.ToString(), train2 != null ? train2.CarNumber : ""); int CrossNumber = Dbers.GetInstance().SelfDber.Count <CmcsTrainRecognition>("where CrossTime>=:CrossTime and MachineCode=1 order by CrossTime desc", new { CrossTime = DateTime.Now.Date }); CommonDAO.GetInstance().SetSignalDataValue(GlobalVars.MachineCode_Recognition_1, eSignalDataName.当日已过车数.ToString(), CrossNumber.ToString()); int CrossNumber2 = Dbers.GetInstance().SelfDber.Count <CmcsTrainRecognition>("where CrossTime>=:CrossTime and MachineCode=2 order by CrossTime desc", new { CrossTime = DateTime.Now.Date }); CommonDAO.GetInstance().SetSignalDataValue(GlobalVars.MachineCode_Recognition_2, eSignalDataName.当日已过车数.ToString(), CrossNumber2.ToString()); if (train != null) { CmcsTrainWeightRecord trainWeight = Dbers.GetInstance().SelfDber.Entity <CmcsTrainWeightRecord>("where TrainNumber=:TrainNumber and GrossTime<:GrossTime and GrossWeight=0 order by GrossTime desc", new { TrainNumber = train.CarNumber, GrossTime = train.CrossTime }); CommonDAO.GetInstance().SetSignalDataValue(GlobalVars.MachineCode_Recognition_2, eSignalDataName.当前记录Id.ToString(), trainWeight != null ? trainWeight.PKID : ""); } if (train2 != null) { CmcsTrainWeightRecord trainWeight2 = Dbers.GetInstance().SelfDber.Entity <CmcsTrainWeightRecord>("where TrainNumber=:TrainNumber and GrossTime<:GrossTime and GrossWeight=0 order by GrossTime desc", new { TrainNumber = train2.CarNumber, GrossTime = train2.CrossTime }); CommonDAO.GetInstance().SetSignalDataValue(GlobalVars.MachineCode_Recognition_2, eSignalDataName.当前记录Id.ToString(), trainWeight2 != null ? trainWeight2.PKID : ""); } //入场总车数 int WeightTotal = CommonDAO.GetInstance().SelfDber.Count <CmcsTrainWeightRecord>("where ArriveTime>=:ArriveTime", new { ArriveTime = DateTime.Now.Date }); //翻车总车数 int GrossTotal = CommonDAO.GetInstance().SelfDber.Count <CmcsTrainRecognition>("where CrossTime>=:CrossTime ", new { CrossTime = DateTime.Now.Date }); //待翻车数 CommonDAO.GetInstance().SetSignalDataValue(GlobalVars.MachineCode_TrunOver, eSignalDataName.当日待翻车数.ToString(), (WeightTotal - GrossTotal).ToString()); //检测火车入场时间 IList <CmcsTrainWeightRecord> list = CommonDAO.GetInstance().SelfDber.Entities <CmcsTrainWeightRecord>("where ArriveTime>=:ArriveTime", new { ArriveTime = DateTime.Now.Date }); if (list != null) { IList <CmcsTrainWeightRecord> list_over = list.Where(a => (DateTime.Now - a.ArriveTime).Hours > CommonDAO.GetInstance().GetCommonAppletConfigInt32("火车入场最长时间")).ToList(); if (list_over != null && list_over.Count > 0) { string msgContent = string.Empty; if (list_over.Count < 6) { msgContent = "火车入场超时:"; IList <string> TrainNumbers = list_over.Select(a => a.TrainNumber).ToList(); foreach (string item in TrainNumbers) { msgContent += item + ","; } msgContent = msgContent.TrimEnd(','); } else { msgContent = string.Format("火车入场:{0}节车厢超时,请到火车入场列表查看", list_over.Count); } CommonDAO.GetInstance().SaveSysMessage("轨道衡", msgContent); } } }
/// <summary> /// 请求数据 /// </summary> void RequestData() { CommonDAO commonDAO = CommonDAO.GetInstance(); MonitorDAO monitorDAO = MonitorDAO.GetInstance(); string value = string.Empty, machineCode = string.Empty, machineCode2 = string.Empty; List <HtmlDataItem> datas = new List <HtmlDataItem>(); List <InfEquInfHitch> equInfHitchs = new List <InfEquInfHitch>(); #region 翻车机 datas.Clear(); #region 入厂 machineCode = GlobalVars.MachineCode_QC_Queue_1; datas.Add(new HtmlDataItem("Infactory_State1", commonDAO.GetSignalDataValue(machineCode, "系统"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Infactory_State2", commonDAO.GetSignalDataValue(machineCode, "IO控制器_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Infactory_State3", commonDAO.GetSignalDataValue(machineCode, "LED屏1_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Infactory_State4", commonDAO.GetSignalDataValue(machineCode, "LED屏2_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Infactory_State5", commonDAO.GetSignalDataValue(machineCode, "抓拍相机_连接状态"), eHtmlDataItemType.json_data)); #endregion #region 采样 machineCode = GlobalVars.MachineCode_QC_JxSampler_1; datas.Add(new HtmlDataItem("Sample1_State1", commonDAO.GetSignalDataValue(machineCode, "系统"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample1_State2", commonDAO.GetSignalDataValue(machineCode, "IO控制器_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample1_State3", commonDAO.GetSignalDataValue(machineCode, "LED屏1_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample1_State4", commonDAO.GetSignalDataValue(machineCode, "LED屏2_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample1_State5", commonDAO.GetSignalDataValue(machineCode, "抓拍相机_连接状态"), eHtmlDataItemType.json_data)); machineCode = GlobalVars.MachineCode_QC_JxSampler_2; datas.Add(new HtmlDataItem("Sample2_State1", commonDAO.GetSignalDataValue(machineCode, "系统"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample2_State2", commonDAO.GetSignalDataValue(machineCode, "IO控制器_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample2_State3", commonDAO.GetSignalDataValue(machineCode, "LED屏1_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample2_State4", commonDAO.GetSignalDataValue(machineCode, "LED屏2_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample2_State5", commonDAO.GetSignalDataValue(machineCode, "抓拍相机_连接状态"), eHtmlDataItemType.json_data)); machineCode = GlobalVars.MachineCode_QC_JxSampler_3; datas.Add(new HtmlDataItem("Sample3_State1", commonDAO.GetSignalDataValue(machineCode, "系统"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample3_State2", commonDAO.GetSignalDataValue(machineCode, "IO控制器_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample3_State3", commonDAO.GetSignalDataValue(machineCode, "LED屏1_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample3_State4", commonDAO.GetSignalDataValue(machineCode, "LED屏2_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample3_State5", commonDAO.GetSignalDataValue(machineCode, "抓拍相机_连接状态"), eHtmlDataItemType.json_data)); machineCode = GlobalVars.MachineCode_QC_JxSampler_4; datas.Add(new HtmlDataItem("Sample4_State1", commonDAO.GetSignalDataValue(machineCode, "系统"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample4_State2", commonDAO.GetSignalDataValue(machineCode, "IO控制器_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample4_State3", commonDAO.GetSignalDataValue(machineCode, "LED屏1_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample4_State4", commonDAO.GetSignalDataValue(machineCode, "LED屏2_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample4_State5", commonDAO.GetSignalDataValue(machineCode, "抓拍相机_连接状态"), eHtmlDataItemType.json_data)); machineCode = GlobalVars.MachineCode_QC_JxSampler_5; datas.Add(new HtmlDataItem("Sample5_State1", commonDAO.GetSignalDataValue(machineCode, "系统"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample5_State2", commonDAO.GetSignalDataValue(machineCode, "IO控制器_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample5_State3", commonDAO.GetSignalDataValue(machineCode, "LED屏1_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample5_State4", commonDAO.GetSignalDataValue(machineCode, "LED屏2_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample5_State5", commonDAO.GetSignalDataValue(machineCode, "抓拍相机_连接状态"), eHtmlDataItemType.json_data)); machineCode = GlobalVars.MachineCode_QC_JxSampler_6; datas.Add(new HtmlDataItem("Sample6_State1", commonDAO.GetSignalDataValue(machineCode, "系统"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample6_State2", commonDAO.GetSignalDataValue(machineCode, "IO控制器_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample6_State3", commonDAO.GetSignalDataValue(machineCode, "LED屏1_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample6_State4", commonDAO.GetSignalDataValue(machineCode, "LED屏2_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Sample6_State5", commonDAO.GetSignalDataValue(machineCode, "抓拍相机_连接状态"), eHtmlDataItemType.json_data)); #endregion #region 汽车衡 machineCode = GlobalVars.MachineCode_QC_Weighter_1; datas.Add(new HtmlDataItem("Weighter1_State1", commonDAO.GetSignalDataValue(machineCode, "系统"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter1_State2", commonDAO.GetSignalDataValue(machineCode, "IO控制器_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter1_State3", commonDAO.GetSignalDataValue(machineCode, "LED屏1_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter1_State4", commonDAO.GetSignalDataValue(machineCode, "LED屏2_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter1_State5", commonDAO.GetSignalDataValue(machineCode, "抓拍相机_连接状态"), eHtmlDataItemType.json_data)); machineCode = GlobalVars.MachineCode_QC_Weighter_2; datas.Add(new HtmlDataItem("Weighter2_State1", commonDAO.GetSignalDataValue(machineCode, "系统"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter2_State2", commonDAO.GetSignalDataValue(machineCode, "IO控制器_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter2_State3", commonDAO.GetSignalDataValue(machineCode, "LED屏1_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter2_State4", commonDAO.GetSignalDataValue(machineCode, "LED屏2_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter2_State5", commonDAO.GetSignalDataValue(machineCode, "抓拍相机_连接状态"), eHtmlDataItemType.json_data)); machineCode = GlobalVars.MachineCode_QC_Weighter_3; datas.Add(new HtmlDataItem("Weighter3_State1", commonDAO.GetSignalDataValue(machineCode, "系统"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter3_State2", commonDAO.GetSignalDataValue(machineCode, "IO控制器_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter3_State3", commonDAO.GetSignalDataValue(machineCode, "LED屏1_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter3_State4", commonDAO.GetSignalDataValue(machineCode, "LED屏2_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter3_State5", commonDAO.GetSignalDataValue(machineCode, "抓拍相机_连接状态"), eHtmlDataItemType.json_data)); machineCode = GlobalVars.MachineCode_QC_Weighter_4; datas.Add(new HtmlDataItem("Weighter4_State1", commonDAO.GetSignalDataValue(machineCode, "系统"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter4_State2", commonDAO.GetSignalDataValue(machineCode, "IO控制器_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter4_State3", commonDAO.GetSignalDataValue(machineCode, "LED屏1_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter4_State4", commonDAO.GetSignalDataValue(machineCode, "LED屏2_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter4_State5", commonDAO.GetSignalDataValue(machineCode, "抓拍相机_连接状态"), eHtmlDataItemType.json_data)); machineCode = GlobalVars.MachineCode_QC_Weighter_5; datas.Add(new HtmlDataItem("Weighter5_State1", commonDAO.GetSignalDataValue(machineCode, "系统"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter5_State2", commonDAO.GetSignalDataValue(machineCode, "IO控制器_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter5_State3", commonDAO.GetSignalDataValue(machineCode, "LED屏1_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter5_State4", commonDAO.GetSignalDataValue(machineCode, "LED屏2_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter5_State5", commonDAO.GetSignalDataValue(machineCode, "抓拍相机_连接状态"), eHtmlDataItemType.json_data)); machineCode = GlobalVars.MachineCode_QC_Weighter_6; datas.Add(new HtmlDataItem("Weighter6_State1", commonDAO.GetSignalDataValue(machineCode, "系统"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter6_State2", commonDAO.GetSignalDataValue(machineCode, "IO控制器_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter6_State3", commonDAO.GetSignalDataValue(machineCode, "LED屏1_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter6_State4", commonDAO.GetSignalDataValue(machineCode, "LED屏2_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter6_State5", commonDAO.GetSignalDataValue(machineCode, "抓拍相机_连接状态"), eHtmlDataItemType.json_data)); machineCode = GlobalVars.MachineCode_QC_Weighter_7; datas.Add(new HtmlDataItem("Weighter7_State1", commonDAO.GetSignalDataValue(machineCode, "系统"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter7_State2", commonDAO.GetSignalDataValue(machineCode, "IO控制器_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter7_State3", commonDAO.GetSignalDataValue(machineCode, "LED屏1_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter7_State4", commonDAO.GetSignalDataValue(machineCode, "LED屏2_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter7_State5", commonDAO.GetSignalDataValue(machineCode, "抓拍相机_连接状态"), eHtmlDataItemType.json_data)); machineCode = GlobalVars.MachineCode_QC_Weighter_8; datas.Add(new HtmlDataItem("Weighter8_State1", commonDAO.GetSignalDataValue(machineCode, "系统"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter8_State2", commonDAO.GetSignalDataValue(machineCode, "IO控制器_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter8_State3", commonDAO.GetSignalDataValue(machineCode, "LED屏1_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter8_State4", commonDAO.GetSignalDataValue(machineCode, "LED屏2_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Weighter8_State5", commonDAO.GetSignalDataValue(machineCode, "抓拍相机_连接状态"), eHtmlDataItemType.json_data)); #endregion #region 出厂 machineCode = GlobalVars.MachineCode_QC_Out_1; datas.Add(new HtmlDataItem("Outfactory_State1", commonDAO.GetSignalDataValue(machineCode, "系统"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Outfactory_State2", commonDAO.GetSignalDataValue(machineCode, "IO控制器_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Outfactory_State3", commonDAO.GetSignalDataValue(machineCode, "LED屏1_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Outfactory_State4", commonDAO.GetSignalDataValue(machineCode, "LED屏2_连接状态"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("Outfactory_State5", commonDAO.GetSignalDataValue(machineCode, "抓拍相机_连接状态"), eHtmlDataItemType.json_data)); #endregion // 发送到页面 cefWebBrowser.Browser.GetMainFrame().ExecuteJavaScript("requestData(" + Newtonsoft.Json.JsonConvert.SerializeObject(datas) + ");", "", 0); #endregion }
/// <summary> /// 执行所有任务 /// </summary> void ExecuteAllTask() { #region #1全自动制样机 EquAutoMakerDAO autoMakerDAO1 = new EquAutoMakerDAO(GlobalVars.MachineCode_QZDZYJ_1, new DapperDber.Dbs.SqlServerDb.SqlServerDapperDber(CommonDAO.GetInstance().GetCommonAppletConfigString("#1全自动制样机接口连接字符串"))); taskSimpleScheduler.StartNewTask("#1全自动制样机-快速同步", () => { autoMakerDAO1.SyncCmd(this.rTxtOutputer.Output); autoMakerDAO1.SyncError(this.rTxtOutputer.Output); autoMakerDAO1.SyncSignal(this.rTxtOutputer.Output); autoMakerDAO1.SyncMakeDetail(this.rTxtOutputer.Output); }, 2000, OutputError); taskSimpleScheduler.StartNewTask("#1全自动制样机-OPC同步", () => { EquAutoMakerOPC.GetInstance().SyncOPCTags(this.rTxtOutputer.Output); }, 0, OutputError); taskSimpleScheduler.StartNewTask("#1全自动制样机执行命令", () => { EquAutoMakerOPC.GetInstance().RunCmd(this.rTxtOutputer.Output); }, 500, OutputError); #endregion }
/// <summary> /// 解析报文数据 /// </summary> /// <returns></returns> public List <CmcsTrainWeightRecord> GetTrainWeightInfo() { String interface_path = CommonDAO.GetInstance().GetCommonAppletConfigString("轨道衡报文路径"); int interface_day = CommonDAO.GetInstance().GetCommonAppletConfigInt32("轨道衡数据读取天数"); List <CmcsTrainWeightRecord> items = new List <CmcsTrainWeightRecord>(); List <string> st = new List <string>(); for (int i = 0; i <= interface_day; i++) { String[] directory = Directory.GetFiles(interface_path, String.Format("{0}_*", DateTime.Now.AddDays(-i).ToString("yyMMdd"))); st.AddRange(directory); } foreach (var item in st) { String bw = File.ReadAllText(item, Encoding.GetEncoding("gb2312")); //if (bw.Contains("*")) // continue; String[] strs = bw.Split(new string[] { "\r\n" }, StringSplitOptions.None); DateTime dt = new DateTime(2000, 1, 1); String fx = ""; String name = ""; for (int i = 0; i < strs.Count(); i++) { if (i == 1) { if (strs[i].Contains("<--")) { fx = "出厂"; } else if (strs[i].Contains("-->")) { fx = "入厂"; } } if (i == 3) { string ss = DateTime.Now.ToString("yyyy").Substring(0, 2) + strs[i].Substring(strs[i].IndexOf(':') + 1, strs[i].Length - strs[i].IndexOf(':') - 1); ss = ss.Substring(0, 4) + "-" + ss.Substring(4, 2) + "-" + ss.Substring(6, 2) + " " + ss.Substring(9, 2) + ":" + ss.Substring(11, 2) + ":" + ss.Substring(13, 2); DateTime.TryParse(ss, out dt); } if (i >= 5) { String[] ss = strs[i].Split(','); if (ss.Count() >= 10) { CmcsTrainWeightRecord tw = new CmcsTrainWeightRecord(); int twOrderNumber; if (int.TryParse(ss[0].Trim(), out twOrderNumber)) { tw.OrderNumber = twOrderNumber; } tw.TrainNumber = ss[1].Trim(); Decimal twGrossWeight; if (Decimal.TryParse(ss[2].Trim(), out twGrossWeight)) { if ((twGrossWeight < 25 && fx == "入厂") || (twGrossWeight > 25 && fx == "出厂") || twGrossWeight == 0) { continue; } tw.GrossWeight = twGrossWeight; } Decimal twTareWeight; if (Decimal.TryParse(ss[3].Trim(), out twTareWeight)) { tw.SkinWeight = twTareWeight;//不同步皮重 } Decimal twSuttleWeight; if (Decimal.TryParse(ss[4].Trim(), out twSuttleWeight)) { tw.StandardWeight = twSuttleWeight; } tw.SupplierName = ss[6].Trim(); decimal ticketWeight; if (Decimal.TryParse(ss[8].Trim(), out ticketWeight)) { tw.TicketWeight = ticketWeight; } Decimal twSpeed; if (Decimal.TryParse(ss[9].Trim(), out twSpeed)) { tw.Speed = twSpeed; } tw.TrainType = ss[10].Trim(); tw.PKID = dt.ToString("yyyyMMddHHmmss") + "-" + tw.OrderNumber; tw.GrossTime = dt; tw.ArriveTime = tw.GrossTime; tw.SkinTime = dt; tw.LeaveTime = dt; tw.MesureMan = name; tw.InFactoryDirection = fx; tw.MachineCode = "轨道衡"; items.Add(tw); } } } } return(items); }
private void panel1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; string SerialNumber = string.Empty, CarNumber = string.Empty, MineName = string.Empty, FuelKindName = string.Empty, GrossTime = string.Empty, TareTime = string.Empty, TicketWeight = string.Empty, GrossWeight = string.Empty, TareWeight = string.Empty, SuttleWeight = string.Empty, DeductWeight = string.Empty, CheckWeight = string.Empty, UserName = string.Empty; if (this._BuyFuelTransport != null) { SerialNumber = this._BuyFuelTransport.SerialNumber; CarNumber = this._BuyFuelTransport.CarNumber; MineName = this._BuyFuelTransport.MineName; FuelKindName = this._BuyFuelTransport.FuelKindName; GrossTime = DisposeTime(this._BuyFuelTransport.GrossTime.ToString(), "yyyy-MM-dd HH:mm"); TareTime = DisposeTime(this._BuyFuelTransport.TareTime.ToString(), "yyyy-MM-dd HH:mm"); TicketWeight = this._BuyFuelTransport.TicketWeight.ToString("F2").PadLeft(6, ' '); GrossWeight = this._BuyFuelTransport.GrossWeight.ToString("F2").PadLeft(6, ' '); TareWeight = this._BuyFuelTransport.TareWeight.ToString("F2").PadLeft(6, ' '); SuttleWeight = this._BuyFuelTransport.SuttleWeight.ToString("F2").PadLeft(6, ' '); DeductWeight = this._BuyFuelTransport.DeductWeight.ToString("F2").PadLeft(6, ' '); List <CmcsBuyFuelTransportDeduct> deductlist = CommonDAO.GetInstance().SelfDber.Entities <CmcsBuyFuelTransportDeduct>("where TransportId=:Transportid order by CreationTime desc", new { Transportid = this._BuyFuelTransport.Id }); #region 入厂煤 // 行间距 24 float TopValue = 53; string printValue = ""; g.DrawString("国电投青铝发电有限公司", TitleFont, Brushes.White, 30, TopValue); TopValue += 34; g.DrawString("打印时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm"), ContentFont, Brushes.White, 30, TopValue); TopValue += 24; g.DrawLine(new Pen(Color.White, 2), 0, TopValue, 300 - 10, TopValue); TopValue += 15; g.DrawString("车 牌 号:" + CarNumber, ContentFont, Brushes.White, 30, TopValue); TopValue += 24; printValue = printValue = "矿 点:" + MineName; if (printValue.Length > 18) { g.DrawString(printValue.Substring(0, 18), ContentFont, Brushes.White, 30, TopValue); TopValue += 24; g.DrawString(printValue.Substring(18, printValue.Length - 18), ContentFont, Brushes.White, 105, TopValue); TopValue += 24; } else { g.DrawString(printValue, ContentFont, Brushes.White, 30, TopValue); TopValue += 24; } g.DrawString("煤 种:" + FuelKindName, ContentFont, Brushes.White, 30, TopValue); TopValue += 24; g.DrawString(string.Format("矿 发 量:{0} 吨", TicketWeight), ContentFont, Brushes.White, 30, TopValue); TopValue += 24; g.DrawString(string.Format("毛 重:{0} 吨", GrossWeight), ContentFont, Brushes.White, 30, TopValue); TopValue += 24; g.DrawString("毛重时间:" + this._BuyFuelTransport.GrossTime.ToString("yyyy-MM-dd HH:mm"), ContentFont, Brushes.White, 30, TopValue); TopValue += 24; g.DrawString(string.Format("皮 重:{0} 吨", TareWeight), ContentFont, Brushes.White, 30, TopValue); TopValue += 24; g.DrawString("皮重时间:" + this._BuyFuelTransport.TareTime.ToString("yyyy-MM-dd HH:mm"), ContentFont, Brushes.White, 30, TopValue); TopValue += 24; int deductindex = 1; foreach (CmcsBuyFuelTransportDeduct item in deductlist) { g.DrawString(string.Format("扣 吨{0}:{1} 吨 ({2})", deductindex, item.DeductWeight, item.DeductType), ContentFont, Brushes.White, 30, TopValue); TopValue += 24; deductindex++; } g.DrawString(string.Format("净 重:{0} 吨", SuttleWeight), ContentFont, Brushes.White, 30, TopValue); TopValue += 24; g.DrawString(string.Format("计量员签字:"), ContentFont, Brushes.White, 30, TopValue); TopValue += 34; g.DrawString(string.Format("监磅员签字:"), ContentFont, Brushes.White, 30, TopValue); TopValue += 34; g.DrawString(string.Format("司机签字:"), ContentFont, Brushes.White, 30, TopValue); TopValue += 34; g.DrawString("", ContentFont, Brushes.Black, 30, TopValue); #endregion } else if (this._GoodsTransport != null) { SerialNumber = this._GoodsTransport.SerialNumber; CarNumber = this._GoodsTransport.CarNumber; MineName = this._GoodsTransport.SupplyUnitName; FuelKindName = this._GoodsTransport.GoodsTypeName; GrossTime = DisposeTime(this._GoodsTransport.FirstTime.ToString(), "yyyy-MM-dd HH:mm"); TareTime = DisposeTime(this._GoodsTransport.SecondTime.ToString(), "yyyy-MM-dd HH:mm"); GrossWeight = this._GoodsTransport.FirstWeight.ToString("F2").PadLeft(6, ' '); TareWeight = this._GoodsTransport.SecondWeight.ToString("F2").PadLeft(6, ' '); SuttleWeight = this._GoodsTransport.SuttleWeight.ToString("F2").PadLeft(6, ' '); #region 其他物资 // 行间距 24 float TopValue = 53; string printValue = ""; g.DrawString(PrintAppConfig.GetInstance().TitleContent, TitleFont, Brushes.Black, 30, TopValue); TopValue += 34; g.DrawString("打印时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm"), ContentFont, Brushes.White, 30, TopValue); TopValue += 24; g.DrawLine(new Pen(Color.Black, 2), 0, TopValue, 300 - 10, TopValue); TopValue += 15; g.DrawString("车 牌 号:" + CarNumber, ContentFont, Brushes.White, 30, TopValue); TopValue += 24; printValue = "单 位:" + MineName; if (printValue.Length > 18) { g.DrawString(printValue.Substring(0, 18), ContentFont, Brushes.White, 30, TopValue); TopValue += 24; g.DrawString(printValue.Substring(18, printValue.Length - 18), ContentFont, Brushes.White, 105, TopValue); TopValue += 24; } else { g.DrawString(printValue, ContentFont, Brushes.White, 30, TopValue); TopValue += 24; } g.DrawString("物资类型:" + FuelKindName, ContentFont, Brushes.White, 30, TopValue); TopValue += 24; g.DrawString(string.Format("一次称重:{0} 吨", GrossWeight), ContentFont, Brushes.White, 30, TopValue); TopValue += 24; g.DrawString("一次时间:" + GrossTime, ContentFont, Brushes.White, 30, TopValue); TopValue += 24; g.DrawString(string.Format("二次称重:{0} 吨", TareWeight), ContentFont, Brushes.White, 30, TopValue); TopValue += 24; g.DrawString("二次时间:" + TareTime, ContentFont, Brushes.White, 30, TopValue); TopValue += 24; g.DrawString(string.Format("净 重:{0} 吨", SuttleWeight), ContentFont, Brushes.White, 30, TopValue); TopValue += 24; g.DrawString(string.Format("计量员签字:"), ContentFont, Brushes.White, 30, TopValue); TopValue += 34; g.DrawString(string.Format("监磅员签字:"), ContentFont, Brushes.White, 30, TopValue); TopValue += 34; g.DrawString(string.Format("司机签字:"), ContentFont, Brushes.White, 30, TopValue); TopValue += 34; g.DrawString("", ContentFont, Brushes.Black, 30, TopValue); #endregion } }
private static void GetQdDatas(CommonDAO commonDAO, string machineCode, ref List <HtmlDataItem> datas) { string value = ""; //value = commonDAO.GetSignalDataValue(machineCode, "系统"); //if ("|就绪待机|自动|正常|".Contains("|" + value + "|")) // datas.Add(new HtmlDataItem("气动传输_系统", "#00c000", eHtmlDataItemType.svg_color)); //else if ("|正在运行|正在卸样|手动|正在传输|".Contains("|" + value + "|")) // datas.Add(new HtmlDataItem("气动传输_系统", "#ff0000", eHtmlDataItemType.svg_color)); //else if ("|发生故障|错误|".Contains("|" + value + "|")) // datas.Add(new HtmlDataItem("气动传输_系统", "#ffff00", eHtmlDataItemType.svg_color)); //else if ("|离线|".Contains("|" + value + "|")) // datas.Add(new HtmlDataItem("气动传输_系统", "#c0c0c0", eHtmlDataItemType.svg_color)); //else // datas.Add(new HtmlDataItem("气动传输_系统", "#c0c0c0", eHtmlDataItemType.svg_color)); //string keys = ""; value = commonDAO.GetSignalDataValue(machineCode, "风机.风机运行"); if (value == "1") { value = commonDAO.GetSignalDataValue(machineCode, "风机.吹气位置"); if (value == "1") { //datas.Add(new HtmlDataItem("风机", "00c000", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("气动传输_风机", "风机正转", eHtmlDataItemType.svg_scroll3)); } value = commonDAO.GetSignalDataValue(machineCode, "风机.吸气位置"); if (value == "1") { datas.Add(new HtmlDataItem("气动传输_风机", "风机反转", eHtmlDataItemType.svg_scroll3)); } } else { datas.Add(new HtmlDataItem("气动传输_风机", "风机停止", eHtmlDataItemType.svg_scroll3)); } value = commonDAO.GetSignalDataValue(machineCode, "换向器1.管道1定位"); if (value == "1") { datas.Add(new HtmlDataItem("转换器1", "1", eHtmlDataItemType.svg_scroll)); datas.Add(new HtmlDataItem("转换器1_1b", "#00ff00", eHtmlDataItemType.svg_color1)); } else { datas.Add(new HtmlDataItem("转换器1_1b", "#a6a8ab", eHtmlDataItemType.svg_color1)); } value = commonDAO.GetSignalDataValue(machineCode, "换向器1.管道2定位"); if (value == "1") { datas.Add(new HtmlDataItem("转换器1", "2", eHtmlDataItemType.svg_scroll)); datas.Add(new HtmlDataItem("转换器1_2b", "#00ff00", eHtmlDataItemType.svg_color1)); } else { datas.Add(new HtmlDataItem("转换器1_2b", "#a6a8ab", eHtmlDataItemType.svg_color1)); } value = commonDAO.GetSignalDataValue(machineCode, "换向器1.管道3定位"); if (value == "1") { datas.Add(new HtmlDataItem("转换器1", "3", eHtmlDataItemType.svg_scroll)); datas.Add(new HtmlDataItem("转换器1_3b", "#00ff00", eHtmlDataItemType.svg_color1)); } else { datas.Add(new HtmlDataItem("转换器1_3b", "#a6a8ab", eHtmlDataItemType.svg_color1)); } value = commonDAO.GetSignalDataValue(machineCode, "换向器1.管道4定位"); if (value == "1") { datas.Add(new HtmlDataItem("转换器1", "4", eHtmlDataItemType.svg_scroll)); datas.Add(new HtmlDataItem("转换器1_4b", "#00ff00", eHtmlDataItemType.svg_color1)); } else { datas.Add(new HtmlDataItem("转换器1_4b", "#a6a8ab", eHtmlDataItemType.svg_color1)); } value = commonDAO.GetSignalDataValue(machineCode, "换向器2.管道1定位"); if (value == "1") { datas.Add(new HtmlDataItem("转换器2", "1", eHtmlDataItemType.svg_scroll)); datas.Add(new HtmlDataItem("转换器2_1b", "#00ff00", eHtmlDataItemType.svg_color1)); } else { datas.Add(new HtmlDataItem("转换器2_1b", "#a6a8ab", eHtmlDataItemType.svg_color1)); } value = commonDAO.GetSignalDataValue(machineCode, "换向器2.管道2定位"); if (value == "1") { datas.Add(new HtmlDataItem("转换器2", "2", eHtmlDataItemType.svg_scroll)); datas.Add(new HtmlDataItem("转换器2_2b", "#00ff00", eHtmlDataItemType.svg_color1)); } else { datas.Add(new HtmlDataItem("转换器2_2b", "#a6a8ab", eHtmlDataItemType.svg_color1)); } value = commonDAO.GetSignalDataValue(machineCode, "换向器2.管道3定位"); if (value == "1") { datas.Add(new HtmlDataItem("转换器2", "3", eHtmlDataItemType.svg_scroll)); datas.Add(new HtmlDataItem("转换器2_3b", "#00ff00", eHtmlDataItemType.svg_color1)); } else { datas.Add(new HtmlDataItem("转换器2_3b", "#a6a8ab", eHtmlDataItemType.svg_color1)); } value = commonDAO.GetSignalDataValue(machineCode, "换向器2.管道4定位"); if (value == "1") { datas.Add(new HtmlDataItem("转换器2", "4", eHtmlDataItemType.svg_scroll)); datas.Add(new HtmlDataItem("转换器2_4b", "#00ff00", eHtmlDataItemType.svg_color1)); } else { datas.Add(new HtmlDataItem("转换器2_4b", "#a6a8ab", eHtmlDataItemType.svg_color1)); } datas.Add(new HtmlDataItem("转换器1_1a", commonDAO.GetSignalDataValue(machineCode, "换向器1.管道1检测") == "1" ? "#00ff00" : "#D0D2D3", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("转换器1_2a", commonDAO.GetSignalDataValue(machineCode, "换向器1.管道2检测") == "1" ? "#00ff00" : "#D0D2D3", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("转换器1_3a", commonDAO.GetSignalDataValue(machineCode, "换向器1.管道3检测") == "1" ? "#00ff00" : "#D0D2D3", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("转换器1_4a", commonDAO.GetSignalDataValue(machineCode, "换向器1.管道4检测") == "1" ? "#00ff00" : "#D0D2D3", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("转换器2_1a", commonDAO.GetSignalDataValue(machineCode, "换向器2.管道1检测") == "1" ? "#00ff00" : "#D0D2D3", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("转换器2_2a", commonDAO.GetSignalDataValue(machineCode, "换向器2.管道2检测") == "1" ? "#00ff00" : "#D0D2D3", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("转换器2_3a", commonDAO.GetSignalDataValue(machineCode, "换向器2.管道3检测") == "1" ? "#00ff00" : "#D0D2D3", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("转换器2_4a", commonDAO.GetSignalDataValue(machineCode, "换向器2.管道4检测") == "1" ? "#00ff00" : "#D0D2D3", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("人工站", commonDAO.GetSignalDataValue(machineCode, "人工发送站.物料检测") == "1" ? "#00ff00" : "#EC1C24", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("大瓶发送站", commonDAO.GetSignalDataValue(machineCode, "大瓶发送站.物料检测") == "1" ? "#00ff00" : "#EC1C24", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("小瓶发送站", commonDAO.GetSignalDataValue(machineCode, "小瓶发送站.物料检测") == "1" ? "#00ff00" : "#EC1C24", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("化验室发送站", commonDAO.GetSignalDataValue(machineCode, "化验室发送站.物料检测") == "1" ? "#00ff00" : "#EC1C24", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("弃样站", commonDAO.GetSignalDataValue(machineCode, "弃样接收站.样品到位检测") == "1" ? "#00ff00" : "#EC1C24", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("化验室接收站", commonDAO.GetSignalDataValue(machineCode, "化验室接收站.样品检测") == "1" ? "#00ff00" : "#EC1C24", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("转换器1_4a", commonDAO.GetSignalDataValue(machineCode, "小瓶发送站.管道检测") == "1" ? "#00ff00" : "#D0D2D3", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("转换器1_3a", commonDAO.GetSignalDataValue(machineCode, "大瓶发送站.管道检测") == "1" ? "#00ff00" : "#D0D2D3", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("转换器2_1a", commonDAO.GetSignalDataValue(machineCode, "化验室发送站.管道检测") == "1" ? "#00ff00" : "#D0D2D3", eHtmlDataItemType.svg_color)); }
public Common() { loCommonDAO = new CommonDAO(); }
private void FrmCarSampler_Load(object sender, EventArgs e) { this.Text = "全自动制样机接口业务"; equDber = new SqlServerDapperDber(CommonDAO.GetInstance().GetCommonAppletConfigString("汽车机械采样机接口连接字符串")); Bind_SAMPLE_INTERFACE_DATA(); }
/// <summary> /// 请求数据 /// </summary> void RequestData() { CommonDAO commonDAO = CommonDAO.GetInstance(); MonitorDAO monitorDAO = MonitorDAO.GetInstance(); string value = string.Empty, machineCode1 = string.Empty, machineCode2 = string.Empty; List <HtmlDataItem> datas = new List <HtmlDataItem>(); List <InfEquInfHitch> equInfHitchs = new List <InfEquInfHitch>(); #region 翻车机 datas.Clear(); machineCode1 = GlobalVars.MachineCode_TrunOver_1; machineCode2 = GlobalVars.MachineCode_TrunOver_2; datas.Add(new HtmlDataItem("翻车机1_正翻", commonDAO.GetSignalDataValue(machineCode1, "正翻"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("翻车机1_反翻", commonDAO.GetSignalDataValue(machineCode1, "反翻"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("翻车机1_重调原位", commonDAO.GetSignalDataValue(machineCode1, "重调原位"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("翻车机1_正翻效果", commonDAO.GetSignalDataValue(machineCode1, "正翻"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("翻车机1_反翻效果", commonDAO.GetSignalDataValue(machineCode1, "反翻"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("翻车机1_转盘信号", commonDAO.GetSignalDataValue(machineCode1, "转盘信号"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("翻车机1_当前翻车车号", commonDAO.GetSignalDataValue(machineCode1, eSignalDataName.当前车号.ToString()), eHtmlDataItemType.key_value)); datas.Add(new HtmlDataItem("翻车机1_待翻车数", commonDAO.GetSignalDataValue(machineCode1, "待翻车数"), eHtmlDataItemType.key_value)); datas.Add(new HtmlDataItem("翻车机1_已翻车数", commonDAO.GetSignalDataValue(machineCode1, "已翻车数"), eHtmlDataItemType.key_value)); string trainWeightRecord1 = commonDAO.GetSignalDataValue(machineCode1, "当前车Id"); // 此处 当前车Id 的值为火车入厂记录Id if (!string.IsNullOrEmpty(trainWeightRecord1)) { DataTable dtl = monitorDAO.GetInFactoryBatchInfoByTrainWeightRecordId(trainWeightRecord1); if (dtl.Rows.Count > 0) { datas.Add(new HtmlDataItem("翻车机1_供应商", dtl.Rows[0]["SupplierName"].ToString(), eHtmlDataItemType.key_value)); datas.Add(new HtmlDataItem("翻车机1_发站", dtl.Rows[0]["StationName"].ToString(), eHtmlDataItemType.key_value)); datas.Add(new HtmlDataItem("翻车机1_矿点", dtl.Rows[0]["MineName"].ToString(), eHtmlDataItemType.key_value)); datas.Add(new HtmlDataItem("翻车机1_煤种", dtl.Rows[0]["FuelName"].ToString(), eHtmlDataItemType.key_value)); } } datas.Add(new HtmlDataItem("翻车机2_正翻", commonDAO.GetSignalDataValue(machineCode2, "正翻"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("翻车机2_反翻", commonDAO.GetSignalDataValue(machineCode2, "反翻"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("翻车机2_重调原位", commonDAO.GetSignalDataValue(machineCode2, "重调原位"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("翻车机2_正翻效果", commonDAO.GetSignalDataValue(machineCode1, "正翻"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("翻车机2_反翻效果", commonDAO.GetSignalDataValue(machineCode1, "反翻"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("翻车机2_转盘信号", commonDAO.GetSignalDataValue(machineCode2, "转盘信号"), eHtmlDataItemType.json_data)); datas.Add(new HtmlDataItem("翻车机2_当前翻车车号", commonDAO.GetSignalDataValue(machineCode2, eSignalDataName.当前车号.ToString()), eHtmlDataItemType.key_value)); datas.Add(new HtmlDataItem("翻车机2_待翻车数", commonDAO.GetSignalDataValue(machineCode2, "待翻车数"), eHtmlDataItemType.key_value)); datas.Add(new HtmlDataItem("翻车机2_已翻车数", commonDAO.GetSignalDataValue(machineCode2, "已翻车数"), eHtmlDataItemType.key_value)); string trainWeightRecord2 = commonDAO.GetSignalDataValue(machineCode2, "当前车Id"); // 此处 当前车Id 的值为火车入厂记录Id if (!string.IsNullOrEmpty(trainWeightRecord2)) { DataTable dtl = monitorDAO.GetInFactoryBatchInfoByTrainWeightRecordId(trainWeightRecord2); if (dtl.Rows.Count > 0) { datas.Add(new HtmlDataItem("翻车机2_供应商", dtl.Rows[0]["SupplierName"].ToString(), eHtmlDataItemType.key_value)); datas.Add(new HtmlDataItem("翻车机2_发站", dtl.Rows[0]["StationName"].ToString(), eHtmlDataItemType.key_value)); datas.Add(new HtmlDataItem("翻车机2_矿点", dtl.Rows[0]["MineName"].ToString(), eHtmlDataItemType.key_value)); datas.Add(new HtmlDataItem("翻车机2_煤种", dtl.Rows[0]["FuelName"].ToString(), eHtmlDataItemType.key_value)); } } // 发送到页面 cefWebBrowser.Browser.GetMainFrame().ExecuteJavaScript("requestData(" + Newtonsoft.Json.JsonConvert.SerializeObject(datas) + ");", "", 0); #endregion }
/// <summary> /// 执行所有任务 /// </summary> void ExecuteAllTask() { #region #3汽车机械采样机 EquCarJXSamplerDAO carJXSamplerDAO3 = new EquCarJXSamplerDAO(GlobalVars.MachineCode_QCJXCYJ_3, new DapperDber.Dbs.SqlServerDb.SqlServerDapperDber(CommonDAO.GetInstance().GetCommonAppletConfigString("#3汽车机械采样机接口连接字符串"))); taskSimpleScheduler.StartNewTask("#3汽车机械采样机-快速同步", () => { carJXSamplerDAO3.SyncBarrel(this.rTxtOutputer.Output); carJXSamplerDAO3.SyncSampleCmd(this.rTxtOutputer.Output); //carJXSamplerDAO3.SyncJXCYControlUnloadCMD(this.rTxtOutputer.Output); carJXSamplerDAO3.SyncUnloadResult(this.rTxtOutputer.Output); carJXSamplerDAO3.SyncQCJXCYJError(this.rTxtOutputer.Output); carJXSamplerDAO3.SyncSignal(this.rTxtOutputer.Output); }, 2000, OutputError); this.taskSimpleScheduler.StartNewTask("#3汽车机械采样机-上位机心跳", () => { carJXSamplerDAO3.SyncHeartbeatSignal(); }, 30000, OutputError); #endregion #region #4汽车机械采样机 EquCarJXSamplerDAO carJXSamplerDAO4 = new EquCarJXSamplerDAO(GlobalVars.MachineCode_QCJXCYJ_4, new DapperDber.Dbs.SqlServerDb.SqlServerDapperDber(CommonDAO.GetInstance().GetCommonAppletConfigString("#4汽车机械采样机接口连接字符串"))); taskSimpleScheduler.StartNewTask("#4汽车机械采样机-快速同步", () => { carJXSamplerDAO4.SyncBarrel(this.rTxtOutputer.Output); carJXSamplerDAO4.SyncSampleCmd(this.rTxtOutputer.Output); //carJXSamplerDAO3.SyncJXCYControlUnloadCMD(this.rTxtOutputer.Output); carJXSamplerDAO4.SyncUnloadResult(this.rTxtOutputer.Output); carJXSamplerDAO4.SyncQCJXCYJError(this.rTxtOutputer.Output); carJXSamplerDAO4.SyncSignal(this.rTxtOutputer.Output); }, 2000, OutputError); this.taskSimpleScheduler.StartNewTask("#4汽车机械采样机-上位机心跳", () => { carJXSamplerDAO4.SyncHeartbeatSignal(); }, 30000, OutputError); #endregion #region #5汽车机械采样机 EquCarJXSamplerDAO carJXSamplerDAO5 = new EquCarJXSamplerDAO(GlobalVars.MachineCode_QCJXCYJ_5, new DapperDber.Dbs.SqlServerDb.SqlServerDapperDber(CommonDAO.GetInstance().GetCommonAppletConfigString("#5汽车机械采样机接口连接字符串"))); taskSimpleScheduler.StartNewTask("#5汽车机械采样机-快速同步", () => { carJXSamplerDAO5.SyncBarrel(this.rTxtOutputer.Output); carJXSamplerDAO5.SyncSampleCmd(this.rTxtOutputer.Output); //carJXSamplerDAO1.SyncJXCYControlUnloadCMD(this.rTxtOutputer.Output); carJXSamplerDAO5.SyncUnloadResult(this.rTxtOutputer.Output); carJXSamplerDAO5.SyncQCJXCYJError(this.rTxtOutputer.Output); carJXSamplerDAO5.SyncSignal(this.rTxtOutputer.Output); }, 2000, OutputError); this.taskSimpleScheduler.StartNewTask("#5汽车机械采样机-上位机心跳", () => { carJXSamplerDAO5.SyncHeartbeatSignal(); }, 30000, OutputError); #endregion }
private void Creatadatas(CommonDAO commonDAO, string machineCode, List <HtmlDataItem> datas) { #region 全自动制样机 //制样信息 string value = ""; datas.Add(new HtmlDataItem(machineCode + "Z型提升机", GetColor(commonDAO.GetSignalDataValue(machineCode, "Z型提升机")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "三毫米清洗样给料机", GetColor(commonDAO.GetSignalDataValue(machineCode, "三毫米清洗样给料机")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "三毫米分析样给料机", GetColor(commonDAO.GetSignalDataValue(machineCode, "三毫米分析样给料机")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "真空上料机", GetColor(commonDAO.GetSignalDataValue(machineCode, "真空上料机")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "零毫米存查样给料机", GetColor(commonDAO.GetSignalDataValue(machineCode, "零毫米存查样给料机")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "零毫米分析样给料机", GetColor(commonDAO.GetSignalDataValue(machineCode, "零毫米分析样给料机")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "0.2毫米存查样瓶", GetColor(commonDAO.GetSignalDataValue(machineCode, "零毫米存查样给料机")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "0.2毫米分析样瓶", GetColor(commonDAO.GetSignalDataValue(machineCode, "零毫米分析样给料机")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "6毫米分析样瓶", GetColor(commonDAO.GetSignalDataValue(machineCode, "六毫米圆盘缩分器")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "3毫米存查样瓶", GetColor(commonDAO.GetSignalDataValue(machineCode, "三毫米圆盘缩分器")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "一号桶", GetColor(commonDAO.GetSignalDataValue(machineCode, "一号桶")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "二号桶", GetColor(commonDAO.GetSignalDataValue(machineCode, "二号桶")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "三号桶", GetColor(commonDAO.GetSignalDataValue(machineCode, "三号桶")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "四号桶", GetColor(commonDAO.GetSignalDataValue(machineCode, "四号桶")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "五号桶", GetColor(commonDAO.GetSignalDataValue(machineCode, "五号桶")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "六号桶", GetColor(commonDAO.GetSignalDataValue(machineCode, "六号桶")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "七号桶", GetColor(commonDAO.GetSignalDataValue(machineCode, "七号桶")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "八号桶", GetColor(commonDAO.GetSignalDataValue(machineCode, "八号桶")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "入料斗", GetColor(commonDAO.GetSignalDataValue(machineCode, "入料斗")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "烘干机A", GetColor(commonDAO.GetSignalDataValue(machineCode, "烘干机A")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "烘干机B", GetColor(commonDAO.GetSignalDataValue(machineCode, "烘干机B")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "烘干机C", GetColor(commonDAO.GetSignalDataValue(machineCode, "烘干机C")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "提升斗", GetColor(commonDAO.GetSignalDataValue(machineCode, "提升斗")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "三毫米存查样输送皮带stroke", GetColor(commonDAO.GetSignalDataValue(machineCode, "三毫米存查样输送皮带")), eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem(machineCode + "弃料皮带stroke", GetColor(commonDAO.GetSignalDataValue(machineCode, "弃料皮带")), eHtmlDataItemType.svg_color)); var up = commonDAO.GetSignalDataValue(machineCode, "上料提升机上升"); var down = commonDAO.GetSignalDataValue(machineCode, "上料提升机下降"); datas.Add(new HtmlDataItem(machineCode + "上料提升机上升", ConvertBoolean(up), eHtmlDataItemType.svg_visible)); datas.Add(new HtmlDataItem(machineCode + "上料提升机下降", ConvertBoolean(down), eHtmlDataItemType.svg_visible)); datas.Add(new HtmlDataItem(machineCode + "上料提升机", up == "1" || down == "1" ? GetColor("1") : GetColor("0"), eHtmlDataItemType.svg_color)); value = commonDAO.GetSignalDataValue(machineCode, eSignalDataName.设备状态.ToString()); if (value.Contains("运行")) { datas.Add(new HtmlDataItem(machineCode + "制样机_系统", ColorTranslator.ToHtml(EquipmentStatusColors.Working), eHtmlDataItemType.svg_color)); } else if (value.Contains("就绪")) { datas.Add(new HtmlDataItem(machineCode + "制样机_系统", ColorTranslator.ToHtml(EquipmentStatusColors.BeReady), eHtmlDataItemType.svg_color)); } else if (value.Contains("故障")) { datas.Add(new HtmlDataItem(machineCode + "制样机_系统", ColorTranslator.ToHtml(EquipmentStatusColors.Breakdown), eHtmlDataItemType.svg_color)); } else { datas.Add(new HtmlDataItem(machineCode + "制样机_系统", ColorTranslator.ToHtml(EquipmentStatusColors.Forbidden), eHtmlDataItemType.svg_color)); } //信号状态 string keys = string.Empty; foreach (string item in strSignal) { var scrollvalue = commonDAO.GetSignalDataValue(machineCode, item); if (scrollvalue == "运行" || scrollvalue == "1") { keys += item; } } datas.Add(new HtmlDataItem(machineCode + "Keys", keys, eHtmlDataItemType.svg_scroll)); #endregion }
/// <summary> /// 请求数据 /// </summary> void RequestData() { CommonDAO commonDAO = CommonDAO.GetInstance(); AutoMakerDAO automakerDAO = AutoMakerDAO.GetInstance(); string value = string.Empty, machineCode = string.Empty; List <HtmlDataItem> datas = new List <HtmlDataItem>(); List <InfEquInfHitch> equInfHitchs = new List <InfEquInfHitch>(); #region 智能存样柜 # datas.Clear(); GetBoxDatas(commonDAO, GlobalVars.MachineCode_CYG1, datas); GetBoxDatas(commonDAO, GlobalVars.MachineCode_CYG2, datas); machineCode = GlobalVars.MachineCode_QD; //datas.Add(new HtmlDataItem("Keys", commonDAO.GetSignalDataValue(machineCode, "风机") == "1" ? "气动传输_风机" : "", eHtmlDataItemType.svg_scroll3)); value = commonDAO.GetSignalDataValue(machineCode, eSignalDataName.序状态.ToString()); if ("|就绪待机|".Contains("|" + value + "|")) { datas.Add(new HtmlDataItem("气动传输_系统", "#00c000", eHtmlDataItemType.svg_color)); } else if ("|正在运行|正在卸样|".Contains("|" + value + "|")) { datas.Add(new HtmlDataItem("气动传输_系统", "#ff0000", eHtmlDataItemType.svg_color)); } else if ("|发生故障|".Contains("|" + value + "|")) { datas.Add(new HtmlDataItem("气动传输_系统", "#ffff00", eHtmlDataItemType.svg_color)); } else { datas.Add(new HtmlDataItem("气动传输_系统", "#c0c0c0", eHtmlDataItemType.svg_color)); } //信号状态 string keys = ""; if (commonDAO.GetSignalDataValue(machineCode, "风机运转") == "1") { keys += "风机正转"; } datas.Add(new HtmlDataItem(machineCode + "Keys", keys, eHtmlDataItemType.svg_scroll)); datas.Add(new HtmlDataItem("1#换向器_位置1", commonDAO.GetSignalDataValue(machineCode, "1#换向器_位置1") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("1#换向器_位置2", commonDAO.GetSignalDataValue(machineCode, "1#换向器_位置2") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("1#换向器_位置3", commonDAO.GetSignalDataValue(machineCode, "1#换向器_位置3") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("1#换向器_位置4", commonDAO.GetSignalDataValue(machineCode, "1#换向器_位置4") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("3#换向器_位置1", commonDAO.GetSignalDataValue(machineCode, "3#换向器_位置1") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("3#换向器_位置2", commonDAO.GetSignalDataValue(machineCode, "3#换向器_位置2") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("3#换向器_位置3", commonDAO.GetSignalDataValue(machineCode, "3#换向器_位置3") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("3#换向器_位置4", commonDAO.GetSignalDataValue(machineCode, "3#换向器_位置4") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("6#换向器_位置1", commonDAO.GetSignalDataValue(machineCode, "6#换向器_位置1") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("6#换向器_位置2", commonDAO.GetSignalDataValue(machineCode, "6#换向器_位置2") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜1换向器_位置1", commonDAO.GetSignalDataValue(machineCode, "存样柜1换向器_位置1") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜1换向器_位置2", commonDAO.GetSignalDataValue(machineCode, "存样柜1换向器_位置2") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜1换向器_位置3", commonDAO.GetSignalDataValue(machineCode, "存样柜1换向器_位置3") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜1换向器_位置4", commonDAO.GetSignalDataValue(machineCode, "存样柜1换向器_位置4") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜2换向器_位置1", commonDAO.GetSignalDataValue(machineCode, "存样柜2换向器_位置1") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜2换向器_位置2", commonDAO.GetSignalDataValue(machineCode, "存样柜2换向器_位置2") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜2换向器_位置3", commonDAO.GetSignalDataValue(machineCode, "存样柜2换向器_位置3") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜2换向器_位置4", commonDAO.GetSignalDataValue(machineCode, "存样柜2换向器_位置4") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("1换向器_样瓶检测1", commonDAO.GetSignalDataValue(machineCode, "1#换向器_样瓶检测1") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("1换向器_样瓶检测2", commonDAO.GetSignalDataValue(machineCode, "1#换向器_样瓶检测2") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("1换向器_样瓶检测3", commonDAO.GetSignalDataValue(machineCode, "1#换向器_样瓶检测3") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("1换向器_样瓶检测4", commonDAO.GetSignalDataValue(machineCode, "1#换向器_样瓶检测4") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("3换向器_样瓶检测1", commonDAO.GetSignalDataValue(machineCode, "3#换向器_样瓶检测1") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("3换向器_样瓶检测2", commonDAO.GetSignalDataValue(machineCode, "3#换向器_样瓶检测2") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("3换向器_样瓶检测3", commonDAO.GetSignalDataValue(machineCode, "3#换向器_样瓶检测3") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("3换向器_样瓶检测4", commonDAO.GetSignalDataValue(machineCode, "3#换向器_样瓶检测4") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("6换向器_样瓶检测1", commonDAO.GetSignalDataValue(machineCode, "6#换向器_样瓶检测1") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("6换向器_样瓶检测2", commonDAO.GetSignalDataValue(machineCode, "6#换向器_样瓶检测2") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜1换向器_样瓶检测1", commonDAO.GetSignalDataValue(machineCode, "存样柜1换向器_样瓶检测1") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜1换向器_样瓶检测2", commonDAO.GetSignalDataValue(machineCode, "存样柜1换向器_样瓶检测2") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜1换向器_样瓶检测3", commonDAO.GetSignalDataValue(machineCode, "存样柜1换向器_样瓶检测3") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜1换向器_样瓶检测4", commonDAO.GetSignalDataValue(machineCode, "存样柜1换向器_样瓶检测4") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜2换向器_样瓶检测1", commonDAO.GetSignalDataValue(machineCode, "存样柜2换向器_样瓶检测1") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜2换向器_样瓶检测2", commonDAO.GetSignalDataValue(machineCode, "存样柜2换向器_样瓶检测2") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜2换向器_样瓶检测3", commonDAO.GetSignalDataValue(machineCode, "存样柜2换向器_样瓶检测3") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜2换向器_样瓶检测4", commonDAO.GetSignalDataValue(machineCode, "存样柜2换向器_样瓶检测4") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("1发送站1_样瓶检测", commonDAO.GetSignalDataValue(machineCode, "1#发送站1_样瓶检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("1发送站1_管道物料检测", commonDAO.GetSignalDataValue(machineCode, "1#发送站1_管道物料检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("1发送站2_样瓶检测", commonDAO.GetSignalDataValue(machineCode, "1#发送站2_样瓶检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("1发送站2_管道物料检测", commonDAO.GetSignalDataValue(machineCode, "1#发送站2_管道物料检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("3发送站1_样瓶检测", commonDAO.GetSignalDataValue(machineCode, "3#发送站1_样瓶检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("3发送站1_管道物料检测", commonDAO.GetSignalDataValue(machineCode, "3#发送站1_管道物料检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("3发送站2_样瓶检测", commonDAO.GetSignalDataValue(machineCode, "3#发送站2_样瓶检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("3发送站2_管道物料检测", commonDAO.GetSignalDataValue(machineCode, "3#发送站2_管道物料检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("6发送站1_样瓶检测", commonDAO.GetSignalDataValue(machineCode, "6#发送站1_样瓶检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("6发送站1_管道物料检测", commonDAO.GetSignalDataValue(machineCode, "6#发送站1_管道物料检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("6发送站2_样瓶检测", commonDAO.GetSignalDataValue(machineCode, "6#发送站2_样瓶检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("6发送站2_管道物料检测", commonDAO.GetSignalDataValue(machineCode, "6#发送站2_管道物料检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("化验室接收站_样瓶检测", commonDAO.GetSignalDataValue(machineCode, "化验室接收站_样瓶检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("人工收发站_管道物料检测", commonDAO.GetSignalDataValue(machineCode, "制样人工收发站_管道物料检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("人工收发站_样瓶检测", commonDAO.GetSignalDataValue(machineCode, "制样人工收发站_样瓶检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜1收发站_管道物料检测", commonDAO.GetSignalDataValue(machineCode, "存样柜1收发站_管道物料检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜1收发站_样瓶检测", commonDAO.GetSignalDataValue(machineCode, "存样柜1收发站_样瓶检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜2收发站_管道物料检测", commonDAO.GetSignalDataValue(machineCode, "存样柜2收发站_管道物料检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); datas.Add(new HtmlDataItem("存样柜2收发站_样瓶检测", commonDAO.GetSignalDataValue(machineCode, "存样柜2收发站_样瓶检测") == "1" ? "#ee4036" : "#ffffff", eHtmlDataItemType.svg_color)); // 发送到页面 cefWebBrowser.Browser.GetMainFrame().ExecuteJavaScript("requestData(" + Newtonsoft.Json.JsonConvert.SerializeObject(datas) + ");", "", 0); //出样信息 //List<InfCYGControlCMDDetail> listMakerRecord = automakerDAO.GetCYGControlCMDDetailByTime(DateTime.Now); //cefWebBrowser.Browser.GetMainFrame().ExecuteJavaScript("LoadSampleInfo(" + Newtonsoft.Json.JsonConvert.SerializeObject(listMakerRecord.Select(a => new { UpdateTime = a.UpdateTime.Year < 2000 ? "" : a.UpdateTime.ToString("yyyy-MM-dd HH:mm"), Code = a.MakeCode, SamType = a. == null ? "" : a.SamType, Status = a.Status == null ? "" : a.Status })) + ");", "", 0); #endregion }
/// <summary> /// 绑定集样罐信息 /// </summary> /// <param name="superGridControl"></param> /// <param name="machineCode">设备编码</param> private void BindBeltSampleBarrel(SuperGridControl superGridControl, string machineCode) { IList <InfEquInfSampleBarrel> list = CommonDAO.GetInstance().GetEquInfSampleBarrels(machineCode); superGridControl.PrimaryGrid.DataSource = list; }
protected override bool Execute(string name, CefV8Value obj, CefV8Value[] arguments, out CefV8Value returnValue, out string exception) { exception = null; returnValue = null; string paramSampler = arguments[0].GetStringValue(); switch (name) { // 急停 case "Stop": commonDAO.SendAppRemoteControlCmd(MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(arguments[0].GetStringValue()), "急停", "1"); CefProcessMessage cefMsg1 = CefProcessMessage.Create("SaveOperationLog"); cefMsg1.Arguments.SetSize(0); cefMsg1.Arguments.SetString(0, "设置" + MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(arguments[0].GetStringValue()) + "急停"); CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg1); break; // 复位 case "Reset": commonDAO.SendAppRemoteControlCmd(MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(arguments[0].GetStringValue()), "急停", "0"); CefProcessMessage cefMsg2 = CefProcessMessage.Create("SaveOperationLog"); cefMsg2.Arguments.SetSize(0); cefMsg2.Arguments.SetString(0, "设置" + MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(arguments[0].GetStringValue()) + "急停复位"); CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg2); break; // 制样急停 case "ZYStop": commonDAO.SendAppRemoteControlCmd(MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(arguments[0].GetStringValue()), "制样急停", "1"); CefProcessMessage cefMsg3 = CefProcessMessage.Create("SaveOperationLog"); cefMsg3.Arguments.SetSize(0); cefMsg3.Arguments.SetString(0, "设置" + MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(arguments[0].GetStringValue()) + "制样急停"); CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg3); break; // 制样复位 case "ZYReset": commonDAO.SendAppRemoteControlCmd(MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(arguments[0].GetStringValue()), "制样急停", "0"); CefProcessMessage cefMsg4 = CefProcessMessage.Create("SaveOperationLog"); cefMsg4.Arguments.SetSize(0); cefMsg4.Arguments.SetString(0, "设置" + MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(arguments[0].GetStringValue()) + "制样急停复位"); CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg4); break; // 车辆信息 case "CarInfo": if (paramSampler == "#1") { MessageBox.Show("#1 CarInfo"); } else if (paramSampler == "#2") { MessageBox.Show("#2 CarInfo"); } break; // 故障复位 case "ErrorReset": if (paramSampler == "#1") { MessageBox.Show("#1 ErrorReset"); } else if (paramSampler == "#2") { MessageBox.Show("#2 ErrorReset"); } break; // 采样历史记录 case "SampleHistory": if (paramSampler == "#1") { MessageBox.Show("#1 SampleHistory"); } else if (paramSampler == "#2") { MessageBox.Show("#2 SampleHistory"); } break; //获取异常信息 case "GetHitchs": //异常信息 string machineCode = string.Empty; if (paramSampler == "#1") { machineCode = GlobalVars.MachineCode_QCJXCYJ_1; } else if (paramSampler == "#2") { machineCode = GlobalVars.MachineCode_QCJXCYJ_2; } equInfHitchs = CommonDAO.GetInstance().GetEquInfHitchsByTime(machineCode, DateTime.Now); returnValue = CefV8Value.CreateString(Newtonsoft.Json.JsonConvert.SerializeObject(equInfHitchs.Select(a => new { MachineCode = a.MachineCode, HitchTime = a.HitchTime.ToString("yyyy-MM-dd HH:mm"), HitchDescribe = a.HitchDescribe }))); break; case "ChangeSelected": CefProcessMessage cefMsg = CefProcessMessage.Create("CarSamplerChangeSelected"); cefMsg.Arguments.SetSize(0); cefMsg.Arguments.SetString(0, paramSampler); CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg); break; // 打开实时视频预览 case "OpenHikVideo": cefMsg = CefProcessMessage.Create("OpenHikVideo"); cefMsg.Arguments.SetSize(0); cefMsg.Arguments.SetString(0, arguments[0].GetStringValue()); CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg); break; default: returnValue = null; break; } return(true); }
/// <summary> /// 同步翻车衡过衡数据 /// </summary> /// <param name="output"></param> /// <returns></returns> public int SyncLwCarsInfo(Action <string, eOutputType> output) { int res = 0; IList <CarInfoMutual> carInfos = DcDbers.GetInstance().TurnCarWeighterMutualDber.Entities <CarInfoMutual>(" where DataFlag=1 and SuttleWeight>0 and CreateDate>=to_date('" + DateTime.Now.Date.AddDays(-2) + "','yyyy/mm/dd HH24:MI:SS')"); foreach (var item in carInfos) { //同步到批次明细 CmcsTransport transport = Dbers.GetInstance().SelfDber.Entity <CmcsTransport>(" where TransportNo=:TransportNo and InfactoryTime>=:InfactoryTime ", new { TransportNo = item.CarNumber, InfactoryTime = DateTime.Now.Date.AddDays(-2) }); if (transport != null && !string.IsNullOrEmpty(transport.InFactoryBatchId)) { if (item.GrossWeight != 0 && transport.GrossQty == 0) { transport.GrossQty = (decimal)item.GrossWeight; } if (item.TareWeight != 0 && transport.SkinQty == 0) { transport.SkinQty = (decimal)item.TareWeight; } if (item.SuttleWeight != 0 && transport.SuttleQty == 0) { transport.SuttleQty = (decimal)item.SuttleWeight; transport.MarginQty = (decimal)(item.SuttleWeight - item.TicketWeight); } transport.MeasureMan = "自动"; transport.IsDeleted = item.CancelSign; transport.ArriveDate = item.WeightDate; transport.TareDate = item.WeightDate.AddMinutes(3).AddSeconds(1.2); transport.TrackCode = item.TurnCarNumber == "#1" ? "#4" : "#2"; if (item.TurnCarNumber == "#1") { CommonDAO.GetInstance().SetSignalDataValue(GlobalVars.MachineCode_TrunOver_1, eSignalDataName.当前车号.ToString(), string.Empty); } else { CommonDAO.GetInstance().SetSignalDataValue(GlobalVars.MachineCode_TrunOver_2, eSignalDataName.当前车号.ToString(), string.Empty); } res += Dbers.GetInstance().SelfDber.Update(transport); //同步到轨道衡数据表 CmcsTrainWeightRecord trainRecord = Dbers.GetInstance().SelfDber.Entity <CmcsTrainWeightRecord>("where TrainNumber=:TrainNumber and ArriveTime>=:ArriveTime", new { TrainNumber = item.CarNumber, ArriveTime = DateTime.Now.Date.AddDays(-2) }); CmcsRCSampling sampling = Dbers.GetInstance().SelfDber.Entity <CmcsRCSampling>("where InFactoryBatchId=:InFactoryBatchId order by SamplingDate", new { InFactoryBatchId = transport.InFactoryBatchId }); if (trainRecord != null) { trainRecord.TrainTipperMachineCode = item.TurnCarNumber; trainRecord.FuelKind = transport.TheBatch.FuelKindName; trainRecord.MineName = sampling != null ? sampling.SampleCode : ""; trainRecord.SupplierName = ""; trainRecord.StationName = transport.TheBatch.TheStation.Name; trainRecord.SerialNumber = item.RecordId; trainRecord.TicketWeight = (decimal)item.TicketWeight; trainRecord.GrossTime = item.WeightDate; trainRecord.GrossWeight = (decimal)item.GrossWeight; trainRecord.SkinTime = item.WeightDate.AddMinutes(3).AddSeconds(1.2); trainRecord.SkinWeight = (decimal)item.TareWeight; trainRecord.StandardWeight = (decimal)item.SuttleWeight; trainRecord.MarginWeight = trainRecord.StandardWeight - trainRecord.TicketWeight - trainRecord.DeductWeight; trainRecord.MesureMan = "自动"; trainRecord.TrainTipperMachineCode = item.TurnCarNumber; trainRecord.MachineCode = item.TurnCarNumber == "#1" ? "#4" : "#2"; trainRecord.IsTurnover = "已翻"; trainRecord.UnloadTime = item.WeightDate; Dbers.GetInstance().SelfDber.Update(trainRecord); } } item.DataFlag = 2; DcDbers.GetInstance().TurnCarWeighterMutualDber.Update(item); } output(string.Format("同步翻车衡数据 {0} 条(第三方 > 集中管控)", res), eOutputType.Normal); return(res); }
/// <summary> /// 执行所有任务 /// </summary> void ExecuteAllTask() { #region #1汽车机械采样机 taskSimpleScheduler.StartNewTask("#1汽车机械采样机-快速同步", () => { EquCarJXSamplerDAO carJXSamplerDAO1 = new EquCarJXSamplerDAO(GlobalVars.MachineCode_QC_JxSampler_1, new DapperDber.Dbs.SqlServerDb.SqlServerDapperDber(CommonDAO.GetInstance().GetCommonAppletConfigString("#1汽车机械采样机接口连接字符串"))); if (CommonDAO.GetInstance().TestPing(carJXSamplerDAO1.EquDber.Connection.DataSource)) { carJXSamplerDAO1.SyncSignal(this.rTxtOutputer.Output); carJXSamplerDAO1.SyncBarrel(this.rTxtOutputer.Output); carJXSamplerDAO1.SyncSampleCmd(this.rTxtOutputer.Output); carJXSamplerDAO1.SyncJXCYControlUnloadCMD(this.rTxtOutputer.Output); carJXSamplerDAO1.SyncResult(this.rTxtOutputer.Output); carJXSamplerDAO1.SyncQCJXCYJError(this.rTxtOutputer.Output); } else { this.rTxtOutputer.Output(string.Format("{0}网络不通", GlobalVars.MachineCode_QC_JxSampler_1), eOutputType.Warn); } }, 4000, OutputError); #endregion #region #2汽车机械采样机 taskSimpleScheduler.StartNewTask("#2汽车机械采样机-快速同步", () => { EquCarJXSamplerDAO carJXSamplerDAO2 = new EquCarJXSamplerDAO(GlobalVars.MachineCode_QC_JxSampler_2, new DapperDber.Dbs.SqlServerDb.SqlServerDapperDber(CommonDAO.GetInstance().GetCommonAppletConfigString("#2汽车机械采样机接口连接字符串"))); if (CommonDAO.GetInstance().TestPing(carJXSamplerDAO2.EquDber.Connection.DataSource)) { carJXSamplerDAO2.SyncSignal(this.rTxtOutputer.Output); carJXSamplerDAO2.SyncBarrel(this.rTxtOutputer.Output); carJXSamplerDAO2.SyncSampleCmd(this.rTxtOutputer.Output); carJXSamplerDAO2.SyncJXCYControlUnloadCMD(this.rTxtOutputer.Output); carJXSamplerDAO2.SyncResult(this.rTxtOutputer.Output); carJXSamplerDAO2.SyncQCJXCYJError(this.rTxtOutputer.Output); } else { this.rTxtOutputer.Output(string.Format("{0}网络不通", GlobalVars.MachineCode_QC_JxSampler_1), eOutputType.Warn); } }, 4000, OutputError); #endregion }
protected override bool Execute(string name, CefV8Value obj, CefV8Value[] arguments, out CefV8Value returnValue, out string exception) { exception = null; returnValue = null; string paramSampler = arguments[0].GetStringValue(); switch (name) { case "ChangeSelected": CefProcessMessage cefMsg = CefProcessMessage.Create("ChangeSelected"); cefMsg.Arguments.SetSize(0); cefMsg.Arguments.SetString(0, paramSampler); CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg); break; case "ShowYGDetail": int overday = CommonDAO.GetInstance().GetCommonAppletConfigInt32("存样柜超期天数"); IList <RowResult> rowResult = new List <RowResult>(); IList <InfAutoCupBoard> cellList = CommonDAO.GetInstance().SelfDber.Entities <InfAutoCupBoard>(string.Format("where CupBoardCode like '%{0}%' and CupBoardType='{1}' and ParentPKID is not null", paramSampler, arguments[1].GetStringValue())); if (cellList != null && cellList.Count > 0) { int maxRow = cellList.OrderByDescending(a => a.RowNumber).First().RowNumber; int maxCell = cellList.OrderByDescending(a => a.CellNumber).First().CellNumber; for (int i = 1; i <= maxRow; i++) { RowResult rowEntity = new RowResult(); rowEntity.RowName = String.Format("第 {0} 层", i); rowEntity.CellList = new List <CellResult>(); for (int j = 1; j <= maxCell; j++) { CellResult cellEntity = new CellResult(); InfAutoCupBoard sampleCell = cellList.Where(a => a.RowNumber == i && a.CellNumber == j).FirstOrDefault(); if (sampleCell == null) { cellEntity.CellFlag = -1; } else { cellEntity.CellNumber = sampleCell.CupBoardDes.Replace("层", "").Replace("格", "").Remove(0, 2); //柜门标识:-1没这一格,0空柜,1已存放,2超期样,3停用 if (sampleCell.IsValid == "0") { cellEntity.CellFlag = 3; } else if (sampleCell.State == 1 && sampleCell.SaveTime < DateTime.Now.AddDays(-overday)) { cellEntity.CellFlag = 2; } else if (sampleCell.State == 1) { cellEntity.CellFlag = 1; } else { cellEntity.CellFlag = 0; } } rowEntity.CellList.Add(cellEntity); } rowResult.Add(rowEntity); } } returnValue = CefV8Value.CreateString(Newtonsoft.Json.JsonConvert.SerializeObject(rowResult)); break; default: returnValue = null; break; } return(true); }
/// <summary> /// 保存数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSubmit_Click(object sender, EventArgs e) { if (this.EditMode == eEditMode.修改) { CmcsBuyFuelTransport.SerialNumber = txt_SerialNumber.Text; CmcsBuyFuelTransport.CarNumber = txt_CarNumber.Text; if (cmcsSupplier != null) { CmcsBuyFuelTransport.SupplierId = cmcsSupplier.Id; CmcsBuyFuelTransport.SupplierName = cmcsSupplier.Name; } if (cmcsTransportCompany != null) { CmcsBuyFuelTransport.TransportCompanyId = cmcsTransportCompany.Id; CmcsBuyFuelTransport.TransportCompanyName = cmcsTransportCompany.Name; } if (cmcsMine != null) { CmcsBuyFuelTransport.MineId = cmcsMine.Id; CmcsBuyFuelTransport.MineName = cmcsMine.Name; } if (cmcsFuelKind != null) { CmcsBuyFuelTransport.FuelKindId = cmcsFuelKind.Id; CmcsBuyFuelTransport.FuelKindName = cmcsFuelKind.Name; } string logValue = "修改前:" + Environment.NewLine; logValue += "车号:" + CmcsBuyFuelTransport.CarNumber + Environment.NewLine; logValue += "矿点:" + CmcsBuyFuelTransport.MineName + " 煤种:" + CmcsBuyFuelTransport.FuelKindName + Environment.NewLine; logValue += "入厂时间:" + CmcsBuyFuelTransport.InFactoryTime + " 矿发量:" + CmcsBuyFuelTransport.TicketWeight + Environment.NewLine; logValue += "毛重时间:" + CmcsBuyFuelTransport.GrossTime + " 毛重:" + CmcsBuyFuelTransport.GrossWeight + Environment.NewLine; logValue += "皮重时间:" + CmcsBuyFuelTransport.TareTime + " 皮重:" + CmcsBuyFuelTransport.TareWeight + Environment.NewLine; logValue += "扣矸:" + CmcsBuyFuelTransport.KgWeight + " 扣水:" + CmcsBuyFuelTransport.KsWeight + " 自动扣水:" + CmcsBuyFuelTransport.AutoKsWeight + Environment.NewLine; logValue += "出厂时间:" + CmcsBuyFuelTransport.OutFactoryTime + " 验收量:" + CmcsBuyFuelTransport.CheckWeight + Environment.NewLine; CmcsBuyFuelTransport.SamplingType = (string)cmb_SampingType.SelectedItem; CmcsBuyFuelTransport.TicketWeight = (decimal)dbi_TicketWeight.Value; CmcsBuyFuelTransport.GrossWeight = (decimal)dbi_GrossWeight.Value; CmcsBuyFuelTransport.TareWeight = (decimal)dbi_TareWeight.Value; CmcsBuyFuelTransport.KgWeight = (decimal)dbi_KgWeight.Value; CmcsBuyFuelTransport.KsWeight = (decimal)dbi_KsWeight.Value; CmcsBuyFuelTransport.Remark = txt_Remark.Text; CmcsBuyFuelTransport.IsFinish = (chb_IsFinish.Checked ? 1 : 0); CmcsBuyFuelTransport.IsUse = (chb_IsUse.Checked ? 1 : 0); // 生成批次以及采制化三级编码数据 CmcsInFactoryBatch inFactoryBatch = carTransportDAO.GCQCInFactoryBatchByBuyFuelTransport(CmcsBuyFuelTransport); WeighterDAO.GetInstance().SaveBuyFuelTransportHand(CmcsBuyFuelTransport); logValue += "修改后:" + Environment.NewLine; logValue += "车号:" + CmcsBuyFuelTransport.CarNumber + Environment.NewLine; logValue += "矿点:" + CmcsBuyFuelTransport.MineName + " 煤种:" + CmcsBuyFuelTransport.FuelKindName + Environment.NewLine; logValue += "入厂时间:" + CmcsBuyFuelTransport.InFactoryTime + " 矿发量:" + CmcsBuyFuelTransport.TicketWeight + Environment.NewLine; logValue += "毛重时间:" + CmcsBuyFuelTransport.GrossTime + " 毛重:" + CmcsBuyFuelTransport.GrossWeight + Environment.NewLine; logValue += "皮重时间:" + CmcsBuyFuelTransport.TareTime + " 皮重:" + CmcsBuyFuelTransport.TareWeight + Environment.NewLine; logValue += "扣矸:" + CmcsBuyFuelTransport.KgWeight + " 扣水:" + CmcsBuyFuelTransport.KsWeight + " 自动扣水:" + CmcsBuyFuelTransport.AutoKsWeight + Environment.NewLine; logValue += "出厂时间:" + CmcsBuyFuelTransport.OutFactoryTime + " 验收量:" + CmcsBuyFuelTransport.CheckWeight + Environment.NewLine; logValue += "修改人:" + SelfVars.LoginUser.UserName; CommonDAO.GetInstance().SaveAppletLog(eAppletLogLevel.Info, "修改运输记录", logValue, SelfVars.LoginUser.UserAccount); } this.DialogResult = DialogResult.OK; this.Close(); }
/// <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 }
/// <summary> /// 车辆数据处理_1号车号识别 /// </summary> /// <param name="carSpotsNum">车辆识别器编号</param> /// <returns></returns> public int CarSpotsHandle1(Action <string, eOutputType> output, int carSpotsNum) { lock (LockObject) { int res = 0; IList <CmcsTrainRecognition_01> cardata = Dbers.GetInstance().SelfDber.Entities <CmcsTrainRecognition_01>(" where MachineCode like '%" + carSpotsNum + "%' and CrossTime>=to_date('" + DateTime.Now.Date.AddDays(-1) + "','yyyy/mm/dd HH24:MI:SS') and DataFlag=0 and carnumber<>'*' order by CrossTime asc,OrderNum asc"); bool flag = false; foreach (var item in cardata) { if (item.Direction == "进") { CmcsTrainWeightRecord transportOver = Dbers.GetInstance().SelfDber.Entity <CmcsTrainWeightRecord>(" where TrainNumber='" + item.CarNumber + "' and IsTurnover='已翻' and ArriveTime>=to_date('" + DateTime.Now.Date.AddDays(-2) + "','yyyy/mm/dd HH24:MI:SS')"); CmcsTrainWeightRecord transport = Dbers.GetInstance().SelfDber.Entity <CmcsTrainWeightRecord>(" where TrainNumber='" + item.CarNumber + "' and IsTurnover='未翻' and ArriveTime>=to_date('" + DateTime.Now.Date.AddDays(-2) + "','yyyy/mm/dd HH24:MI:SS')"); if (transport == null) { // 此判断是过滤车辆出厂后立马进厂合并不同轨道车辆的情况,时间相差几分钟 if (transportOver != null) { //flag = true; } else { Dbers.GetInstance().SelfDber.Insert(new CmcsTrainWeightRecord() { PKID = item.Id, TrainNumber = item.CarNumber, ArriveTime = item.CrossTime, TrainType = item.CarModel.Trim().TrimStart('T'), IsTurnover = "未翻", MachineCode = "1", DataFlag = 0, TicketWeight = (decimal)CommonDAO.GetInstance().GetTrainRateLoadByTrainType(item.CarModel.Trim().TrimStart('T')), OrderNumber = item.OrderNum, GrossTime = item.CrossTime, SkinTime = item.CrossTime, LeaveTime = item.CrossTime, UnloadTime = item.CrossTime, }); } } CmcsTrainCarriagePass transportPass = Dbers.GetInstance().SelfDber.Entity <CmcsTrainCarriagePass>("where TrainNumber='" + item.CarNumber + "' and PassTime>=to_date('" + DateTime.Now.Date.AddDays(-1) + "','yyyy/mm/dd HH24:MI:SS') order by PassTime desc"); if (transportPass == null) { transportPass = new CmcsTrainCarriagePass(); transportPass.TrainNumber = item.CarNumber; transportPass.CarModel = item.CarModel.Trim().TrimStart('T'); transportPass.MachineCode = "1"; transportPass.PassTime = item.CrossTime; transportPass.Direction = "进厂"; transportPass.OrderNum = item.OrderNum; transportPass.DataFlag = 0; transportPass.PKID = item.Id; Dbers.GetInstance().SelfDber.Insert(transportPass); } // 插入定位信息 if (InsertTransportPosition("入厂", item.CarNumber)) { output(string.Format("入厂轨道插入定位信息;{0}车号识别 车号:{1}", item.MachineCode, item.CarNumber), eOutputType.Normal); } flag = true; } else if (item.Direction == "出") { CmcsTrainWeightRecord trainRecord = Dbers.GetInstance().SelfDber.Entity <CmcsTrainWeightRecord>("where TrainNumber=:TrainNumber order by ArriveTime desc", new { TrainNumber = item.CarNumber }); if (trainRecord != null) { trainRecord.LeaveTime = item.CrossTime; Dbers.GetInstance().SelfDber.Update(trainRecord); CmcsTransport transport = Dbers.GetInstance().SelfDber.Entity <CmcsTransport>("where PKID=:PKID order by InfactoryTime desc", new { PKID = item.Id }); if (transport != null) { transport.OutfactoryTime = item.CrossTime; Dbers.GetInstance().SelfDber.Update(transport); } } //移除定位信息 RemoveTransportPosition(item.CarNumber); flag = true; } if (flag) { //item.DataFlag = 1; Dbers.GetInstance().SelfDber.Execute(" update Cmcstbtrainrecognition_01 set DataFlag=1 where Id='" + item.Id + "'"); res++; } } output(string.Format("读取{0}号车号识别数据{1}条", carSpotsNum, res), eOutputType.Normal); return(res); } }
public FrmPrintWeb(CmcsBuyFuelTransport buyfueltransport) { _BuyFuelTransport = CommonDAO.GetInstance().SelfDber.Get <CmcsBuyFuelTransport>(buyfueltransport.Id); InitializeComponent(); }
/// <summary> /// /// </summary> /// <param name="spName"></param> /// <param name="sparams"></param> /// <param name="dbName"></param> /// <returns></returns> public object GetScalarValueBySp(string spName, object[] sparams, string dbName) { _objDAO = new CommonDAO(); return(_objDAO.GetScalarValueBySp(spName, sparams, dbName)); }
/// <summary> /// 生成制样及化验 /// </summary> /// <param name="makeCode"></param> /// <param name="assayType"></param> /// <param name="user"></param> /// <param name="assayTarget"></param> /// <returns></returns> public bool CreateMakeAndAssay(ref string makeCode, string assayType, string user, string assayTarget) { bool isSuccess = false; CmcsRCMake make = Dbers.GetInstance().SelfDber.Entity <CmcsRCMake>("where MakeCode=:MakeCode order by CreateDate desc ", new { MakeCode = makeCode }); if (make != null) { CmcsRCSampling rCSampling = Dbers.GetInstance().SelfDber.Get <CmcsRCSampling>(make.SamplingId); if (rCSampling != null) { // 入厂煤制样 CmcsRCMake rCMake = new CmcsRCMake() { SamplingId = rCSampling.Id, MakeStyle = eMakeType.机器制样.ToString(), MakeType = assayType, MakeStartTime = DateTime.Now, MakeEndTime = DateTime.Now, MakeCode = CommonDAO.GetInstance().CreateNewMakeCode(DateTime.Now), MakePle = user, ParentMakeId = make.Id }; isSuccess = Dbers.GetInstance().SelfDber.Insert(rCMake) > 0; makeCode = rCMake.MakeCode; //入厂煤制样明细 foreach (CodeContent item in CommonDAO.GetInstance().GetCodeContentByKind("制样类型")) { CmcsRCMakeDetail rCMakeDetail = Dbers.GetInstance().SelfDber.Entity <CmcsRCMakeDetail>("where MakeId=:MakeId and SampleType=:SampleType", new { MakeId = rCMake.Id, SampleType = item.Content }); if (rCMakeDetail == null) { rCMakeDetail = new CmcsRCMakeDetail(); rCMakeDetail.MakeId = rCMake.Id; rCMakeDetail.BarrelCode = CommonDAO.GetInstance().CreateNewMakeBarrelCodeByMakeCode(rCMake.MakeCode, item.Content); rCMakeDetail.SampleType = item.Content; isSuccess = Dbers.GetInstance().SelfDber.Insert(rCMakeDetail) > 0; } } // 入厂煤化验 CmcsRCAssay rCAssay = Dbers.GetInstance().SelfDber.Entity <CmcsRCAssay>("where MakeId=:MakeId", new { MakeId = rCMake.Id }); if (rCAssay == null) { // 入厂煤煤质 CmcsFuelQuality fuelQuality = new CmcsFuelQuality() { Id = Guid.NewGuid().ToString() }; if (Dbers.GetInstance().SelfDber.Insert(fuelQuality) > 0) { rCAssay = new CmcsRCAssay() { MakeId = rCMake.Id, AssayType = assayType, AssayWay = assayType, AssayCode = CommonDAO.GetInstance().CreateNewAssayCode(rCMake.CreateDate), InFactoryBatchId = rCSampling.InFactoryBatchId, FuelQualityId = fuelQuality.Id, AssayDate = rCMake.CreateDate, WfStatus = 0, AssayPoint = assayTarget }; isSuccess = Dbers.GetInstance().SelfDber.Insert(rCAssay) > 0; } } } } return(isSuccess); }