瀏覽代碼

添加部门添加的维护

章政 7 年之前
父節點
當前提交
8146cfc98d
共有 2 個文件被更改,包括 93 次插入20 次删除
  1. 64 14
      PLCDataReader/Main.Designer.cs
  2. 29 6
      PLCDataReader/Main.cs

+ 64 - 14
PLCDataReader/Main.Designer.cs

@@ -33,6 +33,7 @@ namespace UAS_PLCDataReader
         /// </summary>
         private void InitializeComponent()
         {
+            this.components = new System.ComponentModel.Container();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
             this.RibbonNav = new DevExpress.XtraBars.Ribbon.RibbonControl();
             this.ButtonDeviceList = new DevExpress.XtraBars.BarButtonItem();
@@ -70,6 +71,10 @@ namespace UAS_PLCDataReader
             this.de_code = new DevExpress.XtraGrid.Columns.GridColumn();
             this.de_name = new DevExpress.XtraGrid.Columns.GridColumn();
             this.de_runstatus = new DevExpress.XtraGrid.Columns.GridColumn();
+            this.de_currentcentername = new DevExpress.XtraGrid.Columns.GridColumn();
+            this.DeviceItemSearchLookUpEdit = new DevExpress.XtraEditors.Repository.RepositoryItemSearchLookUpEdit();
+            this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView();
+            this.de_currentcentercode = new DevExpress.XtraGrid.Columns.GridColumn();
             this.de_stepcode = new DevExpress.XtraGrid.Columns.GridColumn();
             this.de_stepname = new DevExpress.XtraGrid.Columns.GridColumn();
             this.de_sourcecode = new DevExpress.XtraGrid.Columns.GridColumn();
@@ -198,10 +203,10 @@ namespace UAS_PLCDataReader
             this.ButtonSaveClientParam = new DevExpress.XtraEditors.SimpleButton();
             this.UpdateTimeSpan = new System.Windows.Forms.NumericUpDown();
             this.label1 = new System.Windows.Forms.Label();
-            this.TimerDeviceStatus = new System.Windows.Forms.Timer();
-            this.CommonTipController = new DevExpress.Utils.ToolTipController();
-            this.TimerUpdateDevice = new System.Windows.Forms.Timer();
-            this.TimerUpdateSQL = new System.Windows.Forms.Timer();
+            this.TimerDeviceStatus = new System.Windows.Forms.Timer(this.components);
+            this.CommonTipController = new DevExpress.Utils.ToolTipController(this.components);
+            this.TimerUpdateDevice = new System.Windows.Forms.Timer(this.components);
+            this.TimerUpdateSQL = new System.Windows.Forms.Timer(this.components);
             ((System.ComponentModel.ISupportInitialize)(this.RibbonNav)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.MainTabControl)).BeginInit();
             this.MainTabControl.SuspendLayout();
@@ -213,6 +218,8 @@ namespace UAS_PLCDataReader
             ((System.ComponentModel.ISupportInitialize)(this.GridDeviceList)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.GridViewDeviceList)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.dpc_enableCheckEdit)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.DeviceItemSearchLookUpEdit)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.DataItemRepositoryItemComboBox1)).BeginInit();
             this.PageCommandSet.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.Brand.Properties)).BeginInit();
@@ -582,7 +589,8 @@ namespace UAS_PLCDataReader
             this.GridDeviceList.MenuManager = this.RibbonNav;
             this.GridDeviceList.Name = "GridDeviceList";
             this.GridDeviceList.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] {
-            this.DataItemRepositoryItemComboBox1});
+            this.DataItemRepositoryItemComboBox1,
+            this.DeviceItemSearchLookUpEdit});
             this.GridDeviceList.RowCount = 0;
             this.GridDeviceList.Size = new System.Drawing.Size(1034, 547);
             this.GridDeviceList.TabIndex = 0;
@@ -598,6 +606,8 @@ namespace UAS_PLCDataReader
             this.de_code,
             this.de_name,
             this.de_runstatus,
+            this.de_currentcentername,
+            this.de_currentcentercode,
             this.de_stepcode,
             this.de_stepname,
             this.de_sourcecode,
@@ -617,6 +627,7 @@ namespace UAS_PLCDataReader
             this.GridViewDeviceList.Name = "GridViewDeviceList";
             this.GridViewDeviceList.OptionsView.ShowGroupPanel = false;
             this.GridViewDeviceList.RowCellClick += new DevExpress.XtraGrid.Views.Grid.RowCellClickEventHandler(this.GridViewDeviceList_RowCellClick);
+            this.GridViewDeviceList.CellValueChanged += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(this.GridViewDeviceList_CellValueChanged);
             // 
             // DeviceListCheckedColumn
             // 
@@ -664,6 +675,39 @@ namespace UAS_PLCDataReader
             this.de_runstatus.FieldName = "DE_RUNSTATUS";
             this.de_runstatus.Name = "de_runstatus";
             // 
+            // de_currentcentername
+            // 
+            this.de_currentcentername.Caption = "部门名称";
+            this.de_currentcentername.ColumnEdit = this.DeviceItemSearchLookUpEdit;
+            this.de_currentcentername.FieldName = "DE_CURRENTCENTERNAME";
+            this.de_currentcentername.Name = "de_currentcentername";
+            this.de_currentcentername.Visible = true;
+            this.de_currentcentername.VisibleIndex = 5;
+            // 
+            // DeviceItemSearchLookUpEdit
+            // 
+            this.DeviceItemSearchLookUpEdit.AutoHeight = false;
+            this.DeviceItemSearchLookUpEdit.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.DeviceItemSearchLookUpEdit.Name = "DeviceItemSearchLookUpEdit";
+            this.DeviceItemSearchLookUpEdit.NullText = "";
+            this.DeviceItemSearchLookUpEdit.View = this.gridView1;
+            // 
+            // gridView1
+            // 
+            this.gridView1.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
+            this.gridView1.Name = "gridView1";
+            this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false;
+            this.gridView1.OptionsView.ShowGroupPanel = false;
+            // 
+            // de_currentcentercode
+            // 
+            this.de_currentcentercode.Caption = "部门编号";
+            this.de_currentcentercode.FieldName = "DE_CURRENTCENTERCODE";
+            this.de_currentcentercode.Name = "de_currentcentercode";
+            this.de_currentcentercode.Visible = true;
+            this.de_currentcentercode.VisibleIndex = 6;
+            // 
             // de_stepcode
             // 
             this.de_stepcode.Caption = "工序编号";
@@ -678,7 +722,7 @@ namespace UAS_PLCDataReader
             this.de_stepname.FieldName = "DE_STEPNAME";
             this.de_stepname.Name = "de_stepname";
             this.de_stepname.Visible = true;
-            this.de_stepname.VisibleIndex = 5;
+            this.de_stepname.VisibleIndex = 7;
             // 
             // de_sourcecode
             // 
@@ -704,7 +748,7 @@ namespace UAS_PLCDataReader
             this.de_spec.FieldName = "DE_SPEC";
             this.de_spec.Name = "de_spec";
             this.de_spec.Visible = true;
-            this.de_spec.VisibleIndex = 6;
+            this.de_spec.VisibleIndex = 8;
             // 
             // de_inman
             // 
@@ -712,7 +756,7 @@ namespace UAS_PLCDataReader
             this.de_inman.FieldName = "DE_INMAN";
             this.de_inman.Name = "de_inman";
             this.de_inman.Visible = true;
-            this.de_inman.VisibleIndex = 7;
+            this.de_inman.VisibleIndex = 9;
             // 
             // de_vendcode
             // 
@@ -732,7 +776,7 @@ namespace UAS_PLCDataReader
             this.de_address.FieldName = "DE_ADDRESS";
             this.de_address.Name = "de_address";
             this.de_address.Visible = true;
-            this.de_address.VisibleIndex = 8;
+            this.de_address.VisibleIndex = 10;
             // 
             // de_linecode
             // 
@@ -740,7 +784,7 @@ namespace UAS_PLCDataReader
             this.de_linecode.FieldName = "DE_LINECODE";
             this.de_linecode.Name = "de_linecode";
             this.de_linecode.Visible = true;
-            this.de_linecode.VisibleIndex = 9;
+            this.de_linecode.VisibleIndex = 11;
             // 
             // de_wccode
             // 
@@ -748,7 +792,7 @@ namespace UAS_PLCDataReader
             this.de_wccode.FieldName = "DE_WCCODE";
             this.de_wccode.Name = "de_wccode";
             this.de_wccode.Visible = true;
-            this.de_wccode.VisibleIndex = 10;
+            this.de_wccode.VisibleIndex = 12;
             // 
             // de_item1
             // 
@@ -757,7 +801,7 @@ namespace UAS_PLCDataReader
             this.de_item1.FieldName = "DE_ITEM1";
             this.de_item1.Name = "de_item1";
             this.de_item1.Visible = true;
-            this.de_item1.VisibleIndex = 11;
+            this.de_item1.VisibleIndex = 13;
             // 
             // DataItemRepositoryItemComboBox1
             // 
@@ -773,7 +817,7 @@ namespace UAS_PLCDataReader
             this.de_item2.FieldName = "DE_ITEM2";
             this.de_item2.Name = "de_item2";
             this.de_item2.Visible = true;
-            this.de_item2.VisibleIndex = 12;
+            this.de_item2.VisibleIndex = 14;
             // 
             // de_item3
             // 
@@ -782,7 +826,7 @@ namespace UAS_PLCDataReader
             this.de_item3.FieldName = "DE_ITEM3";
             this.de_item3.Name = "de_item3";
             this.de_item3.Visible = true;
-            this.de_item3.VisibleIndex = 13;
+            this.de_item3.VisibleIndex = 15;
             // 
             // PageCommandSet
             // 
@@ -2022,6 +2066,8 @@ namespace UAS_PLCDataReader
             ((System.ComponentModel.ISupportInitialize)(this.GridDeviceList)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.GridViewDeviceList)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.dpc_enableCheckEdit)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.DeviceItemSearchLookUpEdit)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.DataItemRepositoryItemComboBox1)).EndInit();
             this.PageCommandSet.ResumeLayout(false);
             this.PageCommandSet.PerformLayout();
@@ -2239,5 +2285,9 @@ namespace UAS_PLCDataReader
         private ComboBoxEdit ComboxDeviceFloor;
         private LabelControl label_ComboxDeviceFloor;
         private LabelControl label_ComboxDeviceDepartment;
+        private DevExpress.XtraGrid.Columns.GridColumn de_currentcentercode;
+        private DevExpress.XtraGrid.Columns.GridColumn de_currentcentername;
+        private DevExpress.XtraGrid.Views.Grid.GridView gridView1;
+        private DevExpress.XtraEditors.Repository.RepositoryItemSearchLookUpEdit DeviceItemSearchLookUpEdit;
     }
 }

+ 29 - 6
PLCDataReader/Main.cs

@@ -136,10 +136,10 @@ namespace UAS_PLCDataReader
         private void Main_Load(object sender, EventArgs e)
         {
             //设备列表
-            GridDeviceList.GetDataSQL = "SELECT 0 CHECKEDCOLUMN,DE_ID,DE_CODE,DE_NAME,DE_SPEC,DE_INDATE,DE_RUNSTATUS,DE_ADDRESS,DE_INMAN,DE_LINECODE,DE_WCCODE,DE_VENDCODE,DE_VENDNAME,DE_STEPCODE,DE_STEPNAME,DE_SOURCECODE,DE_ITEM1,DE_ITEM2,DE_ITEM3 FROM DEVICE ORDER BY DE_CODE".ToUpper();
+            GridDeviceList.GetDataSQL = "SELECT 0 CHECKEDCOLUMN,DE_ID,DE_CODE,DE_NAME,DE_CURRENTCENTERCODE,DE_CURRENTCENTERNAME,DE_SPEC,DE_INDATE,DE_RUNSTATUS,DE_ADDRESS,DE_INMAN,DE_LINECODE,DE_WCCODE,DE_VENDCODE,DE_VENDNAME,DE_STEPCODE,DE_STEPNAME,DE_SOURCECODE,DE_ITEM1,DE_ITEM2,DE_ITEM3 FROM DEVICE ORDER BY DE_CODE".ToUpper();
             GridDeviceList.TableName = "device";
             GridDeviceList.ID = "de_id";
-            GridDeviceList.InsertSQL = "INSERT INTO DEVICE(DE_ID,DE_CODE,DE_NAME,DE_SPEC,DE_INDATE,DE_RUNSTATUS,DE_ADDRESS,DE_INMAN,DE_LINECODE,DE_WCCODE,DE_VENDCODE,DE_VENDNAME,DE_STEPCODE,DE_STEPNAME,DE_SOURCECODE,DE_ITEM1,DE_ITEM2,DE_ITEM3) VALUES(DEVICE_SEQ.NEXTVAL,:DE_CODE,:DE_NAME,:DE_SPEC,sysdate,:DE_RUNSTATUS,:DE_ADDRESS,:DE_INMAN,:DE_LINECODE,:DE_WCCODE,:DE_VENDCODE,:DE_VENDNAME,:DE_STEPCODE,:DE_STEPNAME,:DE_SOURCECODE,:DE_ITEM1,:DE_ITEM2,:DE_ITEM3)";
+            GridDeviceList.InsertSQL = "INSERT INTO DEVICE(DE_ID,DE_CODE,DE_NAME,DE_SPEC,DE_CURRENTCENTERCODE,DE_CURRENTCENTERNAME,DE_INDATE,DE_RUNSTATUS,DE_ADDRESS,DE_INMAN,DE_LINECODE,DE_WCCODE,DE_VENDCODE,DE_VENDNAME,DE_STEPCODE,DE_STEPNAME,DE_SOURCECODE,DE_ITEM1,DE_ITEM2,DE_ITEM3) VALUES(DEVICE_SEQ.NEXTVAL,:DE_CODE,:DE_NAME,:DE_CURRENTCENTERCODE,:DE_CURRENTCENTERNAME,:DE_SPEC,sysdate,:DE_RUNSTATUS,:DE_ADDRESS,:DE_INMAN,:DE_LINECODE,:DE_WCCODE,:DE_VENDCODE,:DE_VENDNAME,:DE_STEPCODE,:DE_STEPNAME,:DE_SOURCECODE,:DE_ITEM1,:DE_ITEM2,:DE_ITEM3)";
             ButtonAddDevice.Grid = GridDeviceList;
             ButtonSaveDevice.Grid = GridDeviceList;
             ButtonDeleteDevice.Grid = GridDeviceList;
@@ -210,6 +210,11 @@ namespace UAS_PLCDataReader
                 ComBoxDeviceListMan.Properties.DataSource = (DataTable)dh.ExecuteSql("select em_code,em_name from employee ", "select");
                 dt = (DataTable)dh.ExecuteSql("select wc_code,wc_name from workcenter", "select");
                 BaseUtil.FillComBoxEditWidthDataTable(ComboxDeviceListWC, "wc_name", "wc_code", dt, true);
+
+                DataTable dt1 = (DataTable)dh.ExecuteSql("SELECT DP_NAME,DP_CODE FROM DEPARTMENT", "select");
+                DeviceItemSearchLookUpEdit.DataSource = dt1;
+                DeviceItemSearchLookUpEdit.DisplayMember = "DP_NAME";
+                DeviceItemSearchLookUpEdit.ValueMember = "DP_CODE";
             }
         }
 
@@ -225,11 +230,27 @@ namespace UAS_PLCDataReader
             GridDeviceList.RefreshData();
         }
 
+        private void GridViewDeviceList_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
+        {
+            if (e.Column.FieldName == "DE_CURRENTCENTERNAME")
+            {
+                DataTable dt = (DataTable)DeviceItemSearchLookUpEdit.DataSource;
+                if (dt != null)
+                {
+                    DataRow[] dr = dt.Select("dp_code='" + e.Value + "'");
+                    if (dr.Length > 0)
+                    {
+                        GridViewDeviceList.SetRowCellValue(e.RowHandle, "DE_CURRENTCENTERCODE", dr[0]["dp_code"]);
+                    }
+                }
+            }
+        }
+
         private void ComboxDeviceListWC_SelectedIndexChanged(object sender, EventArgs e)
         {
             DeviceListQuerySQL.Clear();
             string WC = BaseUtil.GetComboxEditValue(ComboxDeviceListWC);
-            DeviceListQuerySQL.Append("select  0 CHECKEDCOLUMN,de_id,de_code,de_name,de_spec,de_indate,de_runstatus,de_address,de_wccode,de_inman,de_linecode");
+            DeviceListQuerySQL.Append("select  0 CHECKEDCOLUMN,DE_CURRENTCENTERCODE,DE_CURRENTCENTERNAME,de_id,de_code,de_name,de_spec,de_indate,de_runstatus,de_address,de_wccode,de_inman,de_linecode");
             DeviceListQuerySQL.Append("de_vendcode,de_vendname,de_stepcode,de_stepname,DE_SOURCECODE from device where de_wccode='" + WC + "' order by de_code");
             sql.Clear();
             if (WC == "全部")
@@ -246,13 +267,13 @@ namespace UAS_PLCDataReader
             DeviceListQuerySQL.Clear();
             string WC = BaseUtil.GetComboxEditValue(ComboxDeviceListWC);
             string LC = BaseUtil.GetComboxEditValue(ComboxDeviceListLC);
-            DeviceListQuerySQL.Append("select 0 CHECKEDCOLUMN,de_id,de_code,de_name,de_spec,de_indate,de_runstatus,de_address,de_wccode, ");
+            DeviceListQuerySQL.Append("select 0 CHECKEDCOLUMN,DE_CURRENTCENTERCODE,DE_CURRENTCENTERNAME,de_id,de_code,de_name,de_spec,de_indate,de_runstatus,de_address,de_wccode, ");
             DeviceListQuerySQL.Append("de_vendcode,de_vendname,de_inman,de_linecode,de_stepcode,de_stepname,DE_SOURCECODE,de_item1,de_item2,de_item3 from device where 1=1");
             if (WC != "全部")
                 DeviceListQuerySQL.Append(" and de_wccode='" + WC + "' ");
             if (LC != "全部")
                 DeviceListQuerySQL.Append(" and de_linecode='" + LC + "' ");
-            DeviceListQuerySQL.Append("order by de_code");
+            DeviceListQuerySQL.Append(" order by de_code");
             RefreshDeviceData();
         }
 
@@ -750,7 +771,7 @@ namespace UAS_PLCDataReader
                     DeviceStatusQuerySQL.Append(" and DE_CURRENTCENTERCODE='" + DE + "' ");
                 if (FL != "全部")
                     DeviceStatusQuerySQL.Append(" and DE_ADDRESS='" + FL + "' ");
-                DeviceStatusQuerySQL.Append("order by de_code");
+                DeviceStatusQuerySQL.Append(" order by de_code");
             }
             PaintDeviceStatusControl(DeviceStatusQuerySQL.ToString());
         }
@@ -953,5 +974,7 @@ namespace UAS_PLCDataReader
         {
             dh.ExecuteSql("update devicerunstatus set dr_runstatus='disconnected'", "update");
         }
+
+
     }
 }