Esempio n. 1
0
        private void SetSortingStatus(int status)
        {
            string indexcolname = "";
            string custcolname  = "";

            foreach (DataGridViewColumn column in dataGridViewXs[superTabControl1.SelectedTab.Name].Columns)
            {
                if (column.DataPropertyName.ToUpper() == "INDEXNO")
                {
                    indexcolname = column.Name;
                }
                if (column.DataPropertyName.ToUpper() == "CUSTCODE")
                {
                    custcolname = column.Name;
                }
            }


            foreach (DataGridViewRow selectedRow in dataGridViewXs[superTabControl1.SelectedTab.Name].SelectedRows)
            {
                //改变任务状态
                string          indexcolvalue   = selectedRow.Cells[indexcolname].Value.ToString();
                string          custvalue       = selectedRow.Cells[custcolname].Value.ToString();
                SortingLineTask sortingLineTask = SortingLineTask.GetSortingLineByIndex(indexcolvalue);
                sortingLineTask.Status = status;
                if (status == 2)
                {
                    sortingLineTask.PLCADDRESS = 9;
                }
                if (status == 0)
                {
                    sortingLineTask.PLCADDRESS = 0;
                    SortingLineTaskDetail.SaveStatus(sortingLineTask.ID, "", 0);
                }

                sortingLineTask.SaveSortingTaskProcess(sortingLineTask.ID);



                //改变烟包状态
                //List<CigBoxInfo> cigBoxInfoList = CigBoxInfoList.GetBoxInfoByCustiomNo(custvalue, indexcolvalue,
                //    SortingLine.GetNonSortingLineCode());
                //foreach (CigBoxInfo cigBoxInfo in cigBoxInfoList)
                //{
                //    if (status != 2)
                //    {
                //        CigBoxInfo.SaveProcess(cigBoxInfo.ID, 0);
                //    }
                //    else
                //    {
                //        CigBoxInfo.SaveProcess(cigBoxInfo.ID, status);
                //    }
                //}
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 分拣任务到达出口流程
        /// </summary>
        public void FinishTask()
        {
            //到达任务只要开始后就不会停止
            while (true)
            {
                SortingTaskIssued sortingTaskIssued = SortingTaskIssued.GetSortingTaskIssued("0");

                if (ATOPTagSdk.Tags != null)
                {
                    //提示前台界面已按下的数量
                    if (OnUpdateCSortingMainNumEvent != null)
                    {
                        OnUpdateCSortingMainNumEvent.Invoke(null, new UpdateCSortingMainNumEventArgs(ATOPTagSdk.Tags));
                    }
                }


                //按钮按完进行后续操作
                if (ATOPTagSdk.instance.GetPlcPressTagReady())
                {
                    if (sortingTaskIssued.PLCFLAG != 0)
                    {
                        if (ATOPTagSdk.Tags != null)
                        {
                            foreach (KeyValuePair <int, Tag> tag in ATOPTagSdk.Tags)
                            {
                                SortingLineTaskDetail.SaveStatus(tag.Value.TaskNo, tag.Value.LineboxCode.ToString(), 2);
                            }
                            SortingLineTaskQueue.GetInstance().SaveTaskFinish();

                            //更改下达任务标识为可下达
                            sortingTaskIssued = SortingTaskIssued.GetSortingTaskIssued("0");
                            if (sortingTaskIssued.PLCFLAG != 0)
                            {
                                sortingTaskIssued.PLCFLAG = 0;
                                sortingTaskIssued.Save();

                                //播放语音提示
                                SoundPlayer player = new SoundPlayer();
                                player.SoundLocation = Application.StartupPath + "\\Sound\\订单完成.wav";
                                player.Load();
                                player.Play();
                            }
                        }
                    }

                    //发送当前分拣完成信号给PLC,让小车移动
                    //判断是否可以更改PLC的当前分拣完成信号
                    //判断PLC中订单序号等于系统中队尾的序号
                    //if (operateOpcAndSoft.GetCubeRun() == FJMainForm.Instance.CSortingMain.c_Cubes.Last().labindexno)
                    //{
                    //operateOpcAndSoft.SetCubeRun();
                    //}

                    if (OnTaskMoved != null)
                    {
                        OnTaskMoved.Invoke(null, new EventArgs());
                    }

                    //清除所有电子标签内容
                    ATOPTagSdk.Tags = null;
                }

                Thread.Sleep(500);
            }
        }