Эх сурвалжийг харах

Merge remote-tracking branch 'refs/remotes/origin/master'

章政 8 жил өмнө
parent
commit
a921330cf7

+ 1 - 1
UAS-出货标签管理/Login.cs

@@ -29,7 +29,7 @@ namespace UAS_LabelMachine
         {
             dh = new DataHelper();
             //获取账套信息
-            dt = (DataTable)dh.ExecuteSql("select ma_function,ms_pwd,ma_user from master where ma_enable<>0", "select");
+            dt = (DataTable)dh.ExecuteSql("select ma_function,ms_pwd,ma_user from datacenter.master where ma_enable<>0", "select");
             MasterCombox.DisplayMember = "ma_function";
             MasterCombox.ValueMember = "ma_user";
             MasterCombox.DataSource = dt;

+ 31 - 4
UAS-出货标签管理/PublicMethod/DataHelper.cs

@@ -21,7 +21,7 @@ namespace UAS_LabelMachine
         //富为外网地址
         //private readonly string ConnectionStrings = "Data Source=richwellgroup.com.cn/orcl;User ID=DATACENTER;PassWord=select!#%*(";
         //怡海能达外网地址
-        private readonly string ConnectionStrings = "Data Source=sz.hi-mantech.com/orcl;User ID=DATACENTER;PassWord=select!#%*(";
+        private readonly string ConnectionStrings = "Data Source=sz.hi-mantech.com/orcl;User ID=YHND_SZ;PassWord=select!#%*(";
         //怡海能达内网地址
         //private readonly string ConnectionStrings = "Data Source=192.168.1.200/orcl;User ID=DATACENTER;PassWord=select!#%*(";
         //用户选择的数据库的连接字符串
@@ -29,6 +29,10 @@ namespace UAS_LabelMachine
         static OracleConnection connection = null;
         static OracleCommand command = null;
         /// <summary>
+        /// 重置连接的次数
+        /// </summary>
+        int ReconnectTime = 0;
+        /// <summary>
         /// 执行构造函数的时候打开数据库的链接
         /// </summary>
         public DataHelper()
@@ -98,7 +102,22 @@ namespace UAS_LabelMachine
             command = new OracleCommand(sql, connection);
             OracleDataAdapter ad = new OracleDataAdapter();
             ad.SelectCommand = command;
-            ad.Fill(dt);
+            try
+            {
+                ad.Fill(dt);
+                ReconnectTime = 0;
+            }
+            catch (Exception)
+            {
+                if (ReconnectTime == 0)
+                {
+                    ReconnectTime++;
+                    connection = new OracleConnection(DBConnectionString);
+                    //成功执行后将重复连接数置为0
+                    dt = (DataTable)getFieldDataByCondition(TableName, Field, Condition);
+                }
+            }
+
             if (dt.Rows.Count > 0)
             {
                 ad.Dispose();
@@ -743,6 +762,7 @@ namespace UAS_LabelMachine
             }
         }
 
+      
         /// <summary>
         /// 直接执行SQL,同时传入SQL的类型
         /// </summary>
@@ -790,11 +810,18 @@ namespace UAS_LabelMachine
                         OracleDataAdapter ad = new OracleDataAdapter(command);
                         ad.Fill((DataTable)result);
                         ad.Dispose();
+                        //成功执行后将重复连接数置为0
+                        ReconnectTime = 0;
                     }
                     catch (Exception)
                     {
-                        connection = new OracleConnection(DBConnectionString);
-                        result = ExecuteSql(SQL, Type, names);
+                        if (ReconnectTime == 0)
+                        {
+                            //重置的数据库链接后只执行一次
+                            ReconnectTime=ReconnectTime+1;
+                            connection = new OracleConnection(DBConnectionString);
+                            result = ExecuteSql(SQL, Type, names);
+                        }
                     }
                     break;
                 case "DELETE":

+ 1 - 0
UAS-出货标签管理/PublicMethod/ftpOperater.cs

@@ -149,6 +149,7 @@ namespace UAS_LabelMachine
                 reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
                 reqFTP.UseBinary = true;
                 reqFTP.Credentials = new NetworkCredential(ftpUser, ftpPwd);
+                reqFTP.UsePassive = true;
                 FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
                 Stream ftpStream = response.GetResponseStream();
                 long cl = response.ContentLength;

+ 5 - 9
UAS-出货标签管理/UAS-出货标签管理.csproj

@@ -100,6 +100,11 @@
     <Reference Include="Analysis">
       <HintPath>tool\Analysis.dll</HintPath>
     </Reference>
+    <Reference Include="Interop.LabelManager2, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <EmbedInteropTypes>False</EmbedInteropTypes>
+      <HintPath>bin\Debug\Interop.LabelManager2.dll</HintPath>
+    </Reference>
     <Reference Include="NPOI">
       <HintPath>tool\NPOI.dll</HintPath>
     </Reference>
@@ -647,15 +652,6 @@
     <None Include="Resources\preview_16px_25980_easyicon.net.png" />
   </ItemGroup>
   <ItemGroup>
-    <COMReference Include="LabelManager2">
-      <Guid>{3624B9C2-9E5D-11D3-A896-00C04F324E22}</Guid>
-      <VersionMajor>6</VersionMajor>
-      <VersionMinor>0</VersionMinor>
-      <Lcid>0</Lcid>
-      <WrapperTool>tlbimp</WrapperTool>
-      <Isolated>False</Isolated>
-      <EmbedInteropTypes>False</EmbedInteropTypes>
-    </COMReference>
     <COMReference Include="stdole">
       <Guid>{00020430-0000-0000-C000-000000000046}</Guid>
       <VersionMajor>2</VersionMajor>

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 187 - 214
UAS-出货标签管理/UAS_出货标签管理.Designer.cs


+ 53 - 33
UAS-出货标签管理/UAS_出货标签管理.cs

@@ -134,8 +134,6 @@ namespace UAS_LabelMachine
         ArrayList<ArrayList<string>> ScanData;
         ArrayList<string> GetData;
 
-
-
         public UAS_出货标签打印()
         {
             InitializeComponent();
@@ -188,29 +186,34 @@ namespace UAS_LabelMachine
 
             CollectionUnit.Text = "盘";
             Point pt = new Point();
-            int ScreenWidth = Screen.GetWorkingArea(pt).Width;
-            //如果分辨率大的设置的字体对应的变大 
-            if (ScreenWidth > 1366)
+            //禁止所有列的排序
+            foreach (DataGridViewColumn dgv in LabelInf.Columns)
             {
-                foreach (Control ctl in Controls)
-                {
-                    if (ctl is CheckBox || ctl is Label || ctl is RadioButton)
-                    {
-                        ctl.Font = new Font("微软雅黑", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
-                    }
-                    if (ctl is GroupBoxWithBorder)
-                    {
-                        GroupBoxWithBorder gb = ctl as GroupBoxWithBorder;
-                        for (int i = 0; i < gb.Controls.Count; i++)
-                        {
-                            if (gb.Controls[i] is CheckBox || gb.Controls[i] is Label || gb.Controls[i] is RadioButton)
-                            {
-                                gb.Controls[i].Font = new Font("微软雅黑", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
-                            }
-                        }
-                    }
-                }
+                dgv.SortMode = DataGridViewColumnSortMode.NotSortable;
             }
+            int ScreenWidth = Screen.GetWorkingArea(pt).Width;
+            //如果分辨率大的设置的字体对应的变大 
+            //if (ScreenWidth > 1366)
+            //{
+            //    foreach (Control ctl in Controls)
+            //    {
+            //        if (ctl is CheckBox || ctl is Label || ctl is RadioButton)
+            //        {
+            //            ctl.Font = new Font("微软雅黑", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
+            //        }
+            //        if (ctl is GroupBoxWithBorder)
+            //        {
+            //            GroupBoxWithBorder gb = ctl as GroupBoxWithBorder;
+            //            for (int i = 0; i < gb.Controls.Count; i++)
+            //            {
+            //                if (gb.Controls[i] is CheckBox || gb.Controls[i] is Label || gb.Controls[i] is RadioButton)
+            //                {
+            //                    gb.Controls[i].Font = new Font("微软雅黑", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
+            //                }
+            //            }
+            //        }
+            //    }
+            //}
             //设置获取当前屏幕大小自动全屏但是保留任务栏
             Rectangle ScreenArea = Screen.GetWorkingArea(this);
             Top = 0;
@@ -1119,6 +1122,25 @@ namespace UAS_LabelMachine
 
         private void SingleBoxPrint()
         {
+            try
+            {
+                if (SingleDoc.Variables.FreeVariables.Count == 0) { }
+            }
+            catch (Exception)
+            {
+                MessageBox.Show("单盘标签未维护参数");
+            }
+            if (MidLabelAutoPrint.Checked)
+            {
+                try
+                {
+                    if (MidDoc.Variables.FreeVariables.Count == 0) { }
+                }
+                catch (Exception)
+                {
+                    MessageBox.Show("中盘标签未维护参数");
+                }
+            }
             string la_id = SingleLabelCombox.SelectedValue.ToString().Split('#')[0];
             string cl_labelname = SingleLabelCombox.Text;
             string LabelUrl = dh.getFieldDataByCondition("label left join customerlabel on la_code=cl_labelcode", "cl_labelurl", "la_id='" + la_id + "' and cl_labelname='" + cl_labelname + "'").ToString();
@@ -1149,10 +1171,10 @@ namespace UAS_LabelMachine
                     return;
                 }
                 //打印的时候如果不存在数据开始缓存
-                if (MidBoxCacheData.Rows.Count == 0)
-                    GetMidBoxData();
                 if (SingleBoxCacheData.Rows.Count == 0)
                     GetSingleBoxData();
+                if (MidBoxCacheData.Rows.Count == 0)
+                    GetMidBoxData();
                 for (int i = 0; i < LabelInf.RowCount; i++)
                 {
                     if (i + 1 < LabelInf.RowCount)
@@ -1207,13 +1229,14 @@ namespace UAS_LabelMachine
                                 }
                                 else if (arg.Contains(SingleDoc.Variables.FreeVariables.Item(j + 1).Name))
                                     SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr[0][SingleDoc.Variables.FreeVariables.Item(j + 1).Name].ToString();
-                                ParamLog.AppendLine("打印参数【" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取到值" + SingleDoc.Variables.FreeVariables.Item(j + 1).Value);
+                                ParamLog.AppendLine("pib_id:" + LabelInf.Rows[i].Cells["pib_id1"].Value.ToString() + ",SingleDoc打印参数【" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取到值" + SingleDoc.Variables.FreeVariables.Item(j + 1).Value);
                             }
                             LogManager.DoLog(ParamLog.ToString());
                             //保存参数打印
                             SingleDoc.Save();
                             SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
                             SingleDoc.PrintDocument();
+                            dh.ExecuteSql("update prodiobarcode set pib_printdate=sysdate where pib_id=:pib_id","select",pib_id);
                             //勾选为已打印
                             LabelInf.Rows[i].Cells["pib_ifprint"].Value = true;
                         }
@@ -1304,7 +1327,7 @@ namespace UAS_LabelMachine
                         string sql = dt.Rows[k]["lp_sql"].ToString();
                         sql = sql.Substring(0, sql.IndexOf("{"));
                         sql = sql.Substring(0, sql.LastIndexOf("="));
-                        DataTable temp = dh.getFieldsDatasByCondition(sql + " in " + pib_id_string.ToString());
+                        DataTable temp = dh.getFieldsDatasByCondition(sql.Replace(" from ", " ,pib_id PIBID from ") + " in " + pib_id_string.ToString() + " ORDER by pib_id");
                         temp.Columns[0].ColumnName = SingleDoc.Variables.FreeVariables.Item(j + 1).Name;
                         AllSingleBoxCacheData.Add(temp);
                     }
@@ -1320,7 +1343,7 @@ namespace UAS_LabelMachine
                     //由于之前加了一个ID列,导致j从1开始
                     for (int j = 1; j < SingleBoxCacheData.Columns.Count; j++)
                     {
-                        dr[Temp[j - 1].Columns[0].ColumnName] = Temp[j - 1].Rows[i][0].ToString();
+                        dr[Temp[j - 1].Columns[0].ColumnName] = (Temp[j - 1].Select("PIBID=" + pib_id_arr[i]))[0][0];
                     }
                     SingleBoxCacheData.Rows.Add(dr);
                 }
@@ -1393,13 +1416,13 @@ namespace UAS_LabelMachine
                         {
                             sql = sql.Substring(0, sql.IndexOf("{")) + pib_id + sql.Substring(sql.IndexOf("}") + 1);
                             sql = sql.Substring(0, sql.LastIndexOf("=")) + " in " + pib_qtycondition_string.ToString() + sql.Substring(sql.LastIndexOf("}") + 1);
-                            Console.WriteLine(sql);
+                            sql = "select * from (" + sql + ") order by instr ('" + pib_qtycondition_string.ToString() + "',pib_outboxcode1)";
                         }
                         else
                         {
                             sql = sql.Substring(0, sql.IndexOf("{"));
                             sql = sql.Substring(0, sql.LastIndexOf("="));
-                            sql = sql + " in " + pib_condition_string.ToString();
+                            sql = sql + " in " + pib_condition_string.ToString() + " order by instr('" + pib_condition_string.ToString() + "',pib_id)";
                         }
                         DataTable temp = dh.getFieldsDatasByCondition(sql);
                         temp.Columns[0].ColumnName = MidDoc.Variables.FreeVariables.Item(j + 1).Name;
@@ -1418,9 +1441,7 @@ namespace UAS_LabelMachine
                     dr["pib_outboxcode1"] = pib_outbox_arr[i];
                     //由于之前加了一个ID列和箱号,导致j从2开始
                     for (int j = 2; j < MidBoxCacheData.Columns.Count; j++)
-                    {
                         dr[Temp[j - 2].Columns[0].ColumnName] = Temp[j - 2].Rows[i][0].ToString();
-                    }
                     MidBoxCacheData.Rows.Add(dr);
                 }
             }
@@ -1587,7 +1608,6 @@ namespace UAS_LabelMachine
                             else
                             {
                                 DataRow[] dr = MidBoxCacheData.Select("pib_outboxcode1='" + pib_outboxcode1 + "'");
-                                Console.WriteLine(pib_outboxcode1);
                                 if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode1"))
                                 {
                                     if (LabelInf.Rows[rowindex].Cells["DateCode1"].Value != null)

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно