删除无用项

master
wanghaomei 2 years ago
parent 9bf24c2090
commit 6e8fdf1a19

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!-- 操作人员代码 -->
<add key="opid" value="d85fd590-d9f6-4410-93a1-f6fac77b606e"/>
<!-- 服务器url -->
<add key="serverUrl" value="http://192.168.0.80:8092"/>
<!--<add key="serverUrl" value="http://www.myshipping.net:8656"/>-->
<!-- 监控类型zhenhua振华qide启德qideMulti启德多文件夹方式 -->
<add key="watchType" value="qideMulti"/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
</configuration>

@ -1,60 +0,0 @@
using DSWeb.Common.Helper;
using log4net;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FileWatchCopy
{
public static class Common
{
public const long AppVersion = 20211008001;
public static string WatchType = ConfigurationManager.AppSettings["watchType"];
public static string ServerUrl = ConfigurationManager.AppSettings["serverUrl"];
private static ILog logger = LogManager.GetLogger("Common");
public static bool CheckVersion(out AppVersionCheckModel appVer)
{
logger.Debug($"检查版本,类型:{WatchType},当前版本:{AppVersion}");
bool hasNew = false;
try
{
if (!ServerUrl.EndsWith("/"))
{
ServerUrl += "/";
}
string rtn = WebRequestHelper.DoGet($"{ServerUrl}Common/CheckVersion?type={WatchType}");
var version = JsonConvert.DeserializeObject<AppVersionCheckModel>(rtn);
if (version.Version > AppVersion)
{
hasNew = true;
}
appVer = version;
logger.Error($"检查版本完成,最新版本:{appVer.Version}");
}
catch (Exception ex)
{
logger.Error($"检查版本出错:{ex.Message}");
appVer = null;
}
return hasNew;
}
}
public class AppVersionCheckModel
{
public long Version { get; set; }
public string Description { get; set; }
public string File { get; set; }
}
}

@ -1,246 +0,0 @@
namespace FileWatchCopy
{
partial class FMain
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FMain));
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnChooseDir = new System.Windows.Forms.Button();
this.tbWatch = new System.Windows.Forms.TextBox();
this.groupFtp = new System.Windows.Forms.GroupBox();
this.label4 = new System.Windows.Forms.Label();
this.txtUpDir = new System.Windows.Forms.TextBox();
this.txtPwd = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.txtUserName = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.txtFtpUrl = new System.Windows.Forms.TextBox();
this.btnRun = new System.Windows.Forms.Button();
this.btnStop = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.noti = new System.Windows.Forms.NotifyIcon(this.components);
this.groupBox1.SuspendLayout();
this.groupFtp.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.btnChooseDir);
this.groupBox1.Controls.Add(this.tbWatch);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(461, 64);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "监视目录";
//
// btnChooseDir
//
this.btnChooseDir.Location = new System.Drawing.Point(380, 18);
this.btnChooseDir.Name = "btnChooseDir";
this.btnChooseDir.Size = new System.Drawing.Size(75, 23);
this.btnChooseDir.TabIndex = 1;
this.btnChooseDir.Text = "选择目录";
this.btnChooseDir.UseVisualStyleBackColor = true;
this.btnChooseDir.Click += new System.EventHandler(this.btnChooseDir_Click);
//
// tbWatch
//
this.tbWatch.Location = new System.Drawing.Point(6, 20);
this.tbWatch.Name = "tbWatch";
this.tbWatch.ReadOnly = true;
this.tbWatch.Size = new System.Drawing.Size(368, 21);
this.tbWatch.TabIndex = 0;
//
// groupFtp
//
this.groupFtp.Controls.Add(this.label4);
this.groupFtp.Controls.Add(this.txtUpDir);
this.groupFtp.Controls.Add(this.txtPwd);
this.groupFtp.Controls.Add(this.label3);
this.groupFtp.Controls.Add(this.txtUserName);
this.groupFtp.Controls.Add(this.label2);
this.groupFtp.Controls.Add(this.label1);
this.groupFtp.Controls.Add(this.txtFtpUrl);
this.groupFtp.Location = new System.Drawing.Point(12, 82);
this.groupFtp.Name = "groupFtp";
this.groupFtp.Size = new System.Drawing.Size(461, 93);
this.groupFtp.TabIndex = 1;
this.groupFtp.TabStop = false;
this.groupFtp.Text = "FTP地址";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(224, 23);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(65, 12);
this.label4.TabIndex = 8;
this.label4.Text = "上传文件夹";
//
// txtUpDir
//
this.txtUpDir.Location = new System.Drawing.Point(292, 19);
this.txtUpDir.Name = "txtUpDir";
this.txtUpDir.Size = new System.Drawing.Size(155, 21);
this.txtUpDir.TabIndex = 7;
this.txtUpDir.Text = "/";
//
// txtPwd
//
this.txtPwd.Location = new System.Drawing.Point(292, 52);
this.txtPwd.Name = "txtPwd";
this.txtPwd.Size = new System.Drawing.Size(155, 21);
this.txtPwd.TabIndex = 6;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(224, 56);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(29, 12);
this.label3.TabIndex = 5;
this.label3.Text = "密码";
//
// txtUserName
//
this.txtUserName.Location = new System.Drawing.Point(71, 52);
this.txtUserName.Name = "txtUserName";
this.txtUserName.Size = new System.Drawing.Size(145, 21);
this.txtUserName.TabIndex = 4;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 56);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(41, 12);
this.label2.TabIndex = 3;
this.label2.Text = "用户名";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 23);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(59, 12);
this.label1.TabIndex = 2;
this.label1.Text = "FTP服务器";
//
// txtFtpUrl
//
this.txtFtpUrl.Location = new System.Drawing.Point(71, 19);
this.txtFtpUrl.Name = "txtFtpUrl";
this.txtFtpUrl.Size = new System.Drawing.Size(145, 21);
this.txtFtpUrl.TabIndex = 1;
//
// btnRun
//
this.btnRun.Location = new System.Drawing.Point(198, 196);
this.btnRun.Name = "btnRun";
this.btnRun.Size = new System.Drawing.Size(75, 23);
this.btnRun.TabIndex = 2;
this.btnRun.Text = "运行监视";
this.btnRun.UseVisualStyleBackColor = true;
this.btnRun.Click += new System.EventHandler(this.btnRun_Click);
//
// btnStop
//
this.btnStop.Location = new System.Drawing.Point(198, 196);
this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(75, 23);
this.btnStop.TabIndex = 4;
this.btnStop.Text = "停止监视";
this.btnStop.UseVisualStyleBackColor = true;
this.btnStop.Visible = false;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(360, 196);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 5;
this.button1.Text = "test";
this.button1.UseVisualStyleBackColor = true;
this.button1.Visible = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// noti
//
this.noti.Icon = ((System.Drawing.Icon)(resources.GetObject("noti.Icon")));
this.noti.Text = "大简云文件监视程序";
this.noti.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.noti_MouseDoubleClick);
//
// FMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(485, 231);
this.Controls.Add(this.button1);
this.Controls.Add(this.btnStop);
this.Controls.Add(this.btnRun);
this.Controls.Add(this.groupFtp);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "FMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "文件监视";
this.Load += new System.EventHandler(this.FMain_Load);
this.SizeChanged += new System.EventHandler(this.FMain_SizeChanged);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupFtp.ResumeLayout(false);
this.groupFtp.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox tbWatch;
private System.Windows.Forms.Button btnChooseDir;
private System.Windows.Forms.GroupBox groupFtp;
private System.Windows.Forms.Button btnRun;
private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.NotifyIcon noti;
private System.Windows.Forms.TextBox txtFtpUrl;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtPwd;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtUserName;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox txtUpDir;
}
}

@ -1,293 +0,0 @@
using DSWeb.Common.Helper;
using FluentFTP;
using log4net;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FileWatchCopy
{
public partial class FMain : Form
{
private ILog logger = LogManager.GetLogger("FMain");
private static string CfgFile = Path.Combine(Application.StartupPath, "settings.cfg");
private static string OpId = ConfigurationManager.AppSettings["opid"];
private static string ServerUrl = ConfigurationManager.AppSettings["serverUrl"];
private FileSystemWatcher watcher;
public FMain()
{
InitializeComponent();
}
private void FMain_Load(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(ServerUrl))
{
MessageBox.Show("服务器配置有误,请联系客服人员处理");
this.Close();
}
else
{
if (!ServerUrl.EndsWith("/"))
{
ServerUrl += "/";
}
}
if (string.IsNullOrEmpty(OpId))
{
MessageBox.Show("操作人员代码未配置,请联系客服人员处理");
this.Close();
}
if (File.Exists(CfgFile))
{
JObject jobj = JObject.Parse(File.ReadAllText(CfgFile));
if (jobj.ContainsKey("watchDir"))
{
tbWatch.Text = jobj.GetValue("watchDir").ToString();
}
if (jobj.ContainsKey("ftpUrl"))
{
txtFtpUrl.Text = jobj.GetValue("ftpUrl").ToString();
}
if (jobj.ContainsKey("upDir"))
{
txtUpDir.Text = jobj.GetValue("upDir").ToString();
}
if (jobj.ContainsKey("ftpUser"))
{
txtUserName.Text = jobj.GetValue("ftpUser").ToString();
}
if (jobj.ContainsKey("ftpPwd"))
{
txtPwd.Text = jobj.GetValue("ftpPwd").ToString();
}
btnRun_Click(sender, e);
}
txtFtpUrl.LostFocus += TxtFtp_LostFocus;
txtUpDir.LostFocus += TxtFtp_LostFocus;
txtUserName.LostFocus += TxtFtp_LostFocus;
txtPwd.LostFocus += TxtFtp_LostFocus;
}
//ftp相关文本框修改
private void TxtFtp_LostFocus(object sender, EventArgs e)
{
JObject jobj = null;
if (File.Exists(CfgFile))
{
jobj = JObject.Parse(File.ReadAllText(CfgFile));
}
else
{
jobj = new JObject();
}
var key = "";
if (sender == txtFtpUrl)
{
key = "ftpUrl";
}
else if (sender == txtUpDir)
{
key = "upDir";
if (!txtUpDir.Text.Trim().EndsWith("/"))
{
txtUpDir.Text = txtUpDir.Text.Trim() + "/";
}
}
else if (sender == txtUserName)
{
key = "ftpUser";
}
else if (sender == txtPwd)
{
key = "ftpPwd";
}
if (jobj.ContainsKey(key))
{
jobj[key] = ((TextBox)sender).Text.Trim();
}
else
{
jobj.Add(key, ((TextBox)sender).Text.Trim());
}
File.WriteAllText(CfgFile, JsonConvert.SerializeObject(jobj));
}
//选择监视目录
private void btnChooseDir_Click(object sender, EventArgs e)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
if (fbd.ShowDialog() == DialogResult.OK)
{
JObject jobj = null;
if (File.Exists(CfgFile))
{
jobj = JObject.Parse(File.ReadAllText(CfgFile));
jobj["watchDir"] = new JValue(fbd.SelectedPath);
}
else
{
jobj = new JObject();
jobj.Add("watchDir", new JValue(fbd.SelectedPath));
}
File.WriteAllText(CfgFile, JsonConvert.SerializeObject(jobj));
tbWatch.Text = fbd.SelectedPath;
}
}
//运行、停止监视
private void btnRun_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(tbWatch.Text)
&& !string.IsNullOrEmpty(txtFtpUrl.Text)
&& !string.IsNullOrEmpty(txtUserName.Text)
&& !string.IsNullOrEmpty(txtPwd.Text))
{
watcher = new FileSystemWatcher(tbWatch.Text, "*.txt");
watcher.EnableRaisingEvents = true;
watcher.Created += Watcher_Created;
//watcher.Changed += Watcher_Changed;
btnRun.Visible = false;
btnStop.Visible = true;
groupFtp.Enabled = false;
}
else
{
MessageBox.Show("请先选择监视目录和FTP相关参数");
}
}
private void Watcher_Changed(object sender, FileSystemEventArgs e)
{
}
private void Watcher_Created(object sender, FileSystemEventArgs e)
{
logger.Debug($"发现新文件:{e.FullPath}");
var fileName = Path.GetFileNameWithoutExtension(e.FullPath);
if (Regex.IsMatch(fileName, "^[A-Z0-9_]{20,200}$"))
{
logger.Debug($"准备解析上传:{e.FullPath}");
//File.Copy(e.FullPath, Path.Combine(tbCopyTo.Text, Path.GetFileName(e.FullPath)), true);
//发送到ftp
try
{
FtpClient ftpClient = new FtpClient(txtFtpUrl.Text.Trim(), new NetworkCredential(txtUserName.Text.Trim(), txtPwd.Text.Trim()));
ftpClient.Connect();
ftpClient.UploadFile(e.FullPath, txtUpDir.Text.Trim() + Path.GetFileName(e.FullPath), createRemoteDir: true);
ftpClient.Disconnect();
}
catch (Exception ex)
{
var exp = ex;
while (exp != null)
{
logger.Error(exp.Message);
logger.Error(exp.StackTrace);
exp = exp.InnerException;
}
MessageBox.Show($"FTP上传失败{ex.Message}");
}
//解析上传数据
var rtn = ParseInttraHelper.ParseFile(e.FullPath);
logger.Debug($"解析文件完成:{e.FullPath}{rtn.Success}");
if (rtn.Success)
{
logger.Debug($"解析结果:{JsonConvert.SerializeObject(rtn.TransferModel)}");
var upDataUrl = $"{ServerUrl}Booking/ReceiveSoSiBooking";
try
{
WebRequestHelper.DoPost(upDataUrl, JsonConvert.SerializeObject(new { op = OpId, data = rtn.TransferModel }));
logger.Debug($"上传数据到服务器成功:{upDataUrl}");
}
catch (Exception ex)
{
logger.Error($"上传数据到服务器出错");
logger.Error(ex.Message);
logger.Error(ex.StackTrace);
MessageBox.Show($"业务数据上传({upDataUrl})失败:{ex.Message}");
}
}
else
{
logger.Error($"解析失败:{rtn.Message}");
}
}
}
//停止
private void btnStop_Click(object sender, EventArgs e)
{
watcher.EnableRaisingEvents = false;
watcher.Dispose();
watcher = null;
btnRun.Visible = true;
btnStop.Visible = false;
groupFtp.Enabled = true;
}
private void button1_Click(object sender, EventArgs e)
{
//var rtn = MaskEdiAnalyzeTool.ImportMCSEdiList(Path.Combine(@"D:\whm\振华对接", "XIN_OU_ZHOU0HC8ZE1MA21042010025100.TXT"));
var rtn = ParseInttraHelper.ParseFile(Path.Combine(@"D:\whm\振华对接", "XIN_OU_ZHOU0HC8ZE1MA21042009561100.TXT"));
//var rtn = ParseInttraHelper.ParseFile(Path.Combine(@"D:\whm\振华对接", "XIN_OU_ZHOU0HC8ZE1MA21042010025100.TXT"));
}
//双击还原
private void noti_MouseDoubleClick(object sender, MouseEventArgs e)
{
noti.Visible = false;
ShowInTaskbar = true;
WindowState = FormWindowState.Normal;
Activate();
}
//最小化系统托盘
private void FMain_SizeChanged(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Minimized)
{
noti.Visible = true;
ShowInTaskbar = false;
}
}
}
}

File diff suppressed because it is too large Load Diff

@ -1,181 +0,0 @@
namespace FileWatchCopy
{
partial class FQiDe
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FQiDe));
this.groupSO = new System.Windows.Forms.GroupBox();
this.btnDirSO = new System.Windows.Forms.Button();
this.tbWatchSO = new System.Windows.Forms.TextBox();
this.btnRun = new System.Windows.Forms.Button();
this.btnStop = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.noti = new System.Windows.Forms.NotifyIcon(this.components);
this.groupSI = new System.Windows.Forms.GroupBox();
this.btnDirSI = new System.Windows.Forms.Button();
this.tbWatchSI = new System.Windows.Forms.TextBox();
this.groupSO.SuspendLayout();
this.groupSI.SuspendLayout();
this.SuspendLayout();
//
// groupSO
//
this.groupSO.Controls.Add(this.btnDirSO);
this.groupSO.Controls.Add(this.tbWatchSO);
this.groupSO.Location = new System.Drawing.Point(12, 12);
this.groupSO.Name = "groupSO";
this.groupSO.Size = new System.Drawing.Size(461, 64);
this.groupSO.TabIndex = 0;
this.groupSO.TabStop = false;
this.groupSO.Text = "SO目录";
//
// btnDirSO
//
this.btnDirSO.Location = new System.Drawing.Point(380, 18);
this.btnDirSO.Name = "btnDirSO";
this.btnDirSO.Size = new System.Drawing.Size(75, 23);
this.btnDirSO.TabIndex = 1;
this.btnDirSO.Text = "选择目录";
this.btnDirSO.UseVisualStyleBackColor = true;
this.btnDirSO.Click += new System.EventHandler(this.btnDirSO_Click);
//
// tbWatchSO
//
this.tbWatchSO.Location = new System.Drawing.Point(6, 20);
this.tbWatchSO.Name = "tbWatchSO";
this.tbWatchSO.ReadOnly = true;
this.tbWatchSO.Size = new System.Drawing.Size(368, 21);
this.tbWatchSO.TabIndex = 0;
//
// btnRun
//
this.btnRun.Location = new System.Drawing.Point(198, 196);
this.btnRun.Name = "btnRun";
this.btnRun.Size = new System.Drawing.Size(75, 23);
this.btnRun.TabIndex = 2;
this.btnRun.Text = "运行监视";
this.btnRun.UseVisualStyleBackColor = true;
this.btnRun.Click += new System.EventHandler(this.btnRun_Click);
//
// btnStop
//
this.btnStop.Location = new System.Drawing.Point(198, 196);
this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(75, 23);
this.btnStop.TabIndex = 4;
this.btnStop.Text = "停止监视";
this.btnStop.UseVisualStyleBackColor = true;
this.btnStop.Visible = false;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(360, 196);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 5;
this.button1.Text = "test";
this.button1.UseVisualStyleBackColor = true;
this.button1.Visible = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// noti
//
this.noti.Icon = ((System.Drawing.Icon)(resources.GetObject("noti.Icon")));
this.noti.Text = "大简云文件监视程序";
this.noti.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.noti_MouseDoubleClick);
//
// groupSI
//
this.groupSI.Controls.Add(this.btnDirSI);
this.groupSI.Controls.Add(this.tbWatchSI);
this.groupSI.Location = new System.Drawing.Point(12, 83);
this.groupSI.Name = "groupSI";
this.groupSI.Size = new System.Drawing.Size(461, 64);
this.groupSI.TabIndex = 6;
this.groupSI.TabStop = false;
this.groupSI.Text = "SI目录";
//
// btnDirSI
//
this.btnDirSI.Location = new System.Drawing.Point(380, 18);
this.btnDirSI.Name = "btnDirSI";
this.btnDirSI.Size = new System.Drawing.Size(75, 23);
this.btnDirSI.TabIndex = 1;
this.btnDirSI.Text = "选择目录";
this.btnDirSI.UseVisualStyleBackColor = true;
this.btnDirSI.Click += new System.EventHandler(this.btnDirSI_Click);
//
// tbWatchSI
//
this.tbWatchSI.Location = new System.Drawing.Point(6, 20);
this.tbWatchSI.Name = "tbWatchSI";
this.tbWatchSI.ReadOnly = true;
this.tbWatchSI.Size = new System.Drawing.Size(368, 21);
this.tbWatchSI.TabIndex = 0;
//
// FQiDe
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(485, 231);
this.Controls.Add(this.groupSI);
this.Controls.Add(this.button1);
this.Controls.Add(this.btnStop);
this.Controls.Add(this.btnRun);
this.Controls.Add(this.groupSO);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "FQiDe";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "文件监视(启德)";
this.Load += new System.EventHandler(this.FMain_Load);
this.SizeChanged += new System.EventHandler(this.FMain_SizeChanged);
this.groupSO.ResumeLayout(false);
this.groupSO.PerformLayout();
this.groupSI.ResumeLayout(false);
this.groupSI.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupSO;
private System.Windows.Forms.TextBox tbWatchSO;
private System.Windows.Forms.Button btnDirSO;
private System.Windows.Forms.Button btnRun;
private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.NotifyIcon noti;
private System.Windows.Forms.GroupBox groupSI;
private System.Windows.Forms.Button btnDirSI;
private System.Windows.Forms.TextBox tbWatchSI;
}
}

@ -1,249 +0,0 @@
using DSWeb.Common.Helper;
using FluentFTP;
using log4net;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FileWatchCopy
{
public partial class FQiDe : Form
{
private ILog logger = LogManager.GetLogger("FQiDe");
private static string CfgFile = Path.Combine(Application.StartupPath, "qide.cfg");
private static string OpId = ConfigurationManager.AppSettings["opid"];
private static string ServerUrl = ConfigurationManager.AppSettings["serverUrl"];
private FileSystemWatcher watcherSO;
private FileSystemWatcher watcherSI;
public FQiDe()
{
InitializeComponent();
}
private void FMain_Load(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(ServerUrl))
{
MessageBox.Show("服务器配置有误,请联系客服人员处理");
this.Close();
}
else
{
if (!ServerUrl.EndsWith("/"))
{
ServerUrl += "/";
}
}
if (string.IsNullOrEmpty(OpId))
{
MessageBox.Show("操作人员代码未配置,请联系客服人员处理");
this.Close();
}
if (File.Exists(CfgFile))
{
JObject jobj = JObject.Parse(File.ReadAllText(CfgFile));
if (jobj.ContainsKey("soDir"))
{
tbWatchSO.Text = jobj.GetValue("soDir").ToString();
}
if (jobj.ContainsKey("siDir"))
{
tbWatchSI.Text = jobj.GetValue("siDir").ToString();
}
btnRun_Click(sender, e);
}
}
//选择监视目录SO
private void btnDirSO_Click(object sender, EventArgs e)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
if (fbd.ShowDialog() == DialogResult.OK)
{
JObject jobj = null;
if (File.Exists(CfgFile))
{
jobj = JObject.Parse(File.ReadAllText(CfgFile));
jobj["soDir"] = new JValue(fbd.SelectedPath);
}
else
{
jobj = new JObject();
jobj.Add("soDir", new JValue(fbd.SelectedPath));
}
File.WriteAllText(CfgFile, JsonConvert.SerializeObject(jobj));
tbWatchSO.Text = fbd.SelectedPath;
}
}
//选择监视目录SI
private void btnDirSI_Click(object sender, EventArgs e)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
if (fbd.ShowDialog() == DialogResult.OK)
{
JObject jobj = null;
if (File.Exists(CfgFile))
{
jobj = JObject.Parse(File.ReadAllText(CfgFile));
jobj["siDir"] = new JValue(fbd.SelectedPath);
}
else
{
jobj = new JObject();
jobj.Add("siDir", new JValue(fbd.SelectedPath));
}
File.WriteAllText(CfgFile, JsonConvert.SerializeObject(jobj));
tbWatchSI.Text = fbd.SelectedPath;
}
}
//运行、停止监视
private void btnRun_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(tbWatchSO.Text)
&& !string.IsNullOrEmpty(tbWatchSI.Text))
{
var dirToday = $"{DateTime.Today.Year}\\{DateTime.Today.Month.ToString("00")}\\{DateTime.Today.Day}";
var fullDirSO = Path.Combine(tbWatchSO.Text, dirToday);
if (!Directory.Exists(fullDirSO))
{
Directory.CreateDirectory(fullDirSO);
}
watcherSO = new FileSystemWatcher(fullDirSO, "*.txt");
watcherSO.EnableRaisingEvents = true;
watcherSO.Created += Watcher_Created;
var fullDirSI = Path.Combine(tbWatchSI.Text, dirToday);
if (!Directory.Exists(fullDirSI))
{
Directory.CreateDirectory(fullDirSI);
}
watcherSI = new FileSystemWatcher(fullDirSI, "*.txt");
watcherSI.EnableRaisingEvents = true;
watcherSI.Created += Watcher_Created;
btnRun.Visible = false;
btnStop.Visible = true;
groupSO.Enabled = false;
groupSI.Enabled = false;
}
else
{
MessageBox.Show("请先选择SO、SI监视目录");
}
}
private void Watcher_Changed(object sender, FileSystemEventArgs e)
{
}
private void Watcher_Created(object sender, FileSystemEventArgs e)
{
logger.Debug($"发现新文件:{e.FullPath}");
var fileName = Path.GetFileNameWithoutExtension(e.FullPath);
if (Regex.IsMatch(fileName, "^[A-Z0-9_]{20,200}$"))
{
logger.Debug($"准备解析上传:{e.FullPath}");
//解析上传数据
var rtn = ParseInttraHelper.ParseFile(e.FullPath);
logger.Debug($"解析文件完成:{e.FullPath}{rtn.Success}");
if (rtn.Success)
{
logger.Debug($"解析结果:{JsonConvert.SerializeObject(rtn.TransferModel)}");
var upDataUrl = $"{ServerUrl}Booking/ReceiveSoSiBooking";
try
{
WebRequestHelper.DoPost(upDataUrl, JsonConvert.SerializeObject(new { op = OpId, data = rtn.TransferModel }));
logger.Debug($"上传数据到服务器成功:{upDataUrl}");
}
catch (Exception ex)
{
logger.Error($"上传数据到服务器出错");
logger.Error(ex.Message);
logger.Error(ex.StackTrace);
MessageBox.Show($"业务数据上传({upDataUrl})失败:{ex.Message}");
}
}
else
{
logger.Error($"解析失败:{rtn.Message}");
}
}
}
//停止
private void btnStop_Click(object sender, EventArgs e)
{
watcherSO.EnableRaisingEvents = false;
watcherSO.Dispose();
watcherSO = null;
watcherSI.EnableRaisingEvents = false;
watcherSI.Dispose();
watcherSI = null;
btnRun.Visible = true;
btnStop.Visible = false;
groupSO.Enabled = true;
groupSI.Enabled = true;
}
private void button1_Click(object sender, EventArgs e)
{
//var rtn = MaskEdiAnalyzeTool.ImportMCSEdiList(Path.Combine(@"D:\whm\振华对接", "XIN_OU_ZHOU0HC8ZE1MA21042010025100.TXT"));
var rtn = ParseInttraHelper.ParseFile(Path.Combine(@"D:\whm\振华对接", "XIN_OU_ZHOU0HC8ZE1MA21042009561100.TXT"));
//var rtn = ParseInttraHelper.ParseFile(Path.Combine(@"D:\whm\振华对接", "XIN_OU_ZHOU0HC8ZE1MA21042010025100.TXT"));
}
//双击还原
private void noti_MouseDoubleClick(object sender, MouseEventArgs e)
{
noti.Visible = false;
ShowInTaskbar = true;
WindowState = FormWindowState.Normal;
Activate();
}
//最小化系统托盘
private void FMain_SizeChanged(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Minimized)
{
noti.Visible = true;
ShowInTaskbar = false;
}
}
}
}

File diff suppressed because it is too large Load Diff

@ -1,167 +0,0 @@
namespace FileWatchCopy
{
partial class FQiDeMultiFolder
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FQiDeMultiFolder));
this.button1 = new System.Windows.Forms.Button();
this.btnStop = new System.Windows.Forms.Button();
this.btnRun = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnChooseDir = new System.Windows.Forms.Button();
this.tbWatch = new System.Windows.Forms.TextBox();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.tslbVersion = new System.Windows.Forms.ToolStripStatusLabel();
this.noti = new System.Windows.Forms.NotifyIcon(this.components);
this.groupBox1.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(345, 89);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 9;
this.button1.Text = "test";
this.button1.UseVisualStyleBackColor = true;
this.button1.Visible = false;
//
// btnStop
//
this.btnStop.Location = new System.Drawing.Point(183, 89);
this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(75, 23);
this.btnStop.TabIndex = 8;
this.btnStop.Text = "停止监视";
this.btnStop.UseVisualStyleBackColor = true;
this.btnStop.Visible = false;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
//
// btnRun
//
this.btnRun.Location = new System.Drawing.Point(183, 89);
this.btnRun.Name = "btnRun";
this.btnRun.Size = new System.Drawing.Size(75, 23);
this.btnRun.TabIndex = 7;
this.btnRun.Text = "运行监视";
this.btnRun.UseVisualStyleBackColor = true;
this.btnRun.Click += new System.EventHandler(this.btnRun_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.btnChooseDir);
this.groupBox1.Controls.Add(this.tbWatch);
this.groupBox1.Location = new System.Drawing.Point(8, 10);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(461, 64);
this.groupBox1.TabIndex = 6;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "监视目录";
//
// btnChooseDir
//
this.btnChooseDir.Location = new System.Drawing.Point(380, 18);
this.btnChooseDir.Name = "btnChooseDir";
this.btnChooseDir.Size = new System.Drawing.Size(75, 23);
this.btnChooseDir.TabIndex = 1;
this.btnChooseDir.Text = "选择目录";
this.btnChooseDir.UseVisualStyleBackColor = true;
this.btnChooseDir.Click += new System.EventHandler(this.btnChooseDir_Click);
//
// tbWatch
//
this.tbWatch.Location = new System.Drawing.Point(6, 20);
this.tbWatch.Name = "tbWatch";
this.tbWatch.ReadOnly = true;
this.tbWatch.Size = new System.Drawing.Size(368, 21);
this.tbWatch.TabIndex = 0;
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tslbVersion});
this.statusStrip1.Location = new System.Drawing.Point(0, 129);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(479, 22);
this.statusStrip1.TabIndex = 10;
this.statusStrip1.Text = "statusStrip1";
//
// tslbVersion
//
this.tslbVersion.Name = "tslbVersion";
this.tslbVersion.Size = new System.Drawing.Size(464, 17);
this.tslbVersion.Spring = true;
this.tslbVersion.Text = "123123";
this.tslbVersion.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// noti
//
this.noti.Icon = ((System.Drawing.Icon)(resources.GetObject("noti.Icon")));
this.noti.Text = "大简云文件监视程序";
this.noti.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.noti_MouseDoubleClick);
//
// FQiDeMultiFolder
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(479, 151);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.button1);
this.Controls.Add(this.btnStop);
this.Controls.Add(this.btnRun);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "FQiDeMultiFolder";
this.Text = "SO、SI报文监控启德多文件夹";
this.Load += new System.EventHandler(this.FQiDeMultiFolder_Load);
this.SizeChanged += new System.EventHandler(this.FQiDeMultiFolder_SizeChanged);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.Button btnRun;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button btnChooseDir;
private System.Windows.Forms.TextBox tbWatch;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel tslbVersion;
private System.Windows.Forms.NotifyIcon noti;
}
}

@ -1,253 +0,0 @@
using DSWeb.Common.Helper;
using log4net;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FileWatchCopy
{
public partial class FQiDeMultiFolder : Form
{
private ILog logger = LogManager.GetLogger("FQiDeMultiFolder");
private static string CfgFile = Path.Combine(Application.StartupPath, "qideMulti.cfg");
private static string ServerUrl = ConfigurationManager.AppSettings["serverUrl"];
private List<FileSystemWatcher> watchers = new List<FileSystemWatcher>();
public FQiDeMultiFolder()
{
InitializeComponent();
}
private void FQiDeMultiFolder_Load(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(ServerUrl))
{
MessageBox.Show("服务器配置有误,请联系客服人员处理");
this.Close();
}
else
{
if (!ServerUrl.EndsWith("/"))
{
ServerUrl += "/";
}
}
if (File.Exists(CfgFile))
{
JObject jobj = JObject.Parse(File.ReadAllText(CfgFile));
if (jobj.ContainsKey("watchDir"))
{
tbWatch.Text = jobj.GetValue("watchDir").ToString();
}
btnRun_Click(sender, e);
}
tslbVersion.Visible = false;
}
//选择监视目录
private void btnChooseDir_Click(object sender, EventArgs e)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
if (fbd.ShowDialog() == DialogResult.OK)
{
JObject jobj = null;
if (File.Exists(CfgFile))
{
jobj = JObject.Parse(File.ReadAllText(CfgFile));
jobj["watchDir"] = new JValue(fbd.SelectedPath);
}
else
{
jobj = new JObject();
jobj.Add("watchDir", new JValue(fbd.SelectedPath));
}
File.WriteAllText(CfgFile, JsonConvert.SerializeObject(jobj));
tbWatch.Text = fbd.SelectedPath;
}
}
//运行、停止监视
private void btnRun_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(tbWatch.Text))
{
//先清除
watchers.ForEach(x => x.EnableRaisingEvents = false);
watchers.Clear();
//遍历文件夹,每个文件夹为一个公司
var dirCompanies = Directory.GetDirectories(tbWatch.Text);
foreach (var dir in dirCompanies)
{
var soDir = Path.Combine(dir, "CMA\\SO");
var siDir = Path.Combine(dir, "CMA\\SI");
var listDir = new List<string>();
if (Directory.Exists(soDir))
{
listDir.Add(soDir);
}
if (Directory.Exists(siDir))
{
listDir.Add(siDir);
}
foreach (var dd in listDir)
{
//启动时,立即处理文件夹中存在的报文
var files = Directory.GetFiles(dd);
if (files.Length > 0)
{
foreach (var ff in files)
{
StartProcessSoSi(ff);
}
}
var watcher = new FileSystemWatcher(dd);
watcher.EnableRaisingEvents = true;
watcher.Created += Watcher_Created;
watchers.Add(watcher);
}
}
btnRun.Visible = false;
btnStop.Visible = true;
}
else
{
MessageBox.Show("请先选择监视目录");
}
}
private void Watcher_Created(object sender, FileSystemEventArgs e)
{
logger.Debug($"发现新文件:{e.FullPath}");
StartProcessSoSi(e.FullPath);
}
//停止
private void btnStop_Click(object sender, EventArgs e)
{
watchers.ForEach(x => x.EnableRaisingEvents = false);
watchers.Clear();
btnRun.Visible = true;
btnStop.Visible = false;
}
//双击还原
private void noti_MouseDoubleClick(object sender, MouseEventArgs e)
{
noti.Visible = false;
ShowInTaskbar = true;
WindowState = FormWindowState.Normal;
Activate();
}
//最小化系统托盘
private void FQiDeMultiFolder_SizeChanged(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Minimized)
{
noti.Visible = true;
ShowInTaskbar = false;
}
}
//开启后台任务处理解析sosi报文
private void StartProcessSoSi(string fileFullPath)
{
Task.Run(() =>
{
var fileExt = Path.GetExtension(fileFullPath).ToLower();
var fileNameNoExt = Path.GetFileNameWithoutExtension(fileFullPath);
var fileName = Path.GetFileName(fileFullPath);
if (fileExt == ".txt" && Regex.IsMatch(fileNameNoExt, "^[=\\w.\\s\\u007f]{20,}\\[[\\w-]{36}\\]$"))
{
logger.Debug($"准备解析报文文件:{fileFullPath}");
Thread.Sleep(1000); //立即解析会报错文件被占用等待1S再处理
var opid = string.Empty;
var mch = Regex.Match(fileName, "\\[{1}[\\w0-9-]{36}]{1}");
if (mch.Success)
{
opid = mch.Value.Substring(1, mch.Value.Length - 2);
}
else
{
logger.Error($"从文件名中提取操作ID失败{fileFullPath}");
return;
}
//解析上传数据
var rtn = ParseInttraHelper.ParseFile(fileFullPath);
logger.Debug($"解析文件完成:{fileFullPath}{rtn.Success}");
if (rtn.Success)
{
logger.Debug($"解析结果:{JsonConvert.SerializeObject(rtn.TransferModel)}");
var upDataUrl = $"{ServerUrl}Booking/ReceiveSoSiBooking";
try
{
var resp = WebRequestHelper.DoPost(upDataUrl, JsonConvert.SerializeObject(new { op = opid, data = rtn.TransferModel }), timeout: 20000);
logger.Debug($"上传数据到服务器 {upDataUrl},返回:{resp}");
}
catch (Exception ex)
{
logger.Error($"上传数据到服务器出错");
logger.Error(ex.Message);
logger.Error(ex.StackTrace);
MessageBox.Show($"业务数据上传({upDataUrl})失败:{ex.Message}");
}
}
else
{
logger.Error($"解析失败:{rtn.Message}");
}
//移动文件到备份文件夹
var dirName = Path.GetDirectoryName(fileFullPath);
var dirBackup = Path.Combine(dirName, "backup");
if (!Directory.Exists(dirBackup))
{
Directory.CreateDirectory(dirBackup);
}
File.Move(fileFullPath, Path.Combine(dirBackup, fileName));
}
else
{
logger.Error($"文件名不符合解析规则,忽略:{fileFullPath}");
}
});
}
}
}

File diff suppressed because it is too large Load Diff

@ -1,169 +0,0 @@
namespace FileWatchCopy
{
partial class FQiDeNew
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FQiDeNew));
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnChooseDir = new System.Windows.Forms.Button();
this.tbWatch = new System.Windows.Forms.TextBox();
this.btnRun = new System.Windows.Forms.Button();
this.btnStop = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.noti = new System.Windows.Forms.NotifyIcon(this.components);
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.tslbVersion = new System.Windows.Forms.ToolStripStatusLabel();
this.groupBox1.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.btnChooseDir);
this.groupBox1.Controls.Add(this.tbWatch);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(461, 64);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "监视目录";
//
// btnChooseDir
//
this.btnChooseDir.Location = new System.Drawing.Point(380, 18);
this.btnChooseDir.Name = "btnChooseDir";
this.btnChooseDir.Size = new System.Drawing.Size(75, 23);
this.btnChooseDir.TabIndex = 1;
this.btnChooseDir.Text = "选择目录";
this.btnChooseDir.UseVisualStyleBackColor = true;
this.btnChooseDir.Click += new System.EventHandler(this.btnChooseDir_Click);
//
// tbWatch
//
this.tbWatch.Location = new System.Drawing.Point(6, 20);
this.tbWatch.Name = "tbWatch";
this.tbWatch.ReadOnly = true;
this.tbWatch.Size = new System.Drawing.Size(368, 21);
this.tbWatch.TabIndex = 0;
//
// btnRun
//
this.btnRun.Location = new System.Drawing.Point(187, 91);
this.btnRun.Name = "btnRun";
this.btnRun.Size = new System.Drawing.Size(75, 23);
this.btnRun.TabIndex = 2;
this.btnRun.Text = "运行监视";
this.btnRun.UseVisualStyleBackColor = true;
this.btnRun.Click += new System.EventHandler(this.btnRun_Click);
//
// btnStop
//
this.btnStop.Location = new System.Drawing.Point(187, 91);
this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(75, 23);
this.btnStop.TabIndex = 4;
this.btnStop.Text = "停止监视";
this.btnStop.UseVisualStyleBackColor = true;
this.btnStop.Visible = false;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(349, 91);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 5;
this.button1.Text = "test";
this.button1.UseVisualStyleBackColor = true;
this.button1.Visible = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// noti
//
this.noti.Icon = ((System.Drawing.Icon)(resources.GetObject("noti.Icon")));
this.noti.Text = "大简云文件监视程序";
this.noti.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.noti_MouseDoubleClick);
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tslbVersion});
this.statusStrip1.Location = new System.Drawing.Point(0, 124);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(485, 22);
this.statusStrip1.TabIndex = 6;
this.statusStrip1.Text = "statusStrip1";
//
// tslbVersion
//
this.tslbVersion.Name = "tslbVersion";
this.tslbVersion.Size = new System.Drawing.Size(439, 17);
this.tslbVersion.Spring = true;
this.tslbVersion.Text = "123123";
this.tslbVersion.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// FQiDeNew
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(485, 146);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.button1);
this.Controls.Add(this.btnStop);
this.Controls.Add(this.btnRun);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "FQiDeNew";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "文件监视(启德)";
this.Load += new System.EventHandler(this.FMain_Load);
this.SizeChanged += new System.EventHandler(this.FMain_SizeChanged);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox tbWatch;
private System.Windows.Forms.Button btnChooseDir;
private System.Windows.Forms.Button btnRun;
private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.NotifyIcon noti;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel tslbVersion;
}
}

@ -1,198 +0,0 @@
using DSWeb.Common.Helper;
using FluentFTP;
using log4net;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FileWatchCopy
{
public partial class FQiDeNew : Form
{
private ILog logger = LogManager.GetLogger("FMain");
private static string CfgFile = Path.Combine(Application.StartupPath, "qide_n.cfg");
private static string OpId = ConfigurationManager.AppSettings["opid"];
private static string ServerUrl = ConfigurationManager.AppSettings["serverUrl"];
private FileSystemWatcher watcher;
public FQiDeNew()
{
InitializeComponent();
}
private void FMain_Load(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(ServerUrl))
{
MessageBox.Show("服务器配置有误,请联系客服人员处理");
this.Close();
}
else
{
if (!ServerUrl.EndsWith("/"))
{
ServerUrl += "/";
}
}
if (string.IsNullOrEmpty(OpId))
{
MessageBox.Show("操作人员代码未配置,请联系客服人员处理");
this.Close();
}
if (File.Exists(CfgFile))
{
JObject jobj = JObject.Parse(File.ReadAllText(CfgFile));
if (jobj.ContainsKey("watchDir"))
{
tbWatch.Text = jobj.GetValue("watchDir").ToString();
}
btnRun_Click(sender, e);
}
tslbVersion.Text = $"程序版本:{Common.AppVersion}";
}
//选择监视目录
private void btnChooseDir_Click(object sender, EventArgs e)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
if (fbd.ShowDialog() == DialogResult.OK)
{
JObject jobj = null;
if (File.Exists(CfgFile))
{
jobj = JObject.Parse(File.ReadAllText(CfgFile));
jobj["watchDir"] = new JValue(fbd.SelectedPath);
}
else
{
jobj = new JObject();
jobj.Add("watchDir", new JValue(fbd.SelectedPath));
}
File.WriteAllText(CfgFile, JsonConvert.SerializeObject(jobj));
tbWatch.Text = fbd.SelectedPath;
}
}
//运行、停止监视
private void btnRun_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(tbWatch.Text))
{
watcher = new FileSystemWatcher(tbWatch.Text, "*.txt");
watcher.EnableRaisingEvents = true;
watcher.Created += Watcher_Created;
//watcher.Changed += Watcher_Changed;
btnRun.Visible = false;
btnStop.Visible = true;
}
else
{
MessageBox.Show("请先选择监视目录");
}
}
private void Watcher_Changed(object sender, FileSystemEventArgs e)
{
}
private void Watcher_Created(object sender, FileSystemEventArgs e)
{
logger.Debug($"发现新文件:{e.FullPath}");
var fileName = Path.GetFileNameWithoutExtension(e.FullPath);
if (Regex.IsMatch(fileName, "^[A-Z0-9_.\\s\\u007f]{20,200}$"))
{
logger.Debug($"准备解析上传:{e.FullPath}");
Thread.Sleep(500); //立即解析会报错文件被占用等待1S再处理
//解析上传数据
var rtn = ParseInttraHelper.ParseFile(e.FullPath);
logger.Debug($"解析文件完成:{e.FullPath}{rtn.Success}");
if (rtn.Success)
{
logger.Debug($"解析结果:{JsonConvert.SerializeObject(rtn.TransferModel)}");
var upDataUrl = $"{ServerUrl}Booking/ReceiveSoSiBooking";
try
{
WebRequestHelper.DoPost(upDataUrl, JsonConvert.SerializeObject(new { op = OpId, data = rtn.TransferModel }));
logger.Debug($"上传数据到服务器成功:{upDataUrl}");
}
catch (Exception ex)
{
logger.Error($"上传数据到服务器出错");
logger.Error(ex.Message);
logger.Error(ex.StackTrace);
MessageBox.Show($"业务数据上传({upDataUrl})失败:{ex.Message}");
}
}
else
{
logger.Error($"解析失败:{rtn.Message}");
}
}
}
//停止
private void btnStop_Click(object sender, EventArgs e)
{
watcher.EnableRaisingEvents = false;
watcher.Dispose();
watcher = null;
btnRun.Visible = true;
btnStop.Visible = false;
}
private void button1_Click(object sender, EventArgs e)
{
//var rtn = MaskEdiAnalyzeTool.ImportMCSEdiList(Path.Combine(@"D:\whm\振华对接", "XIN_OU_ZHOU0HC8ZE1MA21042010025100.TXT"));
var rtn = ParseInttraHelper.ParseFile(Path.Combine(@"D:\whm\振华对接", "XIN_OU_ZHOU0HC8ZE1MA21042009561100.TXT"));
//var rtn = ParseInttraHelper.ParseFile(Path.Combine(@"D:\whm\振华对接", "XIN_OU_ZHOU0HC8ZE1MA21042010025100.TXT"));
}
//双击还原
private void noti_MouseDoubleClick(object sender, MouseEventArgs e)
{
noti.Visible = false;
ShowInTaskbar = true;
WindowState = FormWindowState.Normal;
Activate();
}
//最小化系统托盘
private void FMain_SizeChanged(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Minimized)
{
noti.Visible = true;
ShowInTaskbar = false;
}
}
}
}

File diff suppressed because it is too large Load Diff

@ -1,138 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4F5FE4D4-4E6A-49FD-AE4E-4E2BABE17584}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>FileWatchCopy</RootNamespace>
<AssemblyName>FileWatchCopy</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentFTP, Version=34.0.0.0, Culture=neutral, PublicKeyToken=f4af092b1d8df44f, processorArchitecture=MSIL">
<HintPath>..\packages\FluentFTP.34.0.0\lib\net45\FluentFTP.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.1.2.10\lib\2.0\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Common.cs" />
<Compile Include="FQiDeMultiFolder.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FQiDeMultiFolder.Designer.cs">
<DependentUpon>FQiDeMultiFolder.cs</DependentUpon>
</Compile>
<Compile Include="FQiDeNew.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FQiDeNew.Designer.cs">
<DependentUpon>FQiDeNew.cs</DependentUpon>
</Compile>
<Compile Include="FQiDe.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FQiDe.Designer.cs">
<DependentUpon>FQiDe.cs</DependentUpon>
</Compile>
<Compile Include="FMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FMain.Designer.cs">
<DependentUpon>FMain.cs</DependentUpon>
</Compile>
<Compile Include="ParseInttraHelper.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FQiDeMultiFolder.resx">
<DependentUpon>FQiDeMultiFolder.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FQiDeNew.resx">
<DependentUpon>FQiDeNew.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FQiDe.resx">
<DependentUpon>FQiDe.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FMain.resx">
<DependentUpon>FMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Content Include="log4net.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DSWeb.Common\DSWeb.Common.csproj">
<Project>{a0ab3d23-0dad-49ba-9d23-107faa1c369e}</Project>
<Name>DSWeb.Common</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -1,434 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace FileWatchCopy
{
/// <summary>
/// 解析振华SO、SI报文以前同事写的拷贝使用
/// </summary>
class MaskEdiAnalyzeTool
{
public static string GetPosString(string str, int pos, bool isnum = false)
{
var result = "";
if (isnum) result = "0";
var j = 0;
if (str.IndexOf(":") == -1) return result;
str = str.Replace("??", "?").Replace("?:", "^").Replace("?'", "'");
for (int i = 1; i < pos; i++)
{
if (str.IndexOf(":") == -1) return result;
if (str.IndexOf(":") != -1)
{
j = str.IndexOf(":");
str = str.Substring(j + 1, str.Length - j - 1);
}
}
j = str.IndexOf(":");
if (j != -1)
{
str = str.Substring(0, j);
}
else
{
if (str.Length != 0)
str = str.Substring(0, str.Length);
}
result = str.Replace("^", ":");
if (isnum)
{
if (result == "")
result = "0";
}
return result;
}
public static string GetPosStringplus(string str, int pos, bool isnum = false)
{
var result = "";
if (isnum) result = "0";
var j = 0;
if (str.IndexOf("+") == -1) return result;
str = str.Replace("??", "?").Replace("?'", "'").Replace("?+", "し");
for (int i = 1; i < pos; i++)
{
if (str.IndexOf("+") == -1) return result;
if (str.IndexOf("+") != -1)
{
j = str.IndexOf("+");
str = str.Substring(j + 1, str.Length - j - 1);
}
}
j = str.IndexOf("+");
if (j != -1)
{
str = str.Substring(0, j);
}
else
{
if (str.Length != 0)
str = str.Substring(0, str.Length);
}
result = str.Replace("し", "+");
if (isnum)
{
if (result == "")
result = "0";
}
return result;
}
public static string ImportMCSEdiList(string filename)
{
var headList = "";
var result = "";
FileStream fs = null;
StreamReader sr = null;
string line;
int i;
try
{
fs = new FileStream(filename, FileMode.Open);
sr = new StreamReader(fs, System.Text.Encoding.GetEncoding("gb2312"));
var head = "";
var strtmp = "";
var strtmp2 = "";
var Grouphead = "";
var CntrType = "";
int TDTcount = 0;
var TDTstr = "";
while ((line = sr.ReadLine()) != null && line != "")
{
headList = headList + line;
}
headList = headList.Replace("?'", "し");
string[] StrList = headList.Split('\'');
for (i = 0; i <= StrList.Length - 1; i++)
{
line = StrList[i];
if (string.IsNullOrEmpty(line))
{
continue;
}
head = line.Substring(0, 3);
if (head == "UNB")
{
result = result + "船公司代码:" + GetPosString(GetPosStringplus(line, 3), 1) + ",接收方代码:" + GetPosString(GetPosStringplus(line, 4), 1) + Environment.NewLine;
}
if (head == "UNH")
{
result = result + "报文类型:" + GetPosString(GetPosStringplus(line, 3), 1) + Environment.NewLine;
}
if (head == "BGM")
{
strtmp = GetPosStringplus(line, 2);
if (strtmp == "700")
result = result + "签单方式:WAYBILL" + Environment.NewLine;
else if (strtmp == "705")
result = result + "签单方式:Bill of lading" + Environment.NewLine;
Grouphead = "";
}
if (head == "CTA")
{
strtmp = GetPosStringplus(line, 3);
result = result + Grouphead + "联系人:" + GetPosString(strtmp, 2) + Environment.NewLine;
}
if (head == "COM")
{
strtmp = GetPosStringplus(line, 2);
strtmp2 = GetPosString(strtmp, 2);
if (strtmp2 == "EM")
result = result + Grouphead + "联系人邮件:" + GetPosString(strtmp, 1) + Environment.NewLine;
if (strtmp2 == "TE")
result = result + Grouphead + "联系人电话:" + GetPosString(strtmp, 1) + Environment.NewLine;
if (strtmp2 == "FX")
result = result + Grouphead + "联系人传真:" + GetPosString(strtmp, 1) + Environment.NewLine;
}
if (head == "DTM")
{
strtmp = GetPosStringplus(line, 2);
strtmp2 = GetPosString(strtmp, 1);
if (TDTcount == 1) TDTstr = "";
if (TDTcount == 2) TDTstr = "二程";
if (TDTcount == 3) TDTstr = "三程";
if (TDTcount == 4) TDTstr = "四程";
if (strtmp2 == "95")
result = result + "签单日期:" + GetPosString(strtmp, 2) + Environment.NewLine;
if (strtmp2 == "137")
result = result + "报文时间:" + GetPosString(strtmp, 2) + Environment.NewLine;
if (strtmp2 == "132")
result = result + TDTstr + "到港日期:" + GetPosString(strtmp, 2) + Environment.NewLine;
if (strtmp2 == "133")
result = result + TDTstr + "开船日期:" + GetPosString(strtmp, 2) + Environment.NewLine;
if (strtmp2 == "392")
result = result + TDTstr + "提箱日期:" + GetPosString(strtmp, 2) + Environment.NewLine;
if (strtmp2 == "342")
result = result + TDTstr + "装船日期:" + GetPosString(strtmp, 2) + Environment.NewLine;
}
if (head == "TSR")
{
strtmp = GetPosStringplus(line, 2);
if (strtmp == "27")
result = result + "运输条款:CY-CY" + Environment.NewLine;
else if (strtmp == "28")
result = result + "运输条款:DOOR-CY" + Environment.NewLine;
else if (strtmp == "29")
result = result + "运输条款:CY-DOOR" + Environment.NewLine;
else if (strtmp == "30")
result = result + "运输条款:CY-CY" + Environment.NewLine;
else if (strtmp == "37")
result = result + "运输条款:CY-CFS" + Environment.NewLine;
else if (strtmp == "38")
result = result + "运输条款:CFS-CY" + Environment.NewLine;
else if (strtmp == "39")
result = result + "运输条款:DOOR-CFS" + Environment.NewLine;
else if (strtmp == "40")
result = result + "运输条款:CFS-DOOR" + Environment.NewLine;
else if (strtmp == "41")
result = result + "运输条款:CFS-CFS" + Environment.NewLine;
}
if (head == "RFF")
{
strtmp = GetPosStringplus(line, 2);
strtmp2 = GetPosString(strtmp, 1);
if (strtmp2 == "BN")
result = result + "订舱号:" + GetPosString(strtmp, 2) + Environment.NewLine;
else if (strtmp2 == "BM")
result = result + "提单号:" + GetPosString(strtmp, 2) + Environment.NewLine;
else if (strtmp2 == "CT")
result = result + "合同号:" + GetPosString(strtmp, 2) + Environment.NewLine;
else if (strtmp2 == "FF")
result = result + "货运代理的参考号码:" + GetPosString(strtmp, 2) + Environment.NewLine;
else if (strtmp2 == "IV")
result = result + "发票号:" + GetPosString(strtmp, 2) + Environment.NewLine;
else if (strtmp2 == "ON")
result = result + "买方订单号:" + GetPosString(strtmp, 2) + Environment.NewLine;
else if (strtmp2 == "SI")
result = result + "托运人识别号:" + GetPosString(strtmp, 2) + Environment.NewLine;
else if (strtmp2 == "AED")
result = result + "HS编码:" + GetPosString(strtmp, 2) + Environment.NewLine;
}
if (head == "FTX")
{
strtmp = GetPosStringplus(line, 2);
if (strtmp == "AAI")
result = result + "报文备注:" + GetPosStringplus(line, 5) + Environment.NewLine;
if (strtmp == "AAA")
result = result + "货物描述:" + GetPosStringplus(line, 5) + Environment.NewLine;
}
if (head == "TDT")
{
TDTcount++;
if (TDTcount == 1)
{
result = result + "航次:" + GetPosStringplus(line, 3) + Environment.NewLine;
strtmp = GetPosStringplus(line, 9);
result = result + "船名:" + GetPosString(strtmp, 4) + Environment.NewLine;
}else if (TDTcount == 2)
{
result = result + "二程航次:" + GetPosStringplus(line, 3) + Environment.NewLine;
strtmp = GetPosStringplus(line, 9);
result = result + "二程船名:" + GetPosString(strtmp, 4) + Environment.NewLine;
} else if (TDTcount == 3)
{
result = result + "三程航次:" + GetPosStringplus(line, 3) + Environment.NewLine;
strtmp = GetPosStringplus(line, 9);
result = result + "三程船名:" + GetPosString(strtmp, 4) + Environment.NewLine;
}
else if (TDTcount == 4)
{
result = result + "四程航次:" + GetPosStringplus(line, 3) + Environment.NewLine;
strtmp = GetPosStringplus(line, 9);
result = result + "四程船名:" + GetPosString(strtmp, 4) + Environment.NewLine;
}
}
if (head == "LOC")
{
strtmp = GetPosStringplus(line, 2);
strtmp2 = GetPosStringplus(line, 3);
if (TDTcount == 1) TDTstr = "";
if (TDTcount == 2) TDTstr = "二程";
if (TDTcount == 3) TDTstr = "三程";
if (TDTcount == 4) TDTstr = "四程";
if (strtmp == "88")
result = result + TDTstr + "收货地代码:" + GetPosString(strtmp2, 1) + ",收货地:" + GetPosString(strtmp2, 4) + Environment.NewLine;
else if (strtmp == "9")
result = result + TDTstr + "装货港代码:" + GetPosString(strtmp2, 1) + ",装货港:" + GetPosString(strtmp2, 4) + Environment.NewLine;
else if (strtmp == "11")
result = result + TDTstr + "卸货港代码:" + GetPosString(strtmp2, 1) + ",卸货港:" + GetPosString(strtmp2, 4) + Environment.NewLine;
else if (strtmp == "7")
result = result + TDTstr + "交货地代码:" + GetPosString(strtmp2, 1) + ",交货地:" + GetPosString(strtmp2, 4) + Environment.NewLine;
else if (strtmp == "27")
result = result + TDTstr + "原产国代码:" + GetPosString(strtmp2, 1) + ",原产国:" + GetPosString(strtmp2, 4) + Environment.NewLine;
else if (strtmp == "28")
result = result + TDTstr + "目的国代码:" + GetPosString(strtmp2, 1) + ",目的国:" + GetPosString(strtmp2, 4) + Environment.NewLine;
else if (strtmp == "99")
result = result + TDTstr + "签单地代码:" + GetPosString(strtmp2, 1) + ",签单地:" + GetPosString(strtmp2, 4) + Environment.NewLine;
}
if (head == "NAD")
{
strtmp = GetPosStringplus(line, 2);
if (strtmp == "BA")
{
result = result + "订舱代理代码:" + GetPosStringplus(line, 3) + ",详细内容:" + GetPosStringplus(line, 4).Replace(":", " ") + Environment.NewLine;
Grouphead = "订舱代理";
}
else if (strtmp == "CN")
{
result = result + "通知人代码:" + GetPosStringplus(line, 3) + ",详细内容:" + GetPosStringplus(line, 4).Replace(":", " ") + Environment.NewLine;
Grouphead = "通知人";
}
else if (strtmp == "CZ")
{
result = result + "发货人代码:" + GetPosStringplus(line, 3) + ",详细内容:" + GetPosStringplus(line, 4).Replace(":", " ") + Environment.NewLine;
Grouphead = "发货人";
}
else if (strtmp == "N1")
{
result = result + "通知人1代码:" + GetPosStringplus(line, 3) + ",详细内容:" + GetPosStringplus(line, 4).Replace(":", " ") + Environment.NewLine;
Grouphead = "通知人1";
}
else if (strtmp == "N2")
{
result = result + "通知人2代码:" + GetPosStringplus(line, 3) + ",详细内容:" + GetPosStringplus(line, 4).Replace(":", " ") + Environment.NewLine;
Grouphead = "通知人2";
}
else if (strtmp == "FW")
{
result = result + "货运代理:" + GetPosStringplus(line, 3) + ",详细内容:" + GetPosStringplus(line, 4).Replace(":", " ") + Environment.NewLine;
Grouphead = "货运代理";
}
else if (strtmp == "CA")
{
result = result + "船公司代码:" + GetPosStringplus(line, 3) + Environment.NewLine;
Grouphead = "船公司";
}
else if (strtmp == "CK")
{
result = result + "提箱场站代码:" + GetPosStringplus(line, 3) + ",详细内容:" + GetPosStringplus(line, 4).Replace(":", " ") + Environment.NewLine;
Grouphead = "提箱场站";
}
else if (strtmp == "EP")
{
result = result + "码头代码:" + GetPosStringplus(line, 3) + ",详细内容:" + GetPosStringplus(line, 4).Replace(":", " ") + Environment.NewLine;
Grouphead = "码头";
}
else if (strtmp == "FC")
{
result = result + "约主代码:" + GetPosStringplus(line, 3) + ",详细内容:" + GetPosStringplus(line, 4).Replace(":", " ") + Environment.NewLine;
Grouphead = "约主";
}
}
if (head == "GID")
{
strtmp = GetPosStringplus(line, 3);
result = result + "件数:" + GetPosString(strtmp, 1) + ",包装代码:" + GetPosString(strtmp, 2) + ",包装:" + GetPosString(strtmp, 5) + Environment.NewLine;
}
if (head == "MEA")
{
strtmp = GetPosStringplus(line, 3);
if (strtmp == "AAW")
result = result + "总体积:" + GetPosString(GetPosStringplus(line, 4), 2) + Environment.NewLine;
if (strtmp == "G")
result = result + "毛重:" + GetPosString(GetPosStringplus(line, 4), 2) + Environment.NewLine;
if (strtmp == "ABJ")
result = result + "体积:" + GetPosString(GetPosStringplus(line, 4), 2) + Environment.NewLine;
}
if (head == "SGP")
{
result = result + "箱号:" + GetPosStringplus(line, 2) + ",件数" + GetPosStringplus(line, 3) + Environment.NewLine;
}
if (head == "PCI")
{
result = result + "唛头:" + GetPosStringplus(line, 3).Replace(":", " ") + Environment.NewLine;
}
if (head == "DGS")
{
result = result + "危险品类别:" + GetPosStringplus(line, 3) + Environment.NewLine;
result = result + "危险品编号:" + GetPosStringplus(line, 4) + Environment.NewLine;
result = result + "危险品闪点:" + GetPosString(GetPosStringplus(line, 5), 1) + Environment.NewLine;
Grouphead = "危险品";
}
if (head == "TMP")
{
result = result + "冻柜设置温度:" + GetPosString(GetPosStringplus(line, 3), 1) + Environment.NewLine;
}
if (head == "EQD")
{
strtmp = GetPosString(GetPosStringplus(line, 4), 1);
result = result + "箱型代码:" + strtmp + Environment.NewLine;
CntrType = strtmp;
}
if (head == "SEL")
{
strtmp = GetPosStringplus(line, 3);
result = result + "封号:" + GetPosStringplus(line, 2) + Environment.NewLine;
CntrType = strtmp;
}
if (head == "EQN")
{
strtmp = GetPosStringplus(line, 2);
result = result + "箱型:" + CntrType + " 数量" + strtmp + Environment.NewLine;
}
}
}
catch (Exception ex)
{
//LogHelper.WriteLog(typeof(SendmaillTool), ex);
//result.Success = false;
//result.Message = "导入错误,请重试或联系系统管理员";
//MessageBox.Show(ex.Message);
//return result;
}
finally
{
if (sr != null)
{
sr.Close();
}
if (fs != null)
{
fs.Close();
}
}
return result;
}
}
}

@ -1,521 +0,0 @@
using DSWeb.Common.Model;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FileWatchCopy
{
public class ParseInttraHelper
{
//解析文件内容
public static ParseRtnObj ParseFile(string file)
{
OpOrderTransferModel orderModel = new OpOrderTransferModel();
OpCtnTransferViewModel recentCtn = null;
try
{
var lines = File.ReadAllLines(file);
foreach (var line in lines)
{
var head = line.Substring(0, 3);
//运输条款
if (head == "TSR")
{
var str = GetPosStrWithPlus(line, 2);
var service = string.Empty;
switch (str)
{
case "27":
service = "DR-DR";
break;
case "28":
service = "DR-CY";
break;
case "29":
service = "CY-DR";
break;
case "30":
service = "CY-CY";
break;
}
orderModel.SERVICE = service;
}
//各种备注
if (head == "FTX")
{
var subHead = GetPosStrWithPlus(line, 2);
var strContent = GetPosStrWithPlus(line, 5);
if (subHead == "AAI")//备注
{
orderModel.REMARK = strContent;
}
else if (subHead == "BLC") //提单备注
{
orderModel.EDIREMARK = strContent;
}
else if (subHead == "AAA") //货物描述
{
if (!string.IsNullOrEmpty(orderModel.DESCRIPTION))
{
orderModel.DESCRIPTION += Environment.NewLine;
}
orderModel.DESCRIPTION += strContent.Replace("?:", ":");
}
}
//件重尺
if (head == "CNT")
{
var strContent = GetPosStrWithPlus(line, 2);
var subHead = GetPosStrWithColon(strContent, 1);
var subContent = GetPosStrWithColon(strContent, 2);
if (subHead == "7") //毛重
{
orderModel.KGS = Convert.ToDecimal(subContent);
}
else if (subHead == "11") //件数
{
orderModel.PKGS = Convert.ToInt32(subContent);
}
else if (subHead == "15") //体积
{
orderModel.CBM = Convert.ToDecimal(subContent);
}
}
//地点
if (head == "LOC")
{
var subHead = GetPosStrWithPlus(line, 2);
var subContent = GetPosStrWithPlus(line, 3);
if (subHead == "57") //预付地点
{
orderModel.PREPARDAT = GetPosStrWithColon(subContent, 4);
orderModel.PREPARDAT_ID = GetPosStrWithColon(subContent, 1);
}
else if (subHead == "73") //签单地点
{
orderModel.ISSUEPLACE = GetPosStrWithColon(subContent, 4);
orderModel.ISSUEPLACEID = GetPosStrWithColon(subContent, 1);
}
else if (subHead == "9") //装货港
{
orderModel.PORTLOAD = GetPosStrWithColon(subContent, 4);
orderModel.PORTLOADID = GetPosStrWithColon(subContent, 1);
}
else if (subHead == "88") //收货地
{
orderModel.PLACERECEIPT = GetPosStrWithColon(subContent, 4);
orderModel.PLACERECEIPTID = GetPosStrWithColon(subContent, 1);
}
else if (subHead == "11") //卸货港
{
orderModel.PORTDISCHARGE = GetPosStrWithColon(subContent, 4);
orderModel.PORTDISCHARGEID = GetPosStrWithColon(subContent, 1);
}
else if (subHead == "7") //交货地
{
orderModel.PLACEDELIVERY = GetPosStrWithColon(subContent, 4);
orderModel.PLACEDELIVERYID = GetPosStrWithColon(subContent, 1);
}
}
//日期时间(给定的报文中都不存在,待测试检验)
if (head == "DTM")
{
var strContent = GetPosStrWithPlus(line, 2);
var subHead = GetPosStrWithColon(strContent, 1);
if (subHead == "95") //签单日期
{
var strDate = GetPosStrWithColon(strContent, 2);
if (!string.IsNullOrEmpty(strDate) && strDate.Length == 6)
{
orderModel.ISSUEDATE = DateTime.ParseExact(strDate, "yyyyMMdd", CultureInfo.InvariantCulture);
}
}
else if (subHead == "133") //ETD
{
var strDate = GetPosStrWithColon(strContent, 2);
if (!string.IsNullOrEmpty(strDate) && strDate.Length == 6)
{
orderModel.ETD = DateTime.ParseExact(strDate, "yyyyMMdd", CultureInfo.InvariantCulture);
}
}
}
//各种号
if (head == "RFF")
{
var strContent = GetPosStrWithPlus(line, 2);
var subHead = GetPosStrWithColon(strContent, 1);
if (subHead == "BM") //提单号
{
orderModel.MBLNO = GetPosStrWithColon(strContent, 2);
}
else if (subHead == "CT") //运费协议号
{
}
}
//
if (head == "CPI")
{
var subHead = GetPosStrWithPlus(line, 2);
var strContent = GetPosStrWithPlus(line, 4);
if (subHead == "4") //付款方式
{
var blfrt = string.Empty;
switch (strContent)
{
case "P":
orderModel.BLFRT = "PREPAID";
break;
case "C":
orderModel.BLFRT = "COLLECT";
break;
case "B":
orderModel.BLFRT = "THIRD PARTY TO PAY";
break;
case "A":
orderModel.BLFRT = "PAYABLE ELSEWHERE";
break;
}
}
}
//船名航次
if (head == "TDT")
{
var subHead = GetPosStrWithPlus(line, 2);
if (subHead == "20")
{
orderModel.VOYNO = GetPosStrWithPlus(line, 3);
orderModel.CARRIERID = GetPosStrWithColon(GetPosStrWithPlus(line, 6), 1);
orderModel.CARRIER = orderModel.CARRIERID;
orderModel.VESSEL = GetPosStrWithColon(GetPosStrWithPlus(line, 9), 4);
}
}
//船公司和收发通
if (head == "NAD")
{
var subHead = GetPosStrWithPlus(line, 2);
if (subHead == "CA") //船公司
{
orderModel.CARRIERID = GetPosStrWithColon(GetPosStrWithPlus(line, 3), 1);
orderModel.CARRIER = GetPosStrWithPlus(line, 5);
}
else if (subHead == "CZ") //发货人
{
orderModel.SHIPPER = GetPosStrWithPlus(line, 5);
var str = GetPosStrWithPlus(line, 6);
for (int idx = 1; idx <= 5; idx++)
{
var tmp = GetPosStrWithColon(str, idx);
if (!string.IsNullOrEmpty(tmp))
{
orderModel.SHIPPER += Environment.NewLine + tmp;
}
}
}
else if (subHead == "CN") //收货人
{
orderModel.CONSIGNEE = GetPosStrWithPlus(line, 5);
var str = GetPosStrWithPlus(line, 6);
for (int idx = 1; idx <= 5; idx++)
{
var tmp = GetPosStrWithColon(str, idx);
if (!string.IsNullOrEmpty(tmp))
{
orderModel.CONSIGNEE += Environment.NewLine + tmp;
}
}
}
else if (subHead == "NI") //通知人
{
orderModel.NOTIFYPARTY = GetPosStrWithPlus(line, 5);
var str = GetPosStrWithPlus(line, 6);
for (int idx = 1; idx <= 5; idx++)
{
var tmp = GetPosStrWithColon(str, idx);
if (!string.IsNullOrEmpty(tmp))
{
orderModel.NOTIFYPARTY += Environment.NewLine + tmp;
}
}
}
}
//提单份数
if (head == "DOC")
{
var strType = GetPosStrWithPlus(line, 2);
var strNum = GetPosStrWithPlus(line, 5);
if (strType == "706") //正本
{
orderModel.NOBILL = NumToEn(Convert.ToInt32(strNum));
}
else if (strType == "707") //副本
{
orderModel.COPYNOBILLL = NumToEn(Convert.ToInt32(strNum));
}
}
//包装
if (head == "GID")
{
orderModel.KINDPKGS = GetPosStrWithColon(GetPosStrWithPlus(line, 3), 5);
}
//HSCODE
if (head == "PIA")
{
orderModel.HSCODE = GetPosStrWithColon(GetPosStrWithPlus(line, 3), 1);
}
//唛头
if (head == "PCI")
{
orderModel.MARKS = GetPosStrWithPlus(line, 3);
}
//SI箱号、件数
if (head == "SGP")
{
var cntrno = GetPosStrWithPlus(line, 2);
var ctnnum = Convert.ToInt32(GetPosStrWithPlus(line, 3));
//一个箱子开始 SI
var ctnModel = new OpCtnTransferViewModel()
{
CNTRNO = cntrno,
PKGS = ctnnum
};
orderModel.CtrnList.Add(ctnModel);
recentCtn = ctnModel;
}
//箱型箱号
if (head == "EQD")
{
var subHead = GetPosStrWithPlus(line, 2);
if (subHead == "CN")
{
var cntrno = GetPosStrWithPlus(line, 3);
var ctnall = GetPosStrWithPlus(line, 4);
if (string.IsNullOrEmpty(cntrno)) //SO没有箱号
{
//一个箱子开始 SO
var ctnModel = new OpCtnTransferViewModel();
orderModel.CtrnList.Add(ctnModel);
recentCtn = ctnModel;
recentCtn.CTNALL = ctnall;
}
else
{
recentCtn.CTNALL = ctnall;
recentCtn.CTNNUM = 1;
}
}
}
//体积、毛重、皮重
if (head == "MEA")
{
var subHead = GetPosStrWithPlus(line, 2);
if (subHead == "AAE")
{
var cate = GetPosStrWithPlus(line, 3);
if (cate == "WT") //重量
{
var kgs = Convert.ToDecimal(GetPosStrWithColon(GetPosStrWithPlus(line, 4), 2));
if (recentCtn == null)
{
//var ctnModel = new OpCtnTransferViewModel()
//{
// KGS = kgs
//};
//orderModel.CtrnList.Add(ctnModel);
//recentCtn = ctnModel;
}
else
{
recentCtn.KGS = kgs;
}
}
else if (cate == "AAW") //体积
{
var cbm = Convert.ToDecimal(GetPosStrWithColon(GetPosStrWithPlus(line, 4), 2));
if (recentCtn == null)
{
//var ctnModel = new OpCtnTransferViewModel()
//{
// CBM = cbm
//};
//orderModel.CtrnList.Add(ctnModel);
//recentCtn = ctnModel;
}
else
{
recentCtn.CBM = cbm;
}
}
else if (cate == "AAS") //通风
{
var reeferf = GetPosStrWithColon(GetPosStrWithPlus(line, 4), 2);
orderModel.REEFERF = reeferf;
}
}
}
//箱量
if (head == "EQN")
{
recentCtn.CTNNUM = Convert.ToInt32(GetPosStrWithPlus(line, 2));
recentCtn = null; //一个箱子结束 SO
}
//封号
if (head == "SEL")
{
recentCtn.SEALNO = GetPosStrWithPlus(line, 2);
recentCtn = null; //一个箱子结束 SI
}
//温度
if (head == "TMP")
{
var subHead = GetPosStrWithPlus(line, 2);
if (subHead == "2")
{
var str = GetPosStrWithPlus(line, 3);
orderModel.TEMPSET = GetPosStrWithColon(str, 1);
orderModel.TEMPID = GetPosStrWithColon(str, 2).Substring(0, 1);
orderModel.CARGOID = "R";
}
}
}
//船公司特殊处理
if (orderModel.CARRIERID == "CMA"
|| orderModel.CARRIERID == "CMDU")
{
orderModel.CARRIERID = "CMA";
orderModel.CARRIER = "法国达飞";
}
else if (orderModel.CARRIERID == "CHNL")
{
//orderModel.CARRIERID = "CNC";
//orderModel.CARRIER = "正利航运";
//2021-8-5需求改成CMA担心影响提箱小票
orderModel.CARRIERID = "CMA";
orderModel.CARRIER = "法国达飞";
}
return new ParseRtnObj() { Success = true, Message = "", TransferModel = orderModel };
}
catch (Exception ex)
{
return new ParseRtnObj() { Success = false, Message = $"{ex.Message}{Environment.NewLine}{ex.StackTrace}", TransferModel = null };
}
}
/// <summary>
/// 将提单份数数字变为英文
/// </summary>
/// <param name="n"></param>
/// <returns></returns>
private static string NumToEn(int n)
{
string rtn = string.Empty;
var arr = new string[] { "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN" };
if (n <= arr.Length)
{
return arr[n - 1];
}
return rtn;
}
/// <summary>
/// 根据“+”分割符,获取指定位置的内容
/// </summary>
/// <param name="str">原始行字符串</param>
/// <param name="pos">分割后再第几个位置起始数值为1</param>
/// <returns></returns>
public static string GetPosStrWithPlus(string str, int pos)
{
if (str.IndexOf("+") == -1)
{
return string.Empty;
}
if (str.EndsWith("'"))
{
str = str.Substring(0, str.Length - 1);
}
//反转义
str = str.Replace("??", "?").Replace("?'", "'").Replace("?+", "し");
var arr = str.Split('+');
if (pos > 0 && arr.Length >= pos)
{
var result = arr[pos - 1];
result = result.Replace("し", "+"); //把特殊符号还原
return result;
}
return string.Empty;
}
/// <summary>
/// 根据“:”分割符,获取指定位置的内容
/// </summary>
/// <param name="str">原始行字符串</param>
/// <param name="pos">分割后再第几个位置起始数值为1</param>
/// <returns></returns>
public static string GetPosStrWithColon(string str, int pos)
{
if (str.IndexOf(":") == -1)
{
return string.Empty;
}
//反转义
str = str.Replace("??", "?").Replace("?:", "^").Replace("?'", "'");
var arr = str.Split(':');
if (pos > 0 && arr.Length >= pos)
{
var result = arr[pos - 1];
result = result.Replace("^", ":"); //把特殊符号还原
return result;
}
return string.Empty;
}
}
public class ParseRtnObj
{
public bool Success { get; set; }
public string Message { get; set; }
public OpOrderTransferModel TransferModel { get; set; }
}
}

@ -1,71 +0,0 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FileWatchCopy
{
static class Program
{
public static string ServerUrl = ConfigurationManager.AppSettings["serverUrl"];
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Process[] processes = Process.GetProcesses();
Process currentProcess = Process.GetCurrentProcess();
foreach (Process p in processes)
{
if (p.ProcessName == currentProcess.ProcessName && p.Id != currentProcess.Id)
{
MessageBox.Show("已经运行了一个程序的实例");
return;
}
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var watchType = ConfigurationManager.AppSettings["watchType"];
if (watchType == "qideMulti")
{
Application.Run(new FQiDeMultiFolder());
}
else
{
var hasNew = Common.CheckVersion(out AppVersionCheckModel ver);
if (hasNew)
{
if (MessageBox.Show($"更新内容:\r\n{ver.Description}\r\n点击确定开始升级", "发现新版本", MessageBoxButtons.OKCancel) == DialogResult.OK)
{
if (!ServerUrl.EndsWith("/"))
{
ServerUrl += "/";
}
Process.Start(Path.Combine(Application.StartupPath, "AppUpdate.exe"), $"url={ServerUrl}Common/DownloadVersionFile?fileName={ver.File}");
return;
}
}
else
{
if (watchType == "qide") //启德
{
//Application.Run(new FQiDe()); //2021-8-9启德该问跟振华一样不再单独监控当天的文件夹而是一个固定的
Application.Run(new FQiDeNew());
}
else //默认振华
{
Application.Run(new FMain());
}
}
}
}
}
}

@ -1,37 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("FileWatchCopy")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("FileWatchCopy")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("4f5fe4d4-4e6a-49fd-ae4e-4e2babe17584")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", ConfigFileExtension = "config", Watch = true)]

@ -1,71 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace FileWatchCopy.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 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()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[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("FileWatchCopy.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 覆盖当前线程的 CurrentUICulture 属性
/// 使用此强类型的资源类的资源查找。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -1,30 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace FileWatchCopy.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;
}
}
}
}

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" requirePermission="false" />
</configSections>
<log4net>
<root>
<!-- Value of priority may be ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF -->
<level value="DEBUG" />
<appender-ref ref="DebugAppender" />
<appender-ref ref="ErrorAppender" />
</root>
<appender name="DebugAppender" type="log4net.Appender.RollingFileAppender">
<!-- debug log: 记录 DEBUG, INFO 级别的日志 -->
<file value="App_Data\\Logs\\debug.log" />
<appendToFile value="true" />
<rollingStyle value="Composite" />
<datePattern value="yyyyMMdd" />
<maxSizeRollBackups value="100" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout" >
<param name="ConversionPattern" value="%date [%p] [%logger] [%thread] - %message%newline" />
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<levelMax value="INFO" />
</filter>
</appender>
<appender name="ErrorAppender" type="log4net.Appender.RollingFileAppender">
<!-- error log: 记录 WARN,ERROR,FATAL 级别的日志 -->
<file value="App_Data\\Logs\\error.log" />
<appendToFile value="true" />
<rollingStyle value="Composite" />
<datePattern value="yyyyMMdd" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout" >
<param name="ConversionPattern" value="%date [%p] [%logger] [%thread] - %message%newline" />
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="WARN" />
</filter>
</appender>
</log4net>
</configuration>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FluentFTP" version="34.0.0" targetFramework="net46" />
<package id="log4net" version="1.2.10" targetFramework="net46" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net46" />
</packages>
Loading…
Cancel
Save