Explorar el Código

添加Access数据库统一连接

章政 hace 7 años
padre
commit
25fbafb254

+ 3 - 1
UAS-出货标签管理(吉利通)/Entity/SystemInf.cs

@@ -7,6 +7,8 @@ namespace UAS_LabelMachine.Entity
 {
     class SystemInf
     {
-       public static DataHelper dh;
+        public static DataHelper dh;
+
+        public static AccessDBHelper adh;
     }
 }

+ 2 - 0
UAS-出货标签管理(吉利通)/Login.cs

@@ -12,6 +12,7 @@ namespace UAS_LabelMachine
     public partial class Login : Form
     {
         DataHelper dh;
+        AccessDBHelper adh;
         DataTable dt;
 
         public Login()
@@ -30,6 +31,7 @@ namespace UAS_LabelMachine
         private void Login_Load(object sender, EventArgs e)
         {
             dh = new DataHelper();
+            adh = new AccessDBHelper("LabelPrint.accdb");
             SystemInf.dh = dh;
             //获取账套信息
             dt = (DataTable)dh.ExecuteSql("select ma_function,ms_pwd,ma_user from master ", "select");

+ 18 - 0
UAS-出货标签管理(吉利通)/PublicMethod/LogicHandler.cs

@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using UAS_LabelMachine.Entity;
+
+namespace UAS_LabelMachine.PublicMethod
+{
+    class LogicHandler
+    {
+        AccessDBHelper dh = SystemInf.adh;
+
+        public static void UpdateRowCollected(int iPibID)
+        {
+
+        }
+    }
+}

+ 1 - 0
UAS-出货标签管理(吉利通)/UAS-出货标签管理(吉利通).csproj

@@ -254,6 +254,7 @@
     <Compile Include="PublicMethod\ftpOperater.cs" />
     <Compile Include="PublicMethod\GlobalEventsHandler.cs" />
     <Compile Include="PublicMethod\HttpHandler.cs" />
+    <Compile Include="PublicMethod\LogicHandler.cs" />
     <Compile Include="PublicMethod\LogManager.cs" />
     <Compile Include="SetLoadingWindow.cs">
       <SubType>Form</SubType>

+ 2 - 16
UAS-出货标签管理(吉利通)/UAS_出货标签管理.Designer.cs

@@ -57,7 +57,6 @@
             this.pi_cardcode_label = new System.Windows.Forms.Label();
             this.Fresh = new System.Windows.Forms.LinkLabel();
             this.label3 = new System.Windows.Forms.Label();
-            this.CleanInputAfterCollect = new System.Windows.Forms.CheckBox();
             this.AllCollected = new System.Windows.Forms.Button();
             this.RefreshDBConnect = new System.Windows.Forms.Timer(this.components);
             this.GetGridOnly = new System.Windows.Forms.CheckBox();
@@ -329,12 +328,13 @@
             this.si_expression,
             this.si_item,
             this.si_expressionitem});
-            this.Si_ItemDGV.Location = new System.Drawing.Point(324, 16);
+            this.Si_ItemDGV.Location = new System.Drawing.Point(1119, 292);
             this.Si_ItemDGV.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.Si_ItemDGV.Name = "Si_ItemDGV";
             this.Si_ItemDGV.RowTemplate.Height = 23;
             this.Si_ItemDGV.Size = new System.Drawing.Size(134, 144);
             this.Si_ItemDGV.TabIndex = 65;
+            this.Si_ItemDGV.Visible = false;
             // 
             // si_detno
             // 
@@ -460,18 +460,6 @@
             this.label3.TabIndex = 29;
             this.label3.Text = "输出日志";
             // 
-            // CleanInputAfterCollect
-            // 
-            this.CleanInputAfterCollect.AutoSize = true;
-            this.CleanInputAfterCollect.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.CleanInputAfterCollect.Location = new System.Drawing.Point(231, 218);
-            this.CleanInputAfterCollect.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.CleanInputAfterCollect.Name = "CleanInputAfterCollect";
-            this.CleanInputAfterCollect.Size = new System.Drawing.Size(123, 21);
-            this.CleanInputAfterCollect.TabIndex = 74;
-            this.CleanInputAfterCollect.Text = "采集后清除输入框";
-            this.CleanInputAfterCollect.UseVisualStyleBackColor = true;
-            // 
             // AllCollected
             // 
             this.AllCollected.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -1666,7 +1654,6 @@
             this.Controls.Add(this.ChooseAll);
             this.Controls.Add(this.GetGridOnly);
             this.Controls.Add(this.AllCollected);
-            this.Controls.Add(this.CleanInputAfterCollect);
             this.Controls.Add(this.Fresh);
             this.Controls.Add(this.pi_cardcode_label);
             this.Controls.Add(this.pi_cardcode);
@@ -1809,7 +1796,6 @@
         private System.Windows.Forms.Label pi_cardcode_label;
         private System.Windows.Forms.LinkLabel Fresh;
         private System.Windows.Forms.Label label3;
-        private System.Windows.Forms.CheckBox CleanInputAfterCollect;
         private System.Windows.Forms.Button AllCollected;
         private System.Windows.Forms.LinkLabel LogingOut;
         private System.Windows.Forms.Timer RefreshDBConnect;

+ 15 - 10
UAS-出货标签管理(吉利通)/UAS_出货标签管理.cs

@@ -25,6 +25,8 @@ namespace UAS_LabelMachine
 
         DataHelper dh;
 
+        AccessDBHelper adh;
+
         DataTable dt;
 
         StringBuilder sql = new StringBuilder();
@@ -114,6 +116,10 @@ namespace UAS_LabelMachine
         /// </summary>
         bool AllChecked = false;
         /// <summary>
+        /// 默认采集了指定的数据上传
+        /// </summary>
+        int UploadNum = 100;
+        /// <summary>
         /// 是否获取过箱号
         /// </summary>
         bool GetPackingCode = false;
@@ -131,6 +137,8 @@ namespace UAS_LabelMachine
 
         DataTable Attach;
 
+      
+
         public UAS_出货标签打印(string Master)
         {
             InitializeComponent();
@@ -157,6 +165,7 @@ namespace UAS_LabelMachine
             //用计时器重置数据库链接
             LogManager.DoLog("程序启动,登陆人员【" + User.UserName + "】");
             dh = SystemInf.dh;
+            adh = SystemInf.adh;
             CheckForIllegalCrossThreadCalls = false;
             pi_inoutno.Focus();
             sg_code.FormName = Name;
@@ -334,12 +343,6 @@ namespace UAS_LabelMachine
                     return;
                 }
                 CollectInputData();
-                DataTable savedt = (LabelInf.DataSource as DataTable);
-                if (savedt != null && savedt.GetChanges() != null)
-                {
-                    MidSource.EndEdit();
-                    dh.SaveDataTable(savedt.GetChanges(), "ProdioBarCode", "pib_id");
-                }
             }
         }
 
@@ -587,8 +590,6 @@ namespace UAS_LabelMachine
                 if (LastRowProd != CurrentRowProd)
                     SetOutBoxCapacity(CurrentRowProd);
             }
-            if (CleanInputAfterCollect.Checked)
-                Input.Text = "";
         }
 
         /// <summary>
@@ -1450,7 +1451,7 @@ namespace UAS_LabelMachine
                     MidDoc.Variables.FreeVariables.Item(i + 1).Value = dt.Rows[0][MidDoc.Variables.FreeVariables.Item(i + 1).Name.ToLower()].ToString();
                 if (MidDoc.Variables.FreeVariables.Item(i + 1).Value == "")
                 {
-                    DataRow[] dr1 = Attach.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(i + 1).Name.ToLower()+ "'");
+                    DataRow[] dr1 = Attach.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(i + 1).Name.ToLower() + "'");
                     if (dr1.Length > 0)
                         MidDoc.Variables.FreeVariables.Item(i + 1).Value = dr1[0]["lp_sql"].ToString();
                 }
@@ -1584,6 +1585,11 @@ namespace UAS_LabelMachine
             sql.Append(" pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join sale on sa_code=pib_ordercode ");
             sql.Append("where pib_piid='" + PI_ID + "' order by to_number(pib_outboxcode1),pib_id,pd_prodcode");
             dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+            //获取系统设置的上传数量,如参数异常则默认为100
+            if (!int.TryParse(adh.getFieldDataByCondition("dataextra", "uploadnum", "id=1").ToString(), out UploadNum))
+            {
+                UploadNum = 100;
+            }
             MidSource.DataSource = dt;
             BaseUtil.FillDgvWithDataTable(LabelInf, (DataTable)MidSource.DataSource);
             //有数据的话默认取第一条的品牌去取采集策略
@@ -1891,7 +1897,6 @@ namespace UAS_LabelMachine
             }
             catch (Exception) { }
         }
-        AccessDBHelper adh = new AccessDBHelper("LabelPrint.accdb");
 
         private void ChooseAll_Click(object sender, EventArgs e)
         {