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
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(CtlDBAccess.Model.ControlTaskModel model)
 {
     return(dal.Add(model));
 }
Exemple #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(CtlDBAccess.Model.ControlTaskModel model)
 {
     return(dal.Update(model));
 }
        public override bool WCSMainTaskStart(MainControlTaskModel mainTask, WCSFlowPathModel wcsPath, ref string reStr)
        {
            try
            {
                if (!base.WCSMainTaskStart(mainTask, wcsPath, ref reStr))
                {
                    return(false);
                }
                WCSPathNodeModel wcsNode     = wcsPath.GetNodeByID(nodeID);
                WCSPathNodeModel wcsNodeNext = wcsPath.GetNodeByID(wcsNode.NextNodeID);
                CtlDBAccess.Model.ControlTaskModel ctlTask = new CtlDBAccess.Model.ControlTaskModel();
                ctlTask.TaskID         = System.Guid.NewGuid().ToString();
                ctlTask.DeviceID       = nodeID;
                ctlTask.DeviceCata     = devCata;
                ctlTask.StDevice       = nodeID;
                ctlTask.StDeviceCata   = devCata;
                ctlTask.StDeviceParam  = mainTask.StDeviceParam;
                ctlTask.EndDevice      = wcsNode.NextNodeID;
                ctlTask.EndDeviceCata  = wcsNodeNext.DevCata;
                ctlTask.EndDeviceParam = mainTask.EndDeviceParam;
                ctlTask.MainTaskID     = mainTask.MainTaskID;
                ctlTask.PalletCode     = mainTask.PalletCode;
                UInt16 controlID = ctlTaskBll.GetUnusedControlID();
                if (controlID < 1)
                {
                    reStr = "没有可用的控制任务ID";
                    return(false);
                }
                ctlTask.ControlID = controlID;
                ctlTask.TaskIndex = 1;
                SysCfg.EnumAsrsTaskType asrsTaskType = SysCfg.EnumAsrsTaskType.空;
                if (mainTask.TaskType == "下架")
                {
                    asrsTaskType = SysCfg.EnumAsrsTaskType.产品出库;
                }
                else if (mainTask.TaskType == "上架")
                {
                    asrsTaskType = SysCfg.EnumAsrsTaskType.产品入库;
                }

                ctlTask.TaskType   = (int)asrsTaskType;
                ctlTask.TaskParam  = "";
                ctlTask.TaskStatus = "待执行";
                ctlTask.TaskPhase  = 0;
                ctlTask.CreateTime = System.DateTime.Now;
                ctlTask.CreateMode = "自动";
                bool re = ctlTaskBll.Add(ctlTask);
                //return re;
                if (re)
                {
                    mainTask.TaskStatus = "已启动";
                    CtlDBAccess.BLL.MainControlTaskBll mainTaskBll = new CtlDBAccess.BLL.MainControlTaskBll();
                    return(mainTaskBll.Update(mainTask));
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                reStr = ex.ToString();
                return(false);
            }
        }