Files
zhengxuan.zhang 08e623410f 260520 优化历史已解析入库但没有分发成功的问题
新到文件是否仍然正常出现 匹配成功 -> 待解析区 -> 解析成功 -> 正式区 -> 双侧完成 -> 客户报告生成。
历史遗留文件是否出现 已补充分发到正式区 这类新日志,并从源目录消失。
已经真正分发完成的文件,是否仍然保持 已处理且目标区域已存在,跳过,没有重复搬运。
2026-05-20 16:06:37 +08:00

216 lines
6.2 KiB
C#

using NSAnalysis.DAL;
using NSAnalysis.Model;
using System;
using System.Drawing;
using System.Windows.Forms;
using Telerik.WinControls.UI;
namespace NSAnalysis
{
public partial class FEditConfig : Telerik.WinControls.UI.ShapedForm
{
#region
private CjlrDAL tmdal = new CjlrDAL();
private FConfigSetup gFTS;
#endregion
#region
private void btn_MouseHover(object sender, EventArgs e)
{
RadButton btn = sender as RadButton;
btn.BackColor = Color.FromArgb(0, 151, 186);
}
private void btn_MouseLeave(object sender, EventArgs e)
{
RadButton btn = sender as RadButton;
btn.BackColor = Color.FromArgb(19, 46, 53);
}
#endregion
public FEditConfig(FConfigSetup fts)
{
InitializeComponent();
gFTS = fts;
}
private void FEditTolerance_Load(object sender, EventArgs e)
{
rtbCarName.Text = gFTS.dgvTolList.Rows[gFTS.idgvSelectRowNumber].Cells["modelsName"].Value.ToString();
rtbCarType.Text = gFTS.dgvTolList.Rows[gFTS.idgvSelectRowNumber].Cells["modelsCode"].Value.ToString();
rtb_sourceFilePath.Text = gFTS.dgvTolList.Rows[gFTS.idgvSelectRowNumber].Cells["sourceFile"].Value.ToString();
rtb_targetFilePath.Text = gFTS.dgvTolList.Rows[gFTS.idgvSelectRowNumber].Cells["targetFile"].Value.ToString();
string strReadTyple = gFTS.dgvTolList.Rows[gFTS.idgvSelectRowNumber].Cells["readType"].Value.ToString();
if (strReadTyple.Equals("1") || strReadTyple.Equals("2"))
{
rddl_ReadType.Text = "文件内容";
}
else
{
rddl_ReadType.SelectedIndex = -1; // 未匹配到,设置为无选中项
}
string strPosition = gFTS.dgvTolList.Rows[gFTS.idgvSelectRowNumber].Cells["position"].Value.ToString();
if (strPosition.Equals("L"))
{
rddl_Position.Text = "左侧";
}
else if (strPosition.Equals("R"))
{
rddl_Position.Text = "右侧";
}
else
{
rddl_Position.SelectedIndex = -1; // 未匹配到,设置为无选中项
}
string strStatus = gFTS.dgvTolList.Rows[gFTS.idgvSelectRowNumber].Cells["status"].Value.ToString();
if (strStatus.Equals("start"))
{
rddl_Status.Text = "启动";
}
else if (strStatus.Equals("stop"))
{
rddl_Status.Text = "停止";
}
else
{
rddl_Status.SelectedIndex = -1; // 未匹配到,设置为无选中项
}
}
private void rbtnOK_Click(object sender, EventArgs e)
{
#region
string strCarName = rtbCarName.Text.Trim();
string strCarType = rtbCarType.Text.Trim();
string strReadType = rddl_ReadType.Text.Trim();
string strPosition = rddl_Position.Text.Trim();
string strStatus = rddl_Status.Text.Trim();
if (string.IsNullOrEmpty(rtbCarName.Text.Trim()))
{
MessageBox.Show("车型名称不能为空,请重新输入! ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (string.IsNullOrEmpty(rtbCarType.Text.Trim()))
{
MessageBox.Show("车型代码不能为空,请重新输入! ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (string.IsNullOrEmpty(rtb_sourceFilePath.Text.Trim()))
{
MessageBox.Show("源文件路径不能为空,请重新输入! ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (string.IsNullOrEmpty(rtb_targetFilePath.Text.Trim()))
{
MessageBox.Show("目标文件路径不能为空,请重新输入! ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
// 对于分发配置,strReadType 进行转换,文件内容对应1,文件名称对应2
if (string.IsNullOrEmpty(strReadType) || (strReadType != "文件内容" && strReadType != "文件名称"))
{
MessageBox.Show("请选择正确的读取类型! ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (strReadType.Equals("文件名称"))
{
strReadType = "2";
}
else if (strReadType.Equals("文件内容"))
{
strReadType = "1";
}
#endregion
try
{
CjlrTaskReleaseModel cjlrTaskRelease = new CjlrTaskReleaseModel
{
Id = int.Parse(gFTS.dgvTolList.Rows[gFTS.idgvSelectRowNumber].Cells["Id"].Value.ToString()),
ModelsName = strCarName,
ModelsCode = strCarType,
Position = strPosition.Equals("左侧") ? "L" : "R",
SourceFile = rtb_sourceFilePath.Text.Trim(),
TargetFile = rtb_targetFilePath.Text.Trim(),
Status = strStatus.Equals("启动") ? "start" : "stop",
CreateDate = DateTime.Now,
IsDelete = 1, //未删除
ReadType = int.Parse(strReadType)
};
tmdal.UpdateTaskRelease(cjlrTaskRelease);
}
catch (Exception ex)
{
MessageBox.Show("修改分发配置失败,原因:" + ex.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
MessageBox.Show("修改分发配置成功! ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
gFTS.rtbnSearch_Click(null, null);
this.Close();
}
private void rbtnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void btn_sourceFile_Click(object sender, EventArgs e)
{
// 文件路径对话框
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog
{
Description = "请选择源文件所在的文件夹",
ShowNewFolderButton = true
};
if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
{
rtb_sourceFilePath.Text = folderBrowserDialog.SelectedPath; // 设置源文件路径
}
else
{
// 显示未选择文件夹的提示信息
MessageBox.Show("未选择源文件夹", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void btn_targetFile_Click(object sender, EventArgs e)
{
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog
{
Description = "请选择目标文件所在的文件夹",
ShowNewFolderButton = true
};
if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
{
rtb_targetFilePath.Text = folderBrowserDialog.SelectedPath; // 设置目标文件路径
}
else
{
// 显示未选择文件夹的提示信息
MessageBox.Show("未选择目标文件夹", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}