Browse Source

生成条码尾数调整

callm 6 years ago
parent
commit
3f1d8a3769

+ 1 - 1
UAS-出货标签管理(贸易版)/Login.cs

@@ -47,7 +47,7 @@ namespace UAS_LabelMachine
             }
             MasterCombox.DisplayMember = "ma_function";
             MasterCombox.ValueMember = "ma_user";
-            MasterCombox.DataSource = MasterDB;
+            MasterCombox.DataSource = dt;
             //读取上次登陆时的用户名和选择的账套
             UserName.Text = Properties.Settings.Default.LastLoginUser;
             MasterCombox.Text = Properties.Settings.Default.LastLoginMaster;

+ 18 - 7
UAS-出货标签管理(贸易版)/PublicMethod/DataHelper.cs

@@ -11,16 +11,27 @@ namespace UAS_LabelMachine
     public class DataHelper
     {
 
-        //海创外网地址
-        private readonly string ConnectionStrings = "Data Source=cmityj.gicp.net/orcl;User ID=HC_TEST;PassWord=select!#%*(";
-        //海创ERP地址
-        public static readonly string ERPAddesss = "http://cmityj.gicp.net:8099/ERP/";
-        //海创FTP
-        public static readonly string FTPAdress = "ftp://cmityj.gicp.net|HCFTP|Admin1@#";
+        ////海创外网地址
+        //private readonly string ConnectionStrings = "Data Source=cmityj.gicp.net/orcl;User ID=HC_TEST;PassWord=select!#%*(";
+        ////海创ERP地址
+        //public static readonly string ERPAddesss = "http://cmityj.gicp.net:8099/ERP/";
+        ////海创FTP
+        //public static readonly string FTPAdress = "ftp://cmityj.gicp.net|HCFTP|Admin1@#";
+        ////Oracle端口
+        //public static readonly string OraclePort = "1521";
+        ////需要显示的账套
+        //public static readonly string Masters = "HC_TEST";
+
+        //凯而高地址
+        private readonly string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=KRG_TEST;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=112.25.154.186)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        //凯而高ERP地址
+        public static readonly string ERPAddesss = "http://112.25.154.186:8099/ERP/";
+        //凯而高FTP
+        public static readonly string FTPAdress = "ftp://112.25.154.186:21|KEGFTP|Admin1@#";
         //Oracle端口
         public static readonly string OraclePort = "1521";
         //需要显示的账套
-        public static readonly string Masters = "HC_TEST";
+        public static readonly string Masters = "GOLDEN";
 
         ////高登地址
         //private readonly string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=DATACENTER;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=183.238.39.179)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";

+ 22 - 15
UAS-出货标签管理(贸易版)/PublicMethod/Print.cs

@@ -22,7 +22,7 @@ namespace UAS_LabelMachine.PublicMethod
                     DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name + "'");
                     if (dr1.Length > 0)
                     {
-                        if (dr1[0]["lp_valuetype"].ToString() == "字符串")
+                        if (dr1[0]["lp_valuetype"].ToString() == "字符串" && dr1[0]["lp_sql"].ToString() != "")
                             sql.Append(dr1[0]["lp_sql"].ToString() + ",");
                     }
                 }
@@ -31,6 +31,10 @@ namespace UAS_LabelMachine.PublicMethod
                 for (int j = 0; j < SingleDoc.Variables.FormVariables.Count; j++)
                 {
                     DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name + "'");
+                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串" && dr1[0]["lp_sql"].ToString() != "")
+                    {
+                        SingleDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
+                    }
                     if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "SQL值")
                     {
                         DataTable dt1 = (DataTable)SystemInf.sdh.ExecuteSql(dr1[0]["lp_sql"].ToString().Replace("{1}", pib_id), "select");
@@ -60,7 +64,7 @@ namespace UAS_LabelMachine.PublicMethod
                 for (int j = 0; j < MidDoc.Variables.FormVariables.Count; j++)
                 {
                     DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name + "'");
-                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
+                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串" && dr1[0]["lp_sql"].ToString() != "")
                     {
                         sql.Append(dr1[0]["lp_sql"].ToString() + ",");
                     }
@@ -70,7 +74,7 @@ namespace UAS_LabelMachine.PublicMethod
                 for (int j = 0; j < MidDoc.Variables.FormVariables.Count; j++)
                 {
                     DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name + "'");
-                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
+                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串" && dr1[0]["lp_sql"].ToString() != "")
                     {
                         MidDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
                     }
@@ -111,7 +115,7 @@ namespace UAS_LabelMachine.PublicMethod
                 for (int j = 0; j < OutBoxDoc.Variables.FormVariables.Count; j++)
                 {
                     DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name + "'");
-                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
+                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串" && dr1[0]["lp_sql"].ToString() != "")
                     {
                         sql.Append(dr1[0]["lp_sql"].ToString() + ",");
                     }
@@ -123,7 +127,7 @@ namespace UAS_LabelMachine.PublicMethod
                     for (int j = 0; j < OutBoxDoc.Variables.FormVariables.Count; j++)
                     {
                         DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name + "'");
-                        if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
+                        if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串" && dr1[0]["lp_sql"].ToString() != "")
                         {
                             OutBoxDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
                         }
@@ -172,10 +176,9 @@ namespace UAS_LabelMachine.PublicMethod
                 for (int j = 0; j < SingleFormat.SubStrings.Count; j++)
                 {
                     DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleFormat.SubStrings[j].Name + "'");
-                    if (dr1.Length > 0)
+                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串" && dr1[0]["lp_sql"].ToString() != "")
                     {
-                        if (dr1[0]["lp_valuetype"].ToString() == "字符串")
-                            sql.Append(dr1[0]["lp_sql"].ToString() + ",");
+                        sql.Append(dr1[0]["lp_sql"].ToString() + ",");
                     }
                 }
                 sql.Append("1,");
@@ -183,6 +186,10 @@ namespace UAS_LabelMachine.PublicMethod
                 for (int j = 0; j < SingleFormat.SubStrings.Count; j++)
                 {
                     DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleFormat.SubStrings[j].Name + "'");
+                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串" && dr1[0]["lp_sql"].ToString() != "")
+                    {
+                        SingleFormat.SubStrings[j].Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
+                    }
                     if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "SQL值")
                     {
                         DataTable dt1 = (DataTable)SystemInf.sdh.ExecuteSql(dr1[0]["lp_sql"].ToString().Replace("{1}", pib_id), "select");
@@ -212,7 +219,7 @@ namespace UAS_LabelMachine.PublicMethod
                 for (int j = 0; j < MidFormat.SubStrings.Count; j++)
                 {
                     DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidFormat.SubStrings[j].Name + "'");
-                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
+                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串" && dr1[0]["lp_sql"].ToString() != "")
                     {
                         sql.Append(dr1[0]["lp_sql"].ToString() + ",");
                     }
@@ -222,7 +229,7 @@ namespace UAS_LabelMachine.PublicMethod
                 for (int j = 0; j < MidFormat.SubStrings.Count; j++)
                 {
                     DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidFormat.SubStrings[j].Name + "'");
-                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
+                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串" && dr1[0]["lp_sql"].ToString() != "")
                     {
                         MidFormat.SubStrings[j].Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
                     }
@@ -263,7 +270,7 @@ namespace UAS_LabelMachine.PublicMethod
                 for (int j = 0; j < OutFormat.SubStrings.Count; j++)
                 {
                     DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutFormat.SubStrings[j].Name + "'");
-                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
+                    if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串" && dr1[0]["lp_sql"].ToString() != "")
                     {
                         sql.Append(dr1[0]["lp_sql"].ToString() + ",");
                     }
@@ -275,7 +282,7 @@ namespace UAS_LabelMachine.PublicMethod
                     for (int j = 0; j < OutFormat.SubStrings.Count; j++)
                     {
                         DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutFormat.SubStrings[j].Name + "'");
-                        if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
+                        if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串" && dr1[0]["lp_sql"].ToString() != "")
                         {
                             OutFormat.SubStrings[j].Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
                         }
@@ -305,9 +312,9 @@ namespace UAS_LabelMachine.PublicMethod
                         }
                         if (OutFormat.SubStrings[j].Value == "")
                         {
-                            //dr1 = UAS_出货标签打印.Attach.Select("lp_name='" + OutFormat.SubStrings[j].Name + "'");
-                            //if (dr1.Length > 0)
-                            //    OutFormat.SubStrings[j].Value = dr1[0]["lp_sql"].ToString();
+                            dr1 = UAS_出货标签打印.Attach.Select("lp_name='" + OutFormat.SubStrings[j].Name + "'");
+                            if (dr1.Length > 0)
+                                OutFormat.SubStrings[j].Value = dr1[0]["lp_sql"].ToString();
                         }
                     }
                     OutFormat.Print();

+ 5 - 1
UAS-出货标签管理(贸易版)/生成条码.cs

@@ -248,7 +248,11 @@ namespace UAS_LabelMachine
                             int num = 0;
                             if (int.TryParse((mid_remain % pr_zxbzs).ToString(), out num))
                             {
-                                count = int.Parse(Math.Floor(mid_remain / pr_zxbzs).ToString());
+                                //如果小于最小包装数就是一条尾数
+                                if (mid_remain > pr_zxbzs)
+                                    count = int.Parse(Math.Floor(mid_remain / pr_zxbzs).ToString());
+                                else
+                                    count = 1;
                             }
                             else
                             {