浏览代码

对文件进行时间标识,修改打印视图

章政 8 年之前
父节点
当前提交
1bd02d6971

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

@@ -27,6 +27,8 @@ namespace UAS_LabelMachine
 
         private void Login_Load(object sender, EventArgs e)
         {
+            FileInfo f = new FileInfo(@"C:\打印标签\94 大疆 中盒.lab");
+            Console.WriteLine(f.LastWriteTime);
             dh = new DataHelper();
             //获取账套信息
             dt= (DataTable)dh.ExecuteSql("select ma_function,ms_pwd,ma_user from master where ma_enable<>0", "select");

+ 2 - 2
UAS-出货标签管理/PublicMethod/BaseUtil.cs

@@ -187,13 +187,13 @@ namespace UAS_LabelMachine
         /// <param name="URL"></param>
         /// <param name="LabelName"></param>
         /// <returns></returns>
-        public static string GetLabelUrl(string URL, string LabelName)
+        public static string GetLabelUrl(string URL, string LabelName,DateTime time)
         {
             //如果是传入的数据是从FTP取的文件
             if (URL.Contains("ftp:"))
             {
                 ftpOperater ftp = new ftpOperater();
-                return ftp.Download(LabelName);
+                return ftp.Download(LabelName,time);
             }
             else {
                 return URL;

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

@@ -95,6 +95,7 @@ namespace UAS_LabelMachine
         {
             DataTable dt = new DataTable();
             string sql = "select " + Field + " from " + TableName + " where " + Condition;
+            Console.WriteLine(sql);
             command = new OracleCommand(sql, connection);
             OracleDataAdapter ad = new OracleDataAdapter();
             ad.SelectCommand = command;
@@ -738,6 +739,7 @@ namespace UAS_LabelMachine
         /// <returns></returns>
         public object ExecuteSql(string SQL, string Type, params object[] names)
         {
+            Console.WriteLine(SQL);
             object result = null;
             command = new OracleCommand(SQL, connection);
             //用来拼接参数的

+ 8 - 5
UAS-出货标签管理/PublicMethod/ftpOperater.cs

@@ -1,4 +1,5 @@
 using System;
+using System.ComponentModel;
 using System.Diagnostics;
 using System.IO;
 using System.Net;
@@ -11,7 +12,7 @@ namespace UAS_LabelMachine
     {
         public static string FTPAddress = Properties.Settings.Default.FTPAddress.Split('|')[0];
 
-        public static  string DownLoadTo = Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":\" + @"打印标签\";
+        public static string DownLoadTo = Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":\" + @"打印标签\";
 
         private string ftpServerIP;
         private string ftpUser;
@@ -19,7 +20,7 @@ namespace UAS_LabelMachine
 
         public ftpOperater()
         {
-           string[] FTPInf = Properties.Settings.Default.FTPAddress.Split('|');
+            string[] FTPInf = Properties.Settings.Default.FTPAddress.Split('|');
             this.ftpServerIP = FTPInf[0];
             this.ftpUser = FTPInf[1];
             this.ftpPwd = FTPInf[2];
@@ -124,7 +125,6 @@ namespace UAS_LabelMachine
                 FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
                 Stream ftpStream = response.GetResponseStream();
                 fileSize = response.ContentLength;
-
                 ftpStream.Close();
                 response.Close();
             }
@@ -139,7 +139,7 @@ namespace UAS_LabelMachine
         /// 实现ftp下载操作
         /// </summary>
         /// <param name="fileName">远程文件名</param>
-        public string Download(string fileName)
+        public string Download(string fileName,DateTime time)
         {
             FtpWebRequest reqFTP;
             try
@@ -152,7 +152,7 @@ namespace UAS_LabelMachine
                 FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
                 Stream ftpStream = response.GetResponseStream();
                 long cl = response.ContentLength;
-                int bufferSize = 2048;
+                int bufferSize = 4096;
                 int readCount;
                 byte[] buffer = new byte[bufferSize];
                 readCount = ftpStream.Read(buffer, 0, bufferSize);
@@ -164,6 +164,9 @@ namespace UAS_LabelMachine
                 ftpStream.Close();
                 outputStream.Close();
                 response.Close();
+                //设置最后修改文件时间为服务器时间
+                FileInfo f = new FileInfo(DownLoadTo + @"\" + fileName);
+                f.LastWriteTime = time;
                 return DownLoadTo + @"\" + fileName;
             }
             catch (Exception ex)

+ 30 - 12
UAS-出货标签管理/UAS_出货标签管理.cs

@@ -15,7 +15,7 @@ using System.Globalization;
 using UAS_LabelMachine.CustomControl.GroupBoxWithBorder;
 using UAS_LabelMachine.PublicForm;
 using System.Threading;
-
+using System.IO;
 
 namespace UAS_LabelMachine
 {
@@ -962,7 +962,7 @@ namespace UAS_LabelMachine
         private void GetInOutInfAndLabelFile()
         {
             sql.Clear();
-            sql.Append("select cl_labelname,cl_isdefault,la_id||'#'||cl_labelurl la_id,cl_custcode from customerlabel left join prodinout on pi_cardcode=cl_custcode ");
+            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("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");
@@ -976,12 +976,15 @@ namespace UAS_LabelMachine
                 {
                     string LabelUrl = dt.Rows[i]["la_id"].ToString().Split('#')[1];
                     string LabelName = dt.Rows[i]["cl_labelname"].ToString();
-                    BaseUtil.GetLabelUrl(LabelUrl, LabelName);
+                    System.DateTime time = Convert.ToDateTime(dt.Rows[i]["cl_date"].ToString());
+                    FileInfo file = new FileInfo(ftpOperater.DownLoadTo + LabelName);
+                    if (time.ToString() != file.LastWriteTime.ToString())
+                        BaseUtil.GetLabelUrl(LabelUrl, LabelName, time);
                 }
             if (SingleLabelCombox.Text != "")
                 SingleDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + SingleLabelCombox.Text);
             sql.Clear();
-            sql.Append("select cl_labelname,cl_isdefault,la_id||'#'||cl_labelurl la_id,cl_custcode from customerlabel left join prodinout on pi_cardcode=cl_custcode ");
+            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("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");
@@ -995,7 +998,10 @@ namespace UAS_LabelMachine
                 {
                     string LabelUrl = dt.Rows[i]["la_id"].ToString().Split('#')[1];
                     string LabelName = dt.Rows[i]["cl_labelname"].ToString();
-                    BaseUtil.GetLabelUrl(LabelUrl, LabelName);
+                    System.DateTime time = Convert.ToDateTime(dt.Rows[i]["cl_date"].ToString());
+                    FileInfo file = new FileInfo(ftpOperater.DownLoadTo + LabelName);
+                    if (time.ToString() != file.LastWriteTime.ToString())
+                        BaseUtil.GetLabelUrl(LabelUrl, LabelName, time);
                 }
             if (MidLabelCombox.Text != "")
             {
@@ -1004,7 +1010,7 @@ namespace UAS_LabelMachine
                 MidDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + MidLabelCombox.Text);
             }
             sql.Clear();
-            sql.Append("select cl_labelname,cl_isdefault,la_id||'#'||cl_labelurl la_id,cl_custcode from customerlabel left join prodinout on pi_cardcode=cl_custcode ");
+            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("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");
@@ -1018,7 +1024,10 @@ namespace UAS_LabelMachine
                 {
                     string LabelUrl = dt.Rows[i]["la_id"].ToString().Split('#')[1];
                     string LabelName = dt.Rows[i]["cl_labelname"].ToString();
-                    BaseUtil.GetLabelUrl(LabelUrl, LabelName);
+                    System.DateTime time = Convert.ToDateTime(dt.Rows[i]["cl_date"].ToString());
+                    FileInfo file = new FileInfo(ftpOperater.DownLoadTo + LabelName);
+                    if (time.ToString() != file.LastWriteTime.ToString())
+                        BaseUtil.GetLabelUrl(LabelUrl, LabelName, time);
                 }
             if (OutBoxCombox.Text != "")
             {
@@ -1194,7 +1203,7 @@ namespace UAS_LabelMachine
                 }
                 if (CheckedRowCount == 0)
                     MessageBox.Show("未勾选打印明细!");
-                else
+                else if (CurrentRowIndex + 1 < LabelInf.Rows.Count)
                     CurrentRowIndex = CurrentRowIndex + 1;
                 outboxcode1.Clear();
             }
@@ -1585,7 +1594,7 @@ namespace UAS_LabelMachine
                 sql.Append("pib_lotno,pib_datecode,pib_qty,pib_barcode,pib_outboxcode1,pib_outboxcode2,pib_ifpick,pib_ifprint");
                 sql.Append(",sa_pocode 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 ");
-                sql.Append("where pd_piid='" + PI_ID + "' order by to_number(pib_outboxcode1),pib_id,pr_spec,pd_prodcode");
+                sql.Append("where pib_piid='" + PI_ID + "' order by to_number(pib_outboxcode1),pib_id,pd_prodcode");
             }
             dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
             MidSource.DataSource = dt;
@@ -1887,7 +1896,10 @@ namespace UAS_LabelMachine
                 if (SingleDoc != null)
                     SingleDoc.Close();
                 if (SingleLabelCombox.Text != "" && SingleLabelCombox.SelectedValue != null && !GetGridOnly.Checked)
-                    SingleDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(SingleLabelCombox.SelectedValue.ToString().Split('#')[1], SingleLabelCombox.Text));
+                {
+                    System.DateTime time = Convert.ToDateTime(SingleLabelCombox.SelectedValue.ToString().Split('#')[2]);
+                    SingleDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(SingleLabelCombox.SelectedValue.ToString().Split('#')[1], SingleLabelCombox.Text, time));
+                }
             }
             catch (Exception) { }
         }
@@ -1904,7 +1916,10 @@ namespace UAS_LabelMachine
                 if (MidDoc != null)
                     MidDoc.Close();
                 if (MidLabelCombox.Text != "" && MidLabelCombox.SelectedValue != null && !GetGridOnly.Checked)
-                    MidDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(MidLabelCombox.SelectedValue.ToString().Split('#')[1], MidLabelCombox.Text));
+                {
+                    System.DateTime time = Convert.ToDateTime(MidLabelCombox.SelectedValue.ToString().Split('#')[2]);
+                    MidDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(MidLabelCombox.SelectedValue.ToString().Split('#')[1], MidLabelCombox.Text, time));
+                }
             }
             catch (Exception) { }
         }
@@ -1921,7 +1936,10 @@ namespace UAS_LabelMachine
                 if (OutBoxDoc != null)
                     OutBoxDoc.Close();
                 if (OutBoxCombox.Text != "" && OutBoxCombox.SelectedValue != null && !GetGridOnly.Checked)
-                    OutBoxDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(OutBoxCombox.SelectedValue.ToString().Split('#')[1], OutBoxCombox.Text));
+                {
+                    System.DateTime time = Convert.ToDateTime(OutBoxCombox.SelectedValue.ToString().Split('#')[2]);
+                    OutBoxDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(OutBoxCombox.SelectedValue.ToString().Split('#')[1], OutBoxCombox.Text, time));
+                }
             }
             catch (Exception) { }
         }

+ 113 - 104
UAS-出货标签管理/客户标签维护.Designer.cs

@@ -33,8 +33,8 @@ namespace UAS_LabelMachine
         private void InitializeComponent()
         {
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(客户标签维护));
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
             this.cl_code_label = new System.Windows.Forms.Label();
             this.cu_name_label = new System.Windows.Forms.Label();
             this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
@@ -65,6 +65,12 @@ namespace UAS_LabelMachine
             this.ChooseAll = new UAS_LabelMachine.CustomControl.ChooseAllButton();
             this.PrinterList = new UAS_LabelMachine.CustomControl.PrinterCombox();
             this.LabelDataGridView = new UAS_LabelMachine.CustomControl.DataGridViewWithSerialNum();
+            this.PrintTest = new UAS_LabelMachine.CustomControl.NormalButton();
+            this.客户编号 = new UAS_LabelMachine.CustomControl.SearchTextBox();
+            this.cu_code = new UAS_LabelMachine.CustomControl.SearchTextBox();
+            this.UpdateGrid = new UAS_LabelMachine.CustomControl.NormalButton();
+            this.Screen = new UAS_LabelMachine.CustomControl.NormalButton();
+            this.cu_name = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.Choose = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.la_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.cu_name1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -74,16 +80,11 @@ namespace UAS_LabelMachine
             this.cl_labelcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.cl_labelurl = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.cl_labelname = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.cl_date = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.cl_isdefault = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.cl_detno = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.cl_labelsoft = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.cl_status = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.PrintTest = new UAS_LabelMachine.CustomControl.NormalButton();
-            this.客户编号 = new UAS_LabelMachine.CustomControl.SearchTextBox();
-            this.cu_code = new UAS_LabelMachine.CustomControl.SearchTextBox();
-            this.UpdateGrid = new UAS_LabelMachine.CustomControl.NormalButton();
-            this.Screen = new UAS_LabelMachine.CustomControl.NormalButton();
-            this.cu_name = new UAS_LabelMachine.CustomControl.EnterTextBox();
             ((System.ComponentModel.ISupportInitialize)(this.LabelDataGridView)).BeginInit();
             this.SuspendLayout();
             // 
@@ -265,7 +266,7 @@ namespace UAS_LabelMachine
             // 
             // la_name
             // 
-            this.la_name.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+            this.la_name.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
             this.la_name.Location = new System.Drawing.Point(155, 616);
             this.la_name.Margin = new System.Windows.Forms.Padding(4);
@@ -410,6 +411,7 @@ namespace UAS_LabelMachine
             this.cl_labelcode,
             this.cl_labelurl,
             this.cl_labelname,
+            this.cl_date,
             this.cl_isdefault,
             this.cl_detno,
             this.cl_labelsoft,
@@ -417,16 +419,16 @@ namespace UAS_LabelMachine
             this.LabelDataGridView.Location = new System.Drawing.Point(23, 112);
             this.LabelDataGridView.Margin = new System.Windows.Forms.Padding(4);
             this.LabelDataGridView.Name = "LabelDataGridView";
-            dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
-            dataGridViewCellStyle5.BackColor = System.Drawing.Color.Blue;
-            dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText;
-            dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
-            dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
-            dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
-            this.LabelDataGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle5;
-            dataGridViewCellStyle6.BackColor = System.Drawing.Color.White;
-            this.LabelDataGridView.RowsDefaultCellStyle = dataGridViewCellStyle6;
+            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+            dataGridViewCellStyle1.BackColor = System.Drawing.Color.Blue;
+            dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
+            dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+            dataGridViewCellStyle1.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
+            dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+            this.LabelDataGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle1;
+            dataGridViewCellStyle2.BackColor = System.Drawing.Color.White;
+            this.LabelDataGridView.RowsDefaultCellStyle = dataGridViewCellStyle2;
             this.LabelDataGridView.RowTemplate.Height = 23;
             this.LabelDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
             this.LabelDataGridView.Size = new System.Drawing.Size(1186, 435);
@@ -435,6 +437,88 @@ namespace UAS_LabelMachine
             this.LabelDataGridView.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.LabelDataGridView_CellFormatting);
             this.LabelDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.LabelDataGridView_DataError);
             // 
+            // PrintTest
+            // 
+            this.PrintTest.Image = ((System.Drawing.Image)(resources.GetObject("PrintTest.Image")));
+            this.PrintTest.Location = new System.Drawing.Point(1354, 569);
+            this.PrintTest.Margin = new System.Windows.Forms.Padding(4);
+            this.PrintTest.Name = "PrintTest";
+            this.PrintTest.Size = new System.Drawing.Size(81, 30);
+            this.PrintTest.TabIndex = 166;
+            this.PrintTest.Tag = "Print";
+            this.PrintTest.Text = "打印测试";
+            this.PrintTest.UseVisualStyleBackColor = true;
+            this.PrintTest.Click += new System.EventHandler(this.PrintTest_Click);
+            // 
+            // 客户编号
+            // 
+            this.客户编号.Caller = null;
+            this.客户编号.Condition = null;
+            this.客户编号.FormName = null;
+            this.客户编号.Location = new System.Drawing.Point(155, 566);
+            this.客户编号.Margin = new System.Windows.Forms.Padding(4);
+            this.客户编号.Name = "客户编号";
+            this.客户编号.SelectField = null;
+            this.客户编号.SetValueField = null;
+            this.客户编号.Size = new System.Drawing.Size(181, 26);
+            this.客户编号.TabIndex = 168;
+            this.客户编号.TableName = null;
+            this.客户编号.Tag = "cu_code";
+            // 
+            // cu_code
+            // 
+            this.cu_code.Caller = null;
+            this.cu_code.Condition = null;
+            this.cu_code.FormName = null;
+            this.cu_code.Location = new System.Drawing.Point(169, 20);
+            this.cu_code.Margin = new System.Windows.Forms.Padding(4);
+            this.cu_code.Name = "cu_code";
+            this.cu_code.SelectField = null;
+            this.cu_code.SetValueField = null;
+            this.cu_code.Size = new System.Drawing.Size(200, 26);
+            this.cu_code.TabIndex = 159;
+            this.cu_code.TableName = null;
+            this.cu_code.Tag = "cl_custcode";
+            // 
+            // UpdateGrid
+            // 
+            this.UpdateGrid.Image = ((System.Drawing.Image)(resources.GetObject("UpdateGrid.Image")));
+            this.UpdateGrid.Location = new System.Drawing.Point(927, 61);
+            this.UpdateGrid.Margin = new System.Windows.Forms.Padding(4);
+            this.UpdateGrid.Name = "UpdateGrid";
+            this.UpdateGrid.Size = new System.Drawing.Size(81, 30);
+            this.UpdateGrid.TabIndex = 154;
+            this.UpdateGrid.Tag = "IfWrite";
+            this.UpdateGrid.Text = "更新";
+            this.UpdateGrid.UseVisualStyleBackColor = true;
+            this.UpdateGrid.Click += new System.EventHandler(this.Update_Click);
+            // 
+            // Screen
+            // 
+            this.Screen.Image = ((System.Drawing.Image)(resources.GetObject("Screen.Image")));
+            this.Screen.Location = new System.Drawing.Point(776, 61);
+            this.Screen.Margin = new System.Windows.Forms.Padding(4);
+            this.Screen.Name = "Screen";
+            this.Screen.Size = new System.Drawing.Size(81, 30);
+            this.Screen.TabIndex = 153;
+            this.Screen.Tag = "IfRead";
+            this.Screen.Text = "筛选";
+            this.Screen.UseVisualStyleBackColor = true;
+            this.Screen.Click += new System.EventHandler(this.Screen_Click);
+            // 
+            // cu_name
+            // 
+            this.cu_name.ID = null;
+            this.cu_name.Location = new System.Drawing.Point(559, 20);
+            this.cu_name.Margin = new System.Windows.Forms.Padding(4);
+            this.cu_name.Name = "cu_name";
+            this.cu_name.Size = new System.Drawing.Size(199, 25);
+            this.cu_name.Str = null;
+            this.cu_name.Str1 = null;
+            this.cu_name.Str2 = null;
+            this.cu_name.TabIndex = 147;
+            this.cu_name.Tag = "cu_name";
+            // 
             // Choose
             // 
             this.Choose.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
@@ -496,6 +580,12 @@ namespace UAS_LabelMachine
             this.cl_labelname.HeaderText = "模板名称";
             this.cl_labelname.Name = "cl_labelname";
             // 
+            // cl_date
+            // 
+            this.cl_date.DataPropertyName = "cl_date";
+            this.cl_date.HeaderText = "最后修改时间";
+            this.cl_date.Name = "cl_date";
+            // 
             // cl_isdefault
             // 
             this.cl_isdefault.DataPropertyName = "cl_isdefault";
@@ -521,88 +611,6 @@ namespace UAS_LabelMachine
             this.cl_status.Name = "cl_status";
             this.cl_status.ReadOnly = true;
             // 
-            // PrintTest
-            // 
-            this.PrintTest.Image = ((System.Drawing.Image)(resources.GetObject("PrintTest.Image")));
-            this.PrintTest.Location = new System.Drawing.Point(1354, 569);
-            this.PrintTest.Margin = new System.Windows.Forms.Padding(4);
-            this.PrintTest.Name = "PrintTest";
-            this.PrintTest.Size = new System.Drawing.Size(81, 30);
-            this.PrintTest.TabIndex = 166;
-            this.PrintTest.Tag = "Print";
-            this.PrintTest.Text = "打印测试";
-            this.PrintTest.UseVisualStyleBackColor = true;
-            this.PrintTest.Click += new System.EventHandler(this.PrintTest_Click);
-            // 
-            // 客户编号
-            // 
-            this.客户编号.Caller = null;
-            this.客户编号.Condition = null;
-            this.客户编号.FormName = null;
-            this.客户编号.Location = new System.Drawing.Point(155, 566);
-            this.客户编号.Margin = new System.Windows.Forms.Padding(4);
-            this.客户编号.Name = "客户编号";
-            this.客户编号.SelectField = null;
-            this.客户编号.SetValueField = null;
-            this.客户编号.Size = new System.Drawing.Size(181, 26);
-            this.客户编号.TabIndex = 168;
-            this.客户编号.TableName = null;
-            this.客户编号.Tag = "cu_code";
-            // 
-            // cu_code
-            // 
-            this.cu_code.Caller = null;
-            this.cu_code.Condition = null;
-            this.cu_code.FormName = null;
-            this.cu_code.Location = new System.Drawing.Point(169, 20);
-            this.cu_code.Margin = new System.Windows.Forms.Padding(4);
-            this.cu_code.Name = "cu_code";
-            this.cu_code.SelectField = null;
-            this.cu_code.SetValueField = null;
-            this.cu_code.Size = new System.Drawing.Size(200, 26);
-            this.cu_code.TabIndex = 159;
-            this.cu_code.TableName = null;
-            this.cu_code.Tag = "cl_custcode";
-            // 
-            // UpdateGrid
-            // 
-            this.UpdateGrid.Image = ((System.Drawing.Image)(resources.GetObject("UpdateGrid.Image")));
-            this.UpdateGrid.Location = new System.Drawing.Point(927, 61);
-            this.UpdateGrid.Margin = new System.Windows.Forms.Padding(4);
-            this.UpdateGrid.Name = "UpdateGrid";
-            this.UpdateGrid.Size = new System.Drawing.Size(81, 30);
-            this.UpdateGrid.TabIndex = 154;
-            this.UpdateGrid.Tag = "IfWrite";
-            this.UpdateGrid.Text = "更新";
-            this.UpdateGrid.UseVisualStyleBackColor = true;
-            this.UpdateGrid.Click += new System.EventHandler(this.Update_Click);
-            // 
-            // Screen
-            // 
-            this.Screen.Image = ((System.Drawing.Image)(resources.GetObject("Screen.Image")));
-            this.Screen.Location = new System.Drawing.Point(776, 61);
-            this.Screen.Margin = new System.Windows.Forms.Padding(4);
-            this.Screen.Name = "Screen";
-            this.Screen.Size = new System.Drawing.Size(81, 30);
-            this.Screen.TabIndex = 153;
-            this.Screen.Tag = "IfRead";
-            this.Screen.Text = "筛选";
-            this.Screen.UseVisualStyleBackColor = true;
-            this.Screen.Click += new System.EventHandler(this.Screen_Click);
-            // 
-            // cu_name
-            // 
-            this.cu_name.ID = null;
-            this.cu_name.Location = new System.Drawing.Point(559, 20);
-            this.cu_name.Margin = new System.Windows.Forms.Padding(4);
-            this.cu_name.Name = "cu_name";
-            this.cu_name.Size = new System.Drawing.Size(199, 25);
-            this.cu_name.Str = null;
-            this.cu_name.Str1 = null;
-            this.cu_name.Str2 = null;
-            this.cu_name.TabIndex = 147;
-            this.cu_name.Tag = "cu_name";
-            // 
             // 客户标签维护
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
@@ -692,6 +700,9 @@ namespace UAS_LabelMachine
         private TextBox la_name;
         private Label la_name_label;
         private CheckBox FTPShare;
+        private NormalButton NewLabel;
+        private Pagination pagination1;
+        private RadioButton CodeSoft;
         private DataGridViewCheckBoxColumn Choose;
         private DataGridViewTextBoxColumn la_id;
         private DataGridViewTextBoxColumn cu_name1;
@@ -701,12 +712,10 @@ namespace UAS_LabelMachine
         private DataGridViewTextBoxColumn cl_labelcode;
         private DataGridViewTextBoxColumn cl_labelurl;
         private DataGridViewTextBoxColumn cl_labelname;
+        private DataGridViewTextBoxColumn cl_date;
         private DataGridViewTextBoxColumn cl_isdefault;
         private DataGridViewTextBoxColumn cl_detno;
         private DataGridViewTextBoxColumn cl_labelsoft;
         private DataGridViewTextBoxColumn cl_status;
-        private NormalButton NewLabel;
-        private Pagination pagination1;
-        private RadioButton CodeSoft;
     }
 }

+ 12 - 15
UAS-出货标签管理/客户标签维护.cs

@@ -96,7 +96,6 @@ namespace UAS_LabelMachine
             }
             dh = new DataHelper();
             condition.Append("");
-
             ChooseAll.ChooseAll(LabelDataGridView);
             BaseUtil.SetComboxData(la_type, "display", "value", labeltype);
             //加载下拉框的静态值
@@ -120,14 +119,11 @@ namespace UAS_LabelMachine
                 LabelCode = LabelDataGridView.Rows[e.RowIndex].Cells["cl_labelcode"].Value.ToString();
                 CL_ID1 = LabelDataGridView.Rows[e.RowIndex].Cells["cl_id"].Value.ToString();
                 La_id1 = LabelDataGridView.Rows[e.RowIndex].Cells["la_id"].Value.ToString();
+                System.DateTime time = Convert.ToDateTime(LabelDataGridView.Rows[e.RowIndex].Cells["cl_date"].Value.ToString());
                 if (CodeSoft.Checked)
                 {
                     string LabelName = LabelDataGridView.Rows[e.RowIndex].Cells["cl_labelname"].Value.ToString();
-                    doc = lbl.Documents.Open(BaseUtil.GetLabelUrl(LabelPath, LabelName));
-                    if (doc == null)
-                    {
-                        Console.WriteLine("doc is null");
-                    }
+                    doc = lbl.Documents.Open(BaseUtil.GetLabelUrl(LabelPath, LabelName,time));
                     ParamNum = doc.Variables.FreeVariables.Count;
                     //去除之前添加的控件
                     for (int i = 0; i < (ParamName == null ? 0 : ParamName.Length); i++)
@@ -182,7 +178,8 @@ namespace UAS_LabelMachine
                     CL_ID2 = LabelDataGridView.Rows[e.RowIndex].Cells["cl_id"].Value.ToString();
                     LabelPath = LabelDataGridView.Rows[e.RowIndex].Cells["cl_labelurl"].Value.ToString();
                     string LabelName = LabelDataGridView.Rows[e.RowIndex].Cells["cl_labelname"].Value.ToString();
-                    BaseUtil.GetLabelUrl(LabelPath, LabelName);
+                    System.DateTime time = Convert.ToDateTime(LabelDataGridView.Rows[e.RowIndex].Cells["cl_date"].Value.ToString());
+                    BaseUtil.GetLabelUrl(LabelPath, LabelName, time);
                     System.Diagnostics.Process.Start(ftpOperater.DownLoadTo + LabelName);
                     客户编号.Text = LabelDataGridView.Rows[e.RowIndex].Cells["CL_CUSTCODE2"].Value.ToString();
                     la_type1.Text = LabelDataGridView.Rows[e.RowIndex].Cells["cl_labeltype"].Value.ToString();
@@ -205,7 +202,7 @@ namespace UAS_LabelMachine
             }
             else
             {
-                sql.Append("select cu_name,cl_labelurl,cl_labeltype,cl_isdefault,cl_custcode,cl_labelname,cl_id,cl_labelcode,cl_detno,cl_labelsoft,la_id from customerlabel left join customer on cl_custcode=cu_code left join label on la_code=cl_custcode order by cl_custcode ");
+                sql.Append("select to_char(nvl(cl_date,sysdate),'YYYY-MM-DD HH24:Mi:SS') cl_date,cu_name,cl_labelurl,cl_labeltype,cl_isdefault,cl_custcode,cl_labelname,cl_id,cl_labelcode,cl_detno,cl_labelsoft,la_id from customerlabel left join customer on cl_custcode=cu_code left join label on la_code=cl_custcode order by cl_custcode ");
                 //设置筛选的条件
                 condition.Append(BaseUtil.GetScreenSqlCondition(cu_code, la_type));
                 //最终刷选条件拼接成的sql
@@ -233,7 +230,7 @@ namespace UAS_LabelMachine
                         LabelDataGridView.Rows[i].Cells["cl_labelsoft"].Value = LabelSoft;
                     }
                 }
-                string sql = "Insert into customerlabel (cl_ID,cl_custCODE,cl_LABELTYPE,cl_LABELCODE,cl_LABELURL,cl_DETNO,cl_LABELSOFT,cl_ISDEFAULT) values( customerlabel_seq.nextval,'" + cu_code.Text + "',:cl_LABELTYPE,:cl_LABELCODE,:cl_LABELURL,:cl_DETNO,:cl_LABELSOFT,:cl_ISDEFAULT )";
+                string sql = "Insert into customerlabel (cl_ID,cl_custCODE,cl_LABELTYPE,cl_LABELCODE,cl_LABELURL,cl_DETNO,cl_LABELSOFT,cl_ISDEFAULT, cl_date) values( customerlabel_seq.nextval,'" + cu_code.Text + "',:cl_LABELTYPE,:cl_LABELCODE,:cl_LABELURL,:cl_DETNO,:cl_LABELSOFT,:cl_ISDEFAULT,sysdate )";
                 dh.UpDateTableByCondition(dt.GetChanges(), "customerlabel", "cl_id", sql.ToLower());
                 LoadData();
             }
@@ -309,7 +306,7 @@ namespace UAS_LabelMachine
                 //如果没有任何筛选条件直接选取customerlabel的数据
                 if (sql.Length == 0)
                 {
-                    dt = (DataTable)dh.ExecuteSql("select cu_name,cl_labelurl,cl_labeltype,cl_isdefault,cl_labelname,cl_custcode,cl_id,cl_labelcode,cl_detno,cl_labelsoft,la_id from customerlabel left join customer on cl_custcode=cu_code left join label on la_code=CL_LABELCODE order by cl_custcode", "select");
+                    dt = (DataTable)dh.ExecuteSql("select to_char(nvl(cl_date,sysdate),'YYYY-MM-DD HH24:Mi:SS') cl_date,cu_name,cl_labelurl,cl_labeltype,cl_isdefault,cl_labelname,cl_custcode,cl_id,cl_labelcode,cl_detno,cl_labelsoft,la_id from customerlabel left join customer on cl_custcode=cu_code left join label on la_code=CL_LABELCODE order by cl_custcode", "select");
                 }
                 else
                 {
@@ -387,13 +384,13 @@ namespace UAS_LabelMachine
                     {
                         sql.Clear();
                         sql.Append("update customerlabel set cl_labelcode='" + la_code.Text + "',cl_custcode='" + 客户编号.Text + "',");
-                        sql.Append("cl_labeltype='" + la_type1.Text + "',cl_labelname='" + la_name.Text + "' where cl_id=" + CL_ID2);
+                        sql.Append("cl_labeltype='" + la_type1.Text + "',cl_labelname='" + la_name.Text + "',cl_date=sysdate where cl_id=" + CL_ID2);
                     }
                     else
                     {
                         sql.Clear();
-                        sql.Append("insert into customerlabel (cl_id,cl_labelcode,cl_custcode,cl_labeltype,cl_labelurl,cl_labelname,cl_labelsoft) values( customerlabel_seq.nextval, ");
-                        sql.Append("'" + la_code.Text + "','" + (客户编号.Text == "" ? "" : 客户编号.Text) + "','" + la_type1.Text + "','" + ftpOperater.FTPAddress + "','" + la_name.Text + "','" + SoftWare + "')");
+                        sql.Append("insert into customerlabel (cl_id,cl_labelcode,cl_custcode,cl_labeltype,cl_labelurl,cl_labelname,cl_labelsoft,cl_date) values( customerlabel_seq.nextval, ");
+                        sql.Append("'" + la_code.Text + "','" + (客户编号.Text == "" ? "" : 客户编号.Text) + "','" + la_type1.Text + "','" + ftpOperater.FTPAddress + "','" + la_name.Text + "','" + SoftWare + "',sysdate)");
                     }
                     dh.ExecuteSql(sql.ToString(), "insert");
                     sql.Clear();
@@ -425,8 +422,8 @@ namespace UAS_LabelMachine
                         File.Copy(sourceFile, destFile, true);
                         string SoftWare = "CodeSoft";
                         sql.Clear();
-                        sql.Append("insert into customerlabel (cl_id,cl_labelcode,cl_custcode,cl_labeltype,cl_labelurl,cl_labelname,cl_labelsoft) values( customerlabel_seq.nextval, ");
-                        sql.Append("'" + la_code.Text + "','" + (客户编号.Text == "" ? "共用" : 客户编号.Text) + "','" + la_type1.Text + "','" + destFile + "','" + la_name.Text + "','" + SoftWare + "')");
+                        sql.Append("insert into customerlabel (cl_id,cl_labelcode,cl_custcode,cl_labeltype,cl_labelurl,cl_labelname,cl_labelsoft,cl_date) values( customerlabel_seq.nextval, ");
+                        sql.Append("'" + la_code.Text + "','" + (客户编号.Text == "" ? "共用" : 客户编号.Text) + "','" + la_type1.Text + "','" + destFile + "','" + la_name.Text + "','" + SoftWare + "',sysdate)");
                         dh.ExecuteSql(sql.ToString(), "insert");
                         sql.Clear();
                     }

+ 3 - 0
UAS-出货标签管理/客户标签维护.resx

@@ -175,6 +175,9 @@
   <metadata name="cl_labelname.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="cl_date.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="cl_isdefault.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>

+ 51 - 28
UAS-出货标签管理/生成条码.Designer.cs

@@ -43,6 +43,7 @@
             this.ProdIoInfDGV = new UAS_LabelMachine.CustomControl.DataGridViewWithSerialNum();
             this.pi_inoutno = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.Choose = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+            this.pd_orderdetno = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pd_pdno = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pr_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pd_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -65,9 +66,10 @@
             // 
             this.pi_inoutno_label.AutoSize = true;
             this.pi_inoutno_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pi_inoutno_label.Location = new System.Drawing.Point(25, 29);
+            this.pi_inoutno_label.Location = new System.Drawing.Point(33, 36);
+            this.pi_inoutno_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pi_inoutno_label.Name = "pi_inoutno_label";
-            this.pi_inoutno_label.Size = new System.Drawing.Size(90, 21);
+            this.pi_inoutno_label.Size = new System.Drawing.Size(112, 27);
             this.pi_inoutno_label.TabIndex = 148;
             this.pi_inoutno_label.Text = "出入库单号";
             // 
@@ -75,9 +77,10 @@
             // 
             this.pi_class_label.AutoSize = true;
             this.pi_class_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pi_class_label.Location = new System.Drawing.Point(266, 29);
+            this.pi_class_label.Location = new System.Drawing.Point(355, 36);
+            this.pi_class_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pi_class_label.Name = "pi_class_label";
-            this.pi_class_label.Size = new System.Drawing.Size(74, 21);
+            this.pi_class_label.Size = new System.Drawing.Size(92, 27);
             this.pi_class_label.TabIndex = 150;
             this.pi_class_label.Text = "单据类型";
             // 
@@ -85,18 +88,20 @@
             // 
             this.pi_class.AutoSize = true;
             this.pi_class.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pi_class.Location = new System.Drawing.Point(355, 29);
+            this.pi_class.Location = new System.Drawing.Point(473, 36);
+            this.pi_class.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pi_class.Name = "pi_class";
-            this.pi_class.Size = new System.Drawing.Size(0, 21);
+            this.pi_class.Size = new System.Drawing.Size(0, 27);
             this.pi_class.TabIndex = 152;
             // 
             // pr_kind_label
             // 
             this.pr_kind_label.AutoSize = true;
             this.pr_kind_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_kind_label.Location = new System.Drawing.Point(476, 29);
+            this.pr_kind_label.Location = new System.Drawing.Point(635, 36);
+            this.pr_kind_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_kind_label.Name = "pr_kind_label";
-            this.pr_kind_label.Size = new System.Drawing.Size(74, 21);
+            this.pr_kind_label.Size = new System.Drawing.Size(92, 27);
             this.pr_kind_label.TabIndex = 156;
             this.pr_kind_label.Text = "物料类型";
             // 
@@ -108,27 +113,30 @@
             "单件管控",
             "批管控",
             "全部"});
-            this.pr_kind.Location = new System.Drawing.Point(563, 30);
+            this.pr_kind.Location = new System.Drawing.Point(751, 38);
+            this.pr_kind.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.pr_kind.Name = "pr_kind";
-            this.pr_kind.Size = new System.Drawing.Size(121, 20);
+            this.pr_kind.Size = new System.Drawing.Size(160, 23);
             this.pr_kind.TabIndex = 157;
             // 
             // MidCapacity_label
             // 
             this.MidCapacity_label.AutoSize = true;
             this.MidCapacity_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.MidCapacity_label.Location = new System.Drawing.Point(703, 29);
+            this.MidCapacity_label.Location = new System.Drawing.Point(937, 36);
+            this.MidCapacity_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.MidCapacity_label.Name = "MidCapacity_label";
-            this.MidCapacity_label.Size = new System.Drawing.Size(74, 21);
+            this.MidCapacity_label.Size = new System.Drawing.Size(92, 27);
             this.MidCapacity_label.TabIndex = 158;
             this.MidCapacity_label.Text = "中盘容量";
             // 
             // SetMidCapacity
             // 
             this.SetMidCapacity.Image = ((System.Drawing.Image)(resources.GetObject("SetMidCapacity.Image")));
-            this.SetMidCapacity.Location = new System.Drawing.Point(911, 28);
+            this.SetMidCapacity.Location = new System.Drawing.Point(1215, 35);
+            this.SetMidCapacity.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.SetMidCapacity.Name = "SetMidCapacity";
-            this.SetMidCapacity.Size = new System.Drawing.Size(50, 23);
+            this.SetMidCapacity.Size = new System.Drawing.Size(67, 29);
             this.SetMidCapacity.TabIndex = 160;
             this.SetMidCapacity.Text = "刷新";
             this.SetMidCapacity.UseVisualStyleBackColor = true;
@@ -136,17 +144,19 @@
             // 
             // MidCapacity
             // 
-            this.MidCapacity.Location = new System.Drawing.Point(787, 29);
+            this.MidCapacity.Location = new System.Drawing.Point(1049, 36);
+            this.MidCapacity.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.MidCapacity.Name = "MidCapacity";
             this.MidCapacity.Negative = false;
-            this.MidCapacity.Size = new System.Drawing.Size(121, 21);
+            this.MidCapacity.Size = new System.Drawing.Size(160, 25);
             this.MidCapacity.TabIndex = 159;
             // 
             // ChooseAll
             // 
-            this.ChooseAll.Location = new System.Drawing.Point(1, 102);
+            this.ChooseAll.Location = new System.Drawing.Point(1, 128);
+            this.ChooseAll.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.ChooseAll.Name = "ChooseAll";
-            this.ChooseAll.Size = new System.Drawing.Size(46, 23);
+            this.ChooseAll.Size = new System.Drawing.Size(61, 29);
             this.ChooseAll.TabIndex = 155;
             this.ChooseAll.Text = "全选";
             this.ChooseAll.UseVisualStyleBackColor = true;
@@ -154,9 +164,10 @@
             // GenerateBarCode
             // 
             this.GenerateBarCode.Image = ((System.Drawing.Image)(resources.GetObject("GenerateBarCode.Image")));
-            this.GenerateBarCode.Location = new System.Drawing.Point(494, 78);
+            this.GenerateBarCode.Location = new System.Drawing.Point(659, 98);
+            this.GenerateBarCode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.GenerateBarCode.Name = "GenerateBarCode";
-            this.GenerateBarCode.Size = new System.Drawing.Size(64, 24);
+            this.GenerateBarCode.Size = new System.Drawing.Size(85, 30);
             this.GenerateBarCode.TabIndex = 154;
             this.GenerateBarCode.Text = "生成条码";
             this.GenerateBarCode.UseVisualStyleBackColor = true;
@@ -165,9 +176,10 @@
             // Screen
             // 
             this.Screen.Image = ((System.Drawing.Image)(resources.GetObject("Screen.Image")));
-            this.Screen.Location = new System.Drawing.Point(406, 78);
+            this.Screen.Location = new System.Drawing.Point(541, 98);
+            this.Screen.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.Screen.Name = "Screen";
-            this.Screen.Size = new System.Drawing.Size(64, 24);
+            this.Screen.Size = new System.Drawing.Size(85, 30);
             this.Screen.TabIndex = 153;
             this.Screen.Text = "筛选";
             this.Screen.UseVisualStyleBackColor = true;
@@ -183,6 +195,7 @@
             this.ProdIoInfDGV.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.ProdIoInfDGV.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.Choose,
+            this.pd_orderdetno,
             this.pd_pdno,
             this.pr_id,
             this.pd_id,
@@ -199,10 +212,11 @@
             this.mid_num,
             this.mid_remain});
             this.ProdIoInfDGV.GridColor = System.Drawing.SystemColors.ButtonFace;
-            this.ProdIoInfDGV.Location = new System.Drawing.Point(0, 125);
+            this.ProdIoInfDGV.Location = new System.Drawing.Point(0, 156);
+            this.ProdIoInfDGV.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.ProdIoInfDGV.Name = "ProdIoInfDGV";
             this.ProdIoInfDGV.RowTemplate.Height = 23;
-            this.ProdIoInfDGV.Size = new System.Drawing.Size(964, 350);
+            this.ProdIoInfDGV.Size = new System.Drawing.Size(1285, 438);
             this.ProdIoInfDGV.TabIndex = 151;
             this.ProdIoInfDGV.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.ProdIoInfDGV_CellEndEdit);
             this.ProdIoInfDGV.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.ProdIoInfDGV_CellPainting);
@@ -210,9 +224,10 @@
             // pi_inoutno
             // 
             this.pi_inoutno.ID = null;
-            this.pi_inoutno.Location = new System.Drawing.Point(128, 29);
+            this.pi_inoutno.Location = new System.Drawing.Point(171, 36);
+            this.pi_inoutno.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.pi_inoutno.Name = "pi_inoutno";
-            this.pi_inoutno.Size = new System.Drawing.Size(121, 21);
+            this.pi_inoutno.Size = new System.Drawing.Size(160, 25);
             this.pi_inoutno.Str = null;
             this.pi_inoutno.Str1 = null;
             this.pi_inoutno.Str2 = null;
@@ -227,6 +242,12 @@
             this.Choose.Name = "Choose";
             this.Choose.Width = 60;
             // 
+            // pd_orderdetno
+            // 
+            this.pd_orderdetno.DataPropertyName = "pd_orderdetno";
+            this.pd_orderdetno.HeaderText = "订单序号";
+            this.pd_orderdetno.Name = "pd_orderdetno";
+            // 
             // pd_pdno
             // 
             this.pd_pdno.DataPropertyName = "pd_pdno";
@@ -332,9 +353,9 @@
             // 
             // 生成条码
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(965, 477);
+            this.ClientSize = new System.Drawing.Size(1287, 596);
             this.Controls.Add(this.SetMidCapacity);
             this.Controls.Add(this.MidCapacity);
             this.Controls.Add(this.MidCapacity_label);
@@ -348,6 +369,7 @@
             this.Controls.Add(this.pi_class_label);
             this.Controls.Add(this.pi_inoutno);
             this.Controls.Add(this.pi_inoutno_label);
+            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.Name = "生成条码";
             this.Text = "生成条码";
             this.Load += new System.EventHandler(this.生成条码_Load);
@@ -374,6 +396,7 @@
         private CustomControl.NumOnlyTextBox MidCapacity;
         private CustomControl.NormalButton SetMidCapacity;
         private System.Windows.Forms.DataGridViewCheckBoxColumn Choose;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pd_orderdetno;
         private System.Windows.Forms.DataGridViewTextBoxColumn pd_pdno;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_id;
         private System.Windows.Forms.DataGridViewTextBoxColumn pd_id;

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

@@ -109,6 +109,7 @@ namespace UAS_LabelMachine
                     string pr_id = ProdIoInfDGV.Rows[i].Cells["pr_id"].FormattedValue.ToString();
                     string pd_ordercode = ProdIoInfDGV.Rows[i].Cells["pd_ordercode"].FormattedValue.ToString();
                     string pd_pdno = ProdIoInfDGV.Rows[i].Cells["pd_pdno"].FormattedValue.ToString();
+                    string pd_orderdetno = ProdIoInfDGV.Rows[i].Cells["pd_orderdetno"].FormattedValue.ToString();
                     //总数
                     int pd_totalqty = int.Parse(ProdIoInfDGV.Rows[i].Cells["pd_totalqty"].FormattedValue.ToString());
                     //本次数量
@@ -142,16 +143,16 @@ namespace UAS_LabelMachine
                     //    CheckedRowCount--;
                     //    continue;
                     //}
-                    string pib_barcode = dh.getFieldDataByCondition("prodiobarcode", "max(pib_barcode)", "pib_pdid=" + pd_id).ToString();
+                    string pib_barcode = dh.getFieldDataByCondition("prodiobarcode", "max(pib_barcode)", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
                     //中盒数量*中盒容量=需要打印的单盘标签
-                    ArrayList<string> midcode = new ArrayList<string>();
+                    ArrayList <string> midcode = new ArrayList<string>();
                     ArrayList<string> barcode = new ArrayList<string>();
-                    //循环中盒号的个数,取当前出入库单最大的中盒号+1
+                    //循环中盒号的个数,取当前出入库单最大 的中盒号+1
                     for (int j = 0; j < mid_num; j++)
                     {
                         //获取中盘的编号
-                        string mid_code = dh.getFieldDataByCondition("PRODIOBARCODE", "nvl(max(PIB_OUTBOXCODE1),0)+" + (j + 1), "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
-                        //如果尾数不为0,并且已经遍历到了最后一箱(未装满的箱)
+                        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;
                         if (mid_remain != 0 && j + 1 == mid_num)
                         {
@@ -173,9 +174,9 @@ namespace UAS_LabelMachine
                     }
                     sql.Clear();
                     sql.Append("insert into prodiobarcode (PIB_ID,PIB_PRODCODE,PIB_INDATE,PIB_INOUTNO,PIB_PIID,PIB_BARCODE,PIB_PDNO,");
-                    sql.Append("PIB_PDID,PIB_PICLASS,PIB_QTY,PIB_PRODID,PIB_OUTBOXCODE1,PIB_IFPRINT,PIB_IFPICK,PIB_ORDERCODE,PIB_CUSTPO)");
+                    sql.Append("PIB_PDID,PIB_PICLASS,PIB_QTY,PIB_PRODID,PIB_OUTBOXCODE1,PIB_IFPRINT,PIB_IFPICK,PIB_ORDERCODE,PIB_CUSTPO,pib_orderdetno)");
                     sql.Append(" values (prodiobarcode_seq.nextval,'" + pd_prodcode + "',sysdate,'" + pi_inoutno.Text + "'," + pi_id + ",:barcode,'" + pd_pdno + "','" + pd_id + "',");
-                    sql.Append("'" + pi_class.Text + "',:pib_inqty,'" + pr_id + "',:midcode,0,0,'" + pd_ordercode + "','')");
+                    sql.Append("'" + pi_class.Text + "',:pib_inqty,'" + pr_id + "',:midcode,0,0,'" + pd_ordercode + "','','"+pd_orderdetno+"')");
                     dh.BatchInsert(sql.ToString(), new string[] { "barcode", "pib_inqty", "midcode" }, barcode.ToArray(), pib_inqty.ToArray(), midcode.ToArray());
                 }
             }
@@ -390,11 +391,13 @@ namespace UAS_LabelMachine
                     pd_barcodeioqty = "pd_barcodeoutqty";
                 }
                 sql.Clear();
-                sql.Append("select pd_piid,pd_id,pd_pdno,pd_prodcode," + pd_inoroutqty + " as pd_totalqty,pr_zxbzs,pr_brand,pr_id,");
-                sql.Append(pd_inoroutqty + "-nvl((select sum(nvl(pib_qty,0)) from PRODIOBARCODE where PIB_PIID='" + pi_id + "' and pib_pdid=pd_id ");
-                sql.Append("and pib_prodcode=pd_prodcode),0) as pd_qty,pr_detail,pr_spec,pd_ordercode,pr_unit from prodiodetail ");
-                sql.Append("left join product on pr_code=pd_prodcode where pd_piid=" + pi_id + Condition + " and ");
-                sql.Append(pd_inoroutqty + "-nvl(" + pd_barcodeioqty + ",0)>0 ");
+                sql.Append("select pd_piid,pd_id,pr_id,pr_brand,pr_unit,pr_detail,pr_spec,pr_zxbzs,outqty pd_totalqty,pd_ordercode,pd_orderdetno,pd_prodcode,pd_piclass,pd_qty from (select ");
+                sql.Append("pd_piid,pd_id,pr_id,pr_brand,pr_unit,pr_detail,pr_spec,pr_zxbzs,outqty,pd_ordercode,pd_orderdetno,pd_prodcode,pd_piclass,");
+                sql.Append("outqty-nvl((select sum(nvl(pib_qty,0)) from PRODIOBARCODE where PIB_PIID=pd_piid and pib_ordercode=pd_ordercode ");
+                sql.Append("and pib_orderdetno=pd_orderdetno),0)pd_qty from (select pd_piid,min(pd_id) pd_id,sum(pd_outqty)outqty,");
+                sql.Append("pd_ordercode,pd_orderdetno,max(pd_prodcode)pd_prodcode,max(pd_piclass)pd_piclass ");
+                sql.Append("from prodiodetail where pd_piclass='出货单' group by pd_piid,pd_ordercode,pd_orderdetno)T left join product on pr_code=pd_prodcode ");
+                sql.Append("where nvl(pr_zxbzs,0)>0)  where  pd_piid='" + pi_id + "'");
                 dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                 BaseUtil.FillDgvWithDataTable(ProdIoInfDGV, dt);
             }

+ 3 - 0
UAS-出货标签管理/生成条码.resx

@@ -157,6 +157,9 @@
   <metadata name="Choose.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="pd_orderdetno.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="pd_pdno.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>