Browse Source

Merge branch 'master' of ssh://10.10.100.21/source/mes-client

caosy 6 years ago
parent
commit
db0aaf56f8

+ 9 - 0
UAS-出货标签管理(贸易版)/App.config

@@ -59,6 +59,15 @@
       <setting name="OutboxCapacity" serializeAs="String">
         <value>0</value>
       </setting>
+      <setting name="SinglePrinter" serializeAs="String">
+        <value />
+      </setting>
+      <setting name="MidPrinter" serializeAs="String">
+        <value />
+      </setting>
+      <setting name="OutPrinter" serializeAs="String">
+        <value />
+      </setting>
     </UAS_LabelMachine.Properties.Settings>
   </userSettings>
 </configuration>

+ 11 - 6
UAS-出货标签管理(贸易版)/CustomControl/BlurSearch.cs

@@ -8,7 +8,7 @@ namespace UAS_LabelMachine.CustomControl
 {
     public partial class BlurSearch : UserControl
     {
-        DataHelper dh =SystemInf.dh;
+        DataHelper dh = SystemInf.dh;
 
         public delegate void OnTextChange(object sender, EventArgs e);
 
@@ -22,7 +22,7 @@ namespace UAS_LabelMachine.CustomControl
 
         string Field1;
 
-        int ItemSelectIndex = 0;
+        int ItemSelectIndex = -1;
         DataTable dt;
 
         public override string Text
@@ -136,7 +136,7 @@ namespace UAS_LabelMachine.CustomControl
                     con = Field1 + " like '%" + EnterTextBox.Text + "%' and rownum<=5 and " + condition;
                 }
                 dt = dh.getFieldsDatasByCondition(TableName1, new string[] { Field1, valueField, "rownum" }, con.ToUpper());
-                if (dt.Rows.Count > 0)
+                if (dt.Rows.Count > 0 && EnterTextBox.Text != "")
                 {
                     ListBox.Items.Clear();
                     for (int i = 0; i < dt.Rows.Count; i++)
@@ -144,11 +144,16 @@ namespace UAS_LabelMachine.CustomControl
                         ListBox.Items.Add(dt.Rows[i][Field1]);
                     }
                     //每次数据查询之后将索引重置
-                    ItemSelectIndex = 0;
+                    ItemSelectIndex = -1;
                     ListBox.Height = ListBox.ItemHeight * (dt.Rows.Count + 1);
                     ListBox.Visible = true;
                     Height = ListBox.Height + EnterTextBox.Height;
                 }
+                else
+                {
+                    ListBox.Items.Clear();
+                    ListBox.Visible = false;
+                }
                 if (dt.Rows.Count == 1)
                 {
                     value = dt.Rows[0][valueField].ToString();
@@ -215,7 +220,7 @@ namespace UAS_LabelMachine.CustomControl
                 con = Field1 + " like '%" + EnterTextBox.Text + "%' and rownum<=10 and " + condition;
             }
             dt = dh.getFieldsDatasByCondition(TableName1, new string[] { Field1, valueField, "rownum" }, con.ToUpper());
-            if (dt.Rows.Count > 0)
+            if (dt.Rows.Count > 0 && EnterTextBox.Text != "")
             {
                 ListBox.Items.Clear();
                 for (int i = 0; i < dt.Rows.Count; i++)
@@ -223,7 +228,7 @@ namespace UAS_LabelMachine.CustomControl
                     ListBox.Items.Add(dt.Rows[i][Field1]);
                 }
                 //每次数据查询之后将索引重置
-                ItemSelectIndex = 0;
+                ItemSelectIndex = -1;
                 ListBox.Height = ListBox.ItemHeight * (dt.Rows.Count + 1);
                 ListBox.Visible = true;
                 Height = ListBox.Height + EnterTextBox.Height;

+ 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;

+ 9 - 0
UAS-出货标签管理(贸易版)/Properties/Settings.settings

@@ -23,5 +23,14 @@
     <Setting Name="OutboxCapacity" Type="System.Decimal" Scope="User">
       <Value Profile="(Default)">0</Value>
     </Setting>
+    <Setting Name="SinglePrinter" Type="System.String" Scope="User">
+      <Value Profile="(Default)" />
+    </Setting>
+    <Setting Name="MidPrinter" Type="System.String" Scope="User">
+      <Value Profile="(Default)" />
+    </Setting>
+    <Setting Name="OutPrinter" Type="System.String" Scope="User">
+      <Value Profile="(Default)" />
+    </Setting>
   </Settings>
 </SettingsFile>

+ 36 - 0
UAS-出货标签管理(贸易版)/Properties/Settings1.Designer.cs

@@ -106,5 +106,41 @@ namespace UAS_LabelMachine.Properties {
                 this["OutboxCapacity"] = value;
             }
         }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("")]
+        public string SinglePrinter {
+            get {
+                return ((string)(this["SinglePrinter"]));
+            }
+            set {
+                this["SinglePrinter"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("")]
+        public string MidPrinter {
+            get {
+                return ((string)(this["MidPrinter"]));
+            }
+            set {
+                this["MidPrinter"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("")]
+        public string OutPrinter {
+            get {
+                return ((string)(this["OutPrinter"]));
+            }
+            set {
+                this["OutPrinter"] = value;
+            }
+        }
     }
 }

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

@@ -58,6 +58,7 @@ namespace UAS_LabelMachine
             return pd_id + "-" + pr_id + "-" + serialcode;
         }
 
+
         /// <summary>
         /// 筛选DataTable
         /// </summary>

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

@@ -22,6 +22,28 @@ namespace UAS_LabelMachine
         //需要显示的账套
         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 = "GOLDEN";
+
+        ////凯而高
+        //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=192.168.100.12)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        ////凯而高ERP地址
+        //public static readonly string ERPAddesss = "http://192.168.100.11:8099/ERP/";
+        ////凯而高FTP
+        //public static readonly string FTPAdress = "ftp://192.168.100.11:21|KEGFTP|Admin1@#";
+        ////Oracle端口
+        //public static readonly string OraclePort = "1521";
+        ////需要显示的账套
+        //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)));";
         ////高登ERP地址
@@ -341,6 +363,7 @@ namespace UAS_LabelMachine
             string sql = "select ";
             sql += AddField(Fields);
             sql += " from " + TableName + " where " + Condition;
+            Console.WriteLine(sql);
             command = new OracleCommand(sql, connection);
             OracleDataAdapter ad = new OracleDataAdapter(command);
             ad.Fill(dt);

+ 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();

File diff suppressed because it is too large
+ 177 - 206
UAS-出货标签管理(贸易版)/UAS_出货标签管理.Designer.cs


+ 304 - 83
UAS-出货标签管理(贸易版)/UAS_出货标签管理.cs

@@ -199,6 +199,11 @@ namespace UAS_LabelMachine
             sdh.ExecuteZip();
             CheckForIllegalCrossThreadCalls = false;
             CloumnCount = LabelInf.Columns.Count;
+
+            pi_inoutno.TableName = "prodinout";
+            pi_inoutno.Field = "pi_inoutno";
+            pi_inoutno.ValueField = "pi_inoutno";
+            pi_inoutno.Condition = "pi_class in('出货单','拨出单')";
             pi_inoutno.Focus();
             //将本地读取的打印机设置进Combox,并选中默认打印机
             sg_code.FormName = Name;
@@ -232,6 +237,10 @@ namespace UAS_LabelMachine
             Height = ScreenArea.Height;
             MidBoxCapacity.Value = Properties.Settings.Default.MidBoxCapacity;
             OutboxCapacity.Value = Properties.Settings.Default.OutboxCapacity;
+            SingleLabelPrinter.Text= Properties.Settings.Default.SinglePrinter;
+            MidLabelPrinter.Text = Properties.Settings.Default.MidPrinter;
+            OutBoxPrinter.Text = Properties.Settings.Default.OutPrinter;
+
 
             asc.controllInitializeSize(this);
             asc.controlAutoSize(this);
@@ -252,6 +261,7 @@ namespace UAS_LabelMachine
                 engine = new Engine(true);
                 PrintMethod = "BarTender";
             }
+            pi_inoutno.BringToFront();
         }
 
         private void Sg_code_DbChange(object sender, EventArgs e)
@@ -1084,7 +1094,7 @@ namespace UAS_LabelMachine
             if (e.KeyCode == Keys.Enter)
             {
                 sql.Clear();
-                sql.Append("select pi_id,pi_cardcode,to_char(pi_date,'yyyymmdd')pi_date from prodinout where pi_inoutno='" + pi_inoutno.Text + "'");
+                sql.Append("select pi_id,pi_cardcode,pi_class,to_char(pi_date,'yyyymmdd')pi_date from prodinout where pi_inoutno='" + pi_inoutno.Text + "'");
                 dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                 if (dt.Rows.Count > 0)
                 {
@@ -1092,6 +1102,7 @@ namespace UAS_LabelMachine
                     cu_code.Text = dt.Rows[0]["pi_cardcode"].ToString();
                     InitGetLabel = false;
                     pi_date.Text = dt.Rows[0]["pi_date"].ToString();
+                    pi_class.Text = dt.Rows[0]["pi_class"].ToString();
                     PI_ID = dt.Rows[0]["pi_id"].ToString();
                     if (dh.GetConfig("AutoBarcode", "ProdInOut!Sale").ToString() != "")
                     {
@@ -2034,6 +2045,7 @@ namespace UAS_LabelMachine
                         if (SingleFormat != null)
                             SingleFormat.PrintSetup.PrinterName = SingleLabelPrinter.Text;
                     }
+                    Properties.Settings.Default.SinglePrinter = SingleLabelPrinter.Text;
                     break;
                 case "MidLabelPrinter":
                     if (PrintMethod == "CodeSoft")
@@ -2046,6 +2058,7 @@ namespace UAS_LabelMachine
                         if (MidFormat != null)
                             MidFormat.PrintSetup.PrinterName = MidLabelPrinter.Text;
                     }
+                    Properties.Settings.Default.MidPrinter = MidLabelPrinter.Text;
                     break;
                 case "OutBoxPrinter":
                     if (PrintMethod == "CodeSoft")
@@ -2058,10 +2071,12 @@ namespace UAS_LabelMachine
                         if (OutFormat != null)
                             OutFormat.PrintSetup.PrinterName = OutBoxPrinter.Text;
                     }
+                    Properties.Settings.Default.OutPrinter = OutBoxPrinter.Text;
                     break;
                 default:
                     break;
             }
+            Properties.Settings.Default.Save();
         }
 
         private void DocRefresh_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
@@ -2110,7 +2125,8 @@ namespace UAS_LabelMachine
         {
             Menu.Show(new Point(MenuSetting.Location.X, MenuSetting.Location.Y + 20));
         }
-
+        //客户的流水号
+        int custserialnum = 0;
         private void Menu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
         {
             Menu.Close();
@@ -2204,101 +2220,306 @@ namespace UAS_LabelMachine
                     result = ImportExcel.ShowDialog();
                     if (result == DialogResult.OK)
                     {
-                        dt = ExcelHandler.ExcelToDataTable(ImportExcel.FileName, true);
-                        DataTable dt1 = (DataTable)dh.ExecuteSql("select pr_orispeccode,pr_id,pd_piclass,pd_piid,pd_id,pr_zxbzs,pr_brand,pd_pdno,pd_id,pd_prodcode,pd_ordercode,pd_orderdetno from prodiodetail left join product on pd_prodcode=pr_code where pd_inoutno='" + pi_inoutno.Text + "'", "select");
-                        for (int i = 0; i < dt.Rows.Count; i++)
-                        {
-                            ArrayList<string> barcode = new ArrayList<string>();
-                            ArrayList<string> datecode = new ArrayList<string>();
-                            ArrayList<string> lotno = new ArrayList<string>();
-                            ArrayList<string> pib_inqty = new ArrayList<string>();
-                            ArrayList<string> piboutboxcode2 = new ArrayList<string>();
-                            string pr_orispeccode = dt.Rows[i]["规格型号"].ToString();
-                            string qty = dt.Rows[i]["数量"].ToString();
-                            string DateCode = "";
-                            string LotNo = "";
-                            if (dt.Columns.Contains("DC/LOT NO"))
+                        thread = new Thread(ImportBarcode);
+                        stw = new SetLoadingWindow(thread, "正在生成条码");
+                        BaseUtil.SetFormCenter(stw);
+                        stw.ShowDialog();
+                    }
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        //生成客户条码
+        public string BarcodeMethod1(string Prefix, string Suffix, int Index, int Length, int radix)
+        {
+            string str = Prefix;
+            //如果是流水则需要在前面加0
+            string serialcode = BaseUtil.DToAny(custserialnum, radix);
+            for (int j = serialcode.ToString().Length; j < Length; j++)
+            {
+                serialcode = "0" + serialcode;
+            }
+            str += serialcode;
+            str += Suffix;
+            custserialnum = custserialnum + 1;
+            return str;
+        }
+
+        public void ImportBarcode()
+        {
+            try
+            {
+                string Prefix = "";
+
+                string Suffix = "";
+                //客户编号
+                string CustCode = "";
+                //编码规则编号
+                string NrCode = "";
+                DataTable Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_type,nrd_radix,nrd_sql,nrd_length,nr_code,nvl(nrd_iscombine,-1)nrd_iscombine from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode='" + CustCode + "' order by nrd_detno", "select");
+                //如果没有则取公共规则
+                if (Nr.Rows.Count == 0)
+                    Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_radix,nrd_type,nrd_sql,nrd_length,nr_code,nvl(nrd_iscombine,-1)nrd_iscombine from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode is null and nr_isdefault <> 0 order by nrd_detno", "select");
+                //用于过滤参数的正则表达式
+                if (Nr.Rows.Count > 0)
+                {
+                    NrCode = Nr.Rows[0]["nr_code"].ToString();
+                }
+                Regex match = new Regex("{\\w+}");
+                //用于存放每一项的明细的数据
+                string[] NrData = new string[Nr.Rows.Count];
+                //流水号的索引
+                int SerialNumIndex = 0;
+                //流水长度
+                int SerialNumLength = 0;
+                //存放键值对
+                int Radix = 10;
+                string PrefixFixed = "";
+                for (int m = 0; m < Nr.Rows.Count; m++)
+                {
+                    switch (Nr.Rows[m]["nrd_type"].ToString())
+                    {
+                        //常量直接进行拼接
+                        case "常量":
+                            NrData[m] = Nr.Rows[m]["nrd_sql"].ToString();
+                            Prefix += NrData[m];
+                            Suffix += NrData[m];
+                            break;
+                        case "SQL":
+                            string SQL = Nr.Rows[m]["nrd_sql"].ToString();
+                            DataTable Temp;
+                            //如果不包含参数替换
+                            if (SQL.IndexOf("{") == 0)
                             {
-                                DateCode = dt.Rows[i]["DC/LOT NO"].ToString().Split('-')[0];
-                                LotNo = dt.Rows[i]["DC/LOT NO"].ToString().Split('-')[1];
+                                Temp = (DataTable)dh.ExecuteSql(SQL, "select");
                             }
-                            if (dt.Columns.Contains("DC"))
+                            else
                             {
-                                DateCode = dt.Rows[i]["DC"].ToString();
+                                //替换参数后重新执行SQL
+                                foreach (Match mch in match.Matches(SQL))
+                                {
+                                    SQL = SQL.Replace(mch.Value.Trim(), "'" + pi_inoutno.Text + "'");
+                                }
+                                Temp = (DataTable)dh.ExecuteSql(SQL, "select");
                             }
-                            if (dt.Columns.Contains("LOT NO"))
+                            if (Temp.Rows.Count > 0)
                             {
-                                LotNo = dt.Rows[i]["LOT NO"].ToString();
+                                NrData[m] = Temp.Rows[0][0].ToString();
+                                Prefix += NrData[m];
+                                Suffix += NrData[m];
                             }
-                            string pib_outboxcode2 = dt.Rows[i]["箱号"].ToString();
-                            DataRow[] dr = dt1.Select("pr_orispeccode='" + pr_orispeccode + "'");
-                            if (dr.Length == 0)
+                            else
                             {
-                                LogicHandler.FilterData(cu_code.Text, "FUDAN", pr_orispeccode, qty, DateCode, LotNo, out pr_orispeccode, out qty, out DateCode, out LotNo);
-                                dr = dt1.Select("pr_orispeccode='" + pr_orispeccode + "'");
+                                NrData[m] = "";
+                                Prefix += NrData[m];
+                                Suffix += NrData[m];
                             }
-                            else
+                            break;
+                        //流水需要通过MaxNumber去取
+                        case "流水":
+                            NrData[m] = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + NrCode + "'").ToString();
+                            Suffix = "";
+                            PrefixFixed = Prefix;
+                            //设置当前流水
+                            custserialnum = int.Parse(NrData[m] == "" ? "0" : NrData[m]);
+                            SerialNumIndex = m;
+                            SerialNumLength = int.Parse(Nr.Rows[m]["nrd_length"].ToString());
+                            Radix = int.Parse(Nr.Rows[m]["nrd_radix"].ToString());
+                            break;
+                        default:
+                            break;
+                    }
+                }
+                //获取最大的流水号
+                string maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + NrCode + "' and rmn_prefix='" + Prefix + "'").ToString();
+                if (maxnum == "")
+                {
+                    dh.ExecuteSql("insert into RuleMaxNum(rmn_id,rmn_nrcode,rmn_prefix,rmn_maxnumber) values(RuleMaxNum_seq.nextval,'" + NrCode + "','" + Prefix + "','1')", "insert");
+                    custserialnum = 1;
+                }//如果流水号不为空则取当前流水
+                else
+                {
+                    custserialnum = int.Parse(maxnum);
+                }
+                dt = ExcelHandler.ExcelToDataTable(ImportExcel.FileName, true);
+                if (dt == null)
+                {
+                    MessageBox.Show("文件" + ImportExcel.FileName + "被占用");
+                    return;
+                }
+                sql.Clear();
+                sql.Append("select pr_orispeccode,pd_outqty,pr_id,pd_piclass,pd_piid,pd_id,pr_zxbzs,pr_brand,pd_pdno");
+                sql.Append(",pd_prodcode,pd_ordercode,pd_orderdetno from prodiodetail left join product on pd_prodcode=pr_code  ");
+                sql.Append("where pd_inoutno='" + pi_inoutno.Text + "' group by pr_orispeccode,pd_outqty,");
+                sql.Append("pr_id,pd_piclass,pd_piid,pd_id,pr_zxbzs,pr_brand,pd_pdno,pd_id,pd_prodcode,pd_ordercode,pd_orderdetno");
+                DataTable dt1 = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+                //需要插入的参数
+                ArrayList<string> barcode = new ArrayList<string>();
+                ArrayList<string> custbarcode = new ArrayList<string>();
+                ArrayList<string> datecode = new ArrayList<string>();
+                ArrayList<string> lotno = new ArrayList<string>();
+                ArrayList<string> pib_inqty = new ArrayList<string>();
+                ArrayList<string> piboutboxcode2 = new ArrayList<string>();
+                ArrayList<string> pdordercode = new ArrayList<string>();
+                ArrayList<string> pdorderdetno = new ArrayList<string>();
+                ArrayList<string> pdpdno = new ArrayList<string>();
+                ArrayList<string> pdid = new ArrayList<string>();
+                ArrayList<string> prbrand = new ArrayList<string>();
+                ArrayList<string> pdprodcode = new ArrayList<string>();
+                //用于数量的校验
+                Dictionary<string, decimal> sumqty = new Dictionary<string, decimal>();
+                for (int i = 0; i < dt.Rows.Count; i++)
+                {
+                    string pr_orispeccode = dt.Rows[i]["规格型号"].ToString();
+                    string qty = dt.Rows[i]["数量"].ToString();
+                    string DateCode = "";
+                    string LotNo = "";
+                    if (dt.Columns.Contains("DC/LOT NO"))
+                    {
+                        DateCode = dt.Rows[i]["DC/LOT NO"].ToString().Split('-')[0];
+                        LotNo = dt.Rows[i]["DC/LOT NO"].ToString().Split('-')[1];
+                    }
+                    if (dt.Columns.Contains("DC"))
+                    {
+                        DateCode = dt.Rows[i]["DC"].ToString();
+                    }
+                    if (dt.Columns.Contains("LOT NO"))
+                    {
+                        LotNo = dt.Rows[i]["LOT NO"].ToString();
+                    }
+                    string pib_outboxcode2 = dt.Rows[i]["箱号"].ToString();
+                    DataRow[] dr = dt1.Select("pr_orispeccode='" + pr_orispeccode + "'");
+                    if (dr.Length == 0)
+                    {
+                        LogicHandler.FilterData(cu_code.Text, "FUDAN", pr_orispeccode, qty, DateCode, LotNo, out pr_orispeccode, out qty, out DateCode, out LotNo);
+                        dr = dt1.Select("pr_orispeccode='" + pr_orispeccode + "'");
+                    }
+                    else
+                    {
+                        LogicHandler.FilterData(cu_code.Text, dr[0]["pr_brand"].ToString(), pr_orispeccode, qty, DateCode, LotNo, out pr_orispeccode, out qty, out DateCode, out LotNo);
+                    }
+                    if (dr.Length > 0)
+                    {
+                        string pd_orderdetno = dr[0]["pd_orderdetno"].ToString();
+                        string pd_prodcode = dr[0]["pd_prodcode"].ToString();
+                        string pd_ordercode = dr[0]["pd_ordercode"].ToString();
+                        string pd_piid = dr[0]["pd_piid"].ToString();
+                        string pr_brand = dr[0]["pr_brand"].ToString();
+                        string pd_pdno = dr[0]["pd_pdno"].ToString();
+                        string pd_id = dr[0]["pd_id"].ToString();
+                        string pd_piclass = dr[0]["pd_piclass"].ToString();
+                        string pr_id = dr[0]["pr_id"].ToString();
+                        //已导入数量
+                        decimal zxbzs = decimal.Parse(dr[0]["pr_zxbzs"].ToString());
+                        decimal outqty = decimal.Parse(Regex.Replace(qty, @"[^\d]*", ""));
+                        decimal barcodenum = 0;
+                        if (!sumqty.ContainsKey(pr_orispeccode))
+                        {
+                            sumqty.Add(pr_orispeccode, 0);
+                        }
+                        //累计Excel该型号的数量
+                        sumqty[pr_orispeccode] += decimal.Parse(qty);
+                        string pib_barcode = dh.getFieldDataByCondition("prodiobarcode", "max(pib_barcode)", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
+                        if (outqty % zxbzs != 0)
+                        {
+                            barcodenum = Math.Floor(outqty / zxbzs) + 1;
+                            //如果有余数先加上所有最小包最后加尾数
+                            for (int j = 0; j < barcodenum - 1; j++)
                             {
-                                LogicHandler.FilterData(cu_code.Text, dr[0]["pr_brand"].ToString(), pr_orispeccode, qty, DateCode, LotNo, out pr_orispeccode, out qty, out DateCode, out LotNo);
+                                barcode.Add(BaseUtil.BarcodeMethod1(pd_id, pr_id, pib_barcode));
+                                custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
+                                piboutboxcode2.Add(pib_outboxcode2);
+                                pib_inqty.Add(zxbzs);
+                                datecode.Add(DateCode);
+                                lotno.Add(LotNo);
+                                pdordercode.Add(pd_ordercode);
+                                pdorderdetno.Add(pd_orderdetno);
+                                pdpdno.Add(pd_pdno);
+                                pdid.Add(pd_id);
+                                prbrand.Add(pr_brand);
+                                pdprodcode.Add(pd_prodcode);
                             }
-                            if (dr.Length > 0)
+                            custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
+                            barcode.Add(BaseUtil.BarcodeMethod1(pd_id, pr_id, pib_barcode));
+                            pib_inqty.Add(outqty % zxbzs);
+                            piboutboxcode2.Add(pib_outboxcode2);
+                            datecode.Add(DateCode);
+                            lotno.Add(LotNo);
+                            pdordercode.Add(pd_ordercode);
+                            pdorderdetno.Add(pd_orderdetno);
+                            pdpdno.Add(pd_pdno);
+                            pdid.Add(pd_id);
+                            prbrand.Add(pr_brand);
+                            pdprodcode.Add(pd_prodcode);
+                        }
+                        else
+                        {
+                            barcodenum = outqty / zxbzs;
+                            for (int j = 0; j < barcodenum; j++)
                             {
-                                string pd_orderdetno = dr[0]["pd_orderdetno"].ToString();
-                                string pd_prodcode = dr[0]["pd_prodcode"].ToString();
-                                string pd_ordercode = dr[0]["pd_ordercode"].ToString();
-                                string pd_piid = dr[0]["pd_piid"].ToString();
-                                string pr_brand = dr[0]["pr_brand"].ToString();
-                                string pd_pdno = dr[0]["pd_pdno"].ToString();
-                                string pd_id = dr[0]["pd_id"].ToString();
-                                string pd_piclass = dr[0]["pd_piclass"].ToString();
-                                string pr_id = dr[0]["pr_id"].ToString();
-                                decimal zxbzs = decimal.Parse(dr[0]["pr_zxbzs"].ToString());
-                                decimal outqty = decimal.Parse(Regex.Replace(qty, @"[^\d]*", ""));
-                                decimal barcodenum = 0;
-                                string pib_barcode = dh.getFieldDataByCondition("prodiobarcode", "max(pib_barcode)", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
-                                if (outqty % zxbzs != 0)
-                                {
-                                    barcodenum = Math.Floor(outqty / zxbzs) + 1;
-                                    //如果有余数先加上所有最小包最后加尾数
-                                    for (int j = 0; j < barcodenum - 1; j++)
-                                    {
-                                        barcode.Add(BaseUtil.BarcodeMethod1(pd_id, pr_id, pib_barcode));
-                                        piboutboxcode2.Add(pib_outboxcode2);
-                                        pib_inqty.Add(zxbzs);
-                                        datecode.Add(DateCode);
-                                        lotno.Add(LotNo);
-                                    }
-                                    barcode.Add(BaseUtil.BarcodeMethod1(pd_id, pr_id, pib_barcode));
-                                    pib_inqty.Add(outqty % zxbzs);
-                                    piboutboxcode2.Add(pib_outboxcode2);
-                                    datecode.Add(DateCode);
-                                    lotno.Add(LotNo);
-                                }
-                                else
-                                {
-                                    barcodenum = outqty / zxbzs;
-                                    for (int j = 0; j < barcodenum; j++)
-                                    {
-                                        barcode.Add(BaseUtil.BarcodeMethod1(pd_id, pr_id, pib_barcode));
-                                        pib_inqty.Add(zxbzs);
-                                        piboutboxcode2.Add(pib_outboxcode2);
-                                        datecode.Add(DateCode);
-                                        lotno.Add(LotNo);
-                                    }
-                                }
-                                sql.Clear();
-                                sql.Append("insert into prodiobarcode (PIB_ID,PIB_PRODCODE,pib_inman,PIB_INDATE,PIB_INOUTNO,PIB_PIID,pib_brand,PIB_BARCODE,PIB_PDNO,");
-                                sql.Append("PIB_PDID,PIB_PICLASS,PIB_QTY,pib_datecode,pib_lotno,PIB_OUTBOXCODE1,PIB_IFPRINT,PIB_IFPICK,PIB_ORDERCODE,pib_orderdetno,pib_outboxcode2)");
-                                sql.Append(" values (prodiobarcode_seq.nextval,'" + pd_prodcode + "','" + User.UserName + "',sysdate,'" + pi_inoutno.Text + "'");
-                                sql.Append("," + pd_piid + ",'" + pr_brand + "',:barcode,'" + pd_pdno + "','" + pd_id + "',");
-                                sql.Append("'" + pd_piclass + "',:pib_inqty,:pib_datecode,:pib_lotno,0,0,'" + pd_ordercode + "','','" + pd_orderdetno + "',:outboxcode)");
-                                dh.BatchInsert(sql.ToString(), new string[] { "barcode", "pib_inqty", "pib_datecode", "pib_lotno", "outboxcode" }, barcode.ToArray(), pib_inqty.ToArray(), datecode.ToArray(), lotno.ToArray(), piboutboxcode2.ToArray());
+                                barcode.Add(BaseUtil.BarcodeMethod1(pd_id, pr_id, pib_barcode));
+                                custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
+                                pib_inqty.Add(zxbzs);
+                                piboutboxcode2.Add(pib_outboxcode2);
+                                datecode.Add(DateCode);
+                                lotno.Add(LotNo);
+                                pdordercode.Add(pd_ordercode);
+                                pdorderdetno.Add(pd_orderdetno);
+                                pdpdno.Add(pd_pdno);
+                                pdid.Add(pd_id);
+                                prbrand.Add(pr_brand);
+                                pdprodcode.Add(pd_prodcode);
                             }
                         }
                     }
-                    break;
-                default:
-                    break;
+                }
+                //插叙所有的统计数量
+                string ErrMsg = "";
+                foreach (var item in sumqty)
+                {
+                    dt = (DataTable)dh.ExecuteSql("select nvl(sum(pd_outqty),0)pd_outqty,pr_orispeccode from prodiodetail left join product on pr_code=pd_prodcode where pd_piid=" + PI_ID + "group by pr_orispeccode", "select");
+                    dt1 = (DataTable)dh.ExecuteSql("select nvl(sum(pib_qty),0)pib_qty,pr_orispeccode  from prodiobarcode left join product on pib_prodcode=pr_code where pib_piid=" + PI_ID + " group by pr_orispeccode", "select");
+                    DataRow[] dr = dt.Select("pr_orispeccode='" + item.Key + "'");
+                    DataRow[] dr1 = dt1.Select("pr_orispeccode='" + item.Key + "'");
+                    if (dr.Length > 0)
+                    {
+                        decimal pd_outqty = decimal.Parse(dr[0]["pd_outqty"].ToString());
+                        decimal pib_qty = 0;
+                        //如果有已导入的数量
+                        if (dr1.Length > 0)
+                        {
+                            pib_qty = decimal.Parse(dr1[0]["pib_qty"].ToString());
+                        }
+                        //本次导入的数量和原有导入数量累加和出库数量做对比
+                        if (pd_outqty < item.Value + pib_qty)
+                        {
+                            ErrMsg += "型号" + dr[0]["pr_orispeccode"].ToString() + "出货数量" + pd_outqty + ",已导入数量" + pib_qty + ",本次导入" + item.Value + ",超出数量" + (item.Value + pib_qty - pd_outqty) + "\n";
+                        }
+                    }
+                }
+                if (ErrMsg == "")
+                {
+                    sql.Clear();
+                    sql.Append("insert into prodiobarcode (PIB_ID,PIB_PRODCODE,pib_inman,PIB_INDATE,PIB_INOUTNO,PIB_PIID,pib_brand,PIB_BARCODE,PIB_PDNO,");
+                    sql.Append("PIB_PDID,PIB_PICLASS,PIB_QTY,pib_datecode,pib_lotno,PIB_OUTBOXCODE1,PIB_IFPRINT,PIB_IFPICK,PIB_ORDERCODE,pib_orderdetno,pib_outboxcode2,pib_custbarcode)");
+                    sql.Append(" values (prodiobarcode_seq.nextval,:pd_prodcode,'" + User.UserName + "',sysdate,'" + pi_inoutno.Text + "'");
+                    sql.Append("," + PI_ID + ",:pr_brand,:barcode,:pd_pdno,:pd_id,");
+                    sql.Append("'" + pi_class.Text + "',:pib_inqty,:pib_datecode,:pib_lotno,0,0,:pd_ordercode,'',:pd_orderdetno,:outboxcode,:custbarcode)");
+                    dh.BatchInsert(sql.ToString(), new string[] { "pd_prodcode", "pr_brand", "barcode", "pd_pdno", "pd_id", "pib_inqty", "pib_datecode", "pib_lotno", "pd_ordercode", "pd_orderdetno", "outboxcode", "custbarcode" }, pdprodcode.ToArray(), prbrand.ToArray(), barcode.ToArray(), pdpdno.ToArray(), pdid.ToArray(), pib_inqty.ToArray(), datecode.ToArray(), lotno.ToArray(), pdordercode.ToArray(), pdorderdetno.ToArray(), piboutboxcode2.ToArray(), custbarcode.ToArray());
+                    //更新流水
+                    dh.UpdateByCondition("RuleMaxNum", "rmn_maxnumber='" + custserialnum + "'", "rmn_nrcode='" + NrCode + "' and rmn_prefix='" + Prefix + "'");
+                    LoadGridData();
+                }
+                else
+                {
+                    MessageBox.Show(ErrMsg, "超出数量提醒");
+                }
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.Message);
             }
         }
     }

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

@@ -248,7 +248,16 @@ 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)
+                                {
+                                    if (mid_remain % pr_zxbzs != 0)
+                                        count = int.Parse(Math.Floor(mid_remain / pr_zxbzs).ToString()) + 1;
+                                    else
+                                        count = int.Parse(Math.Floor(mid_remain / pr_zxbzs).ToString());
+                                }
+                                else
+                                    count = 1;
                             }
                             else
                             {
@@ -497,7 +506,7 @@ namespace UAS_LabelMachine
                         sql.Append("pd_prodcode,pd_piclass,outqty-nvl((select sum(nvl(pib_qty,0)) from PRODIOBARCODE where PIB_PIID=pd_piid and pib_pdno=pd_pdno ),0)pd_qty ");
                         sql.Append("from (select pd_piid,min(pd_id) pd_id,sum(pd_outqty)outqty,pd_ordercode,pd_orderdetno,pd_pdno,max(pd_prodcode)pd_prodcode,max(pd_piclass)pd_piclass ");
                         sql.Append("from prodiodetail  group by pd_piid,pd_ordercode, pd_orderdetno,pd_pdno)T left join product ");
-                        sql.Append("on pr_code=pd_prodcode)  where  pd_piid='" + pi_id + "'");
+                        sql.Append("on pr_code=pd_prodcode)  where  pd_piid='" + pi_id + "' order by pd_pdno");
                         break;
                     case "完工入库单":
                         sql.Clear();
@@ -506,7 +515,7 @@ namespace UAS_LabelMachine
                         sql.Append("pd_prodcode,pd_piclass,inqty-nvl((select sum(nvl(pib_qty,0)) from PRODIOBARCODE where PIB_PIID=pd_piid and pib_pdno=pd_pdno ),0)pd_qty ");
                         sql.Append("from (select pd_piid,min(pd_id) pd_id,sum(pd_inqty)inqty,pd_ordercode,pd_orderdetno,pd_pdno,max(pd_prodcode)pd_prodcode,max(pd_piclass)pd_piclass ");
                         sql.Append("from prodiodetail  group by pd_piid,pd_ordercode, pd_orderdetno,pd_pdno)T left join product ");
-                        sql.Append("on pr_code=pd_prodcode )  where  pd_piid='" + pi_id + "'");
+                        sql.Append("on pr_code=pd_prodcode )  where  pd_piid='" + pi_id + "' order by pd_pdno");
                         break;
                     default:
                         break;

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

@@ -11,16 +11,16 @@ namespace UAS_LabelMachine
     public class DataHelper
     {
 
-        //富为外网地址
-        private readonly string ConnectionStrings = "Data Source=richwellgroup.com.cn/orcl;User ID=DATACENTER;PassWord=select!#%*(";
-        //富为ERP地址
-        public static readonly string ERPAddesss = "http://richwellgroup.com.cn:8099/ERP/";
-        //富为FTP
-        public static readonly string FTPAdress = "ftp://richwellgroup.com.cn|printuser|printuser";
-        //Oracle端口
-        public static readonly string OraclePort = "1521";
-        //需要显示的账套
-        public static readonly string Masters = "JDTSY,FW_JDT,N_DATACENTER,FY_TEST,JD_TEST,XY_TEST,FW_TEST,DATACENTER,FW,XY,FY";
+        ////富为外网地址
+        //private readonly string ConnectionStrings = "Data Source=richwellgroup.com.cn/orcl;User ID=DATACENTER;PassWord=select!#%*(";
+        ////富为ERP地址
+        //public static readonly string ERPAddesss = "http://richwellgroup.com.cn:8099/ERP/";
+        ////富为FTP
+        //public static readonly string FTPAdress = "ftp://richwellgroup.com.cn|printuser|printuser";
+        ////Oracle端口
+        //public static readonly string OraclePort = "1521";
+        ////需要显示的账套
+        //public static readonly string Masters = "JDTSY,FW_JDT,N_DATACENTER,FY_TEST,JD_TEST,XY_TEST,FW_TEST,DATACENTER,FW,XY,FY";
 
         ////高登地址
         //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)));";
@@ -34,16 +34,16 @@ namespace UAS_LabelMachine
         ////需要显示的账套
         //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=sz.hi-mantech.com)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
-        ////怡海能达ERP地址
-        //public static readonly string ERPAddesss = "http://sz.hi-mantech.com:8099/ERP/";
-        ////怡海能达FTP
-        //public static readonly string FTPAdress = "ftp://sz.hi-mantech.com:46688|yhndftp|Stga28ytG8";
-        ////Oracle端口
-        //public static readonly string OraclePort = "1521";
-        ////需要显示的账套
-        //public static readonly string Masters = "YHND_SZ,YHND_HK,DATACENTER";
+        //怡海能达外网地址
+        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=sz.hi-mantech.com)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        //怡海能达ERP地址
+        public static readonly string ERPAddesss = "http://sz.hi-mantech.com:8099/ERP/";
+        //怡海能达FTP
+        public static readonly string FTPAdress = "ftp://sz.hi-mantech.com:46688|yhndftp|Stga28ytG8";
+        //Oracle端口
+        public static readonly string OraclePort = "1521";
+        //需要显示的账套
+        public static readonly string Masters = "YHND_SZ,YHND_HK,DATACENTER,YITOA_ZX,T_YHND_HK";
 
         ////华商龙外网地址
         //private readonly string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=YITOA_DATACENTER;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=218.18.115.198)(PORT=1523)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";

+ 230 - 230
UAS-出货标签管理/UAS_出货标签管理.Designer.cs

@@ -125,31 +125,6 @@
             this.sg_code = new UAS_LabelMachine.CustomControl.SearchTextBox();
             this.MessageLog = new UAS_LabelMachine.CustomControl.RichText.RichTextAutoBottom();
             this.LabelInf = new UAS_LabelMachine.CustomControl.DataGridViewWithSerialNum();
-            this.Choose = new System.Windows.Forms.DataGridViewCheckBoxColumn();
-            this.pib_ifpick = new System.Windows.Forms.DataGridViewCheckBoxColumn();
-            this.pib_ifprint = new System.Windows.Forms.DataGridViewCheckBoxColumn();
-            this.pib_id1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_pdno = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pr_vendprodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_brand = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_madein = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pr_zxbzs = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pr_unit = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_lotno = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_datecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_cusbarcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_cusoutboxcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_datecode1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_qty = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_barcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_custbarcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pd_pocode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pd_custprodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pd_custprodspec = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pr_spec = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_outboxcode1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_outboxcode2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pi_inoutno = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.SingleLabel = new UAS_LabelMachine.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
             this.CancelOPPOPlate = new System.Windows.Forms.Button();
@@ -181,6 +156,31 @@
             this.OutBoxLabelPrint = new System.Windows.Forms.Button();
             this.OutBoxLabelAutoPrint = new System.Windows.Forms.CheckBox();
             this.OutBoxCombox = new System.Windows.Forms.ComboBox();
+            this.Choose = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+            this.pib_ifpick = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+            this.pib_ifprint = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+            this.pib_id1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_pdno = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_vendprodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_brand = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_madein = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_zxbzs = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_unit = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_lotno = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_datecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_datecode1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_cusbarcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_cusoutboxcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_qty = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_barcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_custbarcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pd_pocode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pd_custprodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pd_custprodspec = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_spec = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_outboxcode1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_outboxcode2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             ((System.ComponentModel.ISupportInitialize)(this.Si_ItemDGV)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.MidSource)).BeginInit();
             this.groupBoxWithBorder1.SuspendLayout();
@@ -1172,9 +1172,9 @@
             this.pr_unit,
             this.pib_lotno,
             this.pib_datecode,
+            this.pib_datecode1,
             this.pib_cusbarcode,
             this.pib_cusoutboxcode,
-            this.pib_datecode1,
             this.pib_qty,
             this.pib_barcode,
             this.pib_custbarcode,
@@ -1195,204 +1195,6 @@
             this.LabelInf.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.LabelInf_CellValueChanged);
             this.LabelInf.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.LabelInf_DataError);
             // 
-            // Choose
-            // 
-            this.Choose.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.Choose.HeaderText = "勾选";
-            this.Choose.Name = "Choose";
-            this.Choose.Resizable = System.Windows.Forms.DataGridViewTriState.True;
-            this.Choose.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
-            this.Choose.Width = 55;
-            // 
-            // pib_ifpick
-            // 
-            this.pib_ifpick.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.pib_ifpick.DataPropertyName = "pib_ifpick";
-            this.pib_ifpick.HeaderText = "已采集";
-            this.pib_ifpick.Name = "pib_ifpick";
-            this.pib_ifpick.Width = 60;
-            // 
-            // pib_ifprint
-            // 
-            this.pib_ifprint.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.pib_ifprint.DataPropertyName = "pib_ifprint";
-            this.pib_ifprint.HeaderText = "已打印";
-            this.pib_ifprint.Name = "pib_ifprint";
-            this.pib_ifprint.Width = 60;
-            // 
-            // pib_id1
-            // 
-            this.pib_id1.DataPropertyName = "pib_id";
-            this.pib_id1.HeaderText = "pib_id";
-            this.pib_id1.Name = "pib_id1";
-            this.pib_id1.Visible = false;
-            this.pib_id1.Width = 66;
-            // 
-            // pib_pdno
-            // 
-            this.pib_pdno.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.pib_pdno.DataPropertyName = "pib_pdno";
-            this.pib_pdno.HeaderText = "明细序号";
-            this.pib_pdno.Name = "pib_pdno";
-            this.pib_pdno.ReadOnly = true;
-            this.pib_pdno.Width = 96;
-            // 
-            // pib_prodcode
-            // 
-            this.pib_prodcode.DataPropertyName = "pib_prodcode";
-            this.pib_prodcode.HeaderText = "物料编号";
-            this.pib_prodcode.Name = "pib_prodcode";
-            this.pib_prodcode.ReadOnly = true;
-            this.pib_prodcode.Width = 78;
-            // 
-            // pr_vendprodcode
-            // 
-            this.pr_vendprodcode.DataPropertyName = "pr_vendprodcode";
-            this.pr_vendprodcode.HeaderText = "MPN";
-            this.pr_vendprodcode.Name = "pr_vendprodcode";
-            this.pr_vendprodcode.ReadOnly = true;
-            this.pr_vendprodcode.Width = 48;
-            // 
-            // pib_brand
-            // 
-            this.pib_brand.DataPropertyName = "pib_brand";
-            this.pib_brand.HeaderText = "品牌";
-            this.pib_brand.Name = "pib_brand";
-            this.pib_brand.ReadOnly = true;
-            this.pib_brand.Width = 54;
-            // 
-            // pib_madein
-            // 
-            this.pib_madein.DataPropertyName = "pib_madein";
-            this.pib_madein.HeaderText = "产地";
-            this.pib_madein.Name = "pib_madein";
-            this.pib_madein.Width = 54;
-            // 
-            // pr_zxbzs
-            // 
-            this.pr_zxbzs.DataPropertyName = "pr_zxbzs";
-            this.pr_zxbzs.HeaderText = "最小包装数";
-            this.pr_zxbzs.Name = "pr_zxbzs";
-            this.pr_zxbzs.Visible = false;
-            this.pr_zxbzs.Width = 90;
-            // 
-            // pr_unit
-            // 
-            this.pr_unit.DataPropertyName = "pr_unit";
-            this.pr_unit.HeaderText = "单位";
-            this.pr_unit.Name = "pr_unit";
-            this.pr_unit.Visible = false;
-            this.pr_unit.Width = 54;
-            // 
-            // pib_lotno
-            // 
-            this.pib_lotno.DataPropertyName = "pib_lotno";
-            this.pib_lotno.HeaderText = "LotNo";
-            this.pib_lotno.Name = "pib_lotno";
-            this.pib_lotno.Width = 60;
-            // 
-            // pib_datecode
-            // 
-            this.pib_datecode.DataPropertyName = "pib_datecode";
-            this.pib_datecode.HeaderText = "DateCode";
-            this.pib_datecode.Name = "pib_datecode";
-            this.pib_datecode.Width = 78;
-            // 
-            // pib_cusbarcode
-            // 
-            this.pib_cusbarcode.DataPropertyName = "pib_cusbarcode";
-            this.pib_cusbarcode.HeaderText = "ViVo条码号";
-            this.pib_cusbarcode.Name = "pib_cusbarcode";
-            this.pib_cusbarcode.Width = 90;
-            // 
-            // pib_cusoutboxcode
-            // 
-            this.pib_cusoutboxcode.DataPropertyName = "pib_cusoutboxcode";
-            this.pib_cusoutboxcode.HeaderText = "ViVo外箱";
-            this.pib_cusoutboxcode.Name = "pib_cusoutboxcode";
-            this.pib_cusoutboxcode.Width = 78;
-            // 
-            // pib_datecode1
-            // 
-            this.pib_datecode1.DataPropertyName = "pib_datecode1";
-            this.pib_datecode1.HeaderText = "DateCode1";
-            this.pib_datecode1.Name = "pib_datecode1";
-            this.pib_datecode1.Visible = false;
-            this.pib_datecode1.Width = 84;
-            // 
-            // pib_qty
-            // 
-            this.pib_qty.DataPropertyName = "pib_qty";
-            this.pib_qty.HeaderText = "数量";
-            this.pib_qty.Name = "pib_qty";
-            this.pib_qty.ReadOnly = true;
-            this.pib_qty.Width = 54;
-            // 
-            // pib_barcode
-            // 
-            this.pib_barcode.DataPropertyName = "pib_barcode";
-            this.pib_barcode.HeaderText = "唯一条码";
-            this.pib_barcode.Name = "pib_barcode";
-            this.pib_barcode.ReadOnly = true;
-            this.pib_barcode.Width = 78;
-            // 
-            // pib_custbarcode
-            // 
-            this.pib_custbarcode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
-            this.pib_custbarcode.DataPropertyName = "pib_custbarcode";
-            this.pib_custbarcode.HeaderText = "客户条码";
-            this.pib_custbarcode.Name = "pib_custbarcode";
-            this.pib_custbarcode.ReadOnly = true;
-            this.pib_custbarcode.Width = 78;
-            // 
-            // pd_pocode
-            // 
-            this.pd_pocode.DataPropertyName = "pd_pocode";
-            this.pd_pocode.HeaderText = "客户PO";
-            this.pd_pocode.Name = "pd_pocode";
-            this.pd_pocode.ReadOnly = true;
-            this.pd_pocode.Width = 66;
-            // 
-            // pd_custprodcode
-            // 
-            this.pd_custprodcode.DataPropertyName = "pd_custprodcode";
-            this.pd_custprodcode.HeaderText = "客户料号";
-            this.pd_custprodcode.Name = "pd_custprodcode";
-            this.pd_custprodcode.ReadOnly = true;
-            this.pd_custprodcode.Width = 78;
-            // 
-            // pd_custprodspec
-            // 
-            this.pd_custprodspec.DataPropertyName = "pd_custprodspec";
-            this.pd_custprodspec.HeaderText = "客户型号";
-            this.pd_custprodspec.Name = "pd_custprodspec";
-            this.pd_custprodspec.ReadOnly = true;
-            this.pd_custprodspec.Width = 78;
-            // 
-            // pr_spec
-            // 
-            this.pr_spec.DataPropertyName = "pr_spec";
-            this.pr_spec.HeaderText = "规格";
-            this.pr_spec.Name = "pr_spec";
-            this.pr_spec.Visible = false;
-            this.pr_spec.Width = 54;
-            // 
-            // pib_outboxcode1
-            // 
-            this.pib_outboxcode1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.pib_outboxcode1.DataPropertyName = "pib_outboxcode1";
-            this.pib_outboxcode1.HeaderText = "中盒号";
-            this.pib_outboxcode1.Name = "pib_outboxcode1";
-            this.pib_outboxcode1.Width = 90;
-            // 
-            // pib_outboxcode2
-            // 
-            this.pib_outboxcode2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
-            this.pib_outboxcode2.DataPropertyName = "pib_outboxcode2";
-            this.pib_outboxcode2.HeaderText = "外箱号";
-            this.pib_outboxcode2.Name = "pib_outboxcode2";
-            this.pib_outboxcode2.Width = 90;
-            // 
             // pi_inoutno
             // 
             this.pi_inoutno.ID = null;
@@ -1780,6 +1582,204 @@
             this.OutBoxCombox.TabIndex = 78;
             this.OutBoxCombox.SelectedIndexChanged += new System.EventHandler(this.OutBoxCombox_SelectedIndexChanged);
             // 
+            // Choose
+            // 
+            this.Choose.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.Choose.DataPropertyName = "Choose";
+            this.Choose.HeaderText = "勾选";
+            this.Choose.Name = "Choose";
+            this.Choose.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+            this.Choose.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+            this.Choose.Width = 55;
+            // 
+            // pib_ifpick
+            // 
+            this.pib_ifpick.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.pib_ifpick.DataPropertyName = "pib_ifpick";
+            this.pib_ifpick.HeaderText = "已采集";
+            this.pib_ifpick.Name = "pib_ifpick";
+            this.pib_ifpick.Width = 60;
+            // 
+            // pib_ifprint
+            // 
+            this.pib_ifprint.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.pib_ifprint.DataPropertyName = "pib_ifprint";
+            this.pib_ifprint.HeaderText = "已打印";
+            this.pib_ifprint.Name = "pib_ifprint";
+            this.pib_ifprint.Width = 60;
+            // 
+            // pib_id1
+            // 
+            this.pib_id1.DataPropertyName = "pib_id";
+            this.pib_id1.HeaderText = "pib_id";
+            this.pib_id1.Name = "pib_id1";
+            this.pib_id1.Visible = false;
+            this.pib_id1.Width = 66;
+            // 
+            // pib_pdno
+            // 
+            this.pib_pdno.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.pib_pdno.DataPropertyName = "pib_pdno";
+            this.pib_pdno.HeaderText = "明细序号";
+            this.pib_pdno.Name = "pib_pdno";
+            this.pib_pdno.ReadOnly = true;
+            this.pib_pdno.Width = 96;
+            // 
+            // pib_prodcode
+            // 
+            this.pib_prodcode.DataPropertyName = "pib_prodcode";
+            this.pib_prodcode.HeaderText = "物料编号";
+            this.pib_prodcode.Name = "pib_prodcode";
+            this.pib_prodcode.ReadOnly = true;
+            this.pib_prodcode.Width = 78;
+            // 
+            // pr_vendprodcode
+            // 
+            this.pr_vendprodcode.DataPropertyName = "pr_vendprodcode";
+            this.pr_vendprodcode.HeaderText = "MPN";
+            this.pr_vendprodcode.Name = "pr_vendprodcode";
+            this.pr_vendprodcode.ReadOnly = true;
+            this.pr_vendprodcode.Width = 48;
+            // 
+            // pib_brand
+            // 
+            this.pib_brand.DataPropertyName = "pib_brand";
+            this.pib_brand.HeaderText = "品牌";
+            this.pib_brand.Name = "pib_brand";
+            this.pib_brand.ReadOnly = true;
+            this.pib_brand.Width = 54;
+            // 
+            // pib_madein
+            // 
+            this.pib_madein.DataPropertyName = "pib_madein";
+            this.pib_madein.HeaderText = "产地";
+            this.pib_madein.Name = "pib_madein";
+            this.pib_madein.Width = 54;
+            // 
+            // pr_zxbzs
+            // 
+            this.pr_zxbzs.DataPropertyName = "pr_zxbzs";
+            this.pr_zxbzs.HeaderText = "最小包装数";
+            this.pr_zxbzs.Name = "pr_zxbzs";
+            this.pr_zxbzs.Visible = false;
+            this.pr_zxbzs.Width = 90;
+            // 
+            // pr_unit
+            // 
+            this.pr_unit.DataPropertyName = "pr_unit";
+            this.pr_unit.HeaderText = "单位";
+            this.pr_unit.Name = "pr_unit";
+            this.pr_unit.Visible = false;
+            this.pr_unit.Width = 54;
+            // 
+            // pib_lotno
+            // 
+            this.pib_lotno.DataPropertyName = "pib_lotno";
+            this.pib_lotno.HeaderText = "LotNo";
+            this.pib_lotno.Name = "pib_lotno";
+            this.pib_lotno.Width = 60;
+            // 
+            // pib_datecode
+            // 
+            this.pib_datecode.DataPropertyName = "pib_datecode";
+            this.pib_datecode.HeaderText = "DC年月日";
+            this.pib_datecode.Name = "pib_datecode";
+            this.pib_datecode.Width = 78;
+            // 
+            // pib_datecode1
+            // 
+            this.pib_datecode1.DataPropertyName = "pib_datecode1";
+            this.pib_datecode1.HeaderText = "DC年周";
+            this.pib_datecode1.Name = "pib_datecode1";
+            this.pib_datecode1.Width = 66;
+            // 
+            // pib_cusbarcode
+            // 
+            this.pib_cusbarcode.DataPropertyName = "pib_cusbarcode";
+            this.pib_cusbarcode.HeaderText = "ViVo条码号";
+            this.pib_cusbarcode.Name = "pib_cusbarcode";
+            this.pib_cusbarcode.Width = 90;
+            // 
+            // pib_cusoutboxcode
+            // 
+            this.pib_cusoutboxcode.DataPropertyName = "pib_cusoutboxcode";
+            this.pib_cusoutboxcode.HeaderText = "ViVo外箱";
+            this.pib_cusoutboxcode.Name = "pib_cusoutboxcode";
+            this.pib_cusoutboxcode.Width = 78;
+            // 
+            // pib_qty
+            // 
+            this.pib_qty.DataPropertyName = "pib_qty";
+            this.pib_qty.HeaderText = "数量";
+            this.pib_qty.Name = "pib_qty";
+            this.pib_qty.ReadOnly = true;
+            this.pib_qty.Width = 54;
+            // 
+            // pib_barcode
+            // 
+            this.pib_barcode.DataPropertyName = "pib_barcode";
+            this.pib_barcode.HeaderText = "唯一条码";
+            this.pib_barcode.Name = "pib_barcode";
+            this.pib_barcode.ReadOnly = true;
+            this.pib_barcode.Width = 78;
+            // 
+            // pib_custbarcode
+            // 
+            this.pib_custbarcode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
+            this.pib_custbarcode.DataPropertyName = "pib_custbarcode";
+            this.pib_custbarcode.HeaderText = "客户条码";
+            this.pib_custbarcode.Name = "pib_custbarcode";
+            this.pib_custbarcode.ReadOnly = true;
+            this.pib_custbarcode.Width = 78;
+            // 
+            // pd_pocode
+            // 
+            this.pd_pocode.DataPropertyName = "pd_pocode";
+            this.pd_pocode.HeaderText = "客户PO";
+            this.pd_pocode.Name = "pd_pocode";
+            this.pd_pocode.ReadOnly = true;
+            this.pd_pocode.Width = 66;
+            // 
+            // pd_custprodcode
+            // 
+            this.pd_custprodcode.DataPropertyName = "pd_custprodcode";
+            this.pd_custprodcode.HeaderText = "客户料号";
+            this.pd_custprodcode.Name = "pd_custprodcode";
+            this.pd_custprodcode.ReadOnly = true;
+            this.pd_custprodcode.Width = 78;
+            // 
+            // pd_custprodspec
+            // 
+            this.pd_custprodspec.DataPropertyName = "pd_custprodspec";
+            this.pd_custprodspec.HeaderText = "客户型号";
+            this.pd_custprodspec.Name = "pd_custprodspec";
+            this.pd_custprodspec.ReadOnly = true;
+            this.pd_custprodspec.Width = 78;
+            // 
+            // pr_spec
+            // 
+            this.pr_spec.DataPropertyName = "pr_spec";
+            this.pr_spec.HeaderText = "规格";
+            this.pr_spec.Name = "pr_spec";
+            this.pr_spec.Visible = false;
+            this.pr_spec.Width = 54;
+            // 
+            // pib_outboxcode1
+            // 
+            this.pib_outboxcode1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.pib_outboxcode1.DataPropertyName = "pib_outboxcode1";
+            this.pib_outboxcode1.HeaderText = "中盒号";
+            this.pib_outboxcode1.Name = "pib_outboxcode1";
+            this.pib_outboxcode1.Width = 90;
+            // 
+            // pib_outboxcode2
+            // 
+            this.pib_outboxcode2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.pib_outboxcode2.DataPropertyName = "pib_outboxcode2";
+            this.pib_outboxcode2.HeaderText = "外箱号";
+            this.pib_outboxcode2.Name = "pib_outboxcode2";
+            this.pib_outboxcode2.Width = 90;
+            // 
             // UAS_出货标签打印
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -1978,6 +1978,11 @@
         private System.Windows.Forms.Label pi_date;
         private System.Windows.Forms.Button CleanBarCode;
         private System.Windows.Forms.Button OPPOPlate;
+        private CustomControl.SearchTextBox cu_code;
+        private System.Windows.Forms.Button CancelOPPOPlate;
+        public CustomControl.PrinterCombox OutBoxPrinter;
+        public CustomControl.PrinterCombox MidLabelPrinter;
+        public CustomControl.PrinterCombox SingleLabelPrinter;
         private System.Windows.Forms.DataGridViewCheckBoxColumn Choose;
         private System.Windows.Forms.DataGridViewCheckBoxColumn pib_ifpick;
         private System.Windows.Forms.DataGridViewCheckBoxColumn pib_ifprint;
@@ -1991,9 +1996,9 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_unit;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_lotno;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_datecode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pib_datecode1;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_cusbarcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_cusoutboxcode;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pib_datecode1;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_qty;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_barcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_custbarcode;
@@ -2003,10 +2008,5 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_spec;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_outboxcode1;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_outboxcode2;
-        private CustomControl.SearchTextBox cu_code;
-        private System.Windows.Forms.Button CancelOPPOPlate;
-        public CustomControl.PrinterCombox OutBoxPrinter;
-        public CustomControl.PrinterCombox MidLabelPrinter;
-        public CustomControl.PrinterCombox SingleLabelPrinter;
     }
 }

+ 101 - 41
UAS-出货标签管理/UAS_出货标签管理.cs

@@ -222,6 +222,7 @@ namespace UAS_LabelMachine
             if (DataHelper.DBConnectionString.Contains("sz.hi-mantech.com") || DataHelper.DBConnectionString.Contains("192.168.1.200"))
             {
                 pib_datecode1.Visible = true;
+                pib_datecode.HeaderText = "DC年月日";
                 SingleLabelAutoPrint.Checked = true;
                 MidLabelAutoPrint.Checked = true;
                 pib_madein.Visible = true;
@@ -542,19 +543,13 @@ namespace UAS_LabelMachine
                     DataTable dt = (DataTable)MidSource.DataSource;
                     if (CollectionUnit.Text == "盒")
                     {
-                        string la_id = "";
-                        if (SingleLabelCombox.SelectedValue != null)
-                        {
-                            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();
                         for (int i = 0; i < LabelInf.RowCount; i++)
                         {
                             if (LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString() == LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value.ToString())
                             {
                                 dt.Rows[i]["pib_lotno"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value;
                                 dt.Rows[i]["pib_datecode"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value;
+                                dt.Rows[i]["pib_datecode1"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value;
                                 LabelInf.Rows[i].Cells["pib_ifpick"].Value = true;
                                 LabelInf.Rows[i].Cells["Choose"].Value = true;
                                 LabelInf.Invalidate();
@@ -562,13 +557,7 @@ namespace UAS_LabelMachine
                                 CurrentRowIndex = i;
                                 if (SingleLabelAutoPrint.Checked)
                                 {
-                                    if (la_id != "")
-                                        AutoPrintSingleLabel(la_id, LabelUrl);
-                                    else
-                                    {
-                                        MessageBox.Show("未维护单盘标签");
-                                        return;
-                                    }
+                                    AutoPrintSingleLabel();
                                 }
                                 if (MidLabelAutoPrint.Checked)
                                     AutoPrintMidLabel();
@@ -582,6 +571,7 @@ namespace UAS_LabelMachine
                         {
                             dt.Rows[i]["pib_lotno"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value;
                             dt.Rows[i]["pib_datecode"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value;
+                            dt.Rows[i]["pib_datecode1"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value;
                             CurrentRowIndex = i;
                             LabelInf.Refresh();
                             LabelInf.Rows[i].Cells["pib_ifpick"].Value = true;
@@ -600,10 +590,7 @@ namespace UAS_LabelMachine
                         {
                             if (SingleLabelCombox.SelectedValue != null)
                             {
-                                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();
-                                AutoPrintSingleLabel(la_id, LabelUrl);
+                                AutoPrintSingleLabel();
                             }
                             else
                             {
@@ -676,7 +663,7 @@ namespace UAS_LabelMachine
             }
         }
 
-        private void AutoPrintSingleLabel(string la_id, string LabelUrl)
+        private void AutoPrintSingleLabel()
         {
             //用标签本身的变量作为最外层的循环条件去匹配;
             string[] arg = SingleBoxArgument.ToArray();
@@ -687,12 +674,37 @@ namespace UAS_LabelMachine
                 for (int k = 0; k < SingleLabelParam.Rows.Count; k++)
                 {
                     //名称相等的时候,取SQL进行值的查询
-                    if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name == SingleLabelParam.Rows[k]["lp_name"].ToString().ToLower())
+                    if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() == SingleLabelParam.Rows[k]["lp_name"].ToString().ToLower())
                     {
                         string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
                         DataRow[] dr = SingleBoxCacheData.Select("pib_id=" + pib_id);
                         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();
+                        if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode1"))
+                        {
+                            if (LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value != null)
+                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value.ToString();
+                        }
+                        else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("lotno"))
+                        {
+                            if (LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value != null)
+                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString();
+                        }
+                        else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode"))
+                        {
+                            if (LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value != null)
+                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString();
+                        }
+                        else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("产地"))
+                        {
+                            if (LabelInf.Rows[CurrentRowIndex].Cells["pib_madein"].Value != null)
+                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_madein"].Value.ToString();
+                        }
+                        else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("pib_cusbarcode"))
+                        {
+                            if (LabelInf.Rows[CurrentRowIndex].Cells["pib_cusbarcode"].Value != null)
+                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_cusbarcode"].Value.ToString();
+                        }
                         if (SingleDoc.Variables.FreeVariables.Item(j + 1).Value == "")
                         {
                             DataRow[] dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
@@ -1115,8 +1127,7 @@ namespace UAS_LabelMachine
             }
             //缓存外箱参数
             ComBoxClickChangeLabelDoc = true;
-            GetSingleBoxData();
-            GetMidBoxData();
+     
         }
         bool InitGetLabel = true;
         /// <summary>
@@ -1171,6 +1182,8 @@ namespace UAS_LabelMachine
                     stw = new SetLoadingWindow(thread, "正在获取打印标签");
                     BaseUtil.SetFormCenter(stw);
                     stw.ShowDialog();
+                    GetSingleBoxData();
+                    GetMidBoxData();
                     //重置采集项次
                     CurrentItemIndex = 0;
                     LogManager.DoLog("输入单号【" + pi_inoutno.Text + "】");
@@ -1276,6 +1289,31 @@ namespace UAS_LabelMachine
                             {
                                 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();
+                                if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode1"))
+                                {
+                                    if (LabelInf.Rows[i].Cells["pib_datecode1"].Value != null)
+                                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_datecode1"].Value.ToString();
+                                }
+                                else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("lotno"))
+                                {
+                                    if (LabelInf.Rows[i].Cells["pib_lotno"].Value != null)
+                                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_lotno"].Value.ToString();
+                                }
+                                else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode"))
+                                {
+                                    if (LabelInf.Rows[i].Cells["pib_datecode"].Value != null)
+                                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_datecode"].Value.ToString();
+                                }
+                                else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("产地"))
+                                {
+                                    if (LabelInf.Rows[i].Cells["pib_madein"].Value != null)
+                                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_madein"].Value.ToString();
+                                }
+                                else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("pib_cusbarcode"))
+                                {
+                                    if (LabelInf.Rows[i].Cells["pib_cusbarcode"].Value != null)
+                                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_cusbarcode"].Value.ToString();
+                                }
                                 if (SingleDoc.Variables.FreeVariables.Item(j + 1).Value == "")
                                 {
                                     DataRow[] dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
@@ -1358,7 +1396,7 @@ namespace UAS_LabelMachine
                     //将维护的模板参数和模板本身的参数名称进行比对
                     for (int k = 0; k < SingleLabelParam.Rows.Count; k++)
                     {
-                        if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name == SingleLabelParam.Rows[k]["lp_name"].ToString())
+                        if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() == SingleLabelParam.Rows[k]["lp_name"].ToString().ToLower())
                         {
                             DataColumn dc = new DataColumn(SingleDoc.Variables.FreeVariables.Item(j + 1).Name);
                             SingleBoxCacheData.Columns.Add(dc);
@@ -1418,7 +1456,6 @@ namespace UAS_LabelMachine
             string[] pib_outbox_arr = MidIDAndOutboxcode.Values.ToArray();
             if (pib_id_arr.Length == 0)
             {
-                MessageBox.Show("未勾选打印明细");
                 return;
             }
             //记录一个ID用来取中盒的数量
@@ -1444,7 +1481,7 @@ namespace UAS_LabelMachine
                 //将维护的模板参数和模板本身的参数名称进行比对
                 for (int k = 0; k < MidLabelParam.Rows.Count; k++)
                 {
-                    if (MidDoc.Variables.FreeVariables.Item(j + 1).Name == MidLabelParam.Rows[k]["lp_name"].ToString())
+                    if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() == MidLabelParam.Rows[k]["lp_name"].ToString().ToLower())
                     {
                         DataColumn dc = new DataColumn(MidDoc.Variables.FreeVariables.Item(j + 1).Name);
                         MidBoxCacheData.Columns.Add(dc);
@@ -1729,7 +1766,7 @@ namespace UAS_LabelMachine
                 for (int k = 0; k < MidLabelParam.Rows.Count; k++)
                 {
                     //名称相等的时候,取SQL进行值的查询
-                    if (MidDoc.Variables.FreeVariables.Item(j + 1).Name == MidLabelParam.Rows[k]["lp_name"].ToString())
+                    if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() == MidLabelParam.Rows[k]["lp_name"].ToString().ToLower())
                     {
                         //获取对应行的pib_id
                         string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
@@ -1747,7 +1784,27 @@ namespace UAS_LabelMachine
                             else
                             {
                                 DataRow[] dr = MidBoxCacheData.Select("pib_outboxcode1='" + pib_outboxcode1 + "'");
-                                if (arg.Contains(MidDoc.Variables.FreeVariables.Item(j + 1).Name))
+                                if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode1"))
+                                {
+                                    if (LabelInf.Rows[rowindex].Cells["pib_datecode1"].Value != null)
+                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode1"].Value.ToString();
+                                }
+                                else if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("lotno"))
+                                {
+                                    if (LabelInf.Rows[rowindex].Cells["pib_lotno"].Value != null)
+                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_lotno"].Value.ToString();
+                                }
+                                else if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode"))
+                                {
+                                    if (LabelInf.Rows[rowindex].Cells["pib_datecode"].Value != null)
+                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode"].Value.ToString();
+                                }
+                                else if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("产地"))
+                                {
+                                    if (LabelInf.Rows[rowindex].Cells["pib_madein"].Value != null)
+                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_madein"].Value.ToString();
+                                }
+                                else if (arg.Contains(MidDoc.Variables.FreeVariables.Item(j + 1).Name))
                                 {
                                     if (dr.Length > 0)
                                     {
@@ -1785,7 +1842,7 @@ namespace UAS_LabelMachine
                 for (int k = 0; k < MidLabelParam.Rows.Count; k++)
                 {
                     //名称相等的时候,取SQL进行值的查询
-                    if (MidDoc.Variables.FreeVariables.Item(j + 1).Name == MidLabelParam.Rows[k]["lp_name"].ToString())
+                    if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() == MidLabelParam.Rows[k]["lp_name"].ToString().ToLower())
                     {
                         //获取对应行的pib_id
                         string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
@@ -1851,7 +1908,7 @@ namespace UAS_LabelMachine
                     for (int k = 0; k < OutLabelParam.Rows.Count; k++)
                     {
                         //名称相等的时候,取SQL进行值的查询
-                        if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name == OutLabelParam.Rows[k]["lp_name"].ToString())
+                        if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() == OutLabelParam.Rows[k]["lp_name"].ToString().ToLower())
                         {
                             //获取对应行的pib_id
                             string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
@@ -1993,7 +2050,7 @@ namespace UAS_LabelMachine
             else
             {
                 sql.Clear();
-                sql.Append("select pd_custprodcode,pd_custprodspec,pd_pocode,pib_madein,pib_custbarcode,pib_custoutboxcode,pib_id,pib_datecode1,pib_pdid,pib_piid,pib_pdno,pib_prodcode,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand, pr_vendprodcode,");
+                sql.Append("select 0 choose,pd_custprodcode,pd_custprodspec,pd_pocode,pib_madein,pib_custbarcode,pib_custoutboxcode,pib_id,pib_datecode1,pib_pdid,pib_piid,pib_pdno,pib_prodcode,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand, pr_vendprodcode,");
                 sql.Append("pib_lotno,pib_datecode,pib_qty,pr_spec,pr_zxbzs,pr_unit,pib_barcode,pib_outboxcode1,pib_outboxcode2,nvl(pib_ifpick,0)pib_ifpick,nvl(pib_ifprint,0)pib_ifprint");
                 sql.Append(" from prodiobarcode left join prodiodetail on pib_piid=pd_piid and pd_pdno=pib_pdno and ");
                 sql.Append(" pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join sale on sa_code=pib_ordercode ");
@@ -2187,20 +2244,23 @@ namespace UAS_LabelMachine
         /// <param name="e"></param>
         private void LabelInf_CellValueChanged(object sender, DataGridViewCellEventArgs e)
         {
-            if (LabelInf.Columns[e.ColumnIndex].Name == "pib_datecode")
+            if (e.RowIndex >= 0)
             {
-                string datecode = LabelInf.Rows[e.RowIndex].Cells["pib_datecode"].Value.ToString();
-                try
+                if (LabelInf.Columns[e.ColumnIndex].Name == "pib_datecode")
                 {
-                    System.DateTime dt = System.DateTime.ParseExact(datecode, "yyyyMMdd", CultureInfo.CurrentCulture);
-                    GregorianCalendar gc = new GregorianCalendar();
-                    int weekOfYear = gc.GetWeekOfYear(dt, CalendarWeekRule.FirstDay, DayOfWeek.Monday);
-                    if (weekOfYear < 10)
-                        LabelInf.Rows[e.RowIndex].Cells["pib_datecode1"].Value = dt.Year.ToString().Substring(2, 2) + "0" + weekOfYear;
-                    else
-                        LabelInf.Rows[e.RowIndex].Cells["pib_datecode1"].Value = dt.Year.ToString().Substring(2, 2) + weekOfYear;
+                    string datecode = LabelInf.Rows[e.RowIndex].Cells["pib_datecode"].Value.ToString();
+                    try
+                    {
+                        System.DateTime dt = System.DateTime.ParseExact(datecode, "yyyyMMdd", CultureInfo.CurrentCulture);
+                        GregorianCalendar gc = new GregorianCalendar();
+                        int weekOfYear = gc.GetWeekOfYear(dt, CalendarWeekRule.FirstDay, DayOfWeek.Monday);
+                        if (weekOfYear < 10)
+                            LabelInf.Rows[e.RowIndex].Cells["pib_datecode1"].Value = dt.Year.ToString().Substring(2, 2) + "0" + weekOfYear;
+                        else
+                            LabelInf.Rows[e.RowIndex].Cells["pib_datecode1"].Value = dt.Year.ToString().Substring(2, 2) + weekOfYear;
+                    }
+                    catch (Exception) { }
                 }
-                catch (Exception) { }
             }
         }
 

+ 3 - 3
UAS-出货标签管理/UAS_出货标签管理.resx

@@ -159,13 +159,13 @@
   <metadata name="pr_unit.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="pib_cusbarcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="pib_datecode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="pib_cusoutboxcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="pib_cusbarcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="pib_datecode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="pib_cusoutboxcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
   <metadata name="pib_custbarcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

+ 9 - 2
UAS-出货标签管理/生成条码.cs

@@ -455,12 +455,19 @@ namespace UAS_LabelMachine
                 switch (pi_class.Text)
                 {
                     case "出货单":
+                        //sql.Clear();
+                        //sql.Append("select pd_piid,pd_id,pr_id,pr_brand,pr_madein,pr_unit,pr_detail,pr_spec,pr_zxbzs,outqty pd_totalqty,pd_ordercode,pd_orderdetno,pd_pdno,pd_prodcode,");
+                        //sql.Append("pd_piclass,pd_qty from (select pd_piid,pd_id,pr_id,pr_brand,pr_madein,pr_unit,pr_detail,pr_spec,pr_zxbzs,outqty,pd_ordercode,pd_orderdetno,pd_pdno,");
+                        //sql.Append("pd_prodcode,pd_piclass,outqty-nvl((select sum(nvl(pib_qty,0)) from PRODIOBARCODE where PIB_PIID=pd_piid and pib_pdno=pd_pdno ),0)pd_qty ");
+                        //sql.Append("from (select pd_piid,min(pd_id) pd_id,sum(pd_outqty)outqty,pd_ordercode,pd_orderdetno,pd_pdno,max(pd_prodcode)pd_prodcode,max(pd_piclass)pd_piclass ");
+                        //sql.Append("from prodiodetail  group by pd_piid,pd_ordercode, pd_orderdetno,pd_pdno)T left join product ");
+                        //sql.Append("on pr_code=pd_prodcode where nvl(pr_zxbzs,0)>0)  where  pd_piid='" + pi_id + "'");
                         sql.Clear();
                         sql.Append("select pd_piid,pd_id,pr_id,pr_brand,pr_madein,pr_unit,pr_detail,pr_spec,pr_zxbzs,outqty pd_totalqty,pd_ordercode,pd_orderdetno,pd_pdno,pd_prodcode,");
                         sql.Append("pd_piclass,pd_qty from (select pd_piid,pd_id,pr_id,pr_brand,pr_madein,pr_unit,pr_detail,pr_spec,pr_zxbzs,outqty,pd_ordercode,pd_orderdetno,pd_pdno,");
                         sql.Append("pd_prodcode,pd_piclass,outqty-nvl((select sum(nvl(pib_qty,0)) from PRODIOBARCODE where PIB_PIID=pd_piid and pib_pdno=pd_pdno ),0)pd_qty ");
-                        sql.Append("from (select pd_piid,min(pd_id) pd_id,sum(pd_outqty)outqty,pd_ordercode,pd_orderdetno,pd_pdno,max(pd_prodcode)pd_prodcode,max(pd_piclass)pd_piclass ");
-                        sql.Append("from prodiodetail  group by pd_piid,pd_ordercode, pd_orderdetno,pd_pdno)T left join product ");
+                        sql.Append("from (select pd_piid,min(pd_id) pd_id,sum(pd_outqty)outqty,min(pd_ordercode)pd_ordercode,min(pd_orderdetno)pd_orderdetno,min(pd_pdno)pd_pdno,max(pd_prodcode)pd_prodcode,max(pd_piclass)pd_piclass ");
+                        sql.Append("from prodiodetail  group by pd_piid,pd_prodcode,pd_custprodcode,pd_custprodspec)T left join product ");
                         sql.Append("on pr_code=pd_prodcode where nvl(pr_zxbzs,0)>0)  where  pd_piid='" + pi_id + "'");
                         break;
                     case "完工入库单":

Some files were not shown because too many files changed in this diff