private void AutoCreateControlTask(ManageTaskModel manaTaskModel, long taskID, TaskTypeModel taskType)
        {
            ControlTaskModel controlTaskModel = new ControlTaskModel();//生成控制任务

            controlTaskModel.ControlCode  = manaTaskModel.TaskCode;
            controlTaskModel.TaskTypeName = taskType.TaskTypeName;
            controlTaskModel.StartArea    = manaTaskModel.TaskStartArea;
            controlTaskModel.StartDevice  = manaTaskModel.TaskStartPostion;
            controlTaskModel.TargetArea   = manaTaskModel.TaskEndArea;
            controlTaskModel.TargetDevice = manaTaskModel.TaskEndPostion;
            controlTaskModel.TaskID       = taskID;
            controlTaskModel.CreateMode   = EnumCreateMode.手动生成.ToString();
            controlTaskModel.TaskStatus   = EnumTaskStatus.待执行.ToString();
            controlTaskModel.TaskType     = manaTaskModel.TaskType;
            controlTaskModel.TaskTypeCode = taskType.TaskTypeCode;
            controlTaskModel.CreateTime   = DateTime.Now;
            bllControlTask.Add(controlTaskModel);
        }
Beispiel #2
0
        private void buttonGenerateTask_Click(object sender, EventArgs e)
        {
            string           taskName = this.comboBoxTaskType.Text;
            ControlTaskModel task     = new ControlTaskModel();

            task.TaskID = long.Parse(this.textBoxTaskManID.Text);
            //task.StartDevice = devID;

            task.TaskTypeName  = taskName;
            task.ControlCode   = ctlTaskIFBll.GetNewTaskCode();//.textBoxControlCode.Text;
            task.CreateTime    = System.DateTime.Now;
            task.TaskStatus    = EnumTaskStatus.待执行.ToString();
            task.CreateMode    = EnumTaskMode.手动.ToString();
            task.TaskParameter = this.textBoxTaskParam.Text;
            task.TaskPhase     = "0";

            if (taskName == EnumTaskName.电芯入库_A1.ToString())
            {
                task.StartArea    = "装箱区";
                task.TargetArea   = "老化区A1";
                task.StartDevice  = "2002";
                task.TargetDevice = this.textBoxTaskParam.Text;
                task.TaskType     = "入库";
                task.TaskTypeCode = 3;
            }
            else if (taskName == EnumTaskName.电芯出库_A1.ToString())
            {
                task.StartArea    = this.textBoxTaskParam.Text;
                task.TargetArea   = "一次检测区";
                task.StartDevice  = "老化区A1";
                task.TargetDevice = "2005";
                task.TaskType     = "出库";
                task.TaskTypeCode = 6;
            }
            else if (taskName == EnumTaskName.分容入库_A1.ToString())
            {
                task.StartArea    = "装箱区";
                task.TargetArea   = "老化区";
                task.StartDevice  = "2004";
                task.TargetDevice = this.textBoxTaskParam.Text;
                task.TaskType     = "入库";
                task.TaskTypeCode = 5;
            }
            else if (taskName == EnumTaskName.分容出库_A1.ToString())
            {
                task.StartArea    = "老化区A1";
                task.TargetArea   = "老化区";
                task.StartDevice  = this.textBoxTaskParam.Text;
                task.TargetDevice = "2003";
                task.TaskType     = "出库";
                task.TaskTypeCode = 4;
            }
            else if (taskName == EnumTaskName.电芯入库_B1.ToString())
            {
                task.StartArea    = "装箱区";
                task.TargetArea   = "老化区";
                task.StartDevice  = "2006";
                task.TargetDevice = this.textBoxTaskParam.Text;
                task.TaskType     = "入库";
                task.TaskTypeCode = 8;
            }
            else if (taskName == EnumTaskName.电芯出库_B1.ToString())
            {
                task.StartArea    = "老化区A1";
                task.TargetArea   = "老化区";
                task.StartDevice  = this.textBoxTaskParam.Text;
                task.TargetDevice = "2007";
                task.TaskType     = "出库";
                task.TaskTypeCode = 9;
            }
            else if (taskName == EnumTaskName.空料框入库.ToString())
            {
                task.StartArea    = "老化区A1";
                task.TargetArea   = "老化区";
                task.StartDevice  = "2008";
                task.TargetDevice = this.textBoxTaskParam.Text;
                task.TaskType     = "入库";
                task.TaskTypeCode = 1;
            }
            else if (taskName == EnumTaskName.空料框出库.ToString())
            {
                task.StartArea    = "老化区A1";
                task.TargetArea   = "老化区";
                task.StartDevice  = this.textBoxTaskParam.Text;
                task.TargetDevice = "2009";
                task.TaskType     = "出库";
                task.TaskTypeCode = 2;
            }
            else if (taskName == EnumTaskName.电芯装箱组盘.ToString())
            {
                task.StartArea    = "老化区A1";
                task.TargetArea   = "老化区";
                task.StartDevice  = "5001";
                task.TargetDevice = "2001";
                task.TaskType     = "入库";
                task.TaskTypeCode = 11;
            }
            else if (taskName == EnumTaskName.电芯一次拣选.ToString())
            {
                task.StartArea    = "老化区A1";
                task.TargetArea   = "老化区";
                task.StartDevice  = "4001";
                task.TargetDevice = "5002";
                task.TaskType     = "出库";
                task.TaskTypeCode = 7;
            }
            else if (taskName == EnumTaskName.电芯二次拣选.ToString())
            {
                task.StartArea    = "老化区A1";
                task.TargetArea   = "老化区";
                task.StartDevice  = "4002";
                task.TargetDevice = "5003";
                task.TaskType     = "出库";
                task.TaskTypeCode = 7;
            }
            try
            {
                ctlTaskBll.Add(task);
                AddLog("增加一条控制任务:" + taskName);
            }
            catch (System.Exception ex)
            {
                AddLog("出现异常:" + ex.Message);
            }
        }