Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
0
        private void InStoreByHandEventHandler(object sender, InStoreByHandEventArgs e)
        {
            int            taskTypeCode   = (int)(EnumTaskName)Enum.Parse(typeof(EnumTaskName), e.TaskTypeName);
            TaskTypeModel  taskType       = bllTaskType.GetModel(taskTypeCode);
            GoodsSiteModel goodsSiteModel = null;

            string[] trayIDs = SplitStringArray(e.TrayIDs);

            if (trayIDs != null)
            {
                for (int i = 0; i < trayIDs.Length; i++)
                {
                    TB_Tray_indexModel trayModel = bllTbTrayIndex.GetModel(trayIDs[i]);
                    if (trayModel == null)
                    {
                        this.View.ShowMessage("信息提示", "条码:“" + trayIDs[i] + "”不存在此条码信息,请重新输入");

                        return;
                    }
                }
            }
            int createStatus = this.View.AskMessBox("您确定要手动生成“" + e.TaskTypeName + "”任务么?");

            if (createStatus == 0)
            {
                if (taskType != null)//控制任务接口插入一个任务申请
                {
                    if (taskType.TaskTypeCode == (int)EnumTaskName.空料框出库)
                    {
                        //查询空料框
                        goodsSiteModel = bllGoodsSite.GetGoodsSite(taskType.StartLogicAreaID, EnumGSStoreStatus.空料框, EnumGSRunStatus.任务完成, EnumGSType.货位);
                        if (goodsSiteModel == null)
                        {
                            if (mainPres != null)
                            {
                                mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "库中没有空料框了,手动生成“"
                                                 + e.TaskTypeName + "”任务失败!");
                            }
                            return;
                        }
                        else
                        {
                            ControlInterfaceModel controlInterModel = new ControlInterfaceModel();
                            controlInterModel.CreateTime      = DateTime.Now;
                            controlInterModel.DeviceCode      = taskType.EndDevice;
                            controlInterModel.InterfaceStatus = EnumCtrlInterStatus.未生成.ToString();
                            controlInterModel.InterfaceType   = EnumTaskCategory.出库.ToString();
                            //生成控制条码 需要跟控制层
                            controlInterModel.TaskCode           = bllControlInter.GetNewTaskCode();
                            controlInterModel.InterfaceParameter = e.TrayIDs;
                            long controlInterID = bllControlInter.Add(controlInterModel);
                            if (controlInterID != 1)
                            {
                                if (mainPres != null)
                                {
                                    mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",手动生成“"
                                                     + e.TaskTypeName + "”任务成功!");
                                    //mainPres.View.AddLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "手动生成“" + e.TaskTypeName + "”任务成功!");
                                }
                            }
                        }
                    }
                    else if (taskType.TaskTypeCode == (int)EnumTaskName.电芯入库_A1 || taskType.TaskTypeCode == (int)EnumTaskName.电芯入库_B1 ||
                             taskType.TaskTypeCode == (int)EnumTaskName.分容入库_A1 || taskType.TaskTypeCode == (int)EnumTaskName.空料框入库)
                    {
                        goodsSiteModel = bllGoodsSite.GetGoodsSite(taskType.EndLogicAreaID, EnumGSStoreStatus.空货位, EnumGSRunStatus.待用, EnumGSType.货位);
                        if (goodsSiteModel == null)
                        {
                            if (mainPres != null)
                            {
                                mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",库中没有空料框了,手动生成“" + e.TaskTypeName + "”任务失败!");
                            }
                            return;
                        }
                        else
                        {
                            ControlInterfaceModel controlInterModel = new ControlInterfaceModel();
                            controlInterModel.CreateTime         = DateTime.Now;
                            controlInterModel.DeviceCode         = taskType.StartDevice;
                            controlInterModel.InterfaceStatus    = EnumCtrlInterStatus.未生成.ToString();
                            controlInterModel.InterfaceType      = EnumTaskCategory.入库.ToString();
                            controlInterModel.InterfaceParameter = e.TrayIDs;
                            controlInterModel.TaskCode           = bllControlInter.GetNewTaskCode();
                            long controlInterID = bllControlInter.Add(controlInterModel);
                            if (controlInterID != 1)
                            {
                                if (mainPres != null)
                                {
                                    mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr
                                                     + ",手动生成“" + e.TaskTypeName + "”任务成功!");
                                }
                            }
                        }
                    }
                }
                DataTable dtCtrlTaskList = bllControlTask.GetCtrlDatatable(this.currentEnumTaskName, this.currentEnumTaskStatus
                                                                           , this.currentHouseName, this.currentCreateMode, this.currentTaskType);
                this.View.ShowControlTaskData(dtCtrlTaskList);
            }
        }