Example #1
0
        /// <summary>
        /// 同步报文
        /// </summary>
        /// <param name="output"></param>
        /// <returns></returns>
        public List <CmcsTrainCarriagePass> GetDBWInfo(Action <string, eOutputType> output)
        {
            List <CmcsTrainCarriagePass> cmcstbtrainrecognition = new List <CmcsTrainCarriagePass>();
            String interface_dbwdest = CommonDAO.GetInstance().GetAppletConfigString("车号识别文件储存位置");
            int    interface_dbwtime = CommonDAO.GetInstance().GetAppletConfigInt32("车号识别文件读取天数");
            int    res = 0;

            if (Directory.Exists(interface_dbwdest))
            {
                String[] dir = Directory.GetFiles(interface_dbwdest);
                foreach (var diritem in dir)
                {
                    ///解析数据
                    if (File.Exists(diritem) && CheckUseFull(diritem).AddDays(interface_dbwtime) >= DateTime.Now.Date)
                    {
                        String Info = File.ReadAllText(diritem);
                        if (Info.StartsWith("D"))
                        {
                            try
                            {
                                //火车方向
                                String fx = Info.Substring(18, 1) == "0" ? "入厂" : "出厂";
                                //到达时间

                                DateTime ddsj = new DateTime(Convert.ToInt32(Info.Substring(34, 4)), Convert.ToInt32(Info.Substring(38, 2)), Convert.ToInt32(Info.Substring(40, 2)), Convert.ToInt32(Info.Substring(42, 2)), Convert.ToInt32(Info.Substring(44, 2)), Convert.ToInt32(Info.Substring(46, 2)));

                                //通过时间
                                DateTime tgsj = new DateTime(Convert.ToInt32(Info.Substring(50, 4)), Convert.ToInt32(Info.Substring(54, 2)), Convert.ToInt32(Info.Substring(56, 2)), Convert.ToInt32(Info.Substring(58, 2)), Convert.ToInt32(Info.Substring(60, 2)), Convert.ToInt32(Info.Substring(62, 2)));

                                //报告时间
                                DateTime bgsj = new DateTime(Convert.ToInt32(Info.Substring(66, 4)), Convert.ToInt32(Info.Substring(70, 2)), Convert.ToInt32(Info.Substring(72, 2)), Convert.ToInt32(Info.Substring(74, 2)), Convert.ToInt32(Info.Substring(76, 2)), Convert.ToInt32(Info.Substring(78, 2)));

                                //车数
                                int countnum = Convert.ToInt32(Info.Substring(82, 3));
                                //车头
                                int ctnum = Convert.ToInt32(Info.Substring(85, 1));
                                //车中
                                int cznum = Convert.ToInt32(Info.Substring(86, 1));
                                //车尾
                                int cwnum = Convert.ToInt32(Info.Substring(87, 1));
                                if ((int)Info.Substring(88 + 24 * countnum, 1).ToCharArray()[0] == 0x04)
                                {
                                    for (int i = 0; i < countnum; i++)
                                    {
                                        String trainnum = Info.Substring(88 + 24 * i, 24);
                                        //车型
                                        String cx = "";
                                        //车号
                                        String ch = "";
                                        //车类型
                                        String clx = "";
                                        if (trainnum.StartsWith("T"))
                                        {
                                            //车型
                                            cx = trainnum.Substring(1, 6).Trim();
                                            //车号
                                            ch  = trainnum.Substring(7, 7);
                                            clx = "车厢";
                                        }
                                        else if (trainnum.StartsWith("J"))
                                        {
                                            //车型
                                            cx = trainnum.Substring(1, 3);
                                            //车号
                                            ch  = trainnum.Substring(4, 4);
                                            clx = "车头";
                                        }
                                        string pkid = ch + "-" + tgsj.ToString("yyyyMMddHHmmss");
                                        if (clx == "车厢")
                                        {
                                            CmcsTrainCarriagePass item = new CmcsTrainCarriagePass
                                            {
                                                OrderNum    = 0,
                                                CarModel    = cx,
                                                TrainNumber = ch,
                                                PassTime    = tgsj,
                                                Speed       = 0,
                                                MachineCode = MachineCode_CHSB
                                            };
                                            cmcstbtrainrecognition.Add(item);
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                output(string.Format("解析 {0} 报文失败,原因:{1}", diritem, ex.Message), eOutputType.Error);
                            }
                        }
                    }
                }
            }
            return(cmcstbtrainrecognition);
        }
        /// <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);
            }
        }
Example #3
0
        void Search(string input)
        {
            List <CmcsTransportCompany> list = CommonDAO.GetInstance().GetTransportCompanyByNameOrChs(input.Trim(), sqlWhere);

            superGridControl1.PrimaryGrid.DataSource = list;
        }
Example #4
0
        /// <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
        }
Example #5
0
        /// <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();
        }
Example #6
0
        /// <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
        }
        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);
        }
Example #8
0
        /// <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);
        }
Example #9
0
        /// <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);
                }
            }
        }
Example #10
0
        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
            }
        }
Example #11
0
        /// <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
        }
Example #12
0
        /// <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);
            }
        }
Example #13
0
        /// <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);
        }
Example #14
0
        /// <summary>
        /// 请求数据
        /// </summary>
        void RequestData()
        {
            string value = string.Empty, machineCode = string.Empty;
            List <HtmlDataItem>   datas        = new List <HtmlDataItem>();
            List <InfEquInfHitch> equInfHitchs = new List <InfEquInfHitch>();

            #region 汽车机械采样机 #1

            datas.Clear();
            machineCode = this.CurrentMachineCode;

            datas.Add(new HtmlDataItem("机械采样机_当前采样机", machineCode, eHtmlDataItemType.svg_text));
            datas.Add(new HtmlDataItem("1号机械采样机_系统", monitorCommon.ConvertMachineStatusToColor(commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QCJXCYJ_1, eSignalDataName.系统.ToString())), eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("2号机械采样机_系统", monitorCommon.ConvertMachineStatusToColor(commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QCJXCYJ_2, eSignalDataName.系统.ToString())), eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("3号机械采样机_系统", monitorCommon.ConvertMachineStatusToColor(commonDAO.GetSignalDataValue(GlobalVars.MachineCode_QCJXCYJ_3, eSignalDataName.系统.ToString())), eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_采样编码", commonDAO.GetSignalDataValue(machineCode, eSignalDataName.采样编码.ToString()), eHtmlDataItemType.svg_text));
            datas.Add(new HtmlDataItem("机械采样机_矿发量", commonDAO.GetSignalDataValue(machineCode, eSignalDataName.矿发量.ToString()), eHtmlDataItemType.svg_text));
            datas.Add(new HtmlDataItem("机械采样机_采样时间", commonDAO.GetSignalDataValue(machineCode, eSignalDataName.采样时间.ToString()), eHtmlDataItemType.svg_text));
            datas.Add(new HtmlDataItem("机械采样机_车牌号", commonDAO.GetSignalDataValue(machineCode, eSignalDataName.当前车号.ToString()), eHtmlDataItemType.svg_text));
            datas.Add(new HtmlDataItem("机械采样机_采样点数", commonDAO.GetSignalDataValue(machineCode, eSignalDataName.采样点数.ToString()), eHtmlDataItemType.svg_text));
            datas.Add(new HtmlDataItem("机械采样机_小车1", commonDAO.GetSignalDataValue(machineCode, "小车") == "1" ? "Red" : "url(#rect1770_1_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_小车2", commonDAO.GetSignalDataValue(machineCode, "小车") == "1" ? "Red" : "url(#rect1752_1_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_小车3", commonDAO.GetSignalDataValue(machineCode, "小车") == "1" ? "Red" : "url(#rect1761_1_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_小车4", commonDAO.GetSignalDataValue(machineCode, "小车") == "1" ? "Red" : "url(#rect1716_1_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_小车5", commonDAO.GetSignalDataValue(machineCode, "小车") == "1" ? "Red" : "url(#rect1725_1_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_小车6", commonDAO.GetSignalDataValue(machineCode, "小车") == "1" ? "Red" : "url(#rect1734_1_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_小车7", commonDAO.GetSignalDataValue(machineCode, "小车") == "1" ? "Red" : "url(#polygon1743_1_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_接料斗1", commonDAO.GetSignalDataValue(machineCode, "接料斗") == "1" ? "Red" : "url(#_164344952_2_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_接料斗2", commonDAO.GetSignalDataValue(machineCode, "接料斗") == "1" ? "Red" : "url(#_130855712_2_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_接料斗3", commonDAO.GetSignalDataValue(machineCode, "接料斗") == "1" ? "Red" : "url(#_164355560_2_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_接料斗4", commonDAO.GetSignalDataValue(machineCode, "接料斗") == "1" ? "Red" : "url(#_164351936_2_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_除铁给料皮带", commonDAO.GetSignalDataValue(machineCode, "给料皮带") == "1" ? "Red" : "#808080", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_溜煤管", commonDAO.GetSignalDataValue(machineCode, "溜煤管") == "1" ? "Red" : "url(#polygon984_1_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_锤式破碎机1", commonDAO.GetSignalDataValue(machineCode, "锤式破碎机") == "1" ? "Red" : "url(#_125277864-0_2_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_锤式破碎机2", commonDAO.GetSignalDataValue(machineCode, "锤式破碎机") == "1" ? "Red" : "url(#_164348960_2_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_锤式破碎机3", commonDAO.GetSignalDataValue(machineCode, "锤式破碎机") == "1" ? "Red" : "url(#_130854176_2_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_锤式破碎机4", commonDAO.GetSignalDataValue(machineCode, "锤式破碎机") == "1" ? "Red" : "url(#_130859336-4_2_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_锤式破碎机5", commonDAO.GetSignalDataValue(machineCode, "锤式破碎机") == "1" ? "Red" : "url(#_164347592_2_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_锤式破碎机6", commonDAO.GetSignalDataValue(machineCode, "锤式破碎机") == "1" ? "Red" : "url(#_164343680_2_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_锤式破碎机7", commonDAO.GetSignalDataValue(machineCode, "锤式破碎机") == "1" ? "Red" : "url(#_164356088_2_)", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_缩分皮带", commonDAO.GetSignalDataValue(machineCode, "缩分皮带") == "1" ? "Red" : "#808080", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("机械采样机_弃料斗", commonDAO.GetSignalDataValue(machineCode, "弃料斗") == "1" ? "Red" : "url(#_164344952-8_1_)", eHtmlDataItemType.svg_color));

            string carNumber                   = commonDAO.GetSignalDataValue(machineCode, "车牌号");
            if (string.IsNullOrEmpty(carNumber))
            {
                datas.Add(new HtmlDataItem("Car1", "false", eHtmlDataItemType.svg_visible));
                this.LastCarNumber = string.Empty;
            }
            else
            {
                if (this.LastCarNumber != carNumber)
                {
                    CmcsAutotruck autotruck = CommonDAO.GetInstance().GetAutotruckByCarNumber(carNumber);
                    if (autotruck != null)
                    {
                        if (PreviewCarCarriage(autotruck))
                        {
                            datas.Add(new HtmlDataItem("Car1", "true", eHtmlDataItemType.svg_visible));
                        }
                        else
                        {
                            datas.Add(new HtmlDataItem("Car1", "false", eHtmlDataItemType.svg_visible));
                        }
                    }
                    else
                    {
                        datas.Add(new HtmlDataItem("Car1", "false", eHtmlDataItemType.svg_visible));
                    }

                    this.LastCarNumber = carNumber;
                }
            }

            // 集样罐
            List <InfEquInfSampleBarrel> barrels1 = MonitorDAO.GetInstance().GetEquInfSampleBarrels(machineCode);
            datas.Add(new HtmlDataItem("采样机1_集样罐", Newtonsoft.Json.JsonConvert.SerializeObject(barrels1.Select(a => new { BarrelNumber = a.BarrelNumber, IsCurrent = a.IsCurrent, BarrelStatus = a.BarrelStatus, SampleCount = a.SampleCount })), eHtmlDataItemType.json_data));
            #endregion

            // 发送到页面
            cefWebBrowser.Browser.GetMainFrame().ExecuteJavaScript("requestData(" + Newtonsoft.Json.JsonConvert.SerializeObject(datas) + ");", "", 0);
        }
Example #15
0
 private void FrmCarSampler_Load(object sender, EventArgs e)
 {
     this.Text = "全自动制样机接口业务";
     equDber   = new SqlServerDapperDber(CommonDAO.GetInstance().GetCommonAppletConfigString("汽车机械采样机接口连接字符串"));
     Bind_SAMPLE_INTERFACE_DATA();
 }
Example #16
0
        /// <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
        }
Example #17
0
        /// <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
        }
Example #18
0
        /// <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
        }
        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;
            }
        }
Example #20
0
        /// <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;
        }
Example #21
0
        /// <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);
        }
Example #22
0
        /// <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);
        }
        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;
            }
        }
Example #24
0
        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);
        }
Example #25
0
        void Search(string input)
        {
            List <CmcsSupplier> list = CommonDAO.GetInstance().GetSupplierByNameOrChs(input.Trim(), sqlWhere);

            superGridControl1.PrimaryGrid.DataSource = list;
        }
        /// <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
        }
Example #27
0
 /// <summary>
 /// 执行所有任务
 /// </summary>
 void ExecuteAllTask()
 {
     #region 封装归批机
     try
     {
         taskSimpleScheduler.StartNewTask("矩阵合样归批机-快速同步", () =>
         {
             EquPackagingBatchDAO batchDAO = new EquPackagingBatchDAO(new DapperDber.Dbs.SqlServerDb.SqlServerDapperDber(CommonDAO.GetInstance().GetCommonAppletConfigString("矩阵合样归批机接口连接字符串")));
             if (CommonDAO.GetInstance().TestPing(batchDAO.EquDber.Connection.DataSource))
             {
                 batchDAO.SyncCmd(this.rTxtOutputer.Output);
                 batchDAO.SyncCoord(this.rTxtOutputer.Output);
                 batchDAO.SyncError(this.rTxtOutputer.Output);
                 batchDAO.SyncSignal(this.rTxtOutputer.Output);
             }
             else
             {
                 this.rTxtOutputer.Output(string.Format("{0}网络不通", batchDAO.MachineCode), eOutputType.Warn);
             }
         }, 5000, OutputError);
     }
     catch (Exception ex)
     {
         OutputError("矩阵合样归批机-快速同步", ex);
     }
     #endregion
 }
Example #28
0
 public FrmPrintWeb(CmcsBuyFuelTransport buyfueltransport)
 {
     _BuyFuelTransport = CommonDAO.GetInstance().SelfDber.Get <CmcsBuyFuelTransport>(buyfueltransport.Id);
     InitializeComponent();
 }
Example #29
0
        /// <summary>
        /// 打印入厂煤磅单
        /// </summary>
        /// <param name="entity"></param>
        public void PrintBuyFuelTransport(CmcsBuyFuelTransport entity)
        {
            #region 备份
            DataTable table = new DataTable();
            table.Columns.Add("SerialNumber", typeof(string));
            table.Columns.Add("TareTime", typeof(string));
            table.Columns.Add("CarNumber", typeof(string));
            table.Columns.Add("FuelKindName", typeof(string));
            table.Columns.Add("SupplierName", typeof(string));
            table.Columns.Add("Remark", typeof(string));
            table.Columns.Add("GrossWeight", typeof(string));
            table.Columns.Add("TareWeight", typeof(string));
            table.Columns.Add("SuttleWeight", typeof(string));
            table.Columns.Add("DeductWeight", typeof(string));
            table.Columns.Add("CreateUser", typeof(string));
            table.Columns.Add("Type", typeof(string));

            table.Rows.Add(entity.SerialNumber, entity.TareTime.ToString("yyyy年MM月dd日 HH:mm:ss"), entity.CarNumber, entity.FuelKindName, entity.SupplierName, "华能渭南",
                           entity.GrossWeight, entity.TareWeight, entity.SuttleWeight, entity.DeductWeight, CommonDAO.GetInstance().GetNameByAccount(entity.CreateUser));

            LocalReport report = new LocalReport();
            //设置需要打印的报表的文件名称。
            report.ReportPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TransportReport.rdlc");

            //创建要打印的数据源
            ReportDataSource source = new ReportDataSource();
            source.Name  = "Transport";
            source.Value = table;

            report.DataSources.Add(source);
            ////刷新报表中的需要呈现的数据
            //report.Refresh();

            PrintDocument(source, report);

            Dispose();

            report.Dispose();

            #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();
            machineCode = GlobalVars.MachineCode_HYGPJ_1;

            ///信号接入
            //datas.Add(new HtmlDataItem("故障提示", commonDAO.GetSignalDataValue(machineCode, "设备状态") == "发生故障" ? "#ff0000" : "#00ff00", eHtmlDataItemType.svg_color));
            //datas.Add(new HtmlDataItem("湿煤破碎电机", commonDAO.GetSignalDataValue(machineCode, "湿煤破碎机") == "1" ? "#00ff00" : "#ff0000", eHtmlDataItemType.svg_color));



            datas.Add(new HtmlDataItem("X轴位置", commonDAO.GetSignalDataValue(machineCode, "当前轴位置"), eHtmlDataItemType.svg_text));
            value = commonDAO.GetSignalDataValue(machineCode, "制样机卸料准备好信号");
            if (value == "1")
            {
                datas.Add(new HtmlDataItem("制样机卸料准备好信号", "制样机卸料准备好", eHtmlDataItemType.svg_text));
                datas.Add(new HtmlDataItem("制样机卸料准备好信号", "#00ff00", eHtmlDataItemType.svg_color));
            }
            else
            {
                datas.Add(new HtmlDataItem("制样机卸料准备好信号", "制样机卸料未准备好", eHtmlDataItemType.svg_text));
                datas.Add(new HtmlDataItem("制样机卸料准备好信号", "#ff0000", eHtmlDataItemType.svg_color));
            }
            value = commonDAO.GetSignalDataValue(machineCode, "系统自动1手动0");
            if (value == "1")
            {
                datas.Add(new HtmlDataItem("本地", "#000000", eHtmlDataItemType.svg_color));
                datas.Add(new HtmlDataItem("自动", "#ff0000", eHtmlDataItemType.svg_color));
            }
            else
            {
                datas.Add(new HtmlDataItem("本地", "#ff0000", eHtmlDataItemType.svg_color));
                datas.Add(new HtmlDataItem("自动", "#000000", eHtmlDataItemType.svg_color));
            }

            value = commonDAO.GetSignalDataValue(machineCode, "归批流程运行中");
            if (value == "1")
            {
                datas.Add(new HtmlDataItem("归批流程", "运行中", eHtmlDataItemType.svg_text));
                datas.Add(new HtmlDataItem("归批流程", "#00ff00", eHtmlDataItemType.svg_color));
            }
            else
            {
                datas.Add(new HtmlDataItem("归批流程", "未运行", eHtmlDataItemType.svg_text));
                datas.Add(new HtmlDataItem("归批流程", "#ff0000", eHtmlDataItemType.svg_color));
            }

            datas.Add(new HtmlDataItem("存桶选择工位", commonDAO.GetSignalDataValue(machineCode, "存桶选择工位"), eHtmlDataItemType.svg_text));

            //datas.Add(new HtmlDataItem("归批流程步", commonDAO.GetSignalDataValue(machineCode, "归批流程步"), eHtmlDataItemType.svg_text));
            value = commonDAO.GetSignalDataValue(machineCode, "归批流程状态");
            string gplc = "空闲";
            if (value == "3")
            {
                gplc = "进桶到读卡位步";
            }
            else if (value == "4")
            {
                gplc = "读卡与判断步";
            }
            else if (value == "5")
            {
                gplc = "进桶选桶步";
            }
            else if (value == "6")
            {
                gplc = "进桶到存桶工位步";
            }
            else if (value == "7")
            {
                gplc = "故障桶排空步";
            }
            else if (value == "8")
            {
                gplc = "完成步";
            }
            datas.Add(new HtmlDataItem("归批流程步", gplc, eHtmlDataItemType.svg_text));


            datas.Add(new HtmlDataItem("归批读卡编码", commonDAO.GetSignalDataValue(machineCode, "归批读卡编码"), eHtmlDataItemType.svg_text));

            value = commonDAO.GetSignalDataValue(machineCode, "倒料流程运行中");
            if (value == "1")
            {
                datas.Add(new HtmlDataItem("倒料流程", "运行中", eHtmlDataItemType.svg_text));
                datas.Add(new HtmlDataItem("倒料流程", "#00ff00", eHtmlDataItemType.svg_color));
            }
            else
            {
                datas.Add(new HtmlDataItem("倒料流程", "未运行", eHtmlDataItemType.svg_text));
                datas.Add(new HtmlDataItem("倒料流程", "#ff0000", eHtmlDataItemType.svg_color));
            }
            datas.Add(new HtmlDataItem("倒料选择工位", commonDAO.GetSignalDataValue(machineCode, "倒料选择工位"), eHtmlDataItemType.svg_text));

            //datas.Add(new HtmlDataItem("倒料流程步", commonDAO.GetSignalDataValue(machineCode, "倒料流程步"), eHtmlDataItemType.svg_text));
            value = commonDAO.GetSignalDataValue(machineCode, "倒料流程运行");
            string dllc = "空闲";
            if (value == "3")
            {
                dllc = "进桶到读卡位步";
            }
            else if (value == "4")
            {
            }
            else if (value == "5")
            {
                dllc = "进桶选桶步";
            }
            else if (value == "6")
            {
                dllc = "进桶到存桶工位步";
            }
            else if (value == "7")
            {
                dllc = "故障桶排空步";
            }
            else if (value == "8")
            {
                dllc = "完成步";
            }
            datas.Add(new HtmlDataItem("倒料流程步", dllc, eHtmlDataItemType.svg_text));


            datas.Add(new HtmlDataItem("倒料读卡编码", commonDAO.GetSignalDataValue(machineCode, "倒料读卡编码"), eHtmlDataItemType.svg_text));
            datas.Add(new HtmlDataItem("倒料编码", commonDAO.GetSignalDataValue(machineCode, "倒料编码给定"), eHtmlDataItemType.svg_text));
            //datas.Add(new HtmlDataItem("倒料模式", commonDAO.GetSignalDataValue(machineCode, "倒料模式"), eHtmlDataItemType.svg_text));

            //样桶信息
            List <InfBatchMachineBarrel> barrel = Dbers.GetInstance().SelfDber.Entities <InfBatchMachineBarrel>();
            foreach (InfBatchMachineBarrel item in barrel)
            {
                if (item.BarrelStatus == 1 && item.DataStatus == 1)
                {
                    datas.Add(new HtmlDataItem(item.BarrelStation + "_" + item.BarrelCode, "1", eHtmlDataItemType.svg_visible));
                }
                else
                {
                    datas.Add(new HtmlDataItem(item.BarrelStation + "_" + item.BarrelCode, "0", eHtmlDataItemType.svg_visible));
                }
            }
            #endregion



            //异常信息
            string             sql  = string.Format(@"select
										a.signalprefix,a.signalname,a.updatetime
										from cmcstbsignaldata a where a.signalprefix like '%合样归批机%' and a.signalname like 'M_%'and a.signalvalue='1' order by updatetime desc
										"                                        );
            DataTable          dt   = commonDAO.SelfDber.ExecuteDataTable(sql);
            List <WarningTemp> list = new List <WarningTemp>();

            if (dt.Rows.Count > 6)
            {
                for (int i = 0; i < 6; i++)
                {
                    WarningTemp entity = new WarningTemp();
                    entity.tDate       = Convert.ToDateTime(dt.Rows[i]["updatetime"]).ToShortDateString();
                    entity.tTime       = Convert.ToDateTime(dt.Rows[i]["updatetime"]).ToShortTimeString();
                    entity.MachineName = dt.Rows[i]["signalprefix"].ToString();
                    entity.Remark      = dt.Rows[i]["signalname"].ToString().TrimStart('M').TrimStart('_');
                    list.Add(entity);
                }
            }
            else
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    WarningTemp entity = new WarningTemp();
                    entity.tDate       = Convert.ToDateTime(dt.Rows[i]["updatetime"]).ToShortDateString();
                    entity.tTime       = Convert.ToDateTime(dt.Rows[i]["updatetime"]).ToShortTimeString();
                    entity.MachineName = dt.Rows[i]["signalprefix"].ToString();
                    entity.Remark      = dt.Rows[i]["signalname"].ToString().TrimStart('M').TrimStart('_');
                    list.Add(entity);
                }
                for (int i = dt.Rows.Count; i < 6; i++)
                {
                    WarningTemp entity = new WarningTemp();
                    entity.tDate       = "";
                    entity.tTime       = "";
                    entity.MachineName = "";
                    entity.Remark      = "";
                    list.Add(entity);
                }
            }
            datas.Add(new HtmlDataItem("报警", dt.Rows.Count > 0 ? "#ff0000" : "#00ff00", eHtmlDataItemType.svg_color));
            datas.Add(new HtmlDataItem("报警数目", dt.Rows.Count.ToString(), eHtmlDataItemType.svg_text));

            cefWebBrowser.Browser.GetMainFrame().ExecuteJavaScript("LoadHitchs(" + Newtonsoft.Json.JsonConvert.SerializeObject(list.Select(a => new { tDate = a.tDate, tTime = a.tTime, MachineName = a.MachineName, Remark = a.Remark })) + ");", "", 0);

            // 发送到页面
            cefWebBrowser.Browser.GetMainFrame().ExecuteJavaScript("requestData(" + Newtonsoft.Json.JsonConvert.SerializeObject(datas) + ");", "", 0);
        }