Exemple #1
0
        public void DelTask(List <string> taskIDs)
        {
            foreach (string taskID in taskIDs)
            {
                CtlDBAccess.Model.ControlTaskModel taskModel = taskBll.GetModel(taskID);
                if (taskModel == null)
                {
                    continue;
                }
                if (taskModel.TaskStatus == SysCfg.EnumTaskStatus.执行中.ToString() || taskModel.TaskStatus == SysCfg.EnumTaskStatus.超时.ToString())
                {
                    continue;
                }
                if (taskModel.TaskType > 5)
                {
                    taskBll.Delete(taskID);
                }
                else
                {
                    AsrsTaskParamModel paramModel = new AsrsTaskParamModel();
                    string             reStr      = "";
                    //  if (!paramModel.ParseParam((SysCfg.EnumAsrsTaskType)taskModel.TaskType, taskModel.TaskParam, ref reStr))
                    if (!paramModel.ParseParam(taskModel, ref reStr))
                    {
                        Console.WriteLine(string.Format("任务ID:{0},参数解析失败,无法删除"), taskModel.TaskID);
                        continue;
                    }
                    if (taskModel.TaskStatus == SysCfg.EnumTaskStatus.待执行.ToString())
                    {
                        if (!asrsResourceManage.UpdateGsTaskStatus(taskModel.tag1, paramModel.CellPos1, EnumGSTaskStatus.完成, ref reStr))
                        {
                            Console.WriteLine(string.Format("任务ID:{0},删除失败,因为更新{1}:{2}-{3}-{4}状态失败", taskModel.TaskID, taskModel.tag1, paramModel.CellPos1.Row, paramModel.CellPos1.Col, paramModel.CellPos1.Layer));
                            continue;
                        }
                        if (taskModel.TaskType == (int)SysCfg.EnumAsrsTaskType.移库)
                        {
                            if (!asrsResourceManage.UpdateGsTaskStatus(taskModel.tag1, paramModel.CellPos2, EnumGSTaskStatus.完成, ref reStr))
                            {
                                Console.WriteLine(string.Format("任务ID:{0},删除失败,因为更新{1}:{2}-{3}-{4}状态失败", taskModel.TaskID, taskModel.tag1, paramModel.CellPos2.Row, paramModel.CellPos2.Col, paramModel.CellPos2.Layer));
                                continue;
                            }
                        }
                    }

                    taskBll.Delete(taskID);
                }
            }
            QueryTask();
        }
Exemple #2
0
 private void DeleteRow()
 {
     if (comboBoxDtName.Text == "控制任务表")
     {
         DataGridViewSelectedRowCollection rws = this.dataGridViewDt.SelectedRows;
         if (rws != null && rws.Count > 0)
         {
             foreach (DataGridViewRow rw in rws)
             {
                 if (rw != null)
                 {
                     int id = int.Parse(rw.Cells["ControlID"].Value.ToString());
                     ctlTaskBll.Delete(id);
                 }
             }
         }
         RefreshDt("控制任务表");
     }
 }
        private void DeleteEventHandler(object sender, DeleteEventArgs e)
        {
            int deleteSure = this.View.AskMessBox("您确定要删除选中数据么?");

            if (deleteSure == 0)
            {
                switch (e.EnumDataList)
                {
                case EnumDataList.管理任务表:
                    for (int i = 0; i < e.ListID.Count(); i++)
                    {
                        bool deleteStatus = bllManaTask.Delete(e.ListID[i]);
                    }

                    DataSet dsManaTask = bllManaTask.GetAllList();
                    if (dsManaTask != null && dsManaTask.Tables.Count > 0)
                    {
                        DataTable dtManaTask = dsManaTask.Tables[0];
                        this.View.RefreshDataList(dtManaTask, e.EnumDataList);
                    }
                    break;

                case EnumDataList.控制接口表:
                    for (int i = 0; i < e.ListID.Count(); i++)
                    {
                        bool deleteStatus = bllControlInter.Delete(e.ListID[i]);
                    }

                    DataSet dsControlInter = bllControlInter.GetAllList();
                    if (dsControlInter != null && dsControlInter.Tables.Count > 0)
                    {
                        DataTable dtControlInter = dsControlInter.Tables[0];
                        this.View.RefreshDataList(dtControlInter, e.EnumDataList);
                    }

                    break;

                case EnumDataList.控制任务表:
                    for (int i = 0; i < e.ListID.Count(); i++)
                    {
                        bool deleteStatus = bllControlTask.Delete(e.ListID[i]);
                    }
                    DataSet dsControlTask = bllControlTask.GetAllList();
                    if (dsControlTask != null && dsControlTask.Tables.Count > 0)
                    {
                        DataTable dtControlTask = dsControlTask.Tables[0];
                        this.View.RefreshDataList(dtControlTask, e.EnumDataList);
                    }
                    break;

                case EnumDataList.库存列表:
                    for (int i = 0; i < e.ListID.Count(); i++)
                    {
                        bool deleteStatus = bllStockList.Delete(e.ListID[i]);
                    }
                    DataSet dsStockList = bllStockList.GetAllList();
                    if (dsStockList != null && dsStockList.Tables.Count > 0)
                    {
                        DataTable dtStockList = dsStockList.Tables[0];
                        this.View.RefreshDataList(dtStockList, e.EnumDataList);
                    }
                    break;

                default:
                    break;
                }
            }
        }