/// <summary> /// 更新车位状态 /// </summary> private void UpdateCarLocationStatus() { foreach (Panel tabPage in m_ltpWareHouse) { CWareHousePanel wareHouseTabPage = (CWareHousePanel)tabPage; wareHouseTabPage.UpdateCarLocationStatus(); } }
/// <summary> /// 初始化主界面各信息 /// </summary> private void InitializeInfo() { int nSum = 0; int nOccupy = 0; int nSpace = 0; int nMaxSpace = 0; string strSumDescp = "("; string strOccupyDescp = "("; string strSpaceDescp = "("; string strMaxSpaceDescp = "("; int i = 1; if (null == m_formCIMCWorker) { m_formCIMCWorker = new CFormCIMCWorker(); } foreach (Panel tabPage in m_ltpWareHouse) { CWareHousePanel wareHouseTabPage = (CWareHousePanel)tabPage; wareHouseTabPage.UpdateCarLocationStatus(); wareHouseTabPage.UpdateDeviceStatus(); // 初始化车厅流程图 List <CDeviceStatusDto> lstDeviceStatus = wareHouseTabPage.UpdateDeviceFault(); foreach (CDeviceStatusDto deviceStatus in lstDeviceStatus) { m_formCIMCWorker.UpdateFlowChart(CStaticClass.ConvertDeviceStatus(deviceStatus)); } nSum += wareHouseTabPage.RectVehCount.X; nOccupy += wareHouseTabPage.RectVehCount.Y; nSpace += wareHouseTabPage.RectVehCount.Width; nMaxSpace += wareHouseTabPage.RectVehCount.Height; string strFlag = ";"; if (i++ == m_ltpWareHouse.Count) { strFlag = ")"; } strSumDescp += wareHouseTabPage.Text + ":" + wareHouseTabPage.RectVehCount.X + strFlag; strOccupyDescp += wareHouseTabPage.Text + ":" + wareHouseTabPage.RectVehCount.Y + strFlag; strSpaceDescp += wareHouseTabPage.Text + ":" + wareHouseTabPage.RectVehCount.Width + strFlag; strMaxSpaceDescp += wareHouseTabPage.Text + ":" + wareHouseTabPage.RectVehCount.Height + strFlag; } if (2 > m_ltpWareHouse.Count) {// 只有一个库时 strSumDescp = string.Empty; strOccupyDescp = string.Empty; strSpaceDescp = string.Empty; strMaxSpaceDescp = string.Empty; } //this.TsslSumTxt.Text = nSum.ToString() + strSumDescp; //this.TsslOccupyTxt.Text = nOccupy.ToString() + strOccupyDescp; //this.TsslSpaceTxt.Text = nSpace.ToString() + strSpaceDescp; //this.TsslSpaceMaxTxt.Text = nMaxSpace.ToString() + strMaxSpaceDescp; SetStatusStripValue(); }
/// <summary> /// 界面布局 /// </summary> private void HandInitalizeComponent() { InitializeComponent(); List <struCarPSONLayoutInfo> lstRect = CStaticClass.ConfigLstRectProject(); int curWidth = 450; #region 初始化 m_formDeviceFault = new CFormDeviceFault(); m_formCarLocation = new CFormCarLocation(); m_formHall = new CFormHall(m_formDeviceFault); m_formETV = new CFormETVorTV(m_formDeviceFault); m_formSystemConfig = new CFormSystemConfig(); #endregion if (!CStaticClass.ConfigBillingFlag()) { this.TlsManage.Items.Remove(this.TsbTollManage); } this.LblTitle.Text = m_strTitle; #region 添加所有车位颜色说明标签 // 添加所有车位颜色说明标签 for (int i = 0; i < 9; i++) { Label label = new Label(); label.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; label.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); label.Name = "label" + (i + 1); label.Size = new System.Drawing.Size(45, 30); label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; label.Location = new System.Drawing.Point(curWidth, 12); curWidth += label.Width + 12; switch (i) { case 0: { label.BackColor = System.Drawing.Color.LightYellow; label.Text = "空闲"; break; } case 1: { label.BackColor = System.Drawing.Color.Purple; label.ForeColor = System.Drawing.Color.White; label.Text = "占用"; break; } case 2: { label.BackColor = System.Drawing.Color.Violet; label.Text = "入库"; break; } case 3: { label.BackColor = System.Drawing.Color.SkyBlue; label.Text = "出库"; break; } case 4: { label.BackColor = System.Drawing.Color.GreenYellow; label.Text = "挪移"; break; } case 5: { label.BackColor = System.Drawing.Color.Blue; label.Text = "取物"; break; } case 6: { label.BackColor = System.Drawing.Color.DarkKhaki; label.ForeColor = System.Drawing.Color.White; label.Text = "车厅"; break; } case 7: { label.BackColor = System.Drawing.Color.DarkGray; label.ForeColor = System.Drawing.Color.White; label.Text = "无效"; // 禁用 break; } case 8: { label.BackColor = System.Drawing.Color.DimGray; label.ForeColor = System.Drawing.Color.White; label.Text = "禁用"; // 无效 break; } //case 9: // { // label.BackColor = System.Drawing.Color.DarkSalmon; // label.Text = "旋转"; // break; // } default: { break; } } m_llblDescp.Add(label); this.GbColor.Controls.Add(label); } #endregion #region 添加所有库车位状态 for (int i = 0; i < lstRect.Count; i++) { string[] strs = lstRect[i].strPanelName.Split('_'); string typeName = string.Empty; //lstRect[i].strPanelName; string strText = string.Empty; //lstRect[i].strPanelName; if (0 < strs.Count()) { typeName = strs[0]; } if (1 < strs.Count()) { strText = strs[1]; } object[] args = new object[] { lstRect[i].rectInfo }; CWareHousePanel tp = (CWareHousePanel)Assembly.Load("CarLocationPanelLib").CreateInstance("CarLocationPanelLib." + typeName, false, BindingFlags.Default, null, args, null, null); tp.EnmSrcLocAddr = EnmTxtCarLocationAddr.FormCarLocation; tp.CallbackCarLocationEvent += new CallbackCarLocationEventHandler(CWareHousePanel_CallbackCarLocationEvent); tp.Text = strText; m_ltpWareHouse.Add(tp); if (1 < lstRect.Count) { tp.Location = this.carLocationStatus.Location; this.carLocationStatus.Visible = false; GroupBox GbTP = new GroupBox(); GbTP.Text = tp.Text; GbTP.Controls.Add(tp); this.Controls.Add(GbTP); } else { tp.Location = this.carLocationStatus.Location; this.carLocationStatus.Visible = false; GroupBox GbTP = new GroupBox(); GbTP.Text = tp.Text; GbTP.Controls.Add(tp); this.Controls.Add(GbTP); } // 手动指令根据车位状态获取地址初始化 CWareHousePanel tpHand = (CWareHousePanel)Assembly.Load("CarLocationPanelLib").CreateInstance("CarLocationPanelLib." + typeName, false, BindingFlags.Default, null, args, null, null); tpHand.CallbackCarLocationEvent += new CallbackCarLocationEventHandler(CWareHousePanel_CallbackCarLocationEvent); tpHand.Text = strText; CStaticClass.myPanelCarLocation.Add(tpHand); } #endregion }
/// <summary> ///WCF回调子函数 /// </summary> /// <param name="e"></param> private void CallBackSubFunction(object e) { if (e.GetType() == typeof(CarLocationPanelLib.PushService.CCarLocationDto)) {// 更新当前某一车位状态 CarLocationPanelLib.PushService.CCarLocationDto carLocation = (CarLocationPanelLib.PushService.CCarLocationDto)e; string strName = carLocation.warehouse.ToString(); CWareHousePanel wareHouseTabPage = (CWareHousePanel)m_ltpWareHouse.Find(a => a.Name == strName); wareHouseTabPage.UpdateCarLocationStatus(carLocation); SetStatusStripValue(); //CLOGException.Trace("CallBackSubFunction, carLocation.carlocaddr:" + carLocation.carlocaddr); //SetStatusStripValue(e); } else if (e.GetType() == typeof(CarLocationPanelLib.PushService.CDeviceStatusDto)) {// 更新当前某一设备状态 CarLocationPanelLib.PushService.CDeviceStatusDto deviceStatus = (CarLocationPanelLib.PushService.CDeviceStatusDto)e; CLOGException.Trace(0, "callback_CallbackEvent, e:", string.Format("deviceStatus.warehouse-{0} deviceStatus.devicecode-{1}", deviceStatus.warehouse, deviceStatus.devicecode)); if ((int)EnmSMGType.ETV == deviceStatus.devicetype) { // 客户端界面ETV位置更新 string strName = deviceStatus.warehouse.ToString(); CWareHousePanel wareHouseTabPage = (CWareHousePanel)m_ltpWareHouse.Find(a => a.Name == strName); wareHouseTabPage.UpdateDeviceStatus(deviceStatus); if (m_formETV.Visible && null != m_formETV.EquipDeviceStatus && m_formETV.EquipDeviceStatus.warehouse == deviceStatus.warehouse && m_formETV.EquipDeviceStatus.devicecode == deviceStatus.devicecode) {// 更新ETV设备信息界面 m_formETV.FillFormEquip(CStaticClass.ConvertDeviceStatus(deviceStatus)); } } else if (m_formHall.Visible && null != m_formHall.EquipDeviceStatus && m_formHall.EquipDeviceStatus.warehouse == deviceStatus.warehouse && m_formHall.EquipDeviceStatus.devicecode == deviceStatus.devicecode) {// 更新车厅设备信息界面 m_formHall.FillFormHall(CStaticClass.ConvertDeviceStatus(deviceStatus)); } List <object> lstETV = CStaticClass.ConfigLstETVOrTVDeviceID(deviceStatus.warehouse); if (null != lstETV && 1 > lstETV.Count) { // 无ETV时,客户端界面ETV颜色更新 string strName = deviceStatus.warehouse.ToString(); CWareHousePanel wareHouseTabPage = (CWareHousePanel)m_ltpWareHouse.Find(a => a.Name == strName); wareHouseTabPage.UpdateDeviceStatus(deviceStatus); } if (null != m_formSystemConfig) { m_formSystemConfig.UpdateDeviceIsable(deviceStatus); } if (null == m_formCIMCWorker) { m_formCIMCWorker = new CFormCIMCWorker(); } m_formCIMCWorker.UpdateFlowChart(deviceStatus); } else if (e.GetType() == typeof(CarLocationPanelLib.PushService.CDeviceFaultDto)) {// 更新当前某一label设备故障 CarLocationPanelLib.PushService.CDeviceFaultDto deviceFault = (CarLocationPanelLib.PushService.CDeviceFaultDto)e; // 客户端界面设备故障状态更新 string strName = deviceFault.warehouse.ToString(); CWareHousePanel wareHouseTabPage = (CWareHousePanel)m_ltpWareHouse.Find(a => a.Name == strName); string str = wareHouseTabPage.UpdateDeviceFault(deviceFault); if (!this.TsslPLC.Text.Contains(str)) {// 获取当前故障设备 this.TsslPLC.Text += str; } // 客户端设备故障界面更新 if (null != m_formDeviceFault) { m_formDeviceFault.UpdateDeviceFault(deviceFault); } } }