Jelajahi Sumber

添加记录登录账号,指令维护插入时保存值缺少问题

章政 7 tahun lalu
induk
melakukan
88163e6238
3 mengubah file dengan 8 tambahan dan 4 penghapusan
  1. 3 2
      PLCDataReader/Login.Designer.cs
  2. 3 0
      PLCDataReader/Login.cs
  3. 2 2
      PLCDataReader/Main.cs

+ 3 - 2
PLCDataReader/Login.Designer.cs

@@ -51,7 +51,7 @@
             // 
             // PassWord
             // 
-            this.PassWord.Location = new System.Drawing.Point(144, 105);
+            this.PassWord.Location = new System.Drawing.Point(144, 104);
             this.PassWord.Name = "PassWord";
             this.PassWord.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
             this.PassWord.Properties.Appearance.Options.UseFont = true;
@@ -72,7 +72,7 @@
             // PassWord_label
             // 
             this.PassWord_label.Appearance.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
-            this.PassWord_label.Location = new System.Drawing.Point(87, 108);
+            this.PassWord_label.Location = new System.Drawing.Point(87, 107);
             this.PassWord_label.Name = "PassWord_label";
             this.PassWord_label.Size = new System.Drawing.Size(32, 21);
             this.PassWord_label.TabIndex = 3;
@@ -95,6 +95,7 @@
             this.Master.Properties.Appearance.Options.UseFont = true;
             this.Master.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.Master.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
             this.Master.Size = new System.Drawing.Size(145, 28);
             this.Master.TabIndex = 5;
             // 

+ 3 - 0
PLCDataReader/Login.cs

@@ -23,6 +23,8 @@ namespace UAS_PLCDataReader
             SystemInf.dh = dh;
             DataTable dt = (DataTable)dh.ExecuteSql("select ma_user,ma_function from master", "select");
             BaseUtil.FillComBoxEditWidthDataTable(Master, "ma_function", "ma_user", dt, false);
+            string index = BaseUtil.GetCacheData("Master").ToString();
+            Master.SelectedIndex = int.Parse(index == "" ? "0" : index);
         }
 
         private void LoginButton_Click(object sender, EventArgs e)
@@ -36,6 +38,7 @@ namespace UAS_PLCDataReader
                     DataHelper.DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=" + master + ";Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=183.238.39.179)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
                     dh = new DataHelper();
                     SystemInf.dh = dh;
+                    BaseUtil.SetCacheData("Master", Master.SelectedIndex);
                     SetInf();
                     Main main = new Main();
                     Hide();

+ 2 - 2
PLCDataReader/Main.cs

@@ -156,7 +156,7 @@ namespace UAS_PLCDataReader
             GridCommandSetting.GetDataSQL = "select 0 CHECKEDCOLUMN,dc_id,dc_code,dc_name,dc_type,case when dc_type='INQTY' then '投入' when dc_type='OUTQTY' then '产出' when dc_type='TEMPERATURE' then '温度' when dc_type='PARAM1' then '参数1' when dc_type='PARAM2' then '参数2' when dc_type='PARAM3' then '参数3'  end dc_typename,dc_value,dc_dataindex,dc_sendcoding,dc_receivecoding,db_name,dc_man,dc_date from devicecommand left join devicebrand on db_code=dc_debrand".ToUpper();
             GridCommandSetting.TableName = "devicecommand";
             GridCommandSetting.ID = "dc_id";
-            GridCommandSetting.InsertSQL = "insert into devicecommand(dc_id,dc_code,dc_name,dc_value,dc_debrand,dc_sendcoding,dc_receivecoding,dc_man,dc_date,dc_dataindex) values(devicecommand_seq.nextval,:dc_code,:dc_name,:dc_value,'" + BaseUtil.GetComboxEditValue(Brand) + "',:dc_sendcoding,:dc_receivecoding,'" + User.UserName + "',sysdate,:dc_dataindex)";
+            GridCommandSetting.InsertSQL = "insert into devicecommand(dc_id,dc_code,dc_name,dc_value,dc_debrand,dc_sendcoding,dc_receivecoding,dc_man,dc_date,dc_dataindex,dc_type) values(devicecommand_seq.nextval,:dc_code,:dc_name,:dc_value,'" + BaseUtil.GetComboxEditValue(Brand) + "',:dc_sendcoding,:dc_receivecoding,'" + User.UserName + "',sysdate,:dc_dataindex,:dc_type)";
             ButtonSaveCommand.Grid = GridCommandSetting;
             ButtonDeleteCommand.Grid = GridCommandSetting;
             ButtonNewCommand.Grid = GridCommandSetting;
@@ -352,7 +352,7 @@ namespace UAS_PLCDataReader
         /// <param name="e"></param>
         private void ButtonSaveCommand_Click(object sender, EventArgs e)
         {
-            GridCommandSetting.InsertSQL = "insert into devicecommand(dc_id,dc_code,dc_name,dc_value,dc_debrand,dc_sendcoding,dc_receivecoding,dc_man,dc_date,dc_dataindex) values(devicecommand_seq.nextval,:dc_code,:dc_name,:dc_value,'" + BaseUtil.GetComboxEditValue(Brand) + "',:dc_sendcoding,:dc_receivecoding,'" + User.UserName + "',sysdate,:dc_dataindex)";
+            GridCommandSetting.InsertSQL = "insert into devicecommand(dc_id,dc_code,dc_name,dc_value,dc_debrand,dc_sendcoding,dc_receivecoding,dc_man,dc_date,dc_dataindex,dc_type) values(devicecommand_seq.nextval,:dc_code,:dc_name,:dc_value,'" + BaseUtil.GetComboxEditValue(Brand) + "',:dc_sendcoding,:dc_receivecoding,'" + User.UserName + "',sysdate,:dc_dataindex,:dc_type)";
             ButtonSaveCommand.DoSaveAfterHandler(true);
             sql.Clear();
             sql.Append("update devicecommand set dc_man='" + User.UserName + "',dc_date=sysdate where dc_id=:dc_id");