diff --git a/FalitPrint/App.config b/FalitPrint/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/FalitPrint/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/FalitPrint/CycleFile.cs b/FalitPrint/CycleFile.cs new file mode 100644 index 0000000..1bf9dbd --- /dev/null +++ b/FalitPrint/CycleFile.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Serialization; + +namespace FalitPrint +{ + [XmlRoot("CycleFile")] + public class CycleFile + { + public List Cycle { get; set; } + } + + public class Field + { + [XmlAttribute("Name")] + public string Name { get; set; } + + [XmlAttribute("Value")] + public string Value { get; set; } + } + +} diff --git a/FalitPrint/FalitPrint.csproj b/FalitPrint/FalitPrint.csproj new file mode 100644 index 0000000..5dd70b7 --- /dev/null +++ b/FalitPrint/FalitPrint.csproj @@ -0,0 +1,110 @@ + + + + + Debug + AnyCPU + {936BA54E-084E-4651-95A1-977C3AB86010} + WinExe + FalitPrint + FalitPrint + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + 7.3 + prompt + true + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + 7.3 + prompt + true + + + + packages\FluentFTP.52.0.0\lib\net472\FluentFTP.dll + + + + + + + + + + + + + + + + + + Form + + + FormMain.cs + + + + + + FormMain.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/FalitPrint/FormMain.Designer.cs b/FalitPrint/FormMain.Designer.cs new file mode 100644 index 0000000..1b3e5e8 --- /dev/null +++ b/FalitPrint/FormMain.Designer.cs @@ -0,0 +1,1182 @@ +namespace FalitPrint +{ + partial class FormMain + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows 窗体设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.label23 = new System.Windows.Forms.Label(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.label22 = new System.Windows.Forms.Label(); + this.label14 = new System.Windows.Forms.Label(); + this.label24 = new System.Windows.Forms.Label(); + this.label25 = new System.Windows.Forms.Label(); + this.photo_Up_Button = new System.Windows.Forms.Button(); + this.label26 = new System.Windows.Forms.Label(); + this.photo_path_Box = new System.Windows.Forms.TextBox(); + this.label20 = new System.Windows.Forms.Label(); + this.Panel_Transfer = new System.Windows.Forms.Panel(); + this.label18 = new System.Windows.Forms.Label(); + this.Panel_Connect_1 = new System.Windows.Forms.Panel(); + this.label17 = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.tabPhoto = new System.Windows.Forms.TabPage(); + this.label10 = new System.Windows.Forms.Label(); + this.btTransform = new System.Windows.Forms.Button(); + this.label8 = new System.Windows.Forms.Label(); + this.ed_XML_Path = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.btDisconnect = new System.Windows.Forms.Button(); + this.label9 = new System.Windows.Forms.Label(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.Printer_selection = new System.Windows.Forms.Button(); + this.save_path = new System.Windows.Forms.TextBox(); + this.Printer_path = new System.Windows.Forms.TextBox(); + this.groupBox7 = new System.Windows.Forms.GroupBox(); + this.check_connect_2 = new System.Windows.Forms.CheckBox(); + this.check_connect_1 = new System.Windows.Forms.CheckBox(); + this.SYS_Connect_Check = new System.Windows.Forms.Timer(this.components); + this.Saw_Photo_Download_Timer = new System.Windows.Forms.Timer(this.components); + this.laPrintStatus = new System.Windows.Forms.Label(); + this.edIP = new System.Windows.Forms.TextBox(); + this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.Print_index = new System.Windows.Forms.Timer(this.components); + this.printDocument1 = new System.Drawing.Printing.PrintDocument(); + this.MainProcess = new System.Windows.Forms.Timer(this.components); + this.Print_Status = new System.Windows.Forms.Timer(this.components); + this.btConnect = new System.Windows.Forms.Button(); + this.label7 = new System.Windows.Forms.Label(); + this.label15 = new System.Windows.Forms.Label(); + this.btSetSize = new System.Windows.Forms.Button(); + this.laprintPath = new System.Windows.Forms.TextBox(); + this.btPrintSingle = new System.Windows.Forms.Button(); + this.laphotoPath = new System.Windows.Forms.TextBox(); + this.laD = new System.Windows.Forms.Label(); + this.laConnectStatus = new System.Windows.Forms.Label(); + this.laP = new System.Windows.Forms.Label(); + this.tabPrint = new System.Windows.Forms.TabPage(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.label6 = new System.Windows.Forms.Label(); + this.lapaperW = new System.Windows.Forms.TextBox(); + this.lapaperH = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.laprintposY = new System.Windows.Forms.TextBox(); + this.laprintposX = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.photoshow = new System.Windows.Forms.PictureBox(); + this.la_DirectQueue = new System.Windows.Forms.Label(); + this.gbConnectView = new System.Windows.Forms.GroupBox(); + this.la_LoopQueue = new System.Windows.Forms.Label(); + this.Err_Box = new System.Windows.Forms.TextBox(); + this.laWarning = new System.Windows.Forms.Label(); + this.laAlarm = new System.Windows.Forms.Label(); + this.gbAlarmWarning = new System.Windows.Forms.GroupBox(); + this.tabMW = new System.Windows.Forms.TabControl(); + this.tabConnect = new System.Windows.Forms.TabPage(); + this.gbAutoConnect = new System.Windows.Forms.GroupBox(); + this.dgConnect = new System.Windows.Forms.DataGridView(); + this.ColumnIP = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.btAutoConnect = new System.Windows.Forms.Button(); + this.btDetect = new System.Windows.Forms.Button(); + this.gbIpconnect = new System.Windows.Forms.GroupBox(); + this.tabXml = new System.Windows.Forms.TabPage(); + this.Image_selection = new System.Windows.Forms.Button(); + this.groupBox6.SuspendLayout(); + this.Panel_Transfer.SuspendLayout(); + this.Panel_Connect_1.SuspendLayout(); + this.tabPhoto.SuspendLayout(); + this.groupBox4.SuspendLayout(); + this.groupBox7.SuspendLayout(); + this.groupBox5.SuspendLayout(); + this.tabPrint.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.photoshow)).BeginInit(); + this.gbConnectView.SuspendLayout(); + this.gbAlarmWarning.SuspendLayout(); + this.tabMW.SuspendLayout(); + this.tabConnect.SuspendLayout(); + this.gbAutoConnect.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dgConnect)).BeginInit(); + this.gbIpconnect.SuspendLayout(); + this.tabXml.SuspendLayout(); + this.SuspendLayout(); + // + // label23 + // + this.label23.Location = new System.Drawing.Point(7, 208); + this.label23.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label23.Name = "label23"; + this.label23.Size = new System.Drawing.Size(626, 41); + this.label23.TabIndex = 30; + this.label23.Text = "3. 系统会自动将文件另存为系统支持的图像文件.PNG并上传至系统"; + // + // groupBox6 + // + this.groupBox6.Controls.Add(this.label22); + this.groupBox6.Controls.Add(this.label23); + this.groupBox6.Controls.Add(this.label14); + this.groupBox6.Controls.Add(this.label24); + this.groupBox6.Controls.Add(this.label25); + this.groupBox6.Controls.Add(this.photo_Up_Button); + this.groupBox6.Controls.Add(this.label26); + this.groupBox6.Controls.Add(this.photo_path_Box); + this.groupBox6.Location = new System.Drawing.Point(4, 8); + this.groupBox6.Margin = new System.Windows.Forms.Padding(4); + this.groupBox6.Name = "groupBox6"; + this.groupBox6.Padding = new System.Windows.Forms.Padding(4); + this.groupBox6.Size = new System.Drawing.Size(841, 387); + this.groupBox6.TabIndex = 42; + this.groupBox6.TabStop = false; + this.groupBox6.Text = "将图片上传至控制器"; + // + // label22 + // + this.label22.Location = new System.Drawing.Point(7, 249); + this.label22.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label22.Name = "label22"; + this.label22.Size = new System.Drawing.Size(556, 37); + this.label22.TabIndex = 31; + this.label22.Text = "4. 将加工程序导入到控制器,即可显示对应的图片文件"; + // + // label14 + // + this.label14.Location = new System.Drawing.Point(7, 137); + this.label14.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(500, 35); + this.label14.TabIndex = 29; + this.label14.Text = "1. 点击右侧的上传图片按钮"; + // + // label24 + // + this.label24.Location = new System.Drawing.Point(7, 173); + this.label24.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label24.Name = "label24"; + this.label24.Size = new System.Drawing.Size(500, 37); + this.label24.TabIndex = 28; + this.label24.Text = "2.选择上传的图片文件路径"; + // + // label25 + // + this.label25.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); + this.label25.Location = new System.Drawing.Point(7, 96); + this.label25.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label25.Name = "label25"; + this.label25.Size = new System.Drawing.Size(138, 37); + this.label25.TabIndex = 27; + this.label25.Text = "* 使用步骤 *"; + // + // photo_Up_Button + // + this.photo_Up_Button.Location = new System.Drawing.Point(677, 137); + this.photo_Up_Button.Margin = new System.Windows.Forms.Padding(4); + this.photo_Up_Button.Name = "photo_Up_Button"; + this.photo_Up_Button.Size = new System.Drawing.Size(141, 71); + this.photo_Up_Button.TabIndex = 25; + this.photo_Up_Button.Text = "上传图片"; + this.photo_Up_Button.UseVisualStyleBackColor = true; + this.photo_Up_Button.Click += new System.EventHandler(this.photo_Up_Button_Click); + // + // label26 + // + this.label26.Location = new System.Drawing.Point(7, 41); + this.label26.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label26.Name = "label26"; + this.label26.Size = new System.Drawing.Size(103, 47); + this.label26.TabIndex = 24; + this.label26.Text = "图片文件路径"; + this.label26.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // photo_path_Box + // + this.photo_path_Box.Enabled = false; + this.photo_path_Box.Location = new System.Drawing.Point(117, 41); + this.photo_path_Box.Margin = new System.Windows.Forms.Padding(4); + this.photo_path_Box.Name = "photo_path_Box"; + this.photo_path_Box.Size = new System.Drawing.Size(717, 29); + this.photo_path_Box.TabIndex = 23; + // + // label20 + // + this.label20.Font = new System.Drawing.Font("微软雅黑", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.label20.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); + this.label20.Location = new System.Drawing.Point(0, 129); + this.label20.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label20.Name = "label20"; + this.label20.Size = new System.Drawing.Size(841, 71); + this.label20.TabIndex = 1; + this.label20.Text = "请先选择连接的控制器!!"; + this.label20.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // Panel_Transfer + // + this.Panel_Transfer.BackColor = System.Drawing.Color.White; + this.Panel_Transfer.Controls.Add(this.label18); + this.Panel_Transfer.Location = new System.Drawing.Point(4, 0); + this.Panel_Transfer.Margin = new System.Windows.Forms.Padding(4); + this.Panel_Transfer.Name = "Panel_Transfer"; + this.Panel_Transfer.Size = new System.Drawing.Size(846, 332); + this.Panel_Transfer.TabIndex = 47; + this.Panel_Transfer.Visible = false; + // + // label18 + // + this.label18.Font = new System.Drawing.Font("微软雅黑", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.label18.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); + this.label18.Location = new System.Drawing.Point(7, 169); + this.label18.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(834, 71); + this.label18.TabIndex = 2; + this.label18.Text = "转换中~请稍后!!"; + this.label18.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // Panel_Connect_1 + // + this.Panel_Connect_1.BackColor = System.Drawing.Color.White; + this.Panel_Connect_1.Controls.Add(this.label20); + this.Panel_Connect_1.Location = new System.Drawing.Point(4, 6); + this.Panel_Connect_1.Margin = new System.Windows.Forms.Padding(4); + this.Panel_Connect_1.Name = "Panel_Connect_1"; + this.Panel_Connect_1.Size = new System.Drawing.Size(836, 337); + this.Panel_Connect_1.TabIndex = 33; + // + // label17 + // + this.label17.Location = new System.Drawing.Point(7, 343); + this.label17.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(500, 37); + this.label17.TabIndex = 32; + this.label17.Text = "5. 贴标机系统共享文件夹设置为\"PLNC\""; + // + // label13 + // + this.label13.Location = new System.Drawing.Point(7, 300); + this.label13.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(556, 37); + this.label13.TabIndex = 31; + this.label13.Text = "4. 同步上传文件夹内的图片文件并将其另存为系统支持的图片格式.png"; + // + // label12 + // + this.label12.Location = new System.Drawing.Point(7, 258); + this.label12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(500, 37); + this.label12.TabIndex = 30; + this.label12.Text = "3. 贴标程序会生成在 C:\\PLNC"; + // + // label11 + // + this.label11.Location = new System.Drawing.Point(7, 137); + this.label11.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(500, 72); + this.label11.TabIndex = 29; + this.label11.Text = "1. 将贴标软件生成的程序(.cyc)以及标签(.bmp)放在同一文件夹内"; + // + // tabPhoto + // + this.tabPhoto.Controls.Add(this.Panel_Connect_1); + this.tabPhoto.Controls.Add(this.groupBox6); + this.tabPhoto.Location = new System.Drawing.Point(4, 33); + this.tabPhoto.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); + this.tabPhoto.Name = "tabPhoto"; + this.tabPhoto.Padding = new System.Windows.Forms.Padding(2, 3, 2, 3); + this.tabPhoto.Size = new System.Drawing.Size(856, 347); + this.tabPhoto.TabIndex = 6; + this.tabPhoto.Text = "图片上传"; + this.tabPhoto.UseVisualStyleBackColor = true; + // + // label10 + // + this.label10.Location = new System.Drawing.Point(7, 215); + this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(500, 37); + this.label10.TabIndex = 28; + this.label10.Text = "2. 点击\"文件转换\"选择贴标清单(.xml)"; + // + // btTransform + // + this.btTransform.Location = new System.Drawing.Point(686, 139); + this.btTransform.Margin = new System.Windows.Forms.Padding(4); + this.btTransform.Name = "btTransform"; + this.btTransform.Size = new System.Drawing.Size(141, 71); + this.btTransform.TabIndex = 25; + this.btTransform.Text = "文件转换"; + this.btTransform.UseVisualStyleBackColor = true; + this.btTransform.Click += new System.EventHandler(this.btTransform_Click); + // + // label8 + // + this.label8.Location = new System.Drawing.Point(7, 41); + this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(103, 47); + this.label8.TabIndex = 24; + this.label8.Text = "当前路径"; + this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // ed_XML_Path + // + this.ed_XML_Path.Enabled = false; + this.ed_XML_Path.Location = new System.Drawing.Point(117, 41); + this.ed_XML_Path.Margin = new System.Windows.Forms.Padding(4); + this.ed_XML_Path.Name = "ed_XML_Path"; + this.ed_XML_Path.Size = new System.Drawing.Size(717, 29); + this.ed_XML_Path.TabIndex = 23; + // + // label1 + // + this.label1.Location = new System.Drawing.Point(8, 67); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(42, 37); + this.label1.TabIndex = 3; + this.label1.Text = "IP"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // btDisconnect + // + this.btDisconnect.Location = new System.Drawing.Point(208, 121); + this.btDisconnect.Margin = new System.Windows.Forms.Padding(4); + this.btDisconnect.Name = "btDisconnect"; + this.btDisconnect.Size = new System.Drawing.Size(70, 85); + this.btDisconnect.TabIndex = 2; + this.btDisconnect.Text = "断开"; + this.btDisconnect.UseVisualStyleBackColor = true; + this.btDisconnect.Click += new System.EventHandler(this.btDisconnect_Click); + // + // label9 + // + this.label9.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); + this.label9.Location = new System.Drawing.Point(7, 96); + this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(138, 37); + this.label9.TabIndex = 27; + this.label9.Text = "* 使用步驟 *"; + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.Panel_Transfer); + this.groupBox4.Controls.Add(this.label17); + this.groupBox4.Controls.Add(this.label13); + this.groupBox4.Controls.Add(this.label12); + this.groupBox4.Controls.Add(this.label11); + this.groupBox4.Controls.Add(this.label10); + this.groupBox4.Controls.Add(this.label9); + this.groupBox4.Controls.Add(this.btTransform); + this.groupBox4.Controls.Add(this.label8); + this.groupBox4.Controls.Add(this.ed_XML_Path); + this.groupBox4.Location = new System.Drawing.Point(4, 4); + this.groupBox4.Margin = new System.Windows.Forms.Padding(4); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Padding = new System.Windows.Forms.Padding(4); + this.groupBox4.Size = new System.Drawing.Size(841, 387); + this.groupBox4.TabIndex = 41; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "贴标程序转换"; + // + // Printer_selection + // + this.Printer_selection.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.Printer_selection.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.Printer_selection.Location = new System.Drawing.Point(34, 132); + this.Printer_selection.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); + this.Printer_selection.Name = "Printer_selection"; + this.Printer_selection.Size = new System.Drawing.Size(105, 30); + this.Printer_selection.TabIndex = 46; + this.Printer_selection.Text = "打印机选择"; + this.Printer_selection.UseVisualStyleBackColor = true; + this.Printer_selection.Click += new System.EventHandler(this.Printer_selection_Click); + // + // save_path + // + this.save_path.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.save_path.Location = new System.Drawing.Point(564, 132); + this.save_path.Margin = new System.Windows.Forms.Padding(4); + this.save_path.Name = "save_path"; + this.save_path.Size = new System.Drawing.Size(331, 23); + this.save_path.TabIndex = 47; + // + // Printer_path + // + this.Printer_path.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.Printer_path.Location = new System.Drawing.Point(159, 132); + this.Printer_path.Margin = new System.Windows.Forms.Padding(4); + this.Printer_path.Name = "Printer_path"; + this.Printer_path.Size = new System.Drawing.Size(248, 23); + this.Printer_path.TabIndex = 45; + // + // groupBox7 + // + this.groupBox7.Controls.Add(this.check_connect_2); + this.groupBox7.Controls.Add(this.check_connect_1); + this.groupBox7.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.groupBox7.Location = new System.Drawing.Point(322, 16); + this.groupBox7.Margin = new System.Windows.Forms.Padding(4); + this.groupBox7.Name = "groupBox7"; + this.groupBox7.Padding = new System.Windows.Forms.Padding(4); + this.groupBox7.Size = new System.Drawing.Size(162, 110); + this.groupBox7.TabIndex = 43; + this.groupBox7.TabStop = false; + this.groupBox7.Text = "连接选择"; + // + // check_connect_2 + // + this.check_connect_2.AutoSize = true; + this.check_connect_2.Location = new System.Drawing.Point(23, 69); + this.check_connect_2.Margin = new System.Windows.Forms.Padding(4); + this.check_connect_2.Name = "check_connect_2"; + this.check_connect_2.Size = new System.Drawing.Size(69, 24); + this.check_connect_2.TabIndex = 30; + this.check_connect_2.Text = "连线2"; + this.check_connect_2.UseVisualStyleBackColor = true; + this.check_connect_2.Click += new System.EventHandler(this.check_connect_2_Click); + // + // check_connect_1 + // + this.check_connect_1.AutoSize = true; + this.check_connect_1.Location = new System.Drawing.Point(23, 37); + this.check_connect_1.Margin = new System.Windows.Forms.Padding(4); + this.check_connect_1.Name = "check_connect_1"; + this.check_connect_1.Size = new System.Drawing.Size(69, 24); + this.check_connect_1.TabIndex = 29; + this.check_connect_1.Text = "连线1"; + this.check_connect_1.UseVisualStyleBackColor = true; + this.check_connect_1.Click += new System.EventHandler(this.check_connect_1_Click); + // + // SYS_Connect_Check + // + this.SYS_Connect_Check.Enabled = true; + this.SYS_Connect_Check.Interval = 500; + this.SYS_Connect_Check.Tick += new System.EventHandler(this.SYS_Connect_Check_Tick); + // + // Saw_Photo_Download_Timer + // + this.Saw_Photo_Download_Timer.Enabled = true; + this.Saw_Photo_Download_Timer.Interval = 500; + this.Saw_Photo_Download_Timer.Tick += new System.EventHandler(this.Saw_Func_Tick); + // + // laPrintStatus + // + this.laPrintStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.laPrintStatus.Location = new System.Drawing.Point(7, 28); + this.laPrintStatus.Margin = new System.Windows.Forms.Padding(4); + this.laPrintStatus.Name = "laPrintStatus"; + this.laPrintStatus.Size = new System.Drawing.Size(176, 74); + this.laPrintStatus.TabIndex = 13; + this.laPrintStatus.Text = "离线"; + this.laPrintStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // edIP + // + this.edIP.Location = new System.Drawing.Point(58, 67); + this.edIP.Margin = new System.Windows.Forms.Padding(4); + this.edIP.Name = "edIP"; + this.edIP.Size = new System.Drawing.Size(220, 29); + this.edIP.TabIndex = 1; + // + // groupBox5 + // + this.groupBox5.Controls.Add(this.laPrintStatus); + this.groupBox5.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.groupBox5.Location = new System.Drawing.Point(476, 16); + this.groupBox5.Margin = new System.Windows.Forms.Padding(4); + this.groupBox5.Name = "groupBox5"; + this.groupBox5.Padding = new System.Windows.Forms.Padding(4); + this.groupBox5.Size = new System.Drawing.Size(190, 110); + this.groupBox5.TabIndex = 42; + this.groupBox5.TabStop = false; + this.groupBox5.Text = "打印机状态"; + this.groupBox5.Visible = false; + // + // Print_index + // + this.Print_index.Enabled = true; + this.Print_index.Interval = 500; + this.Print_index.Tick += new System.EventHandler(this.Print_index_Tick); + // + // printDocument1 + // + this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage); + // + // MainProcess + // + this.MainProcess.Enabled = true; + this.MainProcess.Interval = 50; + this.MainProcess.Tick += new System.EventHandler(this.timer1_Tick); + // + // Print_Status + // + this.Print_Status.Interval = 500; + this.Print_Status.Tick += new System.EventHandler(this.Print_Status_Tick); + // + // btConnect + // + this.btConnect.Location = new System.Drawing.Point(58, 121); + this.btConnect.Margin = new System.Windows.Forms.Padding(4); + this.btConnect.Name = "btConnect"; + this.btConnect.Size = new System.Drawing.Size(70, 85); + this.btConnect.TabIndex = 0; + this.btConnect.Text = "连接"; + this.btConnect.UseVisualStyleBackColor = true; + this.btConnect.Click += new System.EventHandler(this.btConnect_Click); + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(300, 48); + this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(35, 20); + this.label7.TabIndex = 27; + this.label7.Text = "mm"; + // + // label15 + // + this.label15.BackColor = System.Drawing.Color.White; + this.label15.Location = new System.Drawing.Point(366, 223); + this.label15.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(482, 32); + this.label15.TabIndex = 25; + this.label15.Text = "* 点击\"设置\"保存"; + // + // btSetSize + // + this.btSetSize.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.btSetSize.Location = new System.Drawing.Point(726, 35); + this.btSetSize.Margin = new System.Windows.Forms.Padding(4); + this.btSetSize.Name = "btSetSize"; + this.btSetSize.Size = new System.Drawing.Size(122, 47); + this.btSetSize.TabIndex = 24; + this.btSetSize.Text = "设置"; + this.btSetSize.UseVisualStyleBackColor = true; + this.btSetSize.Click += new System.EventHandler(this.btSetSize_Click); + // + // laprintPath + // + this.laprintPath.Enabled = false; + this.laprintPath.Location = new System.Drawing.Point(9, 307); + this.laprintPath.Margin = new System.Windows.Forms.Padding(4); + this.laprintPath.Name = "laprintPath"; + this.laprintPath.Size = new System.Drawing.Size(840, 29); + this.laprintPath.TabIndex = 22; + // + // btPrintSingle + // + this.btPrintSingle.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.btPrintSingle.Location = new System.Drawing.Point(730, 261); + this.btPrintSingle.Margin = new System.Windows.Forms.Padding(4); + this.btPrintSingle.Name = "btPrintSingle"; + this.btPrintSingle.Size = new System.Drawing.Size(114, 29); + this.btPrintSingle.TabIndex = 21; + this.btPrintSingle.Text = "单张打印"; + this.btPrintSingle.UseVisualStyleBackColor = true; + this.btPrintSingle.Click += new System.EventHandler(this.btPrintSingle_Click); + // + // laphotoPath + // + this.laphotoPath.Enabled = false; + this.laphotoPath.Location = new System.Drawing.Point(370, 259); + this.laphotoPath.Margin = new System.Windows.Forms.Padding(4); + this.laphotoPath.Name = "laphotoPath"; + this.laphotoPath.Size = new System.Drawing.Size(352, 29); + this.laphotoPath.TabIndex = 18; + // + // laD + // + this.laD.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.laD.Location = new System.Drawing.Point(190, 69); + this.laD.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.laD.Name = "laD"; + this.laD.Size = new System.Drawing.Size(37, 33); + this.laD.TabIndex = 25; + this.laD.Text = "D"; + this.laD.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // laConnectStatus + // + this.laConnectStatus.BackColor = System.Drawing.Color.LightGray; + this.laConnectStatus.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.laConnectStatus.ForeColor = System.Drawing.Color.Black; + this.laConnectStatus.Location = new System.Drawing.Point(8, 28); + this.laConnectStatus.Margin = new System.Windows.Forms.Padding(4); + this.laConnectStatus.Name = "laConnectStatus"; + this.laConnectStatus.Size = new System.Drawing.Size(175, 64); + this.laConnectStatus.TabIndex = 0; + this.laConnectStatus.Text = "连线关闭"; + this.laConnectStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // laP + // + this.laP.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.laP.Location = new System.Drawing.Point(190, 28); + this.laP.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.laP.Name = "laP"; + this.laP.Size = new System.Drawing.Size(37, 33); + this.laP.TabIndex = 24; + this.laP.Text = "P"; + this.laP.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // tabPrint + // + this.tabPrint.Controls.Add(this.label15); + this.tabPrint.Controls.Add(this.btSetSize); + this.tabPrint.Controls.Add(this.laprintPath); + this.tabPrint.Controls.Add(this.btPrintSingle); + this.tabPrint.Controls.Add(this.laphotoPath); + this.tabPrint.Controls.Add(this.groupBox3); + this.tabPrint.Controls.Add(this.groupBox2); + this.tabPrint.Controls.Add(this.groupBox1); + this.tabPrint.Location = new System.Drawing.Point(4, 33); + this.tabPrint.Margin = new System.Windows.Forms.Padding(4); + this.tabPrint.Name = "tabPrint"; + this.tabPrint.Padding = new System.Windows.Forms.Padding(4); + this.tabPrint.Size = new System.Drawing.Size(856, 347); + this.tabPrint.TabIndex = 2; + this.tabPrint.Text = "列印設定"; + this.tabPrint.UseVisualStyleBackColor = true; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.label7); + this.groupBox3.Controls.Add(this.label6); + this.groupBox3.Controls.Add(this.lapaperW); + this.groupBox3.Controls.Add(this.lapaperH); + this.groupBox3.Controls.Add(this.label4); + this.groupBox3.Controls.Add(this.label5); + this.groupBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.groupBox3.Location = new System.Drawing.Point(370, 117); + this.groupBox3.Margin = new System.Windows.Forms.Padding(4); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Padding = new System.Windows.Forms.Padding(4); + this.groupBox3.Size = new System.Drawing.Size(352, 102); + this.groupBox3.TabIndex = 17; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "纸张大小设置"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(128, 48); + this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(35, 20); + this.label6.TabIndex = 26; + this.label6.Text = "mm"; + // + // lapaperW + // + this.lapaperW.Location = new System.Drawing.Point(43, 35); + this.lapaperW.Margin = new System.Windows.Forms.Padding(4); + this.lapaperW.Name = "lapaperW"; + this.lapaperW.Size = new System.Drawing.Size(81, 26); + this.lapaperW.TabIndex = 25; + this.lapaperW.Text = "100"; + // + // lapaperH + // + this.lapaperH.Location = new System.Drawing.Point(217, 35); + this.lapaperH.Margin = new System.Windows.Forms.Padding(4); + this.lapaperH.Name = "lapaperH"; + this.lapaperH.Size = new System.Drawing.Size(81, 26); + this.lapaperH.TabIndex = 24; + this.lapaperH.Text = "100"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(181, 35); + this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(25, 20); + this.label4.TabIndex = 1; + this.label4.Text = "高"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(7, 35); + this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(25, 20); + this.label5.TabIndex = 0; + this.label5.Text = "宽"; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.laprintposY); + this.groupBox2.Controls.Add(this.laprintposX); + this.groupBox2.Controls.Add(this.label3); + this.groupBox2.Controls.Add(this.label2); + this.groupBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.groupBox2.Location = new System.Drawing.Point(366, 8); + this.groupBox2.Margin = new System.Windows.Forms.Padding(4); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Padding = new System.Windows.Forms.Padding(4); + this.groupBox2.Size = new System.Drawing.Size(352, 101); + this.groupBox2.TabIndex = 16; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "打印坐标设置"; + // + // laprintposY + // + this.laprintposY.Location = new System.Drawing.Point(225, 35); + this.laprintposY.Margin = new System.Windows.Forms.Padding(4); + this.laprintposY.Name = "laprintposY"; + this.laprintposY.Size = new System.Drawing.Size(118, 26); + this.laprintposY.TabIndex = 24; + this.laprintposY.Text = "0"; + // + // laprintposX + // + this.laprintposX.Location = new System.Drawing.Point(55, 35); + this.laprintposX.Margin = new System.Windows.Forms.Padding(4); + this.laprintposX.Name = "laprintposX"; + this.laprintposX.Size = new System.Drawing.Size(118, 26); + this.laprintposX.TabIndex = 23; + this.laprintposX.Text = "0"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(177, 40); + this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(36, 20); + this.label3.TabIndex = 1; + this.label3.Text = "Y轴"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(7, 40); + this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(36, 20); + this.label2.TabIndex = 0; + this.label2.Text = "X轴"; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.photoshow); + this.groupBox1.Location = new System.Drawing.Point(7, 8); + this.groupBox1.Margin = new System.Windows.Forms.Padding(4); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Padding = new System.Windows.Forms.Padding(4); + this.groupBox1.Size = new System.Drawing.Size(352, 282); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "图片预览"; + // + // photoshow + // + this.photoshow.ErrorImage = null; + this.photoshow.InitialImage = null; + this.photoshow.Location = new System.Drawing.Point(6, 30); + this.photoshow.Margin = new System.Windows.Forms.Padding(4); + this.photoshow.Name = "photoshow"; + this.photoshow.Size = new System.Drawing.Size(338, 247); + this.photoshow.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.photoshow.TabIndex = 0; + this.photoshow.TabStop = false; + // + // la_DirectQueue + // + this.la_DirectQueue.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.la_DirectQueue.Location = new System.Drawing.Point(234, 69); + this.la_DirectQueue.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.la_DirectQueue.Name = "la_DirectQueue"; + this.la_DirectQueue.Size = new System.Drawing.Size(47, 33); + this.la_DirectQueue.TabIndex = 23; + this.la_DirectQueue.Text = "0"; + this.la_DirectQueue.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // gbConnectView + // + this.gbConnectView.Controls.Add(this.laD); + this.gbConnectView.Controls.Add(this.laConnectStatus); + this.gbConnectView.Controls.Add(this.laP); + this.gbConnectView.Controls.Add(this.la_DirectQueue); + this.gbConnectView.Controls.Add(this.la_LoopQueue); + this.gbConnectView.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.gbConnectView.Location = new System.Drawing.Point(34, 16); + this.gbConnectView.Margin = new System.Windows.Forms.Padding(4); + this.gbConnectView.Name = "gbConnectView"; + this.gbConnectView.Padding = new System.Windows.Forms.Padding(4); + this.gbConnectView.Size = new System.Drawing.Size(288, 110); + this.gbConnectView.TabIndex = 39; + this.gbConnectView.TabStop = false; + this.gbConnectView.Text = "连接状态"; + // + // la_LoopQueue + // + this.la_LoopQueue.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.la_LoopQueue.Location = new System.Drawing.Point(234, 28); + this.la_LoopQueue.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.la_LoopQueue.Name = "la_LoopQueue"; + this.la_LoopQueue.Size = new System.Drawing.Size(47, 33); + this.la_LoopQueue.TabIndex = 22; + this.la_LoopQueue.Text = "0"; + this.la_LoopQueue.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // Err_Box + // + this.Err_Box.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.Err_Box.Location = new System.Drawing.Point(8, 79); + this.Err_Box.Margin = new System.Windows.Forms.Padding(4); + this.Err_Box.Name = "Err_Box"; + this.Err_Box.Size = new System.Drawing.Size(210, 23); + this.Err_Box.TabIndex = 39; + // + // laWarning + // + this.laWarning.BackColor = System.Drawing.Color.LightGray; + this.laWarning.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.laWarning.ForeColor = System.Drawing.Color.Black; + this.laWarning.Location = new System.Drawing.Point(113, 28); + this.laWarning.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.laWarning.Name = "laWarning"; + this.laWarning.Size = new System.Drawing.Size(105, 50); + this.laWarning.TabIndex = 1; + this.laWarning.Text = "警告"; + this.laWarning.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // laAlarm + // + this.laAlarm.BackColor = System.Drawing.Color.LightGray; + this.laAlarm.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.laAlarm.ForeColor = System.Drawing.Color.Black; + this.laAlarm.Location = new System.Drawing.Point(7, 28); + this.laAlarm.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.laAlarm.Name = "laAlarm"; + this.laAlarm.Size = new System.Drawing.Size(105, 50); + this.laAlarm.TabIndex = 0; + this.laAlarm.Text = "报警"; + this.laAlarm.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // gbAlarmWarning + // + this.gbAlarmWarning.Controls.Add(this.Err_Box); + this.gbAlarmWarning.Controls.Add(this.laWarning); + this.gbAlarmWarning.Controls.Add(this.laAlarm); + this.gbAlarmWarning.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.gbAlarmWarning.Location = new System.Drawing.Point(673, 16); + this.gbAlarmWarning.Margin = new System.Windows.Forms.Padding(4); + this.gbAlarmWarning.Name = "gbAlarmWarning"; + this.gbAlarmWarning.Padding = new System.Windows.Forms.Padding(4); + this.gbAlarmWarning.Size = new System.Drawing.Size(225, 110); + this.gbAlarmWarning.TabIndex = 40; + this.gbAlarmWarning.TabStop = false; + this.gbAlarmWarning.Text = "报警警告"; + // + // tabMW + // + this.tabMW.Controls.Add(this.tabPrint); + this.tabMW.Controls.Add(this.tabConnect); + this.tabMW.Controls.Add(this.tabXml); + this.tabMW.Controls.Add(this.tabPhoto); + this.tabMW.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.tabMW.Location = new System.Drawing.Point(34, 166); + this.tabMW.Margin = new System.Windows.Forms.Padding(4); + this.tabMW.Name = "tabMW"; + this.tabMW.SelectedIndex = 0; + this.tabMW.Size = new System.Drawing.Size(864, 384); + this.tabMW.TabIndex = 41; + this.tabMW.SelectedIndexChanged += new System.EventHandler(this.tabMW_SelectedIndexChanged); + // + // tabConnect + // + this.tabConnect.Controls.Add(this.gbAutoConnect); + this.tabConnect.Controls.Add(this.gbIpconnect); + this.tabConnect.Location = new System.Drawing.Point(4, 33); + this.tabConnect.Margin = new System.Windows.Forms.Padding(4); + this.tabConnect.Name = "tabConnect"; + this.tabConnect.Padding = new System.Windows.Forms.Padding(4); + this.tabConnect.Size = new System.Drawing.Size(856, 347); + this.tabConnect.TabIndex = 3; + this.tabConnect.Text = "连接"; + this.tabConnect.UseVisualStyleBackColor = true; + // + // gbAutoConnect + // + this.gbAutoConnect.Controls.Add(this.dgConnect); + this.gbAutoConnect.Controls.Add(this.btAutoConnect); + this.gbAutoConnect.Controls.Add(this.btDetect); + this.gbAutoConnect.ForeColor = System.Drawing.SystemColors.ControlText; + this.gbAutoConnect.Location = new System.Drawing.Point(7, 8); + this.gbAutoConnect.Margin = new System.Windows.Forms.Padding(4); + this.gbAutoConnect.Name = "gbAutoConnect"; + this.gbAutoConnect.Padding = new System.Windows.Forms.Padding(4); + this.gbAutoConnect.Size = new System.Drawing.Size(450, 360); + this.gbAutoConnect.TabIndex = 3; + this.gbAutoConnect.TabStop = false; + this.gbAutoConnect.Text = "自动搜索设备"; + // + // dgConnect + // + this.dgConnect.AllowUserToDeleteRows = false; + this.dgConnect.BackgroundColor = System.Drawing.SystemColors.Control; + this.dgConnect.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dgConnect.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.ColumnIP}); + this.dgConnect.Location = new System.Drawing.Point(35, 45); + this.dgConnect.Margin = new System.Windows.Forms.Padding(4); + this.dgConnect.Name = "dgConnect"; + this.dgConnect.ReadOnly = true; + this.dgConnect.RowHeadersWidth = 51; + this.dgConnect.RowTemplate.Height = 24; + this.dgConnect.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.dgConnect.Size = new System.Drawing.Size(293, 243); + this.dgConnect.TabIndex = 3; + // + // ColumnIP + // + this.ColumnIP.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; + this.ColumnIP.Frozen = true; + this.ColumnIP.HeaderText = "IP"; + this.ColumnIP.MinimumWidth = 6; + this.ColumnIP.Name = "ColumnIP"; + this.ColumnIP.ReadOnly = true; + this.ColumnIP.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.ColumnIP.Width = 207; + // + // btAutoConnect + // + this.btAutoConnect.Location = new System.Drawing.Point(347, 203); + this.btAutoConnect.Margin = new System.Windows.Forms.Padding(4); + this.btAutoConnect.Name = "btAutoConnect"; + this.btAutoConnect.Size = new System.Drawing.Size(70, 85); + this.btAutoConnect.TabIndex = 2; + this.btAutoConnect.Text = "连接"; + this.btAutoConnect.UseVisualStyleBackColor = true; + this.btAutoConnect.Click += new System.EventHandler(this.btAutoConnect_Click); + // + // btDetect + // + this.btDetect.Location = new System.Drawing.Point(347, 55); + this.btDetect.Margin = new System.Windows.Forms.Padding(4); + this.btDetect.Name = "btDetect"; + this.btDetect.Size = new System.Drawing.Size(70, 85); + this.btDetect.TabIndex = 1; + this.btDetect.Text = "搜索"; + this.btDetect.UseVisualStyleBackColor = true; + this.btDetect.Click += new System.EventHandler(this.btDetect_Click); + // + // gbIpconnect + // + this.gbIpconnect.Controls.Add(this.label1); + this.gbIpconnect.Controls.Add(this.btDisconnect); + this.gbIpconnect.Controls.Add(this.edIP); + this.gbIpconnect.Controls.Add(this.btConnect); + this.gbIpconnect.Location = new System.Drawing.Point(464, 8); + this.gbIpconnect.Margin = new System.Windows.Forms.Padding(4); + this.gbIpconnect.Name = "gbIpconnect"; + this.gbIpconnect.Padding = new System.Windows.Forms.Padding(4); + this.gbIpconnect.Size = new System.Drawing.Size(384, 360); + this.gbIpconnect.TabIndex = 2; + this.gbIpconnect.TabStop = false; + this.gbIpconnect.Text = "IP连接"; + // + // tabXml + // + this.tabXml.Controls.Add(this.groupBox4); + this.tabXml.Location = new System.Drawing.Point(4, 33); + this.tabXml.Margin = new System.Windows.Forms.Padding(4); + this.tabXml.Name = "tabXml"; + this.tabXml.Padding = new System.Windows.Forms.Padding(4); + this.tabXml.Size = new System.Drawing.Size(856, 347); + this.tabXml.TabIndex = 5; + this.tabXml.Text = "转换&上传"; + this.tabXml.UseVisualStyleBackColor = true; + // + // Image_selection + // + this.Image_selection.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.Image_selection.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136))); + this.Image_selection.Location = new System.Drawing.Point(413, 128); + this.Image_selection.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); + this.Image_selection.Name = "Image_selection"; + this.Image_selection.Size = new System.Drawing.Size(136, 27); + this.Image_selection.TabIndex = 48; + this.Image_selection.Text = "打印图片路径选择"; + this.Image_selection.UseVisualStyleBackColor = true; + this.Image_selection.Click += new System.EventHandler(this.Image_selection_Click); + // + // FormMain + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(933, 564); + this.Controls.Add(this.Printer_selection); + this.Controls.Add(this.save_path); + this.Controls.Add(this.Printer_path); + this.Controls.Add(this.groupBox7); + this.Controls.Add(this.groupBox5); + this.Controls.Add(this.gbConnectView); + this.Controls.Add(this.gbAlarmWarning); + this.Controls.Add(this.tabMW); + this.Controls.Add(this.Image_selection); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Margin = new System.Windows.Forms.Padding(4); + this.Name = "FormMain"; + this.Text = "FalitPrint"; + this.Load += new System.EventHandler(this.Form1_Load); + this.groupBox6.ResumeLayout(false); + this.groupBox6.PerformLayout(); + this.Panel_Transfer.ResumeLayout(false); + this.Panel_Connect_1.ResumeLayout(false); + this.tabPhoto.ResumeLayout(false); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); + this.groupBox7.ResumeLayout(false); + this.groupBox7.PerformLayout(); + this.groupBox5.ResumeLayout(false); + this.tabPrint.ResumeLayout(false); + this.tabPrint.PerformLayout(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.photoshow)).EndInit(); + this.gbConnectView.ResumeLayout(false); + this.gbAlarmWarning.ResumeLayout(false); + this.gbAlarmWarning.PerformLayout(); + this.tabMW.ResumeLayout(false); + this.tabConnect.ResumeLayout(false); + this.gbAutoConnect.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dgConnect)).EndInit(); + this.gbIpconnect.ResumeLayout(false); + this.gbIpconnect.PerformLayout(); + this.tabXml.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label23; + private System.Windows.Forms.GroupBox groupBox6; + private System.Windows.Forms.Label label22; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.Label label24; + private System.Windows.Forms.Label label25; + private System.Windows.Forms.Button photo_Up_Button; + private System.Windows.Forms.Label label26; + private System.Windows.Forms.TextBox photo_path_Box; + private System.Windows.Forms.Label label20; + private System.Windows.Forms.Panel Panel_Transfer; + private System.Windows.Forms.Label label18; + private System.Windows.Forms.Panel Panel_Connect_1; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.TabPage tabPhoto; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Button btTransform; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.TextBox ed_XML_Path; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button btDisconnect; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.Button Printer_selection; + private System.Windows.Forms.TextBox save_path; + private System.Windows.Forms.TextBox Printer_path; + private System.Windows.Forms.GroupBox groupBox7; + private System.Windows.Forms.CheckBox check_connect_2; + private System.Windows.Forms.CheckBox check_connect_1; + private System.Windows.Forms.Timer SYS_Connect_Check; + private System.Windows.Forms.Timer Saw_Photo_Download_Timer; + private System.Windows.Forms.Label laPrintStatus; + private System.Windows.Forms.TextBox edIP; + private System.Windows.Forms.GroupBox groupBox5; + private System.Windows.Forms.Timer Print_index; + private System.Drawing.Printing.PrintDocument printDocument1; + public System.Windows.Forms.Timer MainProcess; + private System.Windows.Forms.Timer Print_Status; + private System.Windows.Forms.Button btConnect; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.Button btSetSize; + private System.Windows.Forms.TextBox laprintPath; + private System.Windows.Forms.Button btPrintSingle; + private System.Windows.Forms.TextBox laphotoPath; + private System.Windows.Forms.Label laD; + private System.Windows.Forms.Label laConnectStatus; + private System.Windows.Forms.Label laP; + private System.Windows.Forms.TabPage tabPrint; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.TextBox lapaperW; + private System.Windows.Forms.TextBox lapaperH; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.TextBox laprintposY; + private System.Windows.Forms.TextBox laprintposX; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.PictureBox photoshow; + private System.Windows.Forms.Label la_DirectQueue; + private System.Windows.Forms.GroupBox gbConnectView; + private System.Windows.Forms.Label la_LoopQueue; + private System.Windows.Forms.TextBox Err_Box; + private System.Windows.Forms.Label laWarning; + private System.Windows.Forms.Label laAlarm; + private System.Windows.Forms.GroupBox gbAlarmWarning; + private System.Windows.Forms.TabControl tabMW; + private System.Windows.Forms.TabPage tabConnect; + private System.Windows.Forms.GroupBox gbAutoConnect; + private System.Windows.Forms.DataGridView dgConnect; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnIP; + private System.Windows.Forms.Button btAutoConnect; + private System.Windows.Forms.Button btDetect; + private System.Windows.Forms.GroupBox gbIpconnect; + private System.Windows.Forms.TabPage tabXml; + private System.Windows.Forms.Button Image_selection; + } +} + diff --git a/FalitPrint/FormMain.cs b/FalitPrint/FormMain.cs new file mode 100644 index 0000000..636bec4 --- /dev/null +++ b/FalitPrint/FormMain.cs @@ -0,0 +1,1273 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Drawing.Imaging; +using System.Drawing.Printing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Xml.Serialization; +using System.Xml; +using System.Printing; +using FluentFTP; + +namespace FalitPrint +{ + public partial class FormMain : Form + { + + private int iRt; + + private int iCount = 1; + + public int iServerIdx; + + public int Processing; + + public byte CtlFolder; + + public string SubFolder; + + public string CtlHeadFilter; + + public string CtlTailFilter; + + public string PrintName; + + public int printsignal; + + public int iFTP_Type; + + public int iPrinterStatus; + + public int iSubNameIndex; + + public int iFtpConnectIndex; + + public int iLangIndex; + + public int iNowLangIndex = -1; + + private static string result = Environment.CurrentDirectory; + + public string sXmlSavePaht = "C:\\PLNC"; + + public string sLabelSavePaht = "C:\\PLNC\\Label"; + + public string SysPhotoPath = "home/disk3/data/open_hmi/photo"; + + public string PrintSet = result + "\\PrintSet.txt"; + + public string sLangEncoding = ""; + + public int x; + + public int order; + + private static string data = result + "\\data.txt"; + + private string Printer_name; + + public string sLabelSavePhotoPaht = "C:\\PLNC\\HMI"; + + public string control = result + "\\control.txt"; + + public string photo_path; + + public int print_count; + + private FtpClient client; + public FormMain() + { + InitializeComponent(); + ConnectInitial(); + Connect_SYS_loop(); + ComponentInitial(); + } + + public void ConnectInitial() + { + LNCAPI.DLL_USE_SETTING DllSetting = default; + DllSetting.SoftwareType = 5u; + DllSetting.TalkInfoNum = 1u; + DllSetting.MemSizeI = 4096u; + DllSetting.MemSizeO = 4096u; + DllSetting.MemSizeC = 4096u; + DllSetting.MemSizeS = 4096u; + DllSetting.MemSizeA = 4096u; + DllSetting.MemSizeR = 3500000u; + DllSetting.MemSizeF = 0u; + LNCAPI.FtpSetConnection(5); + iRt = LNCAPI.LibraryInitial(ref DllSetting, 1111, "15C33863AD3210BB63CDDAAB12D2851C55C169A74B5D6C15"); + if (iRt == 100) + { + Console.WriteLine("Initial Success"); + } + else + { + Console.WriteLine("Initial Fail"); + } + } + + public void Connect_SYS_loop() + { + LNCAPI.LClearQueue(iServerIdx); + LNCAPI.LReadBegin(iServerIdx); + LNCAPI.LReadNS(iServerIdx, 3000, 2); + LNCAPI.LReadNS(iServerIdx, 3000, 2); + LNCAPI.LReadNR(iServerIdx, 17003, 1); + LNCAPI.LReadNR(iServerIdx, 3051529, 64); + LNCAPI.LReadNR(iServerIdx, 20302, 1); + LNCAPI.LReadNR(iServerIdx, 1369252, 1); + LNCAPI.LReadNR(iServerIdx, 1390110, 1); + LNCAPI.LReadNR(iServerIdx, 48000, 1); + LNCAPI.LReadNR(iServerIdx, 1358000, 64); + LNCAPI.LReadEnd(iServerIdx); + } + + public void ComponentInitial() + { + dgConnect.RowCount = iCount; + dgConnect.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; + Panel_Connect_1.Visible = false; + } + + + private void timer1_Tick(object sender, EventArgs e) + { + LNCAPI.MainProcess(); + int iConnectStatus = LNCAPI.GetConnectionMsg(iServerIdx, 2); + switch (iConnectStatus) + { + case 0: + laConnectStatus.BackColor = Color.Gray; + laConnectStatus.Text = "断线"; + break; + case 1: + laConnectStatus.BackColor = Color.Yellow; + laConnectStatus.Text = "连接中"; + break; + case 2: + laConnectStatus.BackColor = Color.Gray; + laConnectStatus.Text = "连接失败"; + break; + case 3: + laConnectStatus.BackColor = Color.Blue; + laConnectStatus.Text = "已经连接"; + Panel_Connect_1.Visible = false; + break; + case 4: + laConnectStatus.BackColor = Color.Gray; + laConnectStatus.Text = "无响应"; + break; + } + if (iConnectStatus == 3) + { + laAlarm.BackColor = LNCAPI.memS(iServerIdx, 3000) == 1 ? Color.Red : Color.LightGray; + laWarning.BackColor = LNCAPI.memS(iServerIdx, 3001) == 1 ? Color.Yellow : Color.LightGray; + la_LoopQueue.Text = Convert.ToString(LNCAPI.GetConnectionMsg(iServerIdx, 21)); + la_DirectQueue.Text = Convert.ToString(LNCAPI.GetConnectionMsg(iServerIdx, 22)); + } + using (PrintQueue defaultPrintQueue = LocalPrintServer.GetDefaultPrintQueue()) + { + string PrintStaticText = ""; + switch (defaultPrintQueue.QueueStatus) + { + case PrintQueueStatus.Busy: + PrintStaticText = "打印机忙"; + break; + case PrintQueueStatus.DoorOpen: + PrintStaticText = "打印机上盖打开"; + break; + case PrintQueueStatus.Error: + PrintStaticText = "发生错误,无法打印"; + break; + case PrintQueueStatus.IOActive: + PrintStaticText = "发生打印文件中"; + break; + case PrintQueueStatus.Initializing: + PrintStaticText = "打印机初始化"; + break; + case PrintQueueStatus.ManualFeed: + PrintStaticText = "等待放入纸张"; + break; + case PrintQueueStatus.NoToner: + PrintStaticText = "打印机无墨粉"; + break; + case PrintQueueStatus.None: + PrintStaticText = "未知状态"; + break; + case PrintQueueStatus.NotAvailable: + PrintStaticText = "状态不可用"; + break; + case PrintQueueStatus.Offline: + PrintStaticText = "打印机离线"; + break; + case PrintQueueStatus.OutOfMemory: + PrintStaticText = "打印机内存溢出"; + break; + case PrintQueueStatus.OutputBinFull: + PrintStaticText = "输出纸盒已满"; + break; + case PrintQueueStatus.PagePunt: + PrintStaticText = "不能打印"; + break; + case PrintQueueStatus.PaperJam: + PrintStaticText = "打印机卡纸"; + break; + case PrintQueueStatus.PaperOut: + PrintStaticText = "无效的纸张"; + break; + case PrintQueueStatus.PaperProblem: + PrintStaticText = "纸张错误"; + break; + case PrintQueueStatus.Paused: + PrintStaticText = "暂停"; + break; + case PrintQueueStatus.PendingDeletion: + PrintStaticText = "正在删除"; + break; + case PrintQueueStatus.PowerSave: + PrintStaticText = "节能魔兽"; + break; + case PrintQueueStatus.Printing: + PrintStaticText = "准备打印"; + break; + case PrintQueueStatus.Processing: + PrintStaticText = "执行中"; + break; + case PrintQueueStatus.ServerUnknown: + PrintStaticText = "未知错误"; + break; + case PrintQueueStatus.TonerLow: + PrintStaticText = "缺墨"; + break; + case PrintQueueStatus.UserIntervention: + PrintStaticText = "需要手动处理"; + break; + case PrintQueueStatus.Waiting: + PrintStaticText = "等待"; + break; + case PrintQueueStatus.WarmingUp: + PrintStaticText = "预热"; + break; + } + Err_Box.Text = PrintStaticText; + } + } + + private void Bebug() + { + LNCAPI.LibrarySetDebug(2); + } + + private void Saw_Func_Tick(object sender, EventArgs e) + { + int Photo_Download_Index = LNCAPI.memR(iServerIdx, 1390110); + if (Photo_Download_Index == 1 || Photo_Download_Index == 2) + { + photoshow.Image.Dispose(); + photoshow.Image = Image.FromFile(result + "\\test.png"); + Downloads_Photo(); + LNCAPI.DWrite1R(iServerIdx, 1390110, -1); + LNCAPI.DWaitDone(iServerIdx, 5000); + } + } + + private void SYS_Connect_Check_Tick(object sender, EventArgs e) + { + if (LNCAPI.memR(iServerIdx, 1369252) == 0) + { + LNCAPI.DWrite1R(iServerIdx, 1369252, 1); + LNCAPI.DWaitDone(iServerIdx, 5000); + } + } + + private void Form1_Load(object sender, EventArgs e) + { + if (!File.Exists(sXmlSavePaht)) + { + Directory.CreateDirectory(sXmlSavePaht); + } + if (!File.Exists(sLabelSavePaht)) + { + Directory.CreateDirectory(sLabelSavePaht); + } + if (File.Exists(PrintSet)) + { + using (FileStream fs2 = new FileStream(result + "\\PrintSet.txt", FileMode.Open, FileAccess.Read)) + { + using (StreamReader sr2 = new StreamReader(fs2)) + { + string[] sLine2 = new string[10]; + int iLineCount2 = 0; + string str2; + while ((str2 = sr2.ReadLine()) != null) + { + sLine2[iLineCount2] = str2; + iLineCount2++; + } + laphotoPath.Text = sLine2[0]; + edIP.Text = sLine2[1]; + if (sLine2[2] != null) + { + ed_XML_Path.Text = sLine2[2]; + } + laprintposX.Text = sLine2[3].Split('\t')[0]; + laprintposY.Text = sLine2[3].Split('\t')[1]; + lapaperH.Text = sLine2[3].Split('\t')[2]; + lapaperW.Text = sLine2[3].Split('\t')[3]; + + } + } + } + else + { + using (File.Create(PrintSet)) + { + + } + } + if (File.Exists(data)) + { + using (FileStream fs = new FileStream(result + "\\data.txt", FileMode.Open, FileAccess.Read)) + { + using (StreamReader sr = new StreamReader(fs)) + { + string[] sLine = new string[10]; + int iLineCount = 0; + string str; + while ((str = sr.ReadLine()) != null) + { + sLine[iLineCount] = str; + iLineCount++; + } + if (sLine[0] == "0") + { + check_connect_1.Checked = true; + check_connect_2.Checked = false; + order = 0; + } + else + { + check_connect_1.Checked = false; + check_connect_2.Checked = true; + order = 1; + } + if (sLine[1] != null) + { + Printer_name = sLine[1]; + } + if (sLine[2] != null) + { + sLabelSavePaht = sLine[2]; + } + if (sLine[3] != null) + { + photo_path = sLine[3]; + } + + } + } + } + Printer_path.Text = Printer_name; + save_path.Text = sLabelSavePaht; + photo_path_Box.Text = photo_path; + BootConnect(); + } + + public void WriteLog(string Func, string Info) + { + string Log = result + "\\Log.txt"; + try + { + + + using (FileStream PLNC = (File.Exists(Log) ? new FileStream(Log, FileMode.Append, FileAccess.Write) : File.Create(Log))) + { + StreamWriter PLNC_SW = new StreamWriter(PLNC); + PLNC_SW.WriteLine("[" + Func + "] " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " " + Info); + PLNC_SW.Dispose(); + + } + } + catch (Exception ex) + { + Console.WriteLine("[WriteLog] " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " " + ex.Message); + } + } + + public void RefreshPrintSet() + { + using (FileStream fs = new FileStream(result + "\\PrintSet.txt", FileMode.Create, FileAccess.ReadWrite)) + { + using (StreamWriter sw = new StreamWriter(fs)) + { + sw.WriteLine(laphotoPath.Text); + sw.WriteLine(edIP.Text); + sw.WriteLine(" "); + sw.WriteLine(laprintposX.Text.ToString() + "\t" + laprintposY.Text.ToString() + "\t" + lapaperH.Text.ToString() + "\t" + lapaperW.Text.ToString()); + } + + } + } + + private void StringSaveToR(string Src, int iLen, int iRNo, int iRCount) + { + if (iRNo < 0 || iRCount <= 0) + { + return; + } + _ = iLen % 4; + int ciCount = iLen / 4 + ((!(iLen % 4).Equals(0)) ? 1 : 0); + int[] iRValue = new int[600]; + int iIndex = 0; + int i = 0; + for (i = 0; i < ciCount; i++) + { + int iDest = 0; + int j = 0; + for (j = 0; j < 4; j++) + { + int iStrIndex = i * 4 + j; + if (iStrIndex < iLen) + { + int iByteData = Src[iStrIndex] & 0xFF; + iDest |= iByteData << 8 * j; + } + } + if (i < 600) + { + iRValue[i] = iDest; + } + iIndex++; + } + LNCAPI.DWriteBegin(iServerIdx); + LNCAPI.DWrite1R(iServerIdx, iRNo, iRValue[0]); + LNCAPI.DWrite1R(iServerIdx, iRNo + 1, iRValue[1]); + LNCAPI.DWrite1R(iServerIdx, iRNo + 2, iRValue[2]); + LNCAPI.DWrite1R(iServerIdx, iRNo + 3, iRValue[3]); + LNCAPI.DWrite1R(iServerIdx, iRNo + 4, iRValue[4]); + LNCAPI.DWrite1R(iServerIdx, iRNo + 5, iRValue[5]); + LNCAPI.DWrite1R(iServerIdx, iRNo + 6, iRValue[6]); + LNCAPI.DWrite1R(iServerIdx, iRNo + 7, iRValue[7]); + LNCAPI.DWriteEnd(iServerIdx); + } + + private string StringReadFromR(int iRNo, int iRCount, string Src) + { + if (iRNo >= 0 && iRCount > 0) + { + int[] a_iData = new int[8]; + int j = 0; + for (int i = iRCount - 1; i >= 0; i--) + { + a_iData[i] = LNCAPI.memR(iServerIdx, iRNo + j); + j++; + } + int iIndex = 0; + for (int i = 0; i < iRCount; i++) + { + int iData = a_iData[--j]; + for (int k = 0; k < 4; k++) + { + char cIntData = Convert.ToChar((iData >> 8 * k) & 0xFF); + if (cIntData >= ' ') + { + Src += cIntData; + iIndex++; + } + else if (cIntData == '\0') + { + break; + } + } + } + return Src; + } + return "ture"; + } + + private void tabMW_SelectedIndexChanged(object sender, EventArgs e) + { + if (tabMW.SelectedTab == tabXml) + { + if (LNCAPI.GetConnectionMsg(iServerIdx, 2) != 3) + { + Panel_Connect_1.Visible = true; + } + else + { + Panel_Connect_1.Visible = false; + } + } + else + { + Panel_Connect_1.Visible = false; + } + } + + private void btSetSize_Click(object sender, EventArgs e) + { + RefreshPrintSet(); + MessageBox.Show("设置成功"); + } + + private void btPrintSingle_Click(object sender, EventArgs e) + { + OpenFileDialog singleprint = new OpenFileDialog(); + singleprint.Multiselect = false; + singleprint.Title = "选择文件"; + singleprint.Filter = "Image Files|*.bmp;*.png"; + if (singleprint.ShowDialog() == DialogResult.OK) + { + try + { + PrintDocument obj = new PrintDocument + { + PrinterSettings = + { + PrinterName = Printer_name + } + }; + Console.WriteLine("Single"); + laphotoPath.Text = singleprint.FileName; + laprintPath.Text = singleprint.FileName; + RefreshPrintSet(); + photoshow.Image = Image.FromFile(singleprint.FileName); + obj.PrintPage += printDocument1_PrintPage; + obj.Print(); + obj.Dispose(); + } + catch (Exception ex) + { + WriteLog("PrintSingle", ex.Message.ToString()); + } + } + } + + private void Print_index_Tick(object sender, EventArgs e) + { + printsignal = LNCAPI.memR(iServerIdx, 20302 + order); + if (printsignal == 1) + { + LNCAPI.DWrite1R(iServerIdx, 20302 + order, 2); + LNCAPI.DWaitDone(iServerIdx, 5000); + Print_Action(); + } + } + + public void Print_Action() + { + int iMSG_HINT_Start_R = 1358000 + order * 32; + int IMSG_HINT_Count = 32; + byte[] Namech = new byte[128]; + LNCAPI.memRString(0, iMSG_HINT_Start_R, IMSG_HINT_Count, Namech); + try + { + PrintName = Encoding.GetEncoding(0).GetString(Namech); + } + catch + { + try + { + PrintName = Encoding.GetEncoding(1).GetString(Namech); + } + catch + { + PrintName = Encoding.GetEncoding(2).GetString(Namech); + } + } + PrintName = PrintName.Trim(); + laprintPath.Text = sLabelSavePaht + "\\" + PrintName; + if (File.Exists(laprintPath.Text)) + { + using (PrintDocument obj3 = new PrintDocument()) + { + + + obj3.PrinterSettings.PrinterName = Printer_name; + photoshow.Image = Image.FromFile(laprintPath.Text); + obj3.PrintPage += printDocument1_PrintPage; + obj3.Print(); + + } + } + else + { + LNCAPI.DWrite1R(iServerIdx, 20402 + order, 2); + MessageBox.Show("文件不存在"); + } + Namech = null; + } + + private void printDocument1_PrintPage(object sender, PrintPageEventArgs e) + { + try + { + using (Image img = Image.FromFile(laprintPath.Text)) + { + Console.WriteLine(laprintPath.Text); + double iHgight = double.Parse(lapaperH.Text) / 25.4 * 100.0; + double iWidth = double.Parse(lapaperW.Text) / 25.4 * 100.0; + Point position = new Point(int.Parse(laprintposX.Text), int.Parse(laprintposY.Text)); + Size size = new Size((int)iWidth, (int)iHgight); + Rectangle photosize = new Rectangle(position, size); + e.Graphics.DrawImage(img, photosize); + } + LNCAPI.DWrite1R(iServerIdx, 20402 + order, 1); + } + catch (Exception ex) + { + WriteLog("PrintDocumect1", ex.Message.ToString()); + } + } + + private void btDetect_Click(object sender, EventArgs e) + { + int i = 0; + LNCAPI.LOCAL_CONTROLLER_INFO Info = default; + _ = dgConnect.Rows; + iCount = LNCAPI.LocalDetectControllers(); + if (iCount == 0) + { + dgConnect.RowCount = 1; + } + else if (iCount != 0) + { + dgConnect.RowCount = iCount; + } + for (i = 0; i < iCount; i++) + { + iRt = LNCAPI.LocalReadController(i, ref Info); + string[] str_1 = Encoding.Default.GetString(Info.IP).Split(default(char)); + string[] str_2 = Encoding.Default.GetString(Info.Name).Split(default(char)); + _ = Info.IPLong + " : " + str_1[0] + str_2[0]; + dgConnect.Rows[i].HeaderCell.Value = i.ToString(); + dgConnect.Rows[i].Cells[0].Value = str_1[0]; + } + } + + private void btAutoConnect_Click(object sender, EventArgs e) + { + try + { + LNCAPI.ConnectLocalList(iServerIdx, dgConnect.CurrentCell.RowIndex); + string sIP = dgConnect.CurrentCell.Value.ToString(); + Ftp_Connect(sIP); + edIP.Text = sIP; + } + catch (Exception ex) + { + WriteLog("AutoConnect", ex.Message.ToString()); + } + } + + private void btConnect_Click(object sender, EventArgs e) + { + try + { + string sIP = edIP.Text; + LNCAPI.ConnectLocalIP(iServerIdx, sIP); + Bebug(); + Ftp_Connect(sIP); + } + catch (Exception ex) + { + WriteLog("Connect", ex.Message.ToString()); + } + } + + public void BootConnect() + { + try + { + string sIP = edIP.Text; + LNCAPI.ConnectLocalIP(iServerIdx, sIP); + Ftp_Connect(sIP); + } + catch (Exception ex) + { + WriteLog("Connect", ex.Message.ToString()); + } + } + + private void btDisconnect_Click(object sender, EventArgs e) + { + try + { + LNCAPI.Disconnect(iServerIdx); + client.Disconnect(); + client.Dispose(); + } + catch (Exception ex) + { + WriteLog("Disconnect", ex.Message.ToString()); + } + } + + private void Ftp_Connect(string Connect_IP) + { + try + { + + client = new FtpClient(Connect_IP, "root", "admin0800095590", 2100, new FtpConfig() + { + ConnectTimeout = 500, + SocketKeepAlive = true, + }); + //client.SocketKeepAlive = true; + client.Connect(); + } + catch (Exception ex) + { + WriteLog("Connect", ex.Message.ToString()); + } + } + + private void ClearAllFIles() + { + try + { + string sIP = edIP.Text; + Ftp_Connect(sIP); + if (client.IsConnected) + { + photoshow.Image.Dispose(); + photoshow.Image = Image.FromFile(result + "\\test.png"); + FtpListItem[] listing = client.GetListing(SysPhotoPath); + foreach (FtpListItem item in listing) + { + client.DeleteFile(item.FullName); + } + } + else + { + MessageBox.Show("FTP 连接失败!"); + } + foreach (string item2 in new List { sLabelSavePaht }) + { + string[] files = Directory.GetFiles(item2); + for (int i = 0; i < files.Length; i++) + { + File.Delete(files[i]); + } + } + } + catch (Exception ex) + { + WriteLog("ClearAllFIles", ex.Message.ToString()); + } + } + + private void btTransform_Click(object sender, EventArgs e) + { + int iListCount = -1; + int iCount = 0; + int iLabelIndex = 0; + int cncFilename = 1373200; + int labelFilename = 1375200; + int imageFilename = 1377200; + string[] sXmlList = new string[1500]; + string XmlDocument = ""; + sLabelSavePaht = "C:\\PLNC\\Label"; + Data_Record(); + save_path.Text = sLabelSavePaht; + OpenFileDialog dialog = new OpenFileDialog(); + dialog.Multiselect = false; + dialog.Title = "选择文件清单"; + dialog.Filter = "Input Files|*.xml"; + if (!File.Exists(sLabelSavePaht)) + { + Directory.CreateDirectory(sLabelSavePaht); + } + new XmlDocument(); + LNCAPI.DWrite1RBit(iServerIdx, 8046, 8, 0); + if (dialog.ShowDialog() == DialogResult.OK) + { + Panel_Transfer.Visible = true; + try + { + print_count = 0; + ed_XML_Path.Text = Path.GetDirectoryName(dialog.FileName); + RefreshPrintSet(); + ClearAllFIles(); + int[] test = new int[360]; + LNCAPI.DWriteBegin(iServerIdx); + for (int j = 0; j < 21; j++) + { + LNCAPI.DWriteNR(iServerIdx, 1373200 + j * 300, 300, test); + } + LNCAPI.DWriteEnd(iServerIdx); + string[] fileNames = dialog.FileNames; + foreach (string item in fileNames) + { + XmlDocument = Path.GetDirectoryName(item); + CycleFile root = (CycleFile)new XmlSerializer(typeof(CycleFile)).Deserialize(new StringReader(File.ReadAllText(item, Encoding.UTF8))); + if (root.Cycle == null) + { + continue; + } + foreach (Field items in root.Cycle) + { + if (iListCount >= 250 || (!(items.Name == "PlateID") && !(items.Name == "LabelName") && !(items.Name == "LargeImage"))) + { + continue; + } + if (items.Name == "PlateID") + { + if (iListCount == 249) + { + MessageBox.Show("最大上传250个文件"); + break; + } + iListCount++; + iCount = 0; + } + if (items.Name == "LargeImage") + { + iLabelIndex = 1; + } + sXmlList[iListCount * 6 + iCount] = items.Name; + sXmlList[iListCount * 6 + iCount + 1] = items.Value; + iCount += 2; + } + } + Uplaoads_Photo(); + for (int i = 0; i < iListCount + 1; i++) + { + StringSaveToR(sXmlList[1 + i * 6], sXmlList[1 + i * 6].Length, cncFilename + i * 8, 8); + LNCAPI.FtpWaitDone(50); + StringSaveToR(sXmlList[3 + i * 6], sXmlList[3 + i * 6].Length, labelFilename + i * 8, 8); + LNCAPI.FtpWaitDone(50); + if (iLabelIndex == 1) + { + StringSaveToR(sXmlList[5 + i * 6], sXmlList[5 + i * 6].Length, imageFilename + i * 8, 8); + LNCAPI.FtpWaitDone(50); + } + xmltoNc(XmlDocument, sXmlList[3 + i * 6], sXmlList[1 + i * 6]); + } + Panel_Transfer.Visible = false; + MessageBox.Show("转换完成!"); + } + catch (Exception ex) + { + WriteLog("Transform", ex.Message.ToString()); + } + } + LNCAPI.DWrite1RBit(iServerIdx, 8046, 8, 1); + } + + public void xmltoNc(string ListPath, string LabelFileName, string CNCFileName) + { + Console.WriteLine(ListPath + LabelFileName); + try + { + int XmlValueCount = 0; + string[] sProg = new string[100]; + string[] sProg_2 = new string[100]; + string sPhotoRename = ""; + string sPhotoRename_last = ""; + string sXmlBakPath = ListPath + "\\" + LabelFileName; + string path = sXmlSavePaht + "\\" + LabelFileName; + new XmlDocument(); + File.Delete(path); + FileStream fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write); + iLangIndex = LNCAPI.memR(iServerIdx, 48000); + if (iLangIndex == 0) + { + sLangEncoding = "Big5"; + } + else if (iLangIndex == 1) + { + sLangEncoding = "GB2312"; + } + else + { + sLangEncoding = "UTF8"; + } + StreamWriter sw = new StreamWriter(fs, Encoding.GetEncoding(sLangEncoding)); + CycleFile root = (CycleFile)new XmlSerializer(typeof(CycleFile)).Deserialize(new StringReader(File.ReadAllText(sXmlBakPath, Encoding.UTF8))); + sw.Write(";MADE BY LNC " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "\n"); + int one = 0; + string output; + if (root.Cycle != null) + { + foreach (Field items in root.Cycle) + { + sProg[XmlValueCount] = items.Name; + sProg[XmlValueCount + 1] = items.Value; + XmlValueCount += 2; + if (XmlValueCount == 8) + { + if (one == 0) + { + sProg_2[1] = sProg[1]; + sProg_2[2] = sProg[2]; + sProg_2[3] = sProg[3]; + sProg_2[4] = sProg[4]; + sProg_2[5] = sProg[5]; + one = 1; + XmlValueCount = 0; + sPhotoRename = sProg[1].Split('.')[0] + ".png"; + continue; + } + sPhotoRename_last = sProg_2[1].Split('.')[0] + ".png"; + sPhotoRename = sProg[1].Split('.')[0] + ".png"; + output = "M801 \"" + sPhotoRename_last + "\" " + sProg_2[2] + sProg_2[3] + " " + sProg_2[4] + sProg_2[5] + " \"" + sPhotoRename + "\" \n"; + sw.Write(output); + sProg_2[1] = sProg[1]; + sProg_2[2] = sProg[2]; + sProg_2[3] = sProg[3]; + sProg_2[4] = sProg[4]; + sProg_2[5] = sProg[5]; + XmlValueCount = 0; + } + } + } + output = "M801 \"" + sPhotoRename + "\" " + sProg[2] + sProg[3] + " " + sProg[4] + sProg[5] + "\n"; + sw.Write(output); + output = "M802 \"" + CNCFileName + "\"\n"; + sw.Write(output); + sw.Write("M30"); + sw.Dispose(); + fs.Dispose(); + } + catch (Exception ex) + { + WriteLog("xmltoNc", ex.Message.ToString()); + } + } + + public void Uplaoads_Photo() + { + try + { + if (!Directory.Exists(sLabelSavePhotoPaht)) + { + Directory.CreateDirectory(sLabelSavePhotoPaht); + Console.WriteLine(sLabelSavePhotoPaht); + } + foreach (string item2 in new List { sLabelSavePhotoPaht }) + { + string[] files = Directory.GetFiles(item2); + for (int j = 0; j < files.Length; j++) + { + File.Delete(files[j]); + } + } + FileStream fs_control = new FileStream(control, FileMode.Create, FileAccess.ReadWrite); + iLangIndex = LNCAPI.memR(iServerIdx, 48000); + if (iLangIndex == 0) + { + sLangEncoding = "Big5"; + } + else if (iLangIndex == 1) + { + sLangEncoding = "GB2312"; + } + else + { + sLangEncoding = "UTF8"; + } + StreamWriter sw = new StreamWriter(fs_control, Encoding.GetEncoding(sLangEncoding)); + int control_Name = 0; + foreach (string item in from s in Directory.GetFiles(ed_XML_Path.Text, "*.*", SearchOption.AllDirectories) + where s.EndsWith(".bmp") || s.EndsWith(".png") || s.EndsWith(".jpg") + select s) + { + string sRename = item.Split('\\')[item.Split('\\').Length - 1].Split('.')[0] + ".png"; + string AsPath = sLabelSavePaht + "\\" + sRename; + string HMI_sRename = control_Name + ".png"; + string HMI_AsPath2 = sLabelSavePhotoPaht + "\\" + HMI_sRename; + using (FileStream fs = new FileStream(item, FileMode.Open, FileAccess.Read)) + { + Image image = Image.FromStream(fs); + + image.Save(AsPath, ImageFormat.Png); + image.Save(HMI_AsPath2, ImageFormat.Png); + image.Dispose(); + } + sw.WriteLine(sRename); + sw.WriteLine(HMI_sRename); + control_Name++; + } + sw.Dispose(); + fs_control.Dispose(); + string sIP = edIP.Text; + Ftp_Connect(sIP); + if (client.IsConnected) + { + for (int i = 0; i < control_Name; i++) + { + _ = i + ".png"; + string PC_AsPath = sLabelSavePhotoPaht + "\\" + i + ".png"; + string HMI_AsPath = SysPhotoPath + "/" + i + ".png"; + client.UploadFile(PC_AsPath, HMI_AsPath); + } + string HMI_control = SysPhotoPath + "/control.txt"; + client.UploadFile(control, HMI_control); + Directory.GetFiles(sLabelSavePaht); + } + else + { + MessageBox.Show("FTP连接失败!"); + } + } + catch (Exception ex) + { + WriteLog("Uplaoads_Photo", ex.Message.ToString()); + } + } + + public void Downloads_Photo() + { + try + { + if (!client.IsConnected) + { + return; + } + if (LNCAPI.memR(iServerIdx, 1390110) == 1) + { + foreach (string path in new List { SysPhotoPath }) + { + FtpListItem[] listing = client.GetListing(path); + foreach (FtpListItem item in listing) + { + Console.WriteLine(item.Name); + client.DownloadFile(sLabelSavePaht + "/" + item.Name, item.FullName); + } + } + return; + } + if (LNCAPI.memR(iServerIdx, 1390110) == 2) + { + client.DownloadFile(sLabelSavePaht + "/Manual_Cut_Label.png", "home/disk3/data/open_hmi/photo/Manual_Cut_Label.png"); + } + } + catch (Exception ex) + { + WriteLog("Downloads_Photo", ex.Message.ToString()); + Console.WriteLine(ex.Message.ToString()); + } + } + + public static string ConvertUTF8toBIG5(string strInput) + { + byte[] strut8 = Encoding.Unicode.GetBytes(strInput); + byte[] strbig5 = Encoding.Convert(Encoding.Unicode, Encoding.Default, strut8); + return Encoding.Default.GetString(strbig5); + } + + public static string ConvertUTF8toGBK(string strInput) + { + byte[] strut8 = Encoding.Unicode.GetBytes(strInput); + byte[] strgbk = Encoding.Convert(Encoding.Unicode, Encoding.Default, strut8); + return Encoding.Default.GetString(strgbk); + } + + public void ChangeLangEncoder() + { + iLangIndex = LNCAPI.memR(iServerIdx, 48000); + if (iLangIndex == 0) + { + sLangEncoding = "Big5"; + } + else if (iLangIndex == 1) + { + sLangEncoding = "GB2312"; + } + else + { + sLangEncoding = "UTF8"; + } + iNowLangIndex = iLangIndex; + } + + private void Print_Count() + { + } + + public void GetPrintStatus() + { + } + + private void Print_Status_Tick(object sender, EventArgs e) + { + } + + private void check_connect_1_Click(object sender, EventArgs e) + { + order = 0; + check_connect_2.Checked = false; + Data_Record(); + } + + private void check_connect_2_Click(object sender, EventArgs e) + { + order = 1; + check_connect_1.Checked = false; + Data_Record(); + } + + private void Printer_selection_Click(object sender, EventArgs e) + { + PrintDialog PD = new PrintDialog(); + PD.Document = printDocument1; + DialogResult num = PD.ShowDialog(); + Printer_name = PD.PrinterSettings.PrinterName; + if (num == DialogResult.OK) + { + Update_file_name(); + } + Data_Record(); + } + + public void Update_file_name() + { + PrintDocument printDocument = new PrintDocument(); + Printer_path.Text = Printer_name; + printDocument.PrinterSettings.PrinterName = Printer_name; + } + + public void Data_Record() + { + FileStream fileStream = new FileStream(result + "\\data.txt", FileMode.Create, FileAccess.ReadWrite); + StreamWriter streamWriter = new StreamWriter(fileStream); + streamWriter.WriteLine(order); + streamWriter.WriteLine(Printer_name); + streamWriter.WriteLine(sLabelSavePaht); + streamWriter.WriteLine(photo_path); + streamWriter.Dispose(); + fileStream.Dispose(); + } + + private void Image_selection_Click(object sender, EventArgs e) + { + FolderBrowserDialog LabelSavePaht = new FolderBrowserDialog(); + if (LabelSavePaht.ShowDialog() == DialogResult.OK) + { + sLabelSavePaht = LabelSavePaht.SelectedPath; + save_path.Text = LabelSavePaht.SelectedPath; + Data_Record(); + } + } + + private void photo_Up_Button_Click(object sender, EventArgs e) + { + FolderBrowserDialog photo_Up_Path = new FolderBrowserDialog(); + if (photo_Up_Path.ShowDialog() != DialogResult.OK) + { + return; + } + photo_path = photo_Up_Path.SelectedPath; + photo_path_Box.Text = photo_Up_Path.SelectedPath; + Data_Record(); + FileStream fs_control = new FileStream(control, FileMode.Create, FileAccess.ReadWrite); + iLangIndex = LNCAPI.memR(iServerIdx, 48000); + if (iLangIndex == 0) + { + sLangEncoding = "Big5"; + } + else if (iLangIndex == 1) + { + sLangEncoding = "GB2312"; + } + else + { + sLangEncoding = "UTF8"; + } + StreamWriter sw = new StreamWriter(fs_control, Encoding.GetEncoding(sLangEncoding)); + if (!Directory.Exists(sLabelSavePhotoPaht)) + { + Directory.CreateDirectory(sLabelSavePhotoPaht); + Console.WriteLine(sLabelSavePhotoPaht); + } + string sIP = edIP.Text; + Ftp_Connect(sIP); + if (client.IsConnected) + { + photoshow.Image.Dispose(); + photoshow.Image = Image.FromFile(result + "\\test.png"); + FtpListItem[] listing = client.GetListing(SysPhotoPath); + foreach (FtpListItem item2 in listing) + { + client.DeleteFile(item2.FullName); + } + } + else + { + MessageBox.Show("FTP连接失败!"); + } + foreach (string item3 in new List { sLabelSavePhotoPaht }) + { + string[] files = Directory.GetFiles(item3); + for (int j = 0; j < files.Length; j++) + { + File.Delete(files[j]); + } + } + iLangIndex = LNCAPI.memR(iServerIdx, 48000); + if (iLangIndex == 0) + { + sLangEncoding = "Big5"; + } + else if (iLangIndex == 1) + { + sLangEncoding = "GB2312"; + } + else + { + sLangEncoding = "UTF8"; + } + sw = new StreamWriter(fs_control, Encoding.GetEncoding(sLangEncoding)); + int control_Name = 0; + foreach (string item in from s in Directory.GetFiles(photo_path, "*.*", SearchOption.AllDirectories) + where s.EndsWith(".bmp") || s.EndsWith(".png") || s.EndsWith(".jpg") + select s) + { + string sRename = item.Split('\\')[item.Split('\\').Length - 1].Split('.')[0] + ".png"; + _ = sLabelSavePaht + "\\" + sRename; + string HMI_sRename = control_Name + ".png"; + string HMI_AsPath2 = sLabelSavePhotoPaht + "\\" + HMI_sRename; + using (FileStream fs = new FileStream(item, FileMode.Open, FileAccess.Read)) + { + Image image = Image.FromStream(fs); + image.Save(HMI_AsPath2, ImageFormat.Png); + image.Dispose(); + sw.WriteLine(sRename); + sw.WriteLine(HMI_sRename); + control_Name++; + } + } + sw.Dispose(); + fs_control.Dispose(); + Ftp_Connect(sIP); + if (client.IsConnected) + { + for (int i = 0; i < control_Name; i++) + { + _ = i + ".png"; + string PC_AsPath = sLabelSavePhotoPaht + "\\" + i + ".png"; + string HMI_AsPath = SysPhotoPath + "/" + i + ".png"; + client.UploadFile(PC_AsPath, HMI_AsPath); + } + string HMI_control = SysPhotoPath + "/control.txt"; + client.UploadFile(control, HMI_control); + Directory.GetFiles(sLabelSavePaht); + MessageBox.Show("上传完成!"); + } + else + { + MessageBox.Show("FTP连接失败!"); + } + } + + + } +} diff --git a/FalitPrint/FormMain.resx b/FalitPrint/FormMain.resx new file mode 100644 index 0000000..861be3c --- /dev/null +++ b/FalitPrint/FormMain.resx @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 795, 53 + + + 17, 55 + + + 236, 55 + + + 353, 55 + + + 501, 55 + + + 630, 55 + + + 129 + + \ No newline at end of file diff --git a/FalitPrint/Program.cs b/FalitPrint/Program.cs new file mode 100644 index 0000000..2105a74 --- /dev/null +++ b/FalitPrint/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace FalitPrint +{ + internal static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new FormMain()); + } + } +} diff --git a/FalitPrint/Properties/AssemblyInfo.cs b/FalitPrint/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1ae4a4d --- /dev/null +++ b/FalitPrint/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("FalitPrint")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FalitPrint")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("936ba54e-084e-4651-95a1-977c3ab86010")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/FalitPrint/Properties/Resources.Designer.cs b/FalitPrint/Properties/Resources.Designer.cs new file mode 100644 index 0000000..77c819d --- /dev/null +++ b/FalitPrint/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FalitPrint.Properties +{ + + + /// + /// 强类型资源类,用于查找本地化字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// 返回此类使用的缓存 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FalitPrint.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/FalitPrint/Properties/Resources.resx b/FalitPrint/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/FalitPrint/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/FalitPrint/Properties/Settings.Designer.cs b/FalitPrint/Properties/Settings.Designer.cs new file mode 100644 index 0000000..a5fd4c1 --- /dev/null +++ b/FalitPrint/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace FalitPrint.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/FalitPrint/Properties/Settings.settings b/FalitPrint/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/FalitPrint/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/FalitPrint/packages.config b/FalitPrint/packages.config new file mode 100644 index 0000000..e943c36 --- /dev/null +++ b/FalitPrint/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/FalitPrint/sc.cs b/FalitPrint/sc.cs new file mode 100644 index 0000000..d5daabf --- /dev/null +++ b/FalitPrint/sc.cs @@ -0,0 +1,789 @@ +using System; +using System.Runtime.InteropServices; + +namespace FalitPrint +{ + public class LNCAPI + { + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct ERROR_MSG + { + public byte Type; + + public byte Cmd; + + public byte Error; + + public byte Reserve; + + public int addr; + + public int num; + } + + [StructLayout(LayoutKind.Explicit, Pack = 1)] + public struct SC_DATA + { + [FieldOffset(0)] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1440)] + public byte[] Bytes; + + [FieldOffset(0)] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 720)] + public ushort[] Words; + + [FieldOffset(0)] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 360)] + public uint[] Ints; + + [FieldOffset(0)] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 180)] + public double[] Fixs; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct LOCAL_CONTROLLER_INFO + { + public uint IPLong; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] IP; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] Name; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct FTP_FILE + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] filename; + + public uint filesize; + + public ushort year; + + public byte month; + + public byte day; + + public byte hour; + + public byte minute; + + public byte second; + + public byte Reserve; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct FTP_TRANFER_FILE + { + public byte Folder; + + public string SubFolder; + + public string Filename; + + public string LocalFilename; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct FUNCTION_SETTING + { + public uint MakerID; + + public uint MakerPwd; + + public uint MediaIPLong1; + + public uint MediaIPLong2; + + public byte HaveMediaFunction; + } + + public struct DLL_USE_SETTING + { + public uint TalkInfoNum; + + public uint SoftwareType; + + public uint MemSizeI; + + public uint MemSizeO; + + public uint MemSizeC; + + public uint MemSizeS; + + public uint MemSizeA; + + public uint MemSizeR; + + public uint MemSizeF; + + public uint MemSizeTimer; + + public uint MemSizeCounter; + } + + private const string ReCON_DLL_NAME = "scif2_bcb.dll"; + + public const uint MAX_SYNC_COUNT = 10u; + + public const uint MAX_CONTROLLER_NUM_PER_MAKER = 300u; + + public const uint BIT_CB_SIZE = 4096u; + + public const uint INT_CB_SIZE = 20000u; + + public const uint FIX_CB_SIZE = 4096u; + + public const uint MAX_LOOP_SIZE = 64u; + + public const uint MAX_DIRECT_SIZE = 64u; + + public const uint DIRECT_ADDR_MASK = 63u; + + public const uint MAX_DATA_BYTES = 1440u; + + public const uint MAX_BIT_NUM = 1440u; + + public const uint MAX_WORD_NUM = 720u; + + public const uint MAX_INT_NUM = 360u; + + public const uint MAX_FIX_NUM = 180u; + + public const uint MAX_PTR_NUM = 180u; + + public const uint MAX_CB_NUM = 288u; + + public const uint MAX_CB_BIT_NUM = 288u; + + public const uint MAX_CB_WORD_NUM = 240u; + + public const uint MAX_CB_INT_NUM = 180u; + + public const uint MAX_CB_FIX_NUM = 120u; + + public const uint MAX_CB_PTR_NUM = 120u; + + public const uint I_OFFSET = 0u; + + public const uint O_OFFSET = 5120u; + + public const uint C_OFFSET = 10240u; + + public const uint S_OFFSET = 15360u; + + public const uint A_OFFSET = 20480u; + + public const uint TT_OFFSET = 25600u; + + public const uint CT_OFFSET = 30720u; + + public const uint RBIT_OFFSET = 100000u; + + public const uint R_OFFSET = 0u; + + public const uint RI_OFFSET = 8000000u; + + public const uint RO_OFFSET = 8100000u; + + public const uint RC_OFFSET = 8200000u; + + public const uint RS_OFFSET = 8300000u; + + public const uint RA_OFFSET = 8400000u; + + public const uint RTT_OFFSET = 8500000u; + + public const uint RCT_OFFSET = 8600000u; + + public const uint TV_OFFSET = 10000000u; + + public const uint TS_OFFSET = 10500000u; + + public const uint CV_OFFSET = 11000000u; + + public const uint CS_OFFSET = 11500000u; + + public const uint F_OFFSET = 10000000u; + + public const uint I_NUM = 4096u; + + public const uint O_NUM = 4096u; + + public const uint C_NUM = 4096u; + + public const uint S_NUM = 4096u; + + public const uint A_NUM = 4096u; + + public const uint R_NUM = 6000000u; + + public const uint F_NUM = 100000u; + + public const uint TIMER_NUM = 256u; + + public const uint COUNTER_NUM = 256u; + + public const uint PAC_STRING_SIZE = 20u; + + public const uint PAC_STRING_NUM = 21u; + + public const uint PAC_PATH_SIZE = 5000u; + + public const uint R_PATH_PAC_STRING = 3021500u; + + public const uint BLOCK_PATH_SIZE = 2000u; + + public const uint R_PATH_BLOCK_CURRENT = 3006072u; + + public const uint ALM_COUNT = 1790000u; + + public const uint WARN_COUNT = 1790500u; + + public const uint ALM_STRING = 1790010u; + + public const uint ALM_STRING_SIZR = 40u; + + public const uint WARN_STRING = 1790510u; + + public const uint WARN_STRING_SIZR = 40u; + + public const byte SCIF_PROC_COUNTER = 1; + + public const byte SCIF_MEDIA_STEP = 5; + + public const byte SCIF_MEDIA_STATE = 6; + + public const byte SCIF_MAKER_ID = 7; + + public const byte SCIF_FTP_STATE = 11; + + public const byte SCIF_FTP_RESULT = 12; + + public const byte SCIF_FTP_STEP = 13; + + public const byte SCIF_FTP_TOTAL_PACKAGE = 21; + + public const byte SCIF_FTP_CURRENT_PACKAGE = 22; + + public const byte SCIF_FTP_TOTAL_FILE = 31; + + public const byte SCIF_FTP_CURRENT_FILE = 32; + + public const uint SCIF_MEM_SIZE_I = 40u; + + public const uint SCIF_MEM_SIZE_O = 41u; + + public const uint SCIF_MEM_SIZE_C = 42u; + + public const uint SCIF_MEM_SIZE_S = 43u; + + public const uint SCIF_MEM_SIZE_A = 44u; + + public const uint SCIF_MEM_SIZE_R = 47u; + + public const uint SCIF_MEM_SIZE_F = 52u; + + public const uint SCIF_MEM_SIZE_TIMER = 45u; + + public const uint SCIF_MEM_SIZE_COUNTER = 46u; + + public const sbyte SCIF_CONNECT_STATE = 2; + + public const sbyte SCIF_REMOTE_IPLONG = 3; + + public const sbyte SCIF_CONNECT_STEP = 4; + + public const sbyte SCIF_CONNECT_RESPONSE = 5; + + public const sbyte SCIF_TALK_STATE = 6; + + public const sbyte SCIF_RESPONSE_TIME = 11; + + public const sbyte SCIF_OK_COUNT = 12; + + public const sbyte SCIF_CRC_ERR_CNT = 13; + + public const sbyte SCIF_LOOP_QUEUE_PKG_COUNT = 21; + + public const sbyte SCIF_DIRECT_QUEUE_PKG_COUNT = 22; + + public const sbyte SCIF_LOOP_COUNT = 23; + + public const sbyte SCIF_TX_PKG_CNT = 24; + + public const sbyte SCIF_TX_PKG_RETRY_CNT = 25; + + public const sbyte SCIF_TX_CONNECT_CNT = 26; + + public const sbyte SCIF_RX_UNEXPECT_CNT = 27; + + public const sbyte SCIF_RX_ERR_FMT_CNT = 28; + + public const sbyte SCIF_RX_CONNECT_CNT = 29; + + public const int SC_CONN_STATE_DISCONNECT = 0; + + public const int SC_CONN_STATE_CONNECTING = 1; + + public const int SC_CONN_STATE_FAIL = 2; + + public const int SC_CONN_STATE_OK = 3; + + public const int SC_CONN_STATE_NORESPONSE = 4; + + public const int CONNECT_RESULT_NORESPONSE = 0; + + public const int CONNECT_RESULT_OLD_SOFTWARE_CLEAR = 1; + + public const int CONNECT_RESULT_INVALID_SOFTWARE = 11; + + public const int CONNECT_RESULT_DISABLE_SOFTWARE = 12; + + public const int CONNECT_RESULT_DISABLE_INTERNET = 13; + + public const int CONNECT_RESULT_CLOSED_SOFTWARE = 14; + + public const int CONNECT_RESULT_CLOSED_INTERNET = 15; + + public const int CONNECT_RESULT_INVALID_MAKERID = 16; + + public const int CONNECT_RESULT_WAIT_CONFIRM = 21; + + public const int CONNECT_RESULT_SOFTWARE_CONNECTED = 31; + + public const int CONNECT_RESULT_SOFTWARE_REJECTED = 32; + + public const int CONNECT_RESULT_SOFTWARE_INREQ = 41; + + public const int CONNECT_RESULT_PENDING = 50; + + public const byte FTP_FOLDER_RUN_NCFILES = 1; + + public const byte FTP_FOLDER_RUN_DXF = 2; + + public const byte FTP_FOLDER_TEACH_RUN = 3; + + public const byte FTP_FOLDER_RECIPE_RUN = 4; + + public const byte FTP_FOLDER_WORKDATA_RUN = 5; + + public const byte FTP_FOLDER_NCFILES = 10; + + public const byte FTP_FOLDER_MACRO = 21; + + public const byte FTP_FOLDER_MACRO_MAKER = 20; + + public const byte FTP_FOLDER_OPEN_HMI = 24; + + public const byte FTP_FOLDER_NCFILES_ROOT = 25; + + public const byte FTP_FOLDER_MACRO_MAKER_ROOT = 26; + + public const byte FTP_FOLDER_MACRO_ROOT = 27; + + public const byte FTP_FOLDER_DXF = 28; + + public const byte FTP_FOLDER_OPEN_HMI_BOTTOM = 29; + + public const byte FTP_FOLDER_TEACH = 15; + + public const byte FTP_FOLDER_RECIPE = 16; + + public const byte FTP_FOLDER_WORKDATA = 17; + + public const byte FTP_FOLDER_MACHINE = 30; + + public const byte FTP_FOLDER_SETUP = 40; + + public const byte FTP_FOLDER_SETUP_MACHINE = 41; + + public const byte FTP_FOLDER_BAK = 50; + + public const byte FTP_FOLDER_DATA = 51; + + public const byte FTP_FOLDER_LANGUAGE = 52; + + public const byte FTP_FOLDER_LANGUAGE_DEF = 53; + + public const byte FTP_FOLDER_LOG = 54; + + public const byte FTP_FOLDER_RECORD = 55; + + public const byte FTP_STATE_IDLE = 0; + + public const byte FTP_STATE_UPLOAD = 1; + + public const byte FTP_STATE_DOWNLOAD = 2; + + public const byte FTP_STATE_DELETE = 3; + + public const byte FTP_STATE_LIST = 11; + + public const byte FTP_STATE_UPLOAD_MANY = 21; + + public const byte FTP_STATE_DOWNLOAD_MANY = 22; + + public const byte FTP_STATE_DELETE_MANY = 23; + + public const byte FTP_STATE_MAKE_DIR = 30; + + public const byte FTP_STATE_PENDING = 99; + + public const uint FTP_RESULT_IDLE = 0u; + + public const byte FTP_RESULT_PROCESSING = 1; + + public const byte FTP_RESULT_SUCCESS = 2; + + public const byte FTP_RESULT_FAIL_TO_READ_LOCAL_FILE = 11; + + public const byte FTP_RESULT_FAIL_TO_WRITE_LOCAL_FILE = 12; + + public const byte FTP_RESULT_FAIL_TO_READ_REMOTE_FILE = 13; + + public const byte FTP_RESULT_FAIL_TO_WRITE_REMOTE_FILE = 14; + + public const byte FTP_RESULT_FAIL_TO_SET_COMMAND = 15; + + public const byte FTP_RESULT_FAIL_TO_COMMUNICATION = 16; + + public const byte FTP_RESULT_FILE_MISMATCH = 17; + + public const uint TALK_STATE_NORMAL = 0u; + + public const uint TALK_STATE_ERROR = 1u; + + public const uint TALK_STATE_OVER_RETRY = 2u; + + public const sbyte SC_TRANSACTION_PENDING = 0; + + public const sbyte SC_TRANSACTION_PORCESSING = 1; + + public const sbyte SC_TRANSACTION_FINISH = 2; + + public const sbyte SC_TRANSACTION_INVALID = 3; + + public const uint SCIF_ERROR_INVALID_PACKET_SET = 255u; + + public const uint FILENAME_LENGTH = 32u; + + public const uint MAX_FILE_LIST_NUM = 240u; + + public const uint MAX_TRANSFER_FILE_COUNT = 128u; + + public const uint MAX_SOFTWARE_COUNT = 5u; + + public const uint ERROR_TYPE_NONE = 0u; + + public const uint ERROR_TYPE_POLLING = 1u; + + public const uint ERROR_TYPE_DIRECT = 2u; + + public const uint R_PATH_W_UPDATE = 17020u; + + public const uint R_PATH_R_START_LINE = 17021u; + + public const uint R_PATH_W_FILENAME = 17022u; + + public const sbyte SC_LOOP = 1; + + public const sbyte SC_DIRECT = 1; + + [DllImport("scif2_bcb.dll")] + public static extern int MainProcess(); + + [DllImport("scif2_bcb.dll")] + public static extern int LibraryInitial(ref DLL_USE_SETTING pUseSetting, int MakerID, string EncString); + + [DllImport("scif2_bcb.dll")] + public static extern void LibraryDestroy(); + + [DllImport("scif2_bcb.dll")] + public static extern void LibrarySetDebug(int level); + + [DllImport("scif2_bcb.dll")] + public static extern int GetLibraryMsg(int id); + + [DllImport("scif2_bcb.dll")] + public static extern int GetConnectionMsg(int TgrConn, int MsgID); + + [DllImport("scif2_bcb.dll")] + public static extern void GetConnectionError(int TgrConn, ref ERROR_MSG Msg); + + [DllImport("scif2_bcb.dll")] + public static extern int LocalDetectControllers(); + + [DllImport("scif2_bcb.dll")] + public static extern int LocalReadControllerCount(); + + [DllImport("scif2_bcb.dll")] + public static extern int LocalReadController(int Index, ref LOCAL_CONTROLLER_INFO Info); + + [DllImport("scif2_bcb.dll")] + public static extern int ConnectSetPwd(int TgrConn, string Pwd); + + [DllImport("scif2_bcb.dll")] + public static extern int ConnectLocalList(int TgrConn, int Index); + + [DllImport("scif2_bcb.dll")] + public static extern int ConnectLocalIP(int TgrConn, string IP); + + [DllImport("scif2_bcb.dll")] + public static extern int Disconnect(int TgrConn); + + [DllImport("scif2_bcb.dll")] + public static extern int FtpSetConnection(int TgrConn); + + [DllImport("scif2_bcb.dll")] + public static extern int FtpGetFileList(int Folder, string SubFolder, string HeadFilter, string TailFilter); + + [DllImport("scif2_bcb.dll")] + public static extern int FtpReadFileCount(); + + [DllImport("scif2_bcb.dll")] + public static extern int FtpReadFile(int Index, ref FTP_FILE file); + + [DllImport("scif2_bcb.dll")] + public static extern int FtpMakeDir(int Folder, string DirName); + + [DllImport("scif2_bcb.dll")] + public static extern int FtpUploadFile(int Folder, string SubFolder, string Filename, string LocalFilename); + + [DllImport("scif2_bcb.dll")] + public static extern int FtpDownloadFile(int Folder, string SubFolder, string Filename, string LocalFilename); + + [DllImport("scif2_bcb.dll")] + public static extern int FtpDeleteFile(int Folder, string SubFolder, string Filename); + + [DllImport("scif2_bcb.dll")] + public static extern int FtpTransferFileReset(); + + [DllImport("scif2_bcb.dll")] + public static extern int FtpTransferFileAdd(int Folder, string SubFolder, string Filename, string LocalFilename); + + [DllImport("scif2_bcb.dll")] + public static extern int FtpUploadFiles(); + + [DllImport("scif2_bcb.dll")] + public static extern int FtpDownloadFiles(); + + [DllImport("scif2_bcb.dll")] + public static extern int FtpDeleteFiles2(); + + [DllImport("scif2_bcb.dll")] + public static extern int FtpCheckDone(); + + [DllImport("scif2_bcb.dll")] + public static extern int FtpWaitDone(int MaxWaitTime); + + [DllImport("scif2_bcb.dll")] + public static extern int LocalGetFileList(string Path, string HeadFilter, string TailFilter); + + [DllImport("scif2_bcb.dll")] + public static extern int LocalReadFileCount(); + + [DllImport("scif2_bcb.dll")] + public static extern int LocalReadFile(int Index, ref FTP_FILE file); + + [DllImport("scif2_bcb.dll")] + public static extern int LocalDeleteFile(int Index); + + [DllImport("scif2_bcb.dll")] + public static extern int memI(int TgrConn, int addr); + + [DllImport("scif2_bcb.dll")] + public static extern int memO(int TgrConn, int addr); + + [DllImport("scif2_bcb.dll")] + public static extern int memC(int TgrConn, int addr); + + [DllImport("scif2_bcb.dll")] + public static extern int memS(int TgrConn, int addr); + + [DllImport("scif2_bcb.dll")] + public static extern int memA(int TgrConn, int addr); + + [DllImport("scif2_bcb.dll")] + public static extern int memR(int TgrConn, int addr); + + [DllImport("scif2_bcb.dll")] + public static extern int memRBit(int TgrConn, int addr, int BitIdx); + + [DllImport("scif2_bcb.dll")] + public static extern int memRString(int TgrConn, int addr, int RSize, byte[] Buf); + + [DllImport("scif2_bcb.dll")] + public static extern double memF(int TgrConn, int addr); + + [DllImport("scif2_bcb.dll")] + public static extern int memSetO(int TgrConn, int addr, char val); + + [DllImport("scif2_bcb.dll")] + public static extern int memSetC(int TgrConn, int addr, char val); + + [DllImport("scif2_bcb.dll")] + public static extern int memSetS(int TgrConn, int addr, char val); + + [DllImport("scif2_bcb.dll")] + public static extern int memSetA(int TgrConn, int addr, char val); + + [DllImport("scif2_bcb.dll")] + public static extern int memSetR(int TgrConn, int addr, int val); + + [DllImport("scif2_bcb.dll")] + public static extern int memSetRBit(int TgrConn, int addr, int BitIdx, int val); + + [DllImport("scif2_bcb.dll")] + public static extern int memSetRString(int TgrConn, int addr, int RSize, string Buf); + + [DllImport("scif2_bcb.dll")] + public static extern int memSetF(int TgrConn, int addr, double val); + + [DllImport("scif2_bcb.dll")] + public static extern int GetTranState(int pTran); + + [DllImport("scif2_bcb.dll")] + public static extern IntPtr GetDataPointer(int TranPointer); + + [DllImport("scif2_bcb.dll")] + public static extern void LClearQueue(int TgrConn); + + [DllImport("scif2_bcb.dll")] + public static extern void LReadBegin(int TgrConn); + + [DllImport("scif2_bcb.dll")] + public static extern int LReadNI(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int LReadNO(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int LReadNC(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int LReadNS(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int LReadNA(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int LReadNR(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int LReadNF(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int LReadEnd(int TgrConn); + + [DllImport("scif2_bcb.dll")] + public static extern void LWriteBegin(int TgrConn); + + [DllImport("scif2_bcb.dll")] + public static extern int LWriteNO(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int LWriteNC(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int LWriteNS(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int LWriteNA(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int LWriteNR(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int LWriteNF(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int LWriteEnd(int TgrConn); + + [DllImport("scif2_bcb.dll")] + public static extern void DClearQueue(int TgrConn); + + [DllImport("scif2_bcb.dll")] + public static extern int DWaitDone(int TgrConn, int MaxWaitTime); + + [DllImport("scif2_bcb.dll")] + public static extern void DReadBegin(int TgrConn); + + [DllImport("scif2_bcb.dll")] + public static extern int DReadNI(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int DReadNO(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int DReadNC(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int DReadNS(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int DReadNA(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int DReadNR(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int DReadNF(int TgrConn, int addr, int num); + + [DllImport("scif2_bcb.dll")] + public static extern int DReadEnd(int TgrConn); + + [DllImport("scif2_bcb.dll")] + public static extern void DWriteBegin(int TgrConn); + + [DllImport("scif2_bcb.dll")] + public static extern int DWrite1O(int TgrConn, int addr, int val); + + [DllImport("scif2_bcb.dll")] + public static extern int DWrite1C(int TgrConn, int addr, int val); + + [DllImport("scif2_bcb.dll")] + public static extern int DWrite1S(int TgrConn, int addr, int val); + + [DllImport("scif2_bcb.dll")] + public static extern int DWrite1A(int TgrConn, int addr, int val); + + [DllImport("scif2_bcb.dll")] + public static extern int DWrite1R(int TgrConn, int addr, int val); + + [DllImport("scif2_bcb.dll")] + public static extern int DWrite1F(int TgrConn, int addr, double val); + + [DllImport("scif2_bcb.dll")] + public static extern int DWrite1RBit(int TgrConn, int addr, int BitIdx, int BitValue); + + [DllImport("scif2_bcb.dll")] + public static extern int DWriteRString(int TgrConn, int addr, int BufSize, string Buf); + + [DllImport("scif2_bcb.dll")] + public static extern int DWriteNO(int TgrConn, int addr, int num, int[] data); + + [DllImport("scif2_bcb.dll")] + public static extern int DWriteNC(int TgrConn, int addr, int num, int[] data); + + [DllImport("scif2_bcb.dll")] + public static extern int DWriteNS(int TgrConn, int addr, int num, int[] data); + + [DllImport("scif2_bcb.dll")] + public static extern int DWriteNA(int TgrConn, int addr, int num, int[] data); + + [DllImport("scif2_bcb.dll")] + public static extern int DWriteNR(int TgrConn, int addr, int num, int[] data); + + [DllImport("scif2_bcb.dll")] + public static extern int DWriteNF(int TgrConn, int addr, int num, double[] data); + + [DllImport("scif2_bcb.dll")] + public static extern int DWriteEnd(int TgrConn); + } +} diff --git a/LabelPrint.sln b/LabelPrint.sln new file mode 100644 index 0000000..e9ca2de --- /dev/null +++ b/LabelPrint.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35527.113 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FalitPrint", "FalitPrint\FalitPrint.csproj", "{936BA54E-084E-4651-95A1-977C3AB86010}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {936BA54E-084E-4651-95A1-977C3AB86010}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {936BA54E-084E-4651-95A1-977C3AB86010}.Debug|Any CPU.Build.0 = Debug|Any CPU + {936BA54E-084E-4651-95A1-977C3AB86010}.Debug|x86.ActiveCfg = Debug|x86 + {936BA54E-084E-4651-95A1-977C3AB86010}.Debug|x86.Build.0 = Debug|x86 + {936BA54E-084E-4651-95A1-977C3AB86010}.Release|Any CPU.ActiveCfg = Release|Any CPU + {936BA54E-084E-4651-95A1-977C3AB86010}.Release|Any CPU.Build.0 = Release|Any CPU + {936BA54E-084E-4651-95A1-977C3AB86010}.Release|x86.ActiveCfg = Release|x86 + {936BA54E-084E-4651-95A1-977C3AB86010}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal