Esempio n. 1
0
 public CSMG(int nid, string nCode, bool nAvalible, EnmModel nMode, EnmSMGType nType, EnmHallType nHtype, int nWh, int nMtsk, string nAddrs, int ntskID, int nNextTask, int nLayer, int nRegion)
     : base(nid, nCode)
 {
     mType       = nType;
     mHallType   = nHtype;
     mModel      = nMode;
     mWhouse     = nWh;
     mMtskID     = nMtsk;   //用于保存主作业号
     mIsAvl      = nAvalible;
     mnIsWorking = ntskID;
     mNextTask   = nNextTask;
     mLayer      = nLayer;
     mRegion     = nRegion;
     mAddress    = nAddrs;
 }
Esempio n. 2
0
        public ActionResult Edit(int ID, int IsAble, string HallType)
        {
            Response resp = new Response();
            Log      log  = LogFactory.GetLogger("POST Edit");

            try
            {
                Device smg = new CWDevice().Find(dev => dev.ID == ID);
                if (smg == null)
                {
                    return(RedirectToAction("Index"));
                }
                if (IsAble > 1)
                {
                    ModelState.AddModelError("", "<可用性> 只允许输入:0、1  两种");
                    return(View(smg));
                }
                smg.IsAble = IsAble;
                if (smg.Type == EnmSMGType.Hall)
                {
                    EnmHallType htype = EnmHallType.Init;
                    bool        nback = Enum.TryParse(HallType, out htype);
                    if (nback)
                    {
                        smg.HallType = htype;
                    }
                    else
                    {
                        ModelState.AddModelError("", " <车厅类型> 不正确,只允许输入:Entrance、Exit、EnterOrExit 三种");
                        return(View(smg));
                    }
                }
                resp = new CWDevice().Update(smg);
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
            return(RedirectToAction("Index"));
        }
        /// <summary>
        /// 车厅设置确认
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnOk_Click(object sender, EventArgs e)
        {
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();
            PushServiceClient  push  = new PushServiceClient(new System.ServiceModel.InstanceContext(CStaticClass.myCallback));

            try
            {
                if (string.IsNullOrEmpty(this.CboHallWareHouse.Text) || string.IsNullOrEmpty(this.CboHallID.Text) || 0 > this.CboHallType.SelectedIndex)
                {
                    MessageBox.Show("库区,车厅设备以及车厅类型都不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                DialogResult dr = MessageBox.Show("确定修改吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);

                if (dr == DialogResult.OK)
                {
                    int         nWareHouse  = CStaticClass.ConvertWareHouse(this.CboHallWareHouse.Text);
                    int         nHallID     = CStaticClass.ConvertHallDescp(nWareHouse, this.CboHallID.Text);
                    EnmHallType enmHallType = CStaticClass.ConvertHallType(this.CboHallType.Text);
                    CarLocationPanelLib.PushService.EnmFaultType type = push.SetHallType(nWareHouse, nHallID, enmHallType);

                    switch (type)
                    {
                    case CarLocationPanelLib.PushService.EnmFaultType.Success:
                    {
                        MessageBox.Show("设置车厅类型成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.NotFoundEquip:
                    {
                        MessageBox.Show("没有找到指定的车厅!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.WorkQueueNotEmpty:
                    {
                        MessageBox.Show("有人排队取车,不允许修改车厅类型!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.FailToUpdate:
                    {
                        MessageBox.Show("修改数据库失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.InvalidWareHouseID:
                    {
                        MessageBox.Show("无效库区号!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.FailToSendTelegram:
                    {
                        MessageBox.Show("发送报文失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.FailConnection:
                    {
                        MessageBox.Show("PLC网络连接中断,请检查网络连接再继续", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }

                    case CarLocationPanelLib.PushService.EnmFaultType.Exception:
                    {
                        MessageBox.Show(CStaticClass.GetExceptionInfo(null), "连接异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        break;
                    }

                    default:
                    {
                        MessageBox.Show("设置车厅类型失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }
                    }
                }
            }
            catch (TimeoutException)
            {
                MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (FaultException exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (CommunicationException exception)
            {
                MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            proxy.Close();
            push.Close();
        }