章政 5 жил өмнө
parent
commit
16291ee810

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

@@ -258,7 +258,7 @@ namespace UAS_LabelMachine
             //如果是传入的数据是从FTP取的文件
             if (URL.Contains("ftp:"))
             {
-                ftpOperater ftp = new ftpOperater();
+                ftpOperater ftp = new ftpOperater(Properties.Settings.Default.FTPModel);
                 return ftp.Download(LabelName, time);
             }
             else

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

@@ -11,6 +11,17 @@ 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地址
@@ -33,16 +44,16 @@ namespace UAS_LabelMachine
         ////需要显示的账套
         //public static readonly string Masters = "YHND_SZ,YHND_HK,DATACENTER";
 
-        //华商龙外网地址
-        private readonly string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=YITOA_DATACENTER;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=218.18.115.198)(PORT=1523)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
-        //华商龙ERP地址
-        public static readonly string ERPAddesss = "http://218.18.115.198:8888/ERP/";
-        //华商龙FTP
-        public static readonly string FTPAdress = "ftp://218.18.115.198:21|Print|Administrator1@#";
-        //Oracle端口
-        public static readonly string OraclePort = "1523";
-        //需要显示的账套
-        public static readonly string Masters = "XSQ,N_YITOA_YWC,ZXN,N_YITOA_LHCT,N_YITOA_CT,N_CHL,N_YITOA_HK,N_HUASL_SHTL,N_WILICHK,N_WILIC,N_E_SHINE_SH,N_SHBJ,N_BJKG,N_HUASL,N_HUASL_QD,N_HUASL_XM,N_HUASL_SZ";
+        ////华商龙外网地址
+        //private readonly string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=YITOA_DATACENTER;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=218.18.115.198)(PORT=1523)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        ////华商龙ERP地址
+        //public static readonly string ERPAddesss = "http://218.18.115.198:8888/ERP/";
+        ////华商龙FTP
+        //public static readonly string FTPAdress = "ftp://218.18.115.198:21|Print|Administrator1@#";
+        ////Oracle端口
+        //public static readonly string OraclePort = "1523";
+        ////需要显示的账套
+        //public static readonly string Masters = "XSQ,N_YITOA_YWC,ZXN,N_YITOA_LHCT,N_YITOA_CT,N_CHL,N_YITOA_HK,N_HUASL_SHTL,N_WILICHK,N_WILIC,N_E_SHINE_SH,N_SHBJ,N_BJKG,N_HUASL,N_HUASL_QD,N_HUASL_XM,N_HUASL_SZ";
 
         ////UAS测试地址
         //private readonly string ConnectionStrings = "Data Source=192.168.253.6/orcl;User ID=UAS_TEST;PassWord=select!#%*(";

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

@@ -16,7 +16,7 @@ namespace UAS_LabelMachine
         private string ftpUser;
         private string ftpPwd;
 
-        public ftpOperater()
+        public ftpOperater(bool PortModel)
         {
             string[] FTPInf = DataHelper.FTPAdress.Split('|');
             this.ftpServerIP = FTPInf[0];
@@ -43,6 +43,7 @@ namespace UAS_LabelMachine
             FtpWebRequest reqFTP;
             reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpServerIP + "/" + filename));
             reqFTP.UseBinary = true;
+            reqFTP.UsePassive = Properties.Settings.Default.FTPModel;
             reqFTP.Credentials = new NetworkCredential(ftpUser, ftpPwd);
             reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
             FileInfo file = new FileInfo(filepath + "/" + filename);
@@ -81,6 +82,7 @@ namespace UAS_LabelMachine
                 reqFTP.UseBinary = true;
                 reqFTP.Credentials = new NetworkCredential(ftpUser, ftpPwd);
                 reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
+                reqFTP.UsePassive = Properties.Settings.Default.FTPModel;
                 WebResponse response = reqFTP.GetResponse();
                 StreamReader reader = new StreamReader(response.GetResponseStream());
 
@@ -119,6 +121,7 @@ namespace UAS_LabelMachine
                 reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpServerIP + "/" + filename));
                 reqFTP.Method = WebRequestMethods.Ftp.GetFileSize;
                 reqFTP.UseBinary = true;
+                reqFTP.UsePassive = Properties.Settings.Default.FTPModel;
                 reqFTP.Credentials = new NetworkCredential(ftpUser, ftpPwd);
                 FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
                 Stream ftpStream = response.GetResponseStream();
@@ -147,7 +150,7 @@ namespace UAS_LabelMachine
                 reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
                 reqFTP.UseBinary = true;
                 reqFTP.Credentials = new NetworkCredential(ftpUser, ftpPwd);
-                reqFTP.UsePassive = true;
+                reqFTP.UsePassive = Properties.Settings.Default.FTPModel;
                 FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
                 Stream ftpStream = response.GetResponseStream();
                 long cl = response.ContentLength;

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

@@ -16,7 +16,9 @@
             // this.SettingsSaving += this.SettingsSavingEventHandler;
             //
         }
-        
+
+        public bool FTPModel { get; internal set; }
+
         private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
             // 在此处添加用于处理 SettingChangingEvent 事件的代码。
         }

+ 41 - 12
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 dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = 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();
@@ -85,6 +85,7 @@ namespace UAS_LabelMachine
             this.UpdateGrid = new UAS_LabelMachine.CustomControl.NormalButton();
             this.Screen = new UAS_LabelMachine.CustomControl.NormalButton();
             this.cu_name = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.PortModel = new System.Windows.Forms.CheckBox();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.LabelDataGridView)).BeginInit();
             this.SuspendLayout();
@@ -332,17 +333,22 @@ namespace UAS_LabelMachine
             // 
             // la_code
             // 
+            this.la_code.AllPower = null;
             this.la_code.Caller = null;
             this.la_code.Condition = null;
+            this.la_code.DBTitle = null;
             this.la_code.FormName = null;
             this.la_code.Location = new System.Drawing.Point(659, 455);
             this.la_code.Name = "la_code";
+            this.la_code.Power = null;
+            this.la_code.ReturnData = null;
             this.la_code.SelectField = null;
             this.la_code.SetValueField = null;
             this.la_code.Size = new System.Drawing.Size(161, 21);
             this.la_code.TabIndex = 179;
             this.la_code.TableName = null;
             this.la_code.Tag = "la_code";
+            this.la_code.TextBoxEnable = false;
             // 
             // Save
             // 
@@ -395,16 +401,16 @@ namespace UAS_LabelMachine
             this.cl_status});
             this.LabelDataGridView.Location = new System.Drawing.Point(17, 90);
             this.LabelDataGridView.Name = "LabelDataGridView";
-            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;
+            dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+            dataGridViewCellStyle3.BackColor = System.Drawing.Color.Blue;
+            dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText;
+            dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+            dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
+            dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+            this.LabelDataGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle3;
+            dataGridViewCellStyle4.BackColor = System.Drawing.Color.White;
+            this.LabelDataGridView.RowsDefaultCellStyle = dataGridViewCellStyle4;
             this.LabelDataGridView.RowTemplate.Height = 23;
             this.LabelDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
             this.LabelDataGridView.Size = new System.Drawing.Size(890, 348);
@@ -519,31 +525,41 @@ namespace UAS_LabelMachine
             // 
             // 客户编号
             // 
+            this.客户编号.AllPower = null;
             this.客户编号.Caller = null;
             this.客户编号.Condition = null;
+            this.客户编号.DBTitle = null;
             this.客户编号.FormName = null;
             this.客户编号.Location = new System.Drawing.Point(116, 453);
             this.客户编号.Name = "客户编号";
+            this.客户编号.Power = null;
+            this.客户编号.ReturnData = null;
             this.客户编号.SelectField = null;
             this.客户编号.SetValueField = null;
             this.客户编号.Size = new System.Drawing.Size(136, 21);
             this.客户编号.TabIndex = 168;
             this.客户编号.TableName = null;
             this.客户编号.Tag = "cu_code";
+            this.客户编号.TextBoxEnable = false;
             // 
             // 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(127, 16);
             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(150, 21);
             this.cu_code.TabIndex = 159;
             this.cu_code.TableName = null;
             this.cu_code.Tag = "cl_custcode";
+            this.cu_code.TextBoxEnable = false;
             // 
             // UpdateGrid
             // 
@@ -581,11 +597,23 @@ namespace UAS_LabelMachine
             this.cu_name.TabIndex = 147;
             this.cu_name.Tag = "cu_name";
             // 
+            // PortModel
+            // 
+            this.PortModel.AutoSize = true;
+            this.PortModel.Location = new System.Drawing.Point(923, 116);
+            this.PortModel.Name = "PortModel";
+            this.PortModel.Size = new System.Drawing.Size(96, 16);
+            this.PortModel.TabIndex = 193;
+            this.PortModel.Text = "启用被动模式";
+            this.PortModel.UseVisualStyleBackColor = true;
+            this.PortModel.CheckedChanged += new System.EventHandler(this.PortModel_CheckedChanged);
+            // 
             // 客户标签维护
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1179, 581);
+            this.Controls.Add(this.PortModel);
             this.Controls.Add(this.pictureBox1);
             this.Controls.Add(this.pagination1);
             this.Controls.Add(this.NewLabel);
@@ -687,5 +715,6 @@ namespace UAS_LabelMachine
         private DataGridViewTextBoxColumn cl_labelsoft;
         private DataGridViewTextBoxColumn cl_status;
         private PictureBox pictureBox1;
+        private CheckBox PortModel;
     }
 }

+ 8 - 1
UAS-出货标签管理(贸易版)/客户标签维护.cs

@@ -92,6 +92,7 @@ namespace UAS_LabelMachine
             dh = SystemInf.dh;
             condition.Append("");
             ChooseAll.ChooseAll(LabelDataGridView);
+            PortModel.Checked = Settings.Default.FTPModel;
             BaseUtil.SetComboxData(la_type, "display", "value", labeltype);
             //加载下拉框的静态值
             LoadData();
@@ -335,7 +336,7 @@ namespace UAS_LabelMachine
                 }
                 if (FTPShare.Checked)
                 {
-                    ftpOperater ftp = new ftpOperater();
+                    ftpOperater ftp = new ftpOperater(PortModel.Checked);
                     ftp.UpLoadFile(sourcePath, fileName);
                     string SoftWare = "CodeSoft";
                     if (CL_ID2 != null)
@@ -415,5 +416,11 @@ namespace UAS_LabelMachine
             FolderPath.Text = "";
             CL_ID2 = null;
         }
+
+        private void PortModel_CheckedChanged(object sender, EventArgs e)
+        {
+            Settings.Default.FTPModel = PortModel.Checked;
+            Settings.Default.Save();
+        }
     }
 }