Example #1
0
 public FrmIOActionSet(IOActionInfo actionInfo, bool isView)
 {
     InitializeComponent();
     ActionInfo         = actionInfo;
     IsView             = isView;
     this.StartPosition = FormStartPosition.CenterParent;
 }
Example #2
0
 private bool Valid()
 {
     try
     {
         gvDetail.CloseEditor();
         gvDetail.CloseEditForm();
         gvDetail.FocusedColumn = colActionID;
         gvDetail.FocusedColumn = colIsWait;
         if (gvDetail.FocusedRowHandle < 0)
         {
             return(true);
         }
         IOActionInfo Curr = bsDetail[gvDetail.FocusedRowHandle] as IOActionInfo;
         if (Curr == null)
         {
             return(false);
         }
         if (string.IsNullOrEmpty(Curr.ActionName) || string.IsNullOrEmpty(Curr.IsWaitStr) || string.IsNullOrEmpty(Curr.WaitTime.ToString()))
         {
             return(false);
         }
         return(true);
     }
     catch (Exception ex)
     { MsgBox.ShowError(ex.Message); return(false); }
 }
 private void btnDown_Click(object sender, EventArgs e)
 {
     try
     {
         gvPassLandToAction.CloseEditor();
         IList <IOActionInfo> ToIOActions = bsIOActions.List as IList <IOActionInfo>;
         if (ToIOActions != null && ToIOActions.Count > 0)
         {
             int dsRowIndex = gvPassLandToAction.GetFocusedDataSourceRowIndex();
             if (gvPassLandToAction.IsLastRow)
             {
                 return;
             }
             IOActionInfo Current = gvPassLandToAction.GetRow(dsRowIndex) as IOActionInfo;
             if (Current != null)
             {
                 ToIOActions[dsRowIndex]     = ToIOActions[dsRowIndex + 1];
                 ToIOActions[dsRowIndex + 1] = Current;
                 this.bsIOActions.DataSource = ToIOActions;
                 bsIOActions.ResetBindings(false);
             }
         }
     }
     catch (Exception ex)
     { MsgBox.ShowError(ex.Message); }
 }
Example #4
0
        /// <summary>
        /// 验证数据有效性
        /// </summary>
        /// <returns></returns>
        private bool Valid()
        {
            try
            {
                IOActionInfo CurrentActionInfo = this.bsIOActionSet.Current as IOActionInfo;
                if (CurrentActionInfo == null)
                {
                    return(false);
                }
                if (string.IsNullOrEmpty(CurrentActionInfo.ActionName))
                {
                    MsgBox.ShowWarn("请维护IO动作名称!");
                    return(false);
                }

                if (cbxIsPass.SelectedIndex != 0 || cbxTerminalType.SelectedIndex != 0)
                {
                    if (cbxTerminalType.SelectedIndex != 0 && CurrentActionInfo.DeviceID == -1)
                    {
                        MsgBox.ShowWarn("请维护IO设备编号");
                        return(false);
                    }
                    if (cbxIsPass.SelectedIndex != 0 && cbxTerminalType.SelectedIndex == 0)
                    {
                        MsgBox.ShowWarn("请维护IO控制类型");
                        return(false);
                    }

                    if (CurrentActionInfo.TerminalID == -1)
                    {
                        MsgBox.ShowWarn("请维护控制字节索引!");
                        return(false);
                    }
                    if (string.IsNullOrEmpty(CurrentActionInfo.TerminalData.Trim()))
                    {
                        MsgBox.ShowWarn("请维护控制数据!");
                        return(false);
                    }
                }
                if (cbxIsWait.SelectedIndex == 0 && cbxTerminalType.SelectedIndex == 0)
                {
                    MsgBox.ShowWarn("请维护具体控制信息");
                    return(false);
                }
                return(true);
            }
            catch (Exception ex)
            { MsgBox.ShowError(ex.Message); return(false); }
        }
 private void btnDeleAction_Click(object sender, EventArgs e)
 {
     try
     {
         gvPassLandToAction.CloseEditor();
         IOActionInfo CurrIOAction = bsIOActions.Current as IOActionInfo;
         if (CurrIOAction != null)
         {
             this.bsIOActions.Remove(CurrIOAction);
             bsIOActions.ResetBindings(false);
         }
     }
     catch (Exception ex)
     { MsgBox.ShowError(ex.Message); }
 }
Example #6
0
 private void btnClear_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         IOActionInfo CurrentAction = bsIOActionSet.Current as IOActionInfo;
         if (CurrentAction != null)
         {
             int          actionID = CurrentAction.ActionID;
             IOActionInfo newItem  = new IOActionInfo();
             newItem.ActionID = actionID;
             this.bsIOActionSet.DataSource = newItem;
             this.bsIOActionSet.ResetBindings(false);
         }
     }
     catch (Exception ex)
     { MsgBox.ShowError(ex.Message); }
 }
 private void btnViewDetail_Click(object sender, EventArgs e)
 {
     try
     {
         gvPassLandToAction.CloseEditor();
         IOActionInfo CurrIOAction = bsIOActions.Current as IOActionInfo;
         if (CurrIOAction != null)
         {
             using (FrmIOActionSet frm = new FrmIOActionSet(CurrIOAction, true))
             {
                 frm.ShowDialog();
             }
         }
     }
     catch (Exception ex)
     { MsgBox.ShowError(ex.Message); }
 }
Example #8
0
 private void cbxIsWait_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         cbxIsWait.SelectedIndexChanged       -= cbxIsWait_SelectedIndexChanged;
         cbxTerminalType.SelectedIndexChanged -= cbxTerminalType_SelectedIndexChanged;
         txtDeviceID.EditValueChanged         -= txtDeviceID_EditValueChanged;
         if (cbxIsWait.SelectedIndex == 1)
         {
             cbxTerminalType.SelectedIndex = 0;
             cbxTerminalType.ReadOnly      = true;
             cbxIOUseState.ReadOnly        = true;
             txtTerminalID.ReadOnly        = true;
             cbxIsPass.ReadOnly            = true;
             txtDeviceID.ReadOnly          = true;
             txtTerminalData.ReadOnly      = true;
             IOActionInfo CurrentActionInfo = this.bsIOActionSet.Current as IOActionInfo;
             if (CurrentActionInfo != null)
             {
                 CurrentActionInfo.IsWaitStr  = cbxIsWait.EditValue.ToString();
                 CurrentActionInfo.DeviceID   = -1;
                 CurrentActionInfo.IOUseState = 0;
                 CurrentActionInfo.DeviceName = "";
                 bsIOActionSet.ResetBindings(true);
             }
         }
         else
         {
             cbxTerminalType.ReadOnly = false;
             cbxIOUseState.ReadOnly   = false;
             txtTerminalID.ReadOnly   = false;
             cbxIsPass.ReadOnly       = false;
             txtTerminalData.ReadOnly = false;
             txtDeviceID.ReadOnly     = false;
         }
     }
     catch (Exception ex)
     { MsgBox.ShowError(ex.Message); }
     finally
     {
         cbxTerminalType.SelectedIndexChanged += cbxTerminalType_SelectedIndexChanged;
         cbxIsWait.SelectedIndexChanged       += cbxIsWait_SelectedIndexChanged;
         txtDeviceID.EditValueChanged         += txtDeviceID_EditValueChanged;
     }
 }
Example #9
0
 private void btnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         int          actionID      = this.bsDetail.Count + 1;
         IOActionInfo NewActionInfo = new IOActionInfo();
         NewActionInfo.ActionID = actionID;
         using (FrmIOActionSet frm = new FrmIOActionSet(NewActionInfo, false))
         {
             frm.ShowDialog();
             if (frm.DialogResult == DialogResult.OK)
             {
                 bsDetail.DataSource = AGVDAccess.AGVClientDAccess.LoadAllIOAction();
                 bsDetail.ResetBindings(false);
             }
         }
     }
     catch (Exception ex)
     { MsgBox.ShowError(ex.Message); }
 }
Example #10
0
 private void btnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         labelControl1.Focus();
         if (!Valid())
         {
             return;
         }
         IOActionInfo      CurrentActionInfo = this.bsIOActionSet.Current as IOActionInfo;
         OperateReturnInfo opr = AGVClientDAccess.SaveIOAction(CurrentActionInfo);
         MsgBox.Show(opr);
         if (opr.ReturnCode == OperateCodeEnum.Success)
         {
             this.DialogResult = DialogResult.OK;
             this.Close();
             return;
         }
     }
     catch (Exception ex)
     { MsgBox.ShowError(ex.Message); }
 }
Example #11
0
 private void txtDeviceID_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         txtDeviceID.EditValueChanged -= txtDeviceID_EditValueChanged;
         IOActionInfo CurrentActionInfo = this.bsIOActionSet.Current as IOActionInfo;
         if (CurrentActionInfo != null && !string.IsNullOrEmpty(((DevExpress.XtraEditors.LookUpEdit)sender).Text))
         {
             CurrentActionInfo.DeviceID = Convert.ToInt16(((DevExpress.XtraEditors.LookUpEdit)sender).Text);
             IODeviceInfo CurrDevice = (bsIODevices.DataSource as IList <IODeviceInfo>).FirstOrDefault(p => p.ID == CurrentActionInfo.DeviceID);
             if (CurrDevice != null)
             {
                 CurrentActionInfo.DeviceName = CurrDevice.DeviceName;
             }
             bsIOActionSet.ResetBindings(false);
         }
     }
     catch (Exception ex)
     { MsgBox.ShowError(ex.Message); }
     finally
     { txtDeviceID.EditValueChanged += txtDeviceID_EditValueChanged; }
 }
Example #12
0
 private void btnDele_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         IOActionInfo NewActionInfo = bsDetail.Current as IOActionInfo;
         if (NewActionInfo != null)
         {
             if (MsgBox.ShowQuestion("确定删除当前项?") == DialogResult.Yes)
             {
                 OperateReturnInfo opr = AGVDAccess.AGVClientDAccess.DeleIOAction(NewActionInfo);
                 MsgBox.Show(opr);
                 if (opr.ReturnCode == OperateCodeEnum.Success)
                 {
                     bsDetail.DataSource = AGVDAccess.AGVClientDAccess.LoadAllIOAction();
                     bsDetail.ResetBindings(false);
                 }
             }
         }
     }
     catch (Exception ex)
     { MsgBox.ShowError(ex.Message); }
 }
Example #13
0
 private void btnEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         IList <IOActionInfo> AllAction     = bsDetail.List as IList <IOActionInfo>;
         IOActionInfo         NewActionInfo = bsDetail.Current as IOActionInfo;
         if (NewActionInfo != null)
         {
             NewActionInfo.IsNew = false;
             using (FrmIOActionSet frm = new FrmIOActionSet(NewActionInfo, false))
             {
                 frm.ShowDialog();
                 if (frm.DialogResult == DialogResult.OK)
                 {
                     bsDetail.DataSource = AGVDAccess.AGVClientDAccess.LoadAllIOAction();
                     bsDetail.ResetBindings(false);
                 }
             }
         }
     }
     catch (Exception ex)
     { MsgBox.ShowError(ex.Message); }
 }
Example #14
0
        /// <summary>
        /// 处理呼叫盒呼叫
        /// </summary>
        /// <param name="CallBoxID">呼叫盒ID</param>
        /// <param name="BtnID">按钮ID</param>
        /// <returns></returns>
        private bool HandleCallBoxCall(CallBoxInfo CallBox, CallBoxDetail CurrBoxDetail, int BtnID)
        {
            try
            {
                #region 处理呼叫逻辑
                //加载是否启用储位状态
                string IsUserStoreState = CoreData.SysParameter["IsUserStoreState"].ToString();
                if (string.IsNullOrEmpty(IsUserStoreState))
                {
                    IsUserStoreState = "否";
                }
                int CallBoxID = CallBox.CallBoxID;
                IList <TaskConfigDetail> TaskConfigDetails = AGVClientDAccess.load_TaskDetail(CurrBoxDetail.TaskConditonCode);
                if (TaskConfigDetails == null && (TaskConfigDetails != null && TaskConfigDetails.Count <= 0))
                {
                    LogHelper.WriteCallBoxLog("未配置按钮盒" + CallBox.CallBoxID.ToString() + "任务信息");
                    return(false);
                }

                //开始根据任务配置信息创建任务
                StorageInfo CallStore = CoreData.StorageList.FirstOrDefault(q => q.ID == CurrBoxDetail.LocationID);
                if (CallStore == null)
                {
                    LogHelper.WriteCallBoxLog("未配置按钮盒" + CallBox.CallBoxID.ToString() + "对应的监控储位");
                    return(false);
                }
                //验证当前按钮盒下是否存在未完成的任务
                if (AGVSimulationDAccess.ChekAllowCreatTask(CallBoxID, CallStore.LankMarkCode, BtnID) > 0)
                {
                    LogHelper.WriteCallBoxLog("按钮盒" + CallBox.CallBoxID.ToString() + "对应呼叫存在未完成任务,请稍后再试!");
                    return(false);
                }

                //组装任务信息
                string           dispatchNo = Guid.NewGuid().ToString();
                DispatchTaskInfo TaskInfo   = new DispatchTaskInfo();
                TaskInfo.dispatchNo = dispatchNo;
                TaskInfo.TaskState  = 0;
                TaskInfo.CallLand   = CallStore.LankMarkCode;
                TaskInfo.stationNo  = CallBoxID;
                TaskInfo.CallID     = BtnID;
                TaskInfo.taskType   = 0;

                //创建任务明细
                int DetailID   = 1;
                int PrePutType = -1;
                foreach (TaskConfigDetail item in TaskConfigDetails)
                {
                    //通过任务任务配置明细寻找目标地标
                    StorageInfo ArmStore = null;
                    LogHelper.WriteCallBoxLog("呼叫储位为:" + item.ArmOwnArea.ToString());
                    if (item.ArmOwnArea == -1)
                    {
                        ArmStore = CallStore;
                        LogHelper.WriteCallBoxLog("呼叫储位地标为:" + CallStore.LankMarkCode);
                    }
                    else
                    {
                        if (IsUserStoreState == "否")
                        {
                            ArmStore = CoreData.StorageList.FirstOrDefault(p => p.OwnArea == item.ArmOwnArea && p.StorageState == item.StorageState && p.MaterielType == item.MaterialType);
                        }
                        else
                        {
                            ArmStore = CoreData.StorageList.FirstOrDefault(p => p.OwnArea == item.ArmOwnArea && p.StorageState == item.StorageState && p.MaterielType == item.MaterialType && p.LockState == 0);
                        }
                    }
                    if (ArmStore == null)
                    {
                        LogHelper.WriteCallBoxLog("按钮盒" + CallBox.CallBoxID.ToString() + "对应呼叫,目的储位不存在[原因:不存在或被占用]");
                        return(false);
                    }

                    //再通过配置任务号来处理必经地标
                    IList <TaskConfigMustPass> ConfigMustPasses = AGVServerDAccess.LoadTaskMustPass(item.TaskConditonCode, item.DetailID);
                    if (ConfigMustPasses != null && ConfigMustPasses.Count > 0)
                    {
                        ////如果配置的必经地标则需要产生任务经过必经地标
                        foreach (TaskConfigMustPass MustPassItem in ConfigMustPasses)
                        {
                            foreach (IOActionInfo Action in MustPassItem.MustPassIOAction)
                            {
                                IOActionInfo CurrIOActionInfo = AGVServerDAccess.LoadAllIOAction(Action.ActionID);
                                if (CurrIOActionInfo == null)
                                {
                                    LogHelper.WriteCallBoxLog("按钮盒" + CallBox.CallBoxID.ToString() + "对应呼叫,必经地标中的IO动作" + Action.ActionID.ToString() + "档案信息不存在");
                                    continue;
                                }
                                DispatchTaskDetail newTaskDetail = new DispatchTaskDetail();
                                newTaskDetail.dispatchNo         = dispatchNo;
                                newTaskDetail.DetailID           = DetailID;
                                newTaskDetail.LandCode           = MustPassItem.MustPassLandCode;
                                newTaskDetail.IsAllowExcute      = Action.IsPass;
                                newTaskDetail.IsSensorStop       = 0;
                                newTaskDetail.OperType           = -1;
                                newTaskDetail.IsWait             = Action.IsWait;
                                newTaskDetail.WaitTime           = Action.WaitTime;
                                newTaskDetail.TaskConditonCode   = MustPassItem.TaskConditonCode;
                                newTaskDetail.TaskConfigDetailID = item.DetailID;
                                TaskInfo.TaskDetail.Add(newTaskDetail);
                            }
                        }



                        //foreach (TaskConfigMustPass MustPassItem in ConfigMustPasses)
                        //{
                        //    //根据配置的IO动作ID加载对应的IO动作明细信息
                        //    IOActionInfo CurrIOActionInfo = AGVServerDAccess.LoadAllIOAction(MustPassItem.Action);
                        //    if (CurrIOActionInfo == null)
                        //    {
                        //        LogHelper.WriteCallBoxLog("按钮盒" + CallBox.CallBoxID.ToString() + "对应呼叫,必经地标中的IO动作" + MustPassItem.Action.ToString() + "档案信息不存在");
                        //        continue;
                        //    }
                        //    //找到必经地标中的IO动作后组装任务体
                        //    DispatchTaskDetail dispathDetail_MustPas = new DispatchTaskDetail();
                        //    dispathDetail_MustPas.dispatchNo = dispatchNo;
                        //    dispathDetail_MustPas.DetailID = DetailID;
                        //    dispathDetail_MustPas.LandCode = MustPassItem.MustPassLandCode;
                        //    dispathDetail_MustPas.OperType = -1;
                        //    dispathDetail_MustPas.IsAllowExcute = CurrIOActionInfo.IsWait;
                        //    dispathDetail_MustPas.PutType = -1;
                        //    dispathDetail_MustPas.IOActionID = CurrIOActionInfo.ActionID;
                        //    TaskInfo.TaskDetail.Add(dispathDetail_MustPas);
                        //    DetailID += 1;
                        //}//结束循环处理必经地标配置
                    }

                    //如果没有必经地标或者添加完必经地标后需要继续添加后续的任务配置明细
                    DispatchTaskDetail dispathDetail_TaskConfig = new DispatchTaskDetail();
                    dispathDetail_TaskConfig.dispatchNo    = dispatchNo;
                    dispathDetail_TaskConfig.DetailID      = DetailID;
                    dispathDetail_TaskConfig.LandCode      = ArmStore.LankMarkCode;
                    dispathDetail_TaskConfig.OperType      = item.Action;
                    dispathDetail_TaskConfig.IsAllowExcute = item.IsWaitPass;
                    dispathDetail_TaskConfig.PassType      = item.PassType;
                    if (PrePutType == -1)
                    {
                        dispathDetail_TaskConfig.PutType = ArmStore.StorageState;
                    }
                    else
                    {
                        dispathDetail_TaskConfig.PutType = PrePutType;
                    }
                    dispathDetail_TaskConfig.IsSensorStop = item.IsSensorStop;
                    TaskInfo.TaskDetail.Add(dispathDetail_TaskConfig);
                    PrePutType = ArmStore.StorageState;
                    DetailID  += 1;
                }//结束循环处理任务配置

                //循环组装完任务信息后保存到数据库
                if (TaskInfo != null && TaskInfo.TaskDetail.Count > 0)
                {
                    AGVServerDAccess.CreatTaskInfo(TaskInfo, IsUserStoreState == "是" ? true : false);
                }
                return(true);

                #endregion
            }
            catch (Exception ex)
            {
                LogHelper.WriteCallBoxLog("处理呼叫器呼叫异常:" + ex.Message);
                return(false);
            }
        }
        /// <summary>
        /// 处理呼叫器呼叫任务
        /// </summary>
        /// <param name="CallBox"></param>
        /// <param name="CurrBoxDetail"></param>
        /// <param name="BtnID"></param>
        /// <returns></returns>
        private bool HandleCallBoxCall(CallBoxInfo CallBox, CallBoxDetail CurrBoxDetail, int BtnID)
        {
            try
            {
                lock (lockstorage)
                {
                    #region 处理呼叫逻辑
                    //加载是否启用储位状态
                    string IsUserStoreState = CoreData.SysParameter["IsUserStoreState"].ToString();
                    if (string.IsNullOrEmpty(IsUserStoreState))
                    {
                        IsUserStoreState = "否";
                    }
                    int CallBoxID = CallBox.CallBoxID;
                    IList <TaskConfigDetail> TaskConfigDetails = AGVClientDAccess.load_TaskDetail(CurrBoxDetail.TaskConditonCode);
                    if (TaskConfigDetails == null && (TaskConfigDetails != null && TaskConfigDetails.Count <= 0))
                    {
                        LogHelper.WriteCallBoxLog("未配置按钮盒" + CallBox.CallBoxID.ToString() + "任务信息");
                        return(false);
                    }
                    DataTable dtstorage = CoreData.dbOperator.LoadDatas("QueryAllStore");
                    CoreData.StorageList = DataToObject.TableToEntity <StorageInfo>(dtstorage);
                    //开始根据任务配置信息创建任务
                    StorageInfo CallStore = CoreData.StorageList.FirstOrDefault(q => q.ID == CurrBoxDetail.LocationID);
                    if (CallStore == null)
                    {
                        LogHelper.WriteCallBoxLog("未配置按钮盒" + CallBox.CallBoxID.ToString() + "对应的监控储位");
                        return(false);
                    }
                    //验证当前按钮盒下是否存在未完成的任务
                    if (AGVSimulationDAccess.ChekAllowCreatTask(CallBoxID, CallStore.LankMarkCode, CurrBoxDetail.ButtonID) > 0)
                    {
                        LogHelper.WriteCallBoxLog("按钮盒" + CallBox.CallBoxID.ToString() + "对应呼叫存在未完成任务,请稍后再试!");
                        return(false);
                    }
                    //验证当前按钮盒下是否存在未完成的任务
                    if (AGVSimulationDAccess.ChekAllowCreatTask2(CallBoxID, CallStore.LankMarkCode, CurrBoxDetail.ButtonID) > 0)
                    {
                        LogHelper.WriteCallBoxLog("按钮盒" + CallBox.CallBoxID.ToString() + "对应呼叫存在未完成任务 未回写的任务,请稍后再试!");
                        return(false);
                    }
                    AreaInfo callarea = CoreData.AllAreaList.FirstOrDefault(p => p.OwnArea == CallStore.OwnArea);
                    if (callarea != null && callarea.MaxTaskCount > 0)
                    {
                        if (AGVSimulationDAccess.ChekAllowCreatTask3(callarea.OwnArea) >= callarea.MaxTaskCount)
                        {
                            LogHelper.WriteCallBoxLog("按钮盒" + CallBox.CallBoxIP.ToString() + " 地址" + CurrBoxDetail.DBAddress + " 对应的区域任务数量达到最大,不产生任务");
                            return(false);
                        }
                    }
                    if (!string.IsNullOrEmpty(CallStore.StorageName))
                    {
                        LogHelper.WriteCallBoxLog("按钮盒" + CallBox.CallBoxIP.ToString() + " 地址" + CurrBoxDetail.DBAddress + "对应储位未启用");
                        return(false);
                    }

                    //组装任务信息
                    string           dispatchNo = Guid.NewGuid().ToString();
                    DispatchTaskInfo TaskInfo   = new DispatchTaskInfo();
                    TaskInfo.dispatchNo = dispatchNo;
                    TaskInfo.TaskState  = 0;
                    TaskInfo.CallLand   = CallStore.LankMarkCode;
                    TaskInfo.stationNo  = CallBoxID;
                    TaskInfo.CallID     = BtnID;
                    TaskInfo.taskType   = 0;
                    TaskInfo.OwerArea   = CallStore.OwnArea;
                    //创建任务明细
                    int DetailID   = 1;
                    int PrePutType = -1;
                    foreach (TaskConfigDetail item in TaskConfigDetails)
                    {
                        //通过任务任务配置明细寻找目标地标
                        StorageInfo ArmStore = null;
                        LogHelper.WriteCallBoxLog("呼叫储位为:" + item.ArmOwnArea.ToString());
                        if (item.ArmOwnArea == -1)
                        {
                            ArmStore = CallStore;
                            LogHelper.WriteCallBoxLog("呼叫储位地标为:" + CallStore.LankMarkCode);
                        }
                        else
                        {
                            if (IsUserStoreState == "否")
                            {
                                ArmStore = CoreData.StorageList.FirstOrDefault(p => p.OwnArea == item.ArmOwnArea && p.StorageState == item.StorageState && p.MaterielType == item.MaterialType);
                            }
                            else
                            {
                                ArmStore = CoreData.StorageList.FirstOrDefault(p => p.OwnArea == item.ArmOwnArea && p.StorageState == item.StorageState && p.MaterielType == item.MaterialType && p.LockState == 0);
                            }
                        }
                        if (ArmStore == null)
                        {
                            LogHelper.WriteCallBoxLog(string.Format("按钮盒{0}   地址:{1}   BtnID{2}   对应呼叫,目的储位不存在[原因:不存在或被占用]", CallBox.CallBoxID, CurrBoxDetail.DBAddress, CurrBoxDetail.ButtonID));
                            return(false);
                        }

                        #region  用
                        //再通过配置任务号来处理必经地标
                        IList <TaskConfigMustPass> ConfigMustPasses = AGVServerDAccess.LoadTaskMustPass(item.TaskConditonCode, item.DetailID);
                        if (ConfigMustPasses != null && ConfigMustPasses.Count > 0)
                        {
                            ////如果配置的必经地标则需要产生任务经过必经地标
                            foreach (TaskConfigMustPass MustPassItem in ConfigMustPasses)
                            {
                                foreach (IOActionInfo Action in MustPassItem.MustPassIOAction)
                                {
                                    IOActionInfo CurrIOActionInfo = AGVServerDAccess.LoadAllIOAction(Action.ActionID);
                                    if (CurrIOActionInfo == null)
                                    {
                                        LogHelper.WriteCallBoxLog("按钮器" + CallBox.CallBoxID.ToString() + "对应呼叫,必经地标中的IO动作" + Action.ActionID.ToString() + "档案信息不存在");
                                        continue;
                                    }
                                    DispatchTaskDetail newTaskDetail = new DispatchTaskDetail();
                                    newTaskDetail.dispatchNo         = dispatchNo;
                                    newTaskDetail.DetailID           = DetailID;
                                    newTaskDetail.LandCode           = MustPassItem.MustPassLandCode;
                                    newTaskDetail.IsAllowExcute      = Action.IsPass;
                                    newTaskDetail.IsSensorStop       = 0;
                                    newTaskDetail.OperType           = -1;
                                    newTaskDetail.IsWait             = Action.IsWait;
                                    newTaskDetail.WaitTime           = Action.WaitTime;
                                    newTaskDetail.TaskConditonCode   = MustPassItem.TaskConditonCode;
                                    newTaskDetail.TaskConfigDetailID = item.DetailID;
                                    TaskInfo.TaskDetail.Add(newTaskDetail);
                                }
                            }
                        }
                        #endregion


                        //如果没有必经地标或者添加完必经地标后需要继续添加后续的任务配置明细
                        DispatchTaskDetail dispathDetail_TaskConfig = new DispatchTaskDetail();
                        dispathDetail_TaskConfig.dispatchNo = dispatchNo;
                        dispathDetail_TaskConfig.DetailID   = DetailID;
                        dispathDetail_TaskConfig.LandCode   = ArmStore.LankMarkCode;
                        dispathDetail_TaskConfig.StorageID  = ArmStore.ID;
                        if (!string.IsNullOrEmpty(ArmStore.Remark))
                        {
                            TaskInfo.GoodsInfo = ArmStore.Remark;
                        }
                        dispathDetail_TaskConfig.OperType       = item.Action;
                        dispathDetail_TaskConfig.IsAllowExcute  = item.IsWaitPass;
                        dispathDetail_TaskConfig.PassType       = item.PassType;
                        dispathDetail_TaskConfig.IsNeedCallBack = item.IsNeedCallBack;
                        dispathDetail_TaskConfig.IsCallGoods    = item.IsCallGoods;

                        if (PrePutType == -1)
                        {
                            dispathDetail_TaskConfig.PutType = ArmStore.StorageState;
                        }
                        else
                        {
                            dispathDetail_TaskConfig.PutType = PrePutType;
                        }
                        dispathDetail_TaskConfig.IsSensorStop = item.IsSensorStop;
                        TaskInfo.TaskDetail.Add(dispathDetail_TaskConfig);
                        PrePutType = ArmStore.StorageState;
                        DetailID  += 1;
                    }//结束循环处理任务配置

                    //循环组装完任务信息后保存到数据库
                    if (TaskInfo != null && TaskInfo.TaskDetail.Count > 0)
                    {
                        AGVServerDAccess.CreatTaskInfo(TaskInfo, IsUserStoreState == "是" ? true : false);
                    }
                    return(true);

                    #endregion
                }
            }
            catch (Exception ex)
            {
                DelegateState.InvokeDispatchStateEvent(ex.Message);
                return(false);
            }
        }