Browse Source

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

callm 6 years ago
parent
commit
7098df3a05

+ 1 - 1
UAS-MES/FunctionCode/Make/Make_FeedingCollection.cs

@@ -372,7 +372,7 @@ namespace UAS_MES.Make
             sql.Append("sp_regex,max(pr_detail)pr_detail from stepproduct left join product on pr_code=sp_fsoncode where ");
             sql.Append("sp_bomversion='" + ms_bomversion.Text + "' and sp_craftcode='" + ms_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' ");
             sql.Append("And sp_mothercode ='" + ma_prodcode.Text + "' and sp_tracekind=1 and not exists(select 1 from craftmaterial where ");
-            sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_makecode='" + ma_code.Text + "' and cm_fsoncode=");
+            sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_fsoncode=");
             sql.Append("sp_fsoncode and cm_status=0) group by sp_fsoncode order by SP_DETNO asc");
             dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             code.Clear();

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

@@ -11,27 +11,28 @@ namespace UAS_LabelMachine
     public class DataHelper
     {
 
-        //海创外网地址
-        private readonly string ConnectionStrings = "Data Source=cmityj.gicp.net/orcl;User ID=HC_TEST;PassWord=select!#%*(";
-        //海创ERP地址
-        public static readonly string ERPAddesss = "http://cmityj.gicp.net:8099/ERP/";
-        //海创FTP
-        public static readonly string FTPAdress = "ftp://cmityj.gicp.net|HCFTP|Admin1@#";
-        //Oracle端口
-        public static readonly string OraclePort = "1521";
-        //需要显示的账套
-        public static readonly string Masters = "HC_TEST";
-
-        ////富为外网地址
-        //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";
+        ////海创外网地址
+        //private readonly string ConnectionStrings = "Data Source=cmityj.gicp.net/orcl;User ID=HC_TEST;PassWord=select!#%*(";
+        ////海创ERP地址
+        //public static readonly string ERPAddesss = "http://cmityj.gicp.net:8099/ERP/";
+        ////海创FTP
+        //public static readonly string FTPAdress = "ftp://cmityj.gicp.net|HCFTP|Admin1@#";
         ////Oracle端口
         //public static readonly string OraclePort = "1521";
         ////需要显示的账套
-        //public static readonly string Masters = "JDTSY,FW_JDT,N_DATACENTER,FY_TEST,JD_TEST,XY_TEST,FW_TEST,DATACENTER,FW,XY,FY";
+        //public static readonly string Masters = "HC_TEST";
+
+        //高登地址
+        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地址
+        public static readonly string ERPAddesss = "http://183.238.39.179:8099/ERP/";
+        //高登TP
+        //public static readonly string FTPAdress = "ftp://192.168.0.158:21|GOLDENFTP|Admin1@#";
+        public static readonly string FTPAdress = "ftp://183.238.39.179:21|GOLDENFTP|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=sz.hi-mantech.com)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
@@ -843,11 +844,23 @@ namespace UAS_LabelMachine
             switch (Type.ToUpper())
             {
                 case "SELECT":
-                    result = new DataTable();
-                    OracleDataAdapter ad = new OracleDataAdapter(command);
-                    ad.Fill((DataTable)result);
-                    ad.Dispose();
-                    //成功执行后将重复连接数置为0
+                    try
+                    {
+                        result = new DataTable();
+                        OracleDataAdapter ad = new OracleDataAdapter(command);
+                        ad.Fill((DataTable)result);
+                        ad.Dispose();
+                    }
+                    catch (Exception)
+                    {
+                        connection = new OracleConnection(DBConnectionString);
+                        connection.Open();
+                        command.Connection = connection;
+                        result = new DataTable();
+                        OracleDataAdapter ad = new OracleDataAdapter(command);
+                        ad.Fill((DataTable)result);
+                        ad.Dispose();
+                    }
                     break;
                 case "DELETE":
                     result = command.ExecuteNonQuery();

+ 21 - 2
UAS-出货标签管理(贸易版)/PublicMethod/SqliteDBHelper.cs

@@ -227,7 +227,22 @@ namespace UAS_LabelMachine
         {
             StringBuilder sb = new StringBuilder();
             sb.Clear();
-            sb.Append("update  " + tableName + " set pib_outboxcode2=? where pib_id=?");
+            sb.Append("update  " + tableName + " set  ");
+            for (int i = 0; i < dt.Columns.Count; i++)
+            {
+                if (dt.Columns[i].ColumnName.ToUpper() != "PIB_ID")
+                {
+                    if (i != dt.Columns.Count - 1)
+                    {
+                        sb.Append(dt.Columns[i].ColumnName + "=?,");
+                    }
+                    else
+                    {
+                        sb.Append(dt.Columns[i].ColumnName + "=?");
+                    }
+                }              
+            }
+            sb.Append("where pib_id=?");
             SQLiteTransaction tx = this._odcConnection.BeginTransaction();
             command = new SQLiteCommand();
             command.Connection = this._odcConnection;
@@ -238,7 +253,11 @@ namespace UAS_LabelMachine
                 for (int i = 0; i < dt.Rows.Count; i++)
                 {
                     command.CommandText = sql;
-                    command.Parameters.AddWithValue("pib_outboxcode2", dt.Rows[i]["pib_outboxcode2"]);
+                    for (int j = 0; j < dt.Columns.Count; j++)
+                    {
+                        if (dt.Columns[j].ColumnName.ToUpper() != "PIB_ID")
+                            command.Parameters.AddWithValue(dt.Columns[j].ColumnName, dt.Rows[i][j]);
+                    }
                     command.Parameters.AddWithValue("pib_id", dt.Rows[i]["pib_id"]);
                     try
                     {

+ 311 - 219
UAS-出货标签管理(贸易版)/UAS_出货标签管理.Designer.cs

@@ -55,7 +55,6 @@
             this.si_expressionitem = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.CleanDetail = new System.Windows.Forms.Button();
             this.pib_id = new System.Windows.Forms.Label();
-            this.pi_cardcode = new System.Windows.Forms.Label();
             this.pi_cardcode_label = new System.Windows.Forms.Label();
             this.Fresh = new System.Windows.Forms.LinkLabel();
             this.label3 = new System.Windows.Forms.Label();
@@ -124,36 +123,17 @@
             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_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.label8 = new System.Windows.Forms.Label();
+            this.SingleDocRefresh = new System.Windows.Forms.LinkLabel();
             this.SingleLabelPrinter = new UAS_LabelMachine.CustomControl.PrinterCombox();
             this.SingleLabelPrint = new System.Windows.Forms.Button();
             this.SingleLabelAutoPrint = new System.Windows.Forms.CheckBox();
             this.SingleLabelCombox = new System.Windows.Forms.ComboBox();
             this.MidLabel = new UAS_LabelMachine.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
+            this.label9 = new System.Windows.Forms.Label();
+            this.MidDocRefresh = new System.Windows.Forms.LinkLabel();
             this.MidLabelNum = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.label5 = new System.Windows.Forms.Label();
             this.label4 = new System.Windows.Forms.Label();
@@ -164,6 +144,8 @@
             this.MidLabelAutoPrint = new System.Windows.Forms.CheckBox();
             this.MidLabelCombox = new System.Windows.Forms.ComboBox();
             this.OutBoxLabel = new UAS_LabelMachine.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
+            this.label19 = new System.Windows.Forms.Label();
+            this.OutDocRefresh = new System.Windows.Forms.LinkLabel();
             this.LogingOut = new System.Windows.Forms.LinkLabel();
             this.GetOutBoxCode = new System.Windows.Forms.Button();
             this.OutBoxNum = new UAS_LabelMachine.CustomControl.EnterTextBox();
@@ -174,6 +156,30 @@
             this.OutBoxLabelPrint = new System.Windows.Forms.Button();
             this.OutBoxLabelAutoPrint = new System.Windows.Forms.CheckBox();
             this.OutBoxCombox = new System.Windows.Forms.ComboBox();
+            this.cu_code = new UAS_LabelMachine.CustomControl.SearchTextBox();
+            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_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();
@@ -446,15 +452,6 @@
             this.pib_id.TabIndex = 69;
             this.pib_id.Visible = false;
             // 
-            // pi_cardcode
-            // 
-            this.pi_cardcode.AutoSize = true;
-            this.pi_cardcode.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pi_cardcode.Location = new System.Drawing.Point(77, 38);
-            this.pi_cardcode.Name = "pi_cardcode";
-            this.pi_cardcode.Size = new System.Drawing.Size(0, 20);
-            this.pi_cardcode.TabIndex = 71;
-            // 
             // pi_cardcode_label
             // 
             this.pi_cardcode_label.AutoSize = true;
@@ -1171,189 +1168,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 = 5;
-            // 
-            // 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 = 51;
-            // 
-            // 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 = 51;
-            // 
-            // pib_madein
-            // 
-            this.pib_madein.DataPropertyName = "pib_madein";
-            this.pib_madein.HeaderText = "产地";
-            this.pib_madein.Name = "pib_madein";
-            this.pib_madein.Width = 51;
-            // 
-            // 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 = 5;
-            // 
-            // 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 = 5;
-            // 
-            // 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_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 = 5;
-            // 
-            // 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 = 51;
-            // 
-            // 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 = 51;
-            // 
-            // pib_custbarcode
-            // 
-            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 = 51;
-            // 
-            // 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 = 51;
-            // 
-            // 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 = 51;
-            // 
-            // 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 = 51;
-            // 
-            // 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 = 5;
-            // 
-            // 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;
@@ -1369,6 +1183,8 @@
             // 
             // SingleLabel
             // 
+            this.SingleLabel.Controls.Add(this.label8);
+            this.SingleLabel.Controls.Add(this.SingleDocRefresh);
             this.SingleLabel.Controls.Add(this.SingleLabelPrinter);
             this.SingleLabel.Controls.Add(this.SingleLabelPrint);
             this.SingleLabel.Controls.Add(this.SingleLabelAutoPrint);
@@ -1383,6 +1199,27 @@
             this.SingleLabel.TabStop = false;
             this.SingleLabel.Text = "单盘标签";
             // 
+            // label8
+            // 
+            this.label8.AutoSize = true;
+            this.label8.Font = new System.Drawing.Font("微软雅黑", 10F);
+            this.label8.Location = new System.Drawing.Point(5, 24);
+            this.label8.Name = "label8";
+            this.label8.Size = new System.Drawing.Size(55, 20);
+            this.label8.TabIndex = 116;
+            this.label8.Text = "格式(T)";
+            // 
+            // SingleDocRefresh
+            // 
+            this.SingleDocRefresh.AutoSize = true;
+            this.SingleDocRefresh.Location = new System.Drawing.Point(58, 24);
+            this.SingleDocRefresh.Name = "SingleDocRefresh";
+            this.SingleDocRefresh.Size = new System.Drawing.Size(42, 21);
+            this.SingleDocRefresh.TabIndex = 89;
+            this.SingleDocRefresh.TabStop = true;
+            this.SingleDocRefresh.Text = "刷新";
+            this.SingleDocRefresh.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.DocRefresh_LinkClicked);
+            // 
             // SingleLabelPrinter
             // 
             this.SingleLabelPrinter.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -1432,6 +1269,8 @@
             // 
             // MidLabel
             // 
+            this.MidLabel.Controls.Add(this.label9);
+            this.MidLabel.Controls.Add(this.MidDocRefresh);
             this.MidLabel.Controls.Add(this.MidLabelNum);
             this.MidLabel.Controls.Add(this.label5);
             this.MidLabel.Controls.Add(this.label4);
@@ -1451,6 +1290,27 @@
             this.MidLabel.TabStop = false;
             this.MidLabel.Text = "内盒标签";
             // 
+            // label9
+            // 
+            this.label9.AutoSize = true;
+            this.label9.Font = new System.Drawing.Font("微软雅黑", 10F);
+            this.label9.Location = new System.Drawing.Point(5, 24);
+            this.label9.Name = "label9";
+            this.label9.Size = new System.Drawing.Size(55, 20);
+            this.label9.TabIndex = 117;
+            this.label9.Text = "格式(T)";
+            // 
+            // MidDocRefresh
+            // 
+            this.MidDocRefresh.AutoSize = true;
+            this.MidDocRefresh.Location = new System.Drawing.Point(60, 24);
+            this.MidDocRefresh.Name = "MidDocRefresh";
+            this.MidDocRefresh.Size = new System.Drawing.Size(42, 21);
+            this.MidDocRefresh.TabIndex = 90;
+            this.MidDocRefresh.TabStop = true;
+            this.MidDocRefresh.Text = "刷新";
+            this.MidDocRefresh.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.DocRefresh_LinkClicked);
+            // 
             // MidLabelNum
             // 
             this.MidLabelNum.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -1552,6 +1412,8 @@
             // 
             // OutBoxLabel
             // 
+            this.OutBoxLabel.Controls.Add(this.label19);
+            this.OutBoxLabel.Controls.Add(this.OutDocRefresh);
             this.OutBoxLabel.Controls.Add(this.LogingOut);
             this.OutBoxLabel.Controls.Add(this.GetOutBoxCode);
             this.OutBoxLabel.Controls.Add(this.OutBoxNum);
@@ -1572,6 +1434,27 @@
             this.OutBoxLabel.TabStop = false;
             this.OutBoxLabel.Text = "外箱标签";
             // 
+            // label19
+            // 
+            this.label19.AutoSize = true;
+            this.label19.Font = new System.Drawing.Font("微软雅黑", 10F);
+            this.label19.Location = new System.Drawing.Point(4, 24);
+            this.label19.Name = "label19";
+            this.label19.Size = new System.Drawing.Size(55, 20);
+            this.label19.TabIndex = 118;
+            this.label19.Text = "格式(T)";
+            // 
+            // OutDocRefresh
+            // 
+            this.OutDocRefresh.AutoSize = true;
+            this.OutDocRefresh.Location = new System.Drawing.Point(58, 23);
+            this.OutDocRefresh.Name = "OutDocRefresh";
+            this.OutDocRefresh.Size = new System.Drawing.Size(42, 21);
+            this.OutDocRefresh.TabIndex = 91;
+            this.OutDocRefresh.TabStop = true;
+            this.OutDocRefresh.Text = "刷新";
+            this.OutDocRefresh.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.DocRefresh_LinkClicked);
+            // 
             // LogingOut
             // 
             this.LogingOut.AutoSize = true;
@@ -1682,19 +1565,223 @@
             this.OutBoxCombox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.OutBoxCombox.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.OutBoxCombox.FormattingEnabled = true;
-            this.OutBoxCombox.Location = new System.Drawing.Point(8, 44);
+            this.OutBoxCombox.Location = new System.Drawing.Point(7, 46);
             this.OutBoxCombox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.OutBoxCombox.Name = "OutBoxCombox";
             this.OutBoxCombox.Size = new System.Drawing.Size(158, 25);
             this.OutBoxCombox.TabIndex = 78;
             this.OutBoxCombox.SelectedIndexChanged += new System.EventHandler(this.OutBoxCombox_SelectedIndexChanged);
             // 
+            // cu_code
+            // 
+            this.cu_code.AllPower = null;
+            this.cu_code.Caller = null;
+            this.cu_code.Condition = null;
+            this.cu_code.DBTitle = null;
+            this.cu_code.FormName = null;
+            this.cu_code.Location = new System.Drawing.Point(76, 38);
+            this.cu_code.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.cu_code.Name = "cu_code";
+            this.cu_code.Power = null;
+            this.cu_code.ReturnData = null;
+            this.cu_code.SelectField = null;
+            this.cu_code.SetValueField = null;
+            this.cu_code.Size = new System.Drawing.Size(149, 21);
+            this.cu_code.TabIndex = 88;
+            this.cu_code.TableName = null;
+            this.cu_code.TextBoxEnable = false;
+            this.cu_code.UserControlTextChanged += new UAS_LabelMachine.CustomControl.SearchTextBox.OnTextChange(this.cu_code_UserControlTextChanged);
+            // 
+            // 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_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.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);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(233)))), ((int)(((byte)(206)))));
             this.ClientSize = new System.Drawing.Size(1257, 711);
+            this.Controls.Add(this.cu_code);
             this.Controls.Add(this.CleanBarCode);
             this.Controls.Add(this.pi_date);
             this.Controls.Add(this.AttachInfo);
@@ -1705,7 +1792,6 @@
             this.Controls.Add(this.CleanInputAfterCollect);
             this.Controls.Add(this.Fresh);
             this.Controls.Add(this.pi_cardcode_label);
-            this.Controls.Add(this.pi_cardcode);
             this.Controls.Add(this.pib_id);
             this.Controls.Add(this.pr_code);
             this.Controls.Add(this.CleanDetail);
@@ -1845,7 +1931,6 @@
         private System.Windows.Forms.Label Process_midboxcode;
         private System.Windows.Forms.Label Process_outboxcode;
         private System.Windows.Forms.Label Capacity;
-        private System.Windows.Forms.Label pi_cardcode;
         private System.Windows.Forms.Label pi_cardcode_label;
         private System.Windows.Forms.LinkLabel Fresh;
         private System.Windows.Forms.Label label3;
@@ -1887,6 +1972,13 @@
         private System.Windows.Forms.Button AttachInfo;
         private System.Windows.Forms.Label pi_date;
         private System.Windows.Forms.Button CleanBarCode;
+        private CustomControl.SearchTextBox cu_code;
+        private System.Windows.Forms.LinkLabel SingleDocRefresh;
+        private System.Windows.Forms.LinkLabel MidDocRefresh;
+        private System.Windows.Forms.LinkLabel OutDocRefresh;
+        private System.Windows.Forms.Label label8;
+        private System.Windows.Forms.Label label9;
+        private System.Windows.Forms.Label label19;
         private System.Windows.Forms.DataGridViewCheckBoxColumn Choose;
         private System.Windows.Forms.DataGridViewCheckBoxColumn pib_ifpick;
         private System.Windows.Forms.DataGridViewCheckBoxColumn pib_ifprint;

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

@@ -215,6 +215,11 @@ namespace UAS_LabelMachine
             pr_code.TableName = "prodiodetail left join product on pd_prodcode=pr_code";
             pr_code.SelectField = "pd_pdno # 行号,pr_code # 物料编号";
 
+            cu_code.FormName = Name;
+            cu_code.SetValueField = new string[] { "cu_code" };
+            cu_code.TableName = "customer";
+            cu_code.SelectField = "cu_code # 客户编号,cu_name # 客户名称";
+
             CollectionUnit.Text = "盘";
             Point pt = new Point();
             //禁止所有列的排序
@@ -979,10 +984,10 @@ namespace UAS_LabelMachine
         private void GetInOutInfAndLabelFile()
         {
             ComBoxClickChangeLabelDoc = false;
-            Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql  from LabelAttachPARAMETER where lap_custcode='" + pi_cardcode.Text + "'", "select");
+            Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql  from LabelAttachPARAMETER where lap_custcode='" + cu_code.Text + "'", "select");
             sql.Clear();
             sql.Append("select to_char(nvl(cl_date,sysdate),'YYYY-MM-DD HH24:Mi:SS') cl_date,cl_labelname,cl_isdefault,la_id||'#'||cl_labelurl||'#'||to_char(cl_date,'YYYY-MM-DD HH24:Mi:SS')  la_id,cl_custcode from customerlabel left join prodinout on pi_cardcode=cl_custcode ");
-            sql.Append("left join customer on cu_code=cl_custcode left join label on la_code=CL_LABELCODE where ((pi_cardcode='" + pi_cardcode.Text + "' ");
+            sql.Append("left join customer on cu_code=cl_custcode left join label on la_code=CL_LABELCODE where ((pi_cardcode='" + cu_code.Text + "' ");
             sql.Append("and  pi_inoutno='" + pi_inoutno.Text + "') or( cl_custcode is null)) and cl_labeltype='单盘' order by cl_custcode");
             dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
             SingleLabelCombox.DisplayMember = "cl_labelname";
@@ -1018,7 +1023,7 @@ namespace UAS_LabelMachine
             }
             sql.Clear();
             sql.Append("select to_char(nvl(cl_date,sysdate),'YYYY-MM-DD HH24:Mi:SS') cl_date,cl_labelname,cl_isdefault,la_id||'#'||cl_labelurl||'#'||to_char(cl_date,'YYYY-MM-DD HH24:Mi:SS')  la_id,cl_custcode from customerlabel left join prodinout on pi_cardcode=cl_custcode ");
-            sql.Append("left join customer on cu_code=cl_custcode left join label on la_code=CL_LABELCODE where ((pi_cardcode='" + pi_cardcode.Text + "' ");
+            sql.Append("left join customer on cu_code=cl_custcode left join label on la_code=CL_LABELCODE where ((pi_cardcode='" + cu_code.Text + "' ");
             sql.Append("and  pi_inoutno='" + pi_inoutno.Text + "') or( cl_custcode is null)) and cl_labeltype='中盒' order by cl_custcode");
             dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
             MidLabelCombox.DisplayMember = "cl_labelname";
@@ -1056,7 +1061,7 @@ namespace UAS_LabelMachine
             //缓存中盒参数
             sql.Clear();
             sql.Append("select to_char(nvl(cl_date,sysdate),'YYYY-MM-DD HH24:Mi:SS') cl_date,cl_labelname,cl_isdefault,la_id||'#'||cl_labelurl||'#'||to_char(cl_date,'YYYY-MM-DD HH24:Mi:SS')  la_id,cl_custcode from customerlabel left join prodinout on pi_cardcode=cl_custcode ");
-            sql.Append("left join customer on cu_code=cl_custcode left join label on la_code=CL_LABELCODE where ((pi_cardcode='" + pi_cardcode.Text + "' ");
+            sql.Append("left join customer on cu_code=cl_custcode left join label on la_code=CL_LABELCODE where ((pi_cardcode='" + cu_code.Text + "' ");
             sql.Append("and  pi_inoutno='" + pi_inoutno.Text + "') or( cl_custcode is null)) and cl_labeltype='外箱' order by cl_custcode");
             dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
             OutBoxCombox.DisplayMember = "cl_labelname";
@@ -1093,7 +1098,7 @@ namespace UAS_LabelMachine
             //缓存外箱参数
             ComBoxClickChangeLabelDoc = true;
         }
-
+        bool InitGetLabel = true;
         /// <summary>
         /// 出入库单录入框的回车事件
         /// </summary>
@@ -1108,7 +1113,9 @@ namespace UAS_LabelMachine
                 dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                 if (dt.Rows.Count > 0)
                 {
-                    pi_cardcode.Text = dt.Rows[0]["pi_cardcode"].ToString();
+                    InitGetLabel = true;
+                    cu_code.Text = dt.Rows[0]["pi_cardcode"].ToString();
+                    InitGetLabel = false;
                     pi_date.Text = dt.Rows[0]["pi_date"].ToString();
                     PI_ID = dt.Rows[0]["pi_id"].ToString();
                     if (dh.GetConfig("AutoBarcode", "ProdInOut!Sale").ToString() != "")
@@ -1572,20 +1579,31 @@ namespace UAS_LabelMachine
         private void LoadGridData(object sender, EventArgs e)
         {
             AllCollect = false;
+            //查询Oracle数据库
             sql.Clear();
-            sql.Append("select * from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by rownum ");
-            LabelInfDataTable = (DataTable)sdh.ExecuteSql(sql.ToString(), "select");
-            if (LabelInfDataTable.Rows.Count == 0)
+            sql.Append("select t.*,rownum from prodiobarcode_view t where pib_inoutno='" + pi_inoutno.Text + "'");
+            LabelInfDataTable = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+            //查询本地数据库
+            sql.Clear();
+            sql.Append("select * from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' limit 0,1 ");
+            DataTable dt = (DataTable)sdh.ExecuteSql(sql.ToString(), "select");
+            //如果本地没有缓存过
+            if (dt.Rows.Count == 0)
             {
-                //嵌套查询重置RowNum
-                sql.Clear();
-                sql.Append("select t.*,rownum from prodiobarcode_view t where pib_inoutno='" + pi_inoutno.Text + "'");
-                LabelInfDataTable = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                 //检验查询的字段和本地数据库字段是否匹配
                 sdh.AddColumFromDataTable(LabelInfDataTable, "prodiobarcode");
                 //将数据保存在本地数据库
                 sdh.SaveDataTable(LabelInfDataTable, "prodiobarcode");
             }
+            else if (LabelInfDataTable.Columns.Count != dt.Columns.Count)
+            {
+                //检验查询的字段和本地数据库字段是否匹配
+                sdh.AddColumFromDataTable(LabelInfDataTable, "prodiobarcode");
+                sdh.BatchInsert("prodiobarcode", LabelInfDataTable);
+            }
+            sql.Clear();
+            sql.Append("select * from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by rownum ");
+            LabelInfDataTable = (DataTable)sdh.ExecuteSql(sql.ToString(), "select");
             bindingsource(LabelInf, LabelInfDataTable);
             BaseUtil.FillDgvWithDataTable(LabelInf, LabelInfDataTable);
             //有数据的话默认取第一条的品牌去取采集策略
@@ -1835,7 +1853,7 @@ namespace UAS_LabelMachine
                         {
                             BoxCode = BoxCode + 1;
                         }
-                        else  if (LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() != LabelInf.Rows[i + 1].Cells["pib_prodcode"].Value.ToString())
+                        else if (LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() != LabelInf.Rows[i + 1].Cells["pib_prodcode"].Value.ToString())
                         {
                             BoxCode = BoxCode + 1;
                         }
@@ -1885,11 +1903,10 @@ namespace UAS_LabelMachine
                     System.DateTime time = Convert.ToDateTime(SingleLabelCombox.SelectedValue.ToString().Split('#')[2]);
                     if (SingleLabelCombox.Text != "" && SingleLabelCombox.SelectedValue != null && !GetGridOnly.Checked)
                     {
-                        SingleDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(SingleLabelCombox.SelectedValue.ToString().Split('#')[1], SingleLabelCombox.Text, time));
-                    }
-                    else
-                    {
-                        SingleFormat = engine.Documents.Open(BaseUtil.GetLabelUrl(SingleLabelCombox.SelectedValue.ToString().Split('#')[1], SingleLabelCombox.Text, time));
+                        if (PrintMethod == "CodeSoft")
+                            SingleDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(SingleLabelCombox.SelectedValue.ToString().Split('#')[1], SingleLabelCombox.Text, time));
+                        else
+                            SingleFormat = engine.Documents.Open(BaseUtil.GetLabelUrl(SingleLabelCombox.SelectedValue.ToString().Split('#')[1], SingleLabelCombox.Text, time));
                     }
                 }
             }
@@ -1915,13 +1932,9 @@ namespace UAS_LabelMachine
                     {
                         System.DateTime time = Convert.ToDateTime(MidLabelCombox.SelectedValue.ToString().Split('#')[2]);
                         if (PrintMethod == "CodeSoft")
-                        {
                             MidDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(MidLabelCombox.SelectedValue.ToString().Split('#')[1], MidLabelCombox.Text, time));
-                        }
                         else
-                        {
                             MidFormat = engine.Documents.Open(BaseUtil.GetLabelUrl(MidLabelCombox.SelectedValue.ToString().Split('#')[1], MidLabelCombox.Text, time));
-                        }
                     }
                 }
             }
@@ -1946,11 +1959,10 @@ namespace UAS_LabelMachine
                     System.DateTime time = Convert.ToDateTime(OutBoxCombox.SelectedValue.ToString().Split('#')[2]);
                     if (OutBoxCombox.Text != "" && OutBoxCombox.SelectedValue != null && !GetGridOnly.Checked)
                     {
-                        OutBoxDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(OutBoxCombox.SelectedValue.ToString().Split('#')[1], OutBoxCombox.Text, time));
-                    }
-                    else
-                    {
-                        OutFormat = engine.Documents.Open(BaseUtil.GetLabelUrl(OutBoxCombox.SelectedValue.ToString().Split('#')[1], OutBoxCombox.Text, time));
+                        if (PrintMethod == "CodeSoft")
+                            OutBoxDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(OutBoxCombox.SelectedValue.ToString().Split('#')[1], OutBoxCombox.Text, time));
+                        else
+                            OutFormat = engine.Documents.Open(BaseUtil.GetLabelUrl(OutBoxCombox.SelectedValue.ToString().Split('#')[1], OutBoxCombox.Text, time));
                     }
                 }
             }
@@ -2050,9 +2062,9 @@ namespace UAS_LabelMachine
 
         private void AttachInfo_Click(object sender, EventArgs e)
         {
-            if (pi_cardcode.Text != "")
+            if (cu_code.Text != "")
             {
-                附件内容打印 att = new 附件内容打印(pi_cardcode.Text);
+                附件内容打印 att = new 附件内容打印(cu_code.Text);
                 att.ShowDialog();
             }
             else MessageBox.Show("请先获取出库单信息");
@@ -2130,5 +2142,47 @@ namespace UAS_LabelMachine
                     break;
             }
         }
+
+        private void DocRefresh_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
+        {
+            switch ((sender as Control).Name)
+            {
+                case "SingleDocRefresh":
+                    if (SingleDoc != null)
+                        SingleDoc.Close();
+                    if (SingleLabelCombox.Text != "" && SingleLabelCombox.SelectedValue != null && !GetGridOnly.Checked)
+                    {
+                        System.DateTime time = Convert.ToDateTime(SingleLabelCombox.SelectedValue.ToString().Split('#')[2]);
+                        SingleDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(SingleLabelCombox.SelectedValue.ToString().Split('#')[1], SingleLabelCombox.Text, time));
+                    }
+                    break;
+                case "MidDocRefresh":
+                    if (MidDoc != null)
+                        MidDoc.Close();
+                    if (MidLabelCombox.Text != "" && MidLabelCombox.SelectedValue != null && !GetGridOnly.Checked)
+                    {
+                        System.DateTime time = Convert.ToDateTime(MidLabelCombox.SelectedValue.ToString().Split('#')[2]);
+                        MidDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(MidLabelCombox.SelectedValue.ToString().Split('#')[1], MidLabelCombox.Text, time));
+                    }
+                    break;
+                case "OutDocRefresh":
+                    if (OutBoxDoc != null)
+                        OutBoxDoc.Close();
+                    if (OutBoxCombox.Text != "" && OutBoxCombox.SelectedValue != null && !GetGridOnly.Checked)
+                    {
+                        System.DateTime time = Convert.ToDateTime(OutBoxCombox.SelectedValue.ToString().Split('#')[2]);
+                        OutBoxDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(OutBoxCombox.SelectedValue.ToString().Split('#')[1], OutBoxCombox.Text, time));
+                    }
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        private void cu_code_UserControlTextChanged(object sender, EventArgs e)
+        {
+            if (!InitGetLabel)
+                GetInOutInfAndLabelFile();
+        }
     }
 }

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

@@ -195,11 +195,11 @@ namespace UAS_LabelMachine
                     string pd_orderdetno = ProdIoInfDGV.Rows[i].Cells["pd_orderdetno"].FormattedValue.ToString();
                     string pr_brand = ProdIoInfDGV.Rows[i].Cells["pr_brand"].FormattedValue.ToString();
                     //总数
-                    double pd_totalqty = double.Parse(ProdIoInfDGV.Rows[i].Cells["pd_totalqty"].FormattedValue.ToString());
+                    decimal pd_totalqty = decimal.Parse(ProdIoInfDGV.Rows[i].Cells["pd_totalqty"].FormattedValue.ToString());
                     //本次数量
-                    double pd_qty = double.Parse(ProdIoInfDGV.Rows[i].Cells["pd_qty"].FormattedValue.ToString());
+                    decimal pd_qty = decimal.Parse(ProdIoInfDGV.Rows[i].Cells["pd_qty"].FormattedValue.ToString());
                     //最小包装数
-                    double pr_zxbzs = double.Parse(ProdIoInfDGV.Rows[i].Cells["pr_zxbzs"].FormattedValue.ToString());
+                    decimal pr_zxbzs = decimal.Parse(ProdIoInfDGV.Rows[i].Cells["pr_zxbzs"].FormattedValue.ToString());
                     //中盒容量
                     int mid_qty;
                     try
@@ -214,7 +214,7 @@ namespace UAS_LabelMachine
                     //如果中盘盒数量为1且有尾数则表示一箱未装满
                     int mid_num = int.Parse(ProdIoInfDGV.Rows[i].Cells["mid_num"].FormattedValue.ToString());
                     //中盒尾数
-                    double mid_remain = double.Parse(ProdIoInfDGV.Rows[i].Cells["mid_remain"].FormattedValue.ToString());
+                    decimal mid_remain = decimal.Parse(ProdIoInfDGV.Rows[i].Cells["mid_remain"].FormattedValue.ToString());
                     string pib_barcode = dh.getFieldDataByCondition("prodiobarcode", "max(pib_barcode)", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
                     //中盒数量*中盒容量=需要打印的单盘标签
                     ArrayList<string> midcode = new ArrayList<string>();
@@ -241,7 +241,7 @@ namespace UAS_LabelMachine
                         string mid_code = dh.getFieldDataByCondition("PRODIOBARCODE", "nvl(max(to_number(PIB_OUTBOXCODE1)),0)+" + (j + 1), "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
                         //如果尾数不为0,并且已经遍历到了最后一箱(未装满的箱)
                         int count = 0;
-                        double AddNum = pr_zxbzs;
+                        decimal AddNum = pr_zxbzs;
                         if (mid_remain != 0 && j + 1 == mid_num)
                         {
                             //剩下的尾数刚好够整数的最小包或者加上一个未装满的最小包
@@ -412,12 +412,12 @@ namespace UAS_LabelMachine
             }
             if (pr_zxbzs != null && pd_qty != null && mid_qty != null)
             {
-                double 最小包装量 = double.Parse(pr_zxbzs.ToString());
-                double 中盘容量 = double.Parse(mid_qty.ToString());
-                double 本次数量 = double.Parse(pd_qty.ToString());
-                double 总数 = double.Parse(pd_totalqty.ToString());
+                decimal 最小包装量 = decimal.Parse(pr_zxbzs.ToString());
+                decimal 中盘容量 = decimal.Parse(mid_qty.ToString());
+                decimal 本次数量 = decimal.Parse(pd_qty.ToString());
+                decimal 总数 = decimal.Parse(pd_totalqty.ToString());
                 //计算中盘数量
-                double mid_num = 本次数量 / (最小包装量 * 中盘容量);
+                decimal mid_num = 本次数量 / (最小包装量 * 中盘容量);
                 int num = 0;
                 if (int.TryParse(mid_num.ToString(), out num))
                 {
@@ -455,12 +455,12 @@ namespace UAS_LabelMachine
                 object pd_totalqty = ProdIoInfDGV.Rows[i].Cells["pd_totalqty"].Value;
                 if (ProdIoInfDGV.Rows[i].Cells["pr_zxbzs"].Value.ToString() != "" && ProdIoInfDGV.Rows[i].Cells["pd_qty"].Value.ToString() != "" && ProdIoInfDGV.Rows[i].Cells["mid_qty"].Value.ToString() != "" && ProdIoInfDGV.Rows[i].Cells["pr_zxbzs"].Value.ToString() != "0")
                 {
-                    double 最小包装量 = double.Parse(pr_zxbzs.ToString());
-                    double 中盘容量 = double.Parse(mid_qty.ToString());
-                    double 本次数量 = double.Parse(pd_qty.ToString());
-                    double 总数 = double.Parse(pd_totalqty.ToString());
+                    decimal 最小包装量 = decimal.Parse(pr_zxbzs.ToString());
+                    decimal 中盘容量 = decimal.Parse(mid_qty.ToString());
+                    decimal 本次数量 = decimal.Parse(pd_qty.ToString());
+                    decimal 总数 = decimal.Parse(pd_totalqty.ToString());
                     //计算中盘数量
-                    double mid_num = 本次数量 / (最小包装量 * 中盘容量);
+                    decimal mid_num = 本次数量 / (最小包装量 * 中盘容量);
                     int num = 0;
                     if (int.TryParse(mid_num.ToString(), out num))
                     {