Beispiel #1
0
 private void LoadConfirmrequest()
 {
     if (!InTaskList.IsInTaskFinish())
     {
         _comfirmintask = InTask.GetConfirmInTask();
         if (_comfirmintask != null && _comfirmintask.INDEXNO > 0)
         {
             panelEx2.Visible = true;
             panelEx2.Dock    = DockStyle.Fill;
             //labintaskno.Text = _comfirmintask.INTASKNO.ToString();
             laborderdate.Text = _comfirmintask.ORDERDATE;
             //labintaskport.Text = _comfirmintask.INPORTCODE;
             labindexno.Text = _comfirmintask.INDEXNO.ToString() + "/" + maxtaskno;
             labcigcode.Text = _comfirmintask.BARCODE;
             labcigname.Text = _comfirmintask.CIGNAME;
             //labcigqty.Text = (_comfirmintask.INQTY/50).ToString();
         }
         else
         {
             panelEx2.Visible = false;
             panelEx2.Dock    = DockStyle.None;
         }
     }
     else
     {
         panelEx2.Visible = false;
     }
 }
Beispiel #2
0
        /// <summary>
        /// 1.5秒刷新一次补货大屏的数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            //Thread thread = new Thread(GetInPortInfo);
            //thread.IsBackground = true;
            //thread.Start();
            GetInPortInfo();

            try
            {
                //如果补货任务已全部下达
                if (InTaskList.IsInTaskFinish())
                {
                    timer1.Enabled = false;


                    Thread t = new Thread(ShowFinish);
                    t.Start();
                }
            }
            catch (Exception)
            {
            }
        }
Beispiel #3
0
        private void ScanTask()
        {
            PlCResult plCResult = new PlCResult();

            try
            {
                plCResult = operateOpcAndSoft.InDataToTaskAddress();
            }
            catch
            {
            }
            if (plCResult.Succeed)
            {
                while (taskStatus == TaskStatus.Run)
                {
                    if (!InTaskList.IsInTaskFinish())
                    {
                        //获取需要下达的任务
                        InTask inTask = InTaskList.GetComfirmRequestInTask();
                        if (inTask != null)
                        {
                            if (!string.IsNullOrEmpty(inTask.ID))
                            {
                                //下达补货任务
                                plCResult = operateOpcAndSoft.ReplenishmentTask(inTask);
                                if (plCResult.Succeed)
                                {
                                    //写日志
                                    MonitorLog monitorLog = MonitorLog.NewMonitorLog();
                                    monitorLog.LOGNAME  = "PLC任务下达";
                                    monitorLog.LOGINFO  = "PLCTASKNO:" + inTask.INDEXNO.ToString().PadRight(10);
                                    monitorLog.LOGINFO += "CIG:" + inTask.CIGCODE + "-" + inTask.CIGNAME + "-" +
                                                          inTask.PICKLINENAME +
                                                          "-" + inTask.INQTY;
                                    monitorLog.LOGLOCATION = "PLC";
                                    monitorLog.LOGTYPE     = 0;
                                    monitorLog.Save();
                                    //加载数据
                                    this.BeginInvoke(new MethodInvoker(LoadInTask));

                                    //while (!operateOpcAndSoft.IsIntaskScanFinish(inTask))
                                    //{
                                    //    Thread.Sleep(300);
                                    //}
                                }
                                else if (!string.IsNullOrEmpty(plCResult.Exception))
                                {
                                    //写日志
                                    MonitorLog monitorLog = MonitorLog.NewMonitorLog();
                                    monitorLog.LOGNAME     = "PLC补货任务下达异常";
                                    monitorLog.LOGINFO     = plCResult.Exception;
                                    monitorLog.LOGLOCATION = "PLC";
                                    monitorLog.LOGTYPE     = 0;
                                    monitorLog.Save();
                                }
                            }
                        }
                    }
                    else
                    {
                        //写日志
                        Thread.Sleep(2000);
                        MonitorLog monitorLog = MonitorLog.NewMonitorLog();
                        monitorLog.LOGNAME     = "PLC任务下达";
                        monitorLog.LOGINFO     = "补货任务下达全部完成";
                        monitorLog.LOGLOCATION = "PLC";
                        monitorLog.LOGTYPE     = 0;
                        monitorLog.Save();

                        //设置完成后的界面及参数
                        BHMainForm.Instance.InTaskFinish();
                        break;
                    }
                    Thread.Sleep(1000);
                }
            }
            else
            {
                //写日志
                MonitorLog monitorLog = MonitorLog.NewMonitorLog();
                monitorLog.LOGNAME     = "PLC补货绑定品牌下达异常";
                monitorLog.LOGINFO     = plCResult.Exception;
                monitorLog.LOGLOCATION = "PLC";
                monitorLog.LOGTYPE     = 0;
                monitorLog.Save();
            }
        }