|
|
@ -93,7 +93,9 @@ namespace Stone.WinBiz.JISAdmin |
|
|
|
DateTime StartTime = DateTime.Now; |
|
|
|
|
|
|
|
var partMsg = ""; |
|
|
|
if (file.Name.ToUpper().IndexOf("DEL") >= 0) |
|
|
|
//LAB 调整
|
|
|
|
// if (file.Name.ToUpper().IndexOf("DEL") >= 0)
|
|
|
|
if (file.Name.ToUpper().IndexOf("VDA") >= 0) |
|
|
|
{ |
|
|
|
ProcessDataLab(text, fileType, file.Name, out partMsg); //解析LAB数据
|
|
|
|
} |
|
|
@ -213,8 +215,14 @@ namespace Stone.WinBiz.JISAdmin |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void ProcessDataLab(string text, string fileType, string filename,out string Msg) |
|
|
|
/// <summary>
|
|
|
|
/// By jinhao 20250407 LAB格式调整前
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="text"></param>
|
|
|
|
/// <param name="fileType"></param>
|
|
|
|
/// <param name="filename"></param>
|
|
|
|
/// <param name="Msg"></param>
|
|
|
|
private static void ProcessDataLab_Old(string text, string fileType, string filename,out string Msg) |
|
|
|
{ |
|
|
|
|
|
|
|
Entity_t_JIS_Lab t_JIS_Lab = new Entity_t_JIS_Lab(); |
|
|
@ -258,7 +266,6 @@ namespace Stone.WinBiz.JISAdmin |
|
|
|
{ |
|
|
|
partRelese.PartCode = sp_line[1].Split(':')[0]; |
|
|
|
} |
|
|
|
|
|
|
|
if (sp_line[0] == "ADI") |
|
|
|
{ |
|
|
|
partRelese.Release = sp_line[1].Trim(); |
|
|
@ -603,6 +610,552 @@ namespace Stone.WinBiz.JISAdmin |
|
|
|
Msg = strPartMsg; |
|
|
|
} |
|
|
|
|
|
|
|
private static void ProcessDataLab(string text, string fileType, string filename, out string Msg) |
|
|
|
{ |
|
|
|
|
|
|
|
Entity_t_JIS_Lab t_JIS_Lab = new Entity_t_JIS_Lab(); |
|
|
|
Entity_t_Product t_Product = new Entity_t_Product(); |
|
|
|
|
|
|
|
LocalDBService db = new LocalDBService(); |
|
|
|
|
|
|
|
text = text.Replace("\r\n", "").Replace("\r", "").Replace("\n", ""); |
|
|
|
string[] sp_text = text.Split('\''); |
|
|
|
|
|
|
|
string version = string.Empty; |
|
|
|
string releaseId = string.Empty; |
|
|
|
string partNumber = string.Empty; |
|
|
|
string partDesc = string.Empty; |
|
|
|
string orderNumber = string.Empty; |
|
|
|
string status = string.Empty; |
|
|
|
string startDate = string.Empty; |
|
|
|
string endDate = string.Empty; |
|
|
|
string quantity = string.Empty; |
|
|
|
string cumulativeQuantity = string.Empty; |
|
|
|
string location = string.Empty; |
|
|
|
string LocationCode = string.Empty; |
|
|
|
string time = ""; |
|
|
|
|
|
|
|
StringBuilder sqls = new StringBuilder(); |
|
|
|
string sql = ""; |
|
|
|
List<string> items = new List<string>(); |
|
|
|
|
|
|
|
var strPartMsg = ""; |
|
|
|
var strPartRelease = ""; |
|
|
|
//卸货点新增
|
|
|
|
var alertMsg1 = ""; |
|
|
|
//卸货点与代码不匹配
|
|
|
|
var alertMsg2 = ""; |
|
|
|
//卸货点失效
|
|
|
|
var alertMsg3 = ""; |
|
|
|
//零件新增
|
|
|
|
var alertMsg4 = ""; |
|
|
|
//零件失效
|
|
|
|
var alertMsg5 = ""; |
|
|
|
//零件ReleaseID 不连续
|
|
|
|
var alertMsg6 = ""; |
|
|
|
status = "1"; |
|
|
|
|
|
|
|
//获取零件对应的版本号 add by jinh 20220419
|
|
|
|
//版本号在需求日期之后,目前是在需求日期处进行的数据插入
|
|
|
|
var lstPartRelease = new List<PartRelease>(); |
|
|
|
var partRelese = new PartRelease(); |
|
|
|
|
|
|
|
foreach (var line_text in sp_text) |
|
|
|
{ |
|
|
|
if (line_text.Trim() == "") continue; |
|
|
|
string[] sp_line = line_text.Split('+'); |
|
|
|
var partCode = ""; |
|
|
|
var release = ""; |
|
|
|
//LAB调整 LIN+1++5A0B549-00:IN ARD+7360674-02::MDL DISK HEADREST SUPPORT
|
|
|
|
// if (sp_line[0] == "ARD")
|
|
|
|
if (sp_line[0] == "LIN") |
|
|
|
{ |
|
|
|
// partRelese.PartCode = sp_line[1].Split(':')[0];
|
|
|
|
partRelese.PartCode = sp_line[3].Split(':')[0]; |
|
|
|
} |
|
|
|
//LAB调整 RFF+AAN:1747' ADI+00001509+220308
|
|
|
|
// if (sp_line[0] == "ADI")
|
|
|
|
if (sp_line[0] == "RFF" && sp_line[1].Substring(0, 3) == "AAN") |
|
|
|
{ |
|
|
|
// partRelese.Release = sp_line[1].Trim();
|
|
|
|
partRelese.Release = sp_line[1].Split(':')[1].Trim(); |
|
|
|
//校验ReleaseID是否按顺序生成
|
|
|
|
var strsql = ""; |
|
|
|
strsql = "select top 1 * from t_JIS_Lab_All where partNumber = '" + partRelese.PartCode + "' order by id desc"; |
|
|
|
var dsPartRelease = db.Exec_DataSet(strsql); |
|
|
|
if (dsPartRelease.Tables[0].Rows.Count > 0) |
|
|
|
{ |
|
|
|
var strRelese = dsPartRelease.Tables[0].Rows[0]["releaseId"].ToString(); |
|
|
|
if((int.Parse(strRelese)-int.Parse(partRelese.Release)) != 1) |
|
|
|
{ |
|
|
|
strPartRelease += "零件号 " + partRelese.PartCode + " releaseId " + partRelese.Release + "与之前Lab文件的 releaseId " + strRelese + "不延续!" ; |
|
|
|
alertMsg6 += "零件号 " + partRelese.PartCode + " releaseId " + partRelese.Release + "与之前Lab文件的 releaseId " + strRelese + "不延续!" + Environment.NewLine; |
|
|
|
} |
|
|
|
} |
|
|
|
lstPartRelease.Add(partRelese); |
|
|
|
partRelese = new PartRelease(); |
|
|
|
} |
|
|
|
} |
|
|
|
//如果版本不连续,抛出异常,解析失败 考虑抛出在数据库中设置
|
|
|
|
if (alertMsg6.Trim() != "") |
|
|
|
{ |
|
|
|
//通过前台配置ReleaseID不联系是否继续接续
|
|
|
|
var strsql = "select top 1 * from t_ErrTypeLevel where Code = '00' order by id desc"; |
|
|
|
var dsErrLevel = db.Exec_DataSet(strsql); |
|
|
|
if (dsErrLevel.Tables[0].Rows.Count > 0) |
|
|
|
{ |
|
|
|
var errLevel = dsErrLevel.Tables[0].Rows[0]["ErrLevel"].ToString(); |
|
|
|
if (errLevel == "0") |
|
|
|
{ |
|
|
|
throw new Exception(strPartRelease); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
foreach (string line_text in sp_text) |
|
|
|
{ |
|
|
|
if (line_text.Trim() == "") continue; |
|
|
|
string[] sp_line = line_text.Split('+'); |
|
|
|
//ARD+2972240-04::DS FINISHER BLACK+:00+I297224004+++-0
|
|
|
|
//LIN+1++5A0B549-00:IN
|
|
|
|
if (sp_line[0] == "LIN") |
|
|
|
{ |
|
|
|
partNumber = sp_line[3].Split(':')[0]; |
|
|
|
sql = $"delete from t_JIS_Lab where [fileType]='{fileType}' and [partNumber]='{partNumber}'"; |
|
|
|
sqls.AppendLine(sql); |
|
|
|
|
|
|
|
if (sqls.Length > 20000) |
|
|
|
{ |
|
|
|
db.Exec_NonQuery(sqls.ToString()); |
|
|
|
sqls = new StringBuilder(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
int i = 1; |
|
|
|
foreach (string line_text in sp_text) |
|
|
|
{ |
|
|
|
i++; |
|
|
|
if (i == 41) |
|
|
|
{ |
|
|
|
i = i; |
|
|
|
} |
|
|
|
|
|
|
|
if (line_text.Trim() == "") continue; |
|
|
|
string[] sp_line = line_text.Split('+'); |
|
|
|
//DTM+2' continue
|
|
|
|
if (sp_line[0] == "DTM" && sp_line[1].Split(':').Length <3) |
|
|
|
{ |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
//UNB+UNOA:1+O01770000000000X00A+O0177X1BH000000+220308:1458+S2022/6 -7++DELINS
|
|
|
|
//UNB+UNOC:3+O01770000000000X00ATEST+O0177X1BH000000TEST+250307:1500+000000001 新LAB
|
|
|
|
if (sp_line[0] == "UNB") |
|
|
|
{ |
|
|
|
version = sp_line[5]; |
|
|
|
|
|
|
|
time = "20" + sp_line[4].Split(':')[0] + sp_line[4].Split(':')[1]; |
|
|
|
} |
|
|
|
|
|
|
|
//if (sp_line[0] == "MID")
|
|
|
|
//{
|
|
|
|
// releaseId = sp_line[1];
|
|
|
|
// releaseIdNew = releaseId.Replace("S", "").Replace("/", "").Replace("-", "").Replace(" ", "0");
|
|
|
|
|
|
|
|
//}
|
|
|
|
// if (sp_line[0] == "PDI")
|
|
|
|
// if (sp_line[0] == "ADI")
|
|
|
|
// {
|
|
|
|
// releaseId = sp_line[1].Trim();
|
|
|
|
// }
|
|
|
|
|
|
|
|
//新LAB未找到该点 赋固定值
|
|
|
|
// if (sp_line[0] == "SAD")
|
|
|
|
// {
|
|
|
|
// status = sp_line[1];
|
|
|
|
// }
|
|
|
|
|
|
|
|
// ARD ARD+2972240-04::DS FINISHER BLACK+:00+I297224004+++-0
|
|
|
|
//LIN+1++5A0B549-00:IN
|
|
|
|
if (sp_line[0] == "LIN") |
|
|
|
{ |
|
|
|
partNumber = sp_line[3].Split(':')[0]; |
|
|
|
// partDesc = sp_line[1].Split(':')[2];
|
|
|
|
// orderNumber = sp_line[3];
|
|
|
|
//add by jinh 20220419 从list获取该零件的版本号
|
|
|
|
releaseId = lstPartRelease.FirstOrDefault(p => p.PartCode == partNumber).Release; |
|
|
|
} |
|
|
|
//新LAB 获取零件描述
|
|
|
|
//IMD+F++::272: REINFORCEMENT SILL TOP LH G20:F'
|
|
|
|
if (sp_line[0] == "IMD") |
|
|
|
{ |
|
|
|
partDesc = sp_line[3].Split(':')[3]; |
|
|
|
} |
|
|
|
//新LAB 获取采购订单号
|
|
|
|
//RFF+ON:N5A0B54900:00010'
|
|
|
|
if (sp_line[0] == "RFF" && sp_line[1].Substring(0,2) == "ON") |
|
|
|
{ |
|
|
|
orderNumber = sp_line[1].Split(':')[1]; |
|
|
|
|
|
|
|
//校验零件号是否失效
|
|
|
|
var strsql = ""; |
|
|
|
strsql = "select top 1 * from t_Product where Code = '" + partNumber + "' order by id desc"; |
|
|
|
var dsProd = db.Exec_DataSet(strsql); |
|
|
|
if (dsProd.Tables[0].Rows.Count > 0) |
|
|
|
{ |
|
|
|
var strState = dsProd.Tables[0].Rows[0]["State"].ToString(); |
|
|
|
if (strState == "0" || string.IsNullOrEmpty(strState)) |
|
|
|
{ |
|
|
|
strPartMsg += "零件号 " + partNumber + " 已失效!" + Environment.NewLine; |
|
|
|
alertMsg5 += "零件号 " + partNumber + " 已失效!" + Environment.NewLine; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
strPartMsg += "零件号," + partNumber + "," + partDesc + ",未定义!" + Environment.NewLine; |
|
|
|
alertMsg4 += "零件号," + partNumber + "," + partDesc + ",未定义!" + Environment.NewLine; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//CSG+15288009:BMW BRILLIANCE AUTOMOTIVE LTD.:**********:::*******14*+:BMW BRILLIANCE AUTOMOTIVE LTD.+AS05+CN
|
|
|
|
//NAD+BY+19461010::92 新LAB
|
|
|
|
if (sp_line[0] == "NAD" && sp_line[1] == "BY") |
|
|
|
{ |
|
|
|
LocationCode = sp_line[2].Split(':')[0]; |
|
|
|
} |
|
|
|
|
|
|
|
//新LAB 获取 location
|
|
|
|
//LOC+11+TBL1::92'
|
|
|
|
if (sp_line[0] == "LOC" && sp_line[1] == "11") |
|
|
|
{ |
|
|
|
location = sp_line[2].Split(':')[0]; |
|
|
|
//校验卸货点是否失效
|
|
|
|
var strsql = ""; |
|
|
|
strsql = "select top 1 * from t_Location where Code = '" + location + "' order by id desc"; |
|
|
|
var dsLoc = db.Exec_DataSet(strsql); |
|
|
|
if (dsLoc.Tables[0].Rows.Count > 0) |
|
|
|
{ |
|
|
|
var strState = dsLoc.Tables[0].Rows[0]["State"].ToString(); |
|
|
|
if (strState == "0" || string.IsNullOrEmpty(strState)) |
|
|
|
{ |
|
|
|
strPartMsg += "卸货点 " + location + " 已失效!" + Environment.NewLine; |
|
|
|
alertMsg3 += "卸货点 " + location + " 已失效!" + Environment.NewLine; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
strPartMsg += "卸货点 " + location + " 未在系统中定义!" + Environment.NewLine; |
|
|
|
alertMsg1 += "卸货点 " + location + " 未在系统中定义!" + Environment.NewLine; |
|
|
|
} |
|
|
|
|
|
|
|
//校验卸货点、卸货点代码是否匹配
|
|
|
|
strsql = "select top 1 * from t_Location" + |
|
|
|
" where Code = '" + location + "'" + |
|
|
|
//" and (LocCode1 = '" + LocationCode + "' or LocCode2 = '" + LocationCode + "' or LocCode3 = '" + LocationCode + "' or LocCode4 = '" + LocationCode + "')"+
|
|
|
|
" and (LocCode1 = '" + LocationCode + "')" + |
|
|
|
" order by id desc"; |
|
|
|
dsLoc = db.Exec_DataSet(strsql); |
|
|
|
if (dsLoc.Tables[0].Rows.Count == 0) |
|
|
|
{ |
|
|
|
strPartMsg += "卸货点 " + location + " 对应的代码 " + LocationCode + " 未在系统中定义!" + Environment.NewLine; |
|
|
|
alertMsg2 += "卸货点 " + location + " 对应的代码 " + LocationCode + " 未在系统中定义!" + Environment.NewLine; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//DST+220308+242798:173410::000000
|
|
|
|
// QTY + 70:116053:PCE'
|
|
|
|
if (sp_line[0] == "QTY" && sp_line[1].Split(':')[0].ToString() == "70") |
|
|
|
{ |
|
|
|
cumulativeQuantity = sp_line[1].Split(':')[1]; |
|
|
|
} |
|
|
|
|
|
|
|
//DEL+220307::220307+0::0::196
|
|
|
|
//DTM+2:20231106:102' 日计划触发一次保存
|
|
|
|
// SCC + 24 Group is transfer daily demand to supplier;
|
|
|
|
// SCC + 4 Group is transfer period demand to supplier;
|
|
|
|
//获取日计划的数量
|
|
|
|
//QTY+113:720:PCE'
|
|
|
|
if (sp_line[0] == "QTY" && sp_line[1].Split(':')[0].ToString() == "113") |
|
|
|
{ |
|
|
|
quantity = sp_line[1].Split(':')[1]; |
|
|
|
} |
|
|
|
//DTM+2:20231106:102' 日计划触发一次保存
|
|
|
|
if (sp_line[0] == "DTM" && sp_line[1].Split(':')[0].ToString() == "2") |
|
|
|
{ |
|
|
|
startDate = sp_line[1].Split(':')[1]; |
|
|
|
endDate = sp_line[1].Split(':')[1]; |
|
|
|
startDate = GetDateTimeStyle4(startDate, MyDateTimeType.Date); |
|
|
|
endDate = GetDateTimeStyle4(endDate, MyDateTimeType.Date); |
|
|
|
|
|
|
|
object[] obj = new object[14]; |
|
|
|
obj[0] = partNumber; |
|
|
|
obj[1] = startDate; |
|
|
|
obj[2] = endDate; |
|
|
|
obj[3] = GetDateTimeStyle1(time, MyDateTimeType.DateTime); |
|
|
|
obj[4] = releaseId; |
|
|
|
obj[5] = location; |
|
|
|
obj[6] = orderNumber; |
|
|
|
obj[7] = cumulativeQuantity; |
|
|
|
obj[8] = quantity; |
|
|
|
obj[9] = status; |
|
|
|
obj[10] = fileType; |
|
|
|
obj[11] = version; |
|
|
|
obj[12] = LocationCode; |
|
|
|
obj[13] = filename; |
|
|
|
|
|
|
|
//插入新的数据(当前数据)
|
|
|
|
sql = @"
|
|
|
|
insert into t_JIS_Lab(partNumber, startDate, endDate, [time], releaseId, location, orderNumber, cumulativeQuantity, quantity, [status], [fileType], [version], [LocationCode], [filename]) |
|
|
|
values('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', {7}, {8}, {9}, '{10}', '{11}', '{12}', '{13}') |
|
|
|
";
|
|
|
|
sql = string.Format(sql, obj); |
|
|
|
sqls.AppendLine(sql); |
|
|
|
|
|
|
|
|
|
|
|
//插入新的数据(版本对比)
|
|
|
|
sql = @"
|
|
|
|
insert into t_JIS_Lab_All(partNumber, startDate, endDate, [time], releaseId, location, orderNumber, cumulativeQuantity, quantity, [status], [fileType], [version], [LocationCode], [filename]) |
|
|
|
values('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', {7}, {8}, {9}, '{10}', '{11}', '{12}', '{13}') |
|
|
|
";
|
|
|
|
sql = string.Format(sql, obj); |
|
|
|
sqls.AppendLine(sql); |
|
|
|
|
|
|
|
|
|
|
|
//更新采购订单号
|
|
|
|
//sql = $"update t_Product set [StandardNo]='{orderNumber}' where [Code]='{partNumber}'";
|
|
|
|
//sqls.AppendLine(sql);
|
|
|
|
|
|
|
|
|
|
|
|
if (sqls.Length > 20000) |
|
|
|
{ |
|
|
|
db.Exec_NonQuery(sqls.ToString()); |
|
|
|
sqls = new StringBuilder(); |
|
|
|
} |
|
|
|
} |
|
|
|
//获取周期计划的数量
|
|
|
|
//QTY+113:410:PCE' 和日计划的数量取数逻辑一样
|
|
|
|
if (sp_line[0] == "QTY" && sp_line[1].Split(':')[0].ToString() == "113") |
|
|
|
{ |
|
|
|
quantity = sp_line[1].Split(':')[1]; |
|
|
|
} |
|
|
|
//获取周期计划的 开始时间
|
|
|
|
// DTM + 64:20241111:102'
|
|
|
|
if (sp_line[0] == "DTM" && sp_line[1].Split(':')[0].ToString() == "64") |
|
|
|
{ |
|
|
|
startDate = sp_line[1].Split(':')[1]; |
|
|
|
} |
|
|
|
|
|
|
|
//获取周期计划的 结束时间 并保存
|
|
|
|
// DTM + 63:20241117:102'
|
|
|
|
if (sp_line[0] == "DTM" && sp_line[1].Split(':')[0].ToString() == "63") |
|
|
|
{ |
|
|
|
endDate = sp_line[1].Split(':')[1]; |
|
|
|
startDate = GetDateTimeStyle4(startDate, MyDateTimeType.Date); |
|
|
|
endDate = GetDateTimeStyle4(endDate, MyDateTimeType.Date); |
|
|
|
|
|
|
|
object[] obj = new object[14]; |
|
|
|
obj[0] = partNumber; |
|
|
|
obj[1] = startDate; |
|
|
|
obj[2] = endDate; |
|
|
|
obj[3] = GetDateTimeStyle1(time, MyDateTimeType.DateTime); |
|
|
|
obj[4] = releaseId; |
|
|
|
obj[5] = location; |
|
|
|
obj[6] = orderNumber; |
|
|
|
obj[7] = cumulativeQuantity; |
|
|
|
obj[8] = quantity; |
|
|
|
obj[9] = status; |
|
|
|
obj[10] = fileType; |
|
|
|
obj[11] = version; |
|
|
|
obj[12] = LocationCode; |
|
|
|
obj[13] = filename; |
|
|
|
|
|
|
|
//插入新的数据(当前数据)
|
|
|
|
sql = @"
|
|
|
|
insert into t_JIS_Lab(partNumber, startDate, endDate, [time], releaseId, location, orderNumber, cumulativeQuantity, quantity, [status], [fileType], [version], [LocationCode], [filename]) |
|
|
|
values('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', {7}, {8}, {9}, '{10}', '{11}', '{12}', '{13}') |
|
|
|
";
|
|
|
|
sql = string.Format(sql, obj); |
|
|
|
sqls.AppendLine(sql); |
|
|
|
|
|
|
|
//插入新的数据(版本对比)
|
|
|
|
sql = @"
|
|
|
|
insert into t_JIS_Lab_All(partNumber, startDate, endDate, [time], releaseId, location, orderNumber, cumulativeQuantity, quantity, [status], [fileType], [version], [LocationCode], [filename]) |
|
|
|
values('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', {7}, {8}, {9}, '{10}', '{11}', '{12}', '{13}') |
|
|
|
";
|
|
|
|
sql = string.Format(sql, obj); |
|
|
|
sqls.AppendLine(sql); |
|
|
|
|
|
|
|
if (sqls.Length > 20000) |
|
|
|
{ |
|
|
|
db.Exec_NonQuery(sqls.ToString()); |
|
|
|
sqls = new StringBuilder(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (sqls.ToString() != "") |
|
|
|
{ |
|
|
|
db.Exec_NonQuery(sqls.ToString()); |
|
|
|
sqls = new StringBuilder(); |
|
|
|
} |
|
|
|
|
|
|
|
if (strPartMsg != "") |
|
|
|
{ |
|
|
|
var strsql = ""; |
|
|
|
var dsErrMail = new DataSet(); |
|
|
|
if (alertMsg1 != "") |
|
|
|
{ |
|
|
|
alertMsg1 = filename + " " + alertMsg1; |
|
|
|
strsql = "select top 1 * from t_ErrTypeLevel" + |
|
|
|
" where Code = '02'" + |
|
|
|
" order by id desc"; |
|
|
|
dsErrMail = db.Exec_DataSet(strsql); |
|
|
|
if (dsErrMail.Tables[0].Rows.Count > 0) |
|
|
|
{ |
|
|
|
//获取收件人
|
|
|
|
var mailTo = dsErrMail.Tables[0].Rows[0]["ToPerson"].ToString(); |
|
|
|
var errLvevl = dsErrMail.Tables[0].Rows[0]["ErrLevel"].ToString(); |
|
|
|
var errTypeDesc = dsErrMail.Tables[0].Rows[0]["ErrTypeDesc"].ToString(); |
|
|
|
//设置邮件标题
|
|
|
|
var title = ""; |
|
|
|
title = "LAB解析异常-错误级别-" + errLvevl + "-" + errTypeDesc; |
|
|
|
F_Mail.Send(title, alertMsg1, mailTo); |
|
|
|
|
|
|
|
//插入报警信息
|
|
|
|
var operCode = dsErrMail.Tables[0].Rows[0]["OperCode"].ToString(); |
|
|
|
strsql = "Insert into t_Error_Log(OperCode,Msg) values ('" + operCode + "','" + alertMsg1 + "')"; |
|
|
|
db.Exec_NonQuery(strsql); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (alertMsg2 != "") |
|
|
|
{ |
|
|
|
alertMsg2 = filename + " " + alertMsg2; |
|
|
|
strsql = "select top 1 * from t_ErrTypeLevel" + |
|
|
|
" where Code = '03'" + |
|
|
|
" order by id desc"; |
|
|
|
dsErrMail = db.Exec_DataSet(strsql); |
|
|
|
if (dsErrMail.Tables[0].Rows.Count > 0) |
|
|
|
{ |
|
|
|
//获取收件人
|
|
|
|
var mailTo = dsErrMail.Tables[0].Rows[0]["ToPerson"].ToString(); |
|
|
|
var errLvevl = dsErrMail.Tables[0].Rows[0]["ErrLevel"].ToString(); |
|
|
|
var errTypeDesc = dsErrMail.Tables[0].Rows[0]["ErrTypeDesc"].ToString(); |
|
|
|
//设置邮件标题
|
|
|
|
var title = ""; |
|
|
|
title = "LAB解析异常-错误级别-" + errLvevl + "-" + errTypeDesc; |
|
|
|
F_Mail.Send(title, alertMsg2, mailTo); |
|
|
|
|
|
|
|
//插入报警信息
|
|
|
|
var operCode = dsErrMail.Tables[0].Rows[0]["OperCode"].ToString(); |
|
|
|
strsql = "Insert into t_Error_Log(OperCode,Msg) values ('" + operCode + "','" + alertMsg2 + "')"; |
|
|
|
db.Exec_NonQuery(strsql); |
|
|
|
} |
|
|
|
} |
|
|
|
if (alertMsg3 != "") |
|
|
|
{ |
|
|
|
alertMsg3 = filename + " " + alertMsg3; |
|
|
|
strsql = "select top 1 * from t_ErrTypeLevel" + |
|
|
|
" where Code = '04'" + |
|
|
|
" order by id desc"; |
|
|
|
dsErrMail = db.Exec_DataSet(strsql); |
|
|
|
if (dsErrMail.Tables[0].Rows.Count > 0) |
|
|
|
{ |
|
|
|
//获取收件人
|
|
|
|
var mailTo = dsErrMail.Tables[0].Rows[0]["ToPerson"].ToString(); |
|
|
|
var errLvevl = dsErrMail.Tables[0].Rows[0]["ErrLevel"].ToString(); |
|
|
|
var errTypeDesc = dsErrMail.Tables[0].Rows[0]["ErrTypeDesc"].ToString(); |
|
|
|
//设置邮件标题
|
|
|
|
var title = ""; |
|
|
|
title = "LAB解析异常-错误级别-" + errLvevl + "-" + errTypeDesc; |
|
|
|
F_Mail.Send(title, alertMsg3, mailTo); |
|
|
|
|
|
|
|
//插入报警信息
|
|
|
|
var operCode = dsErrMail.Tables[0].Rows[0]["OperCode"].ToString(); |
|
|
|
strsql = "Insert into t_Error_Log(OperCode,Msg) values ('" + operCode + "','" + alertMsg3 + "')"; |
|
|
|
db.Exec_NonQuery(strsql); |
|
|
|
} |
|
|
|
} |
|
|
|
if (alertMsg4 != "") |
|
|
|
{ |
|
|
|
alertMsg4 = filename + " " + alertMsg4; |
|
|
|
strsql = "select top 1 * from t_ErrTypeLevel" + |
|
|
|
" where Code = '05'" + |
|
|
|
" order by id desc"; |
|
|
|
dsErrMail = db.Exec_DataSet(strsql); |
|
|
|
if (dsErrMail.Tables[0].Rows.Count > 0) |
|
|
|
{ |
|
|
|
//获取收件人
|
|
|
|
var mailTo = dsErrMail.Tables[0].Rows[0]["ToPerson"].ToString(); |
|
|
|
var errLvevl = dsErrMail.Tables[0].Rows[0]["ErrLevel"].ToString(); |
|
|
|
var errTypeDesc = dsErrMail.Tables[0].Rows[0]["ErrTypeDesc"].ToString(); |
|
|
|
//设置邮件标题
|
|
|
|
var title = ""; |
|
|
|
title = "LAB解析异常-错误级别-" + errLvevl + "-" + errTypeDesc; |
|
|
|
F_Mail.Send(title, alertMsg4, mailTo); |
|
|
|
|
|
|
|
//插入报警信息
|
|
|
|
var operCode = dsErrMail.Tables[0].Rows[0]["OperCode"].ToString(); |
|
|
|
strsql = "Insert into t_Error_Log(OperCode,Msg) values ('" + operCode + "','" + alertMsg4 + "')"; |
|
|
|
db.Exec_NonQuery(strsql); |
|
|
|
} |
|
|
|
} |
|
|
|
if (alertMsg5 != "") |
|
|
|
{ |
|
|
|
alertMsg5 = filename + " " + alertMsg5; |
|
|
|
strsql = "select top 1 * from t_ErrTypeLevel" + |
|
|
|
" where Code = '06'" + |
|
|
|
" order by id desc"; |
|
|
|
dsErrMail = db.Exec_DataSet(strsql); |
|
|
|
if (dsErrMail.Tables[0].Rows.Count > 0) |
|
|
|
{ |
|
|
|
//获取收件人
|
|
|
|
var mailTo = dsErrMail.Tables[0].Rows[0]["ToPerson"].ToString(); |
|
|
|
var errLvevl = dsErrMail.Tables[0].Rows[0]["ErrLevel"].ToString(); |
|
|
|
var errTypeDesc = dsErrMail.Tables[0].Rows[0]["ErrTypeDesc"].ToString(); |
|
|
|
//设置邮件标题
|
|
|
|
var title = ""; |
|
|
|
title = "LAB解析异常-错误级别-" + errLvevl + "-" + errTypeDesc; |
|
|
|
F_Mail.Send(title, alertMsg5, mailTo); |
|
|
|
|
|
|
|
//插入报警信息
|
|
|
|
var operCode = dsErrMail.Tables[0].Rows[0]["OperCode"].ToString(); |
|
|
|
strsql = "Insert into t_Error_Log(OperCode,Msg) values ('" + operCode + "','" + alertMsg5 + "')"; |
|
|
|
db.Exec_NonQuery(strsql); |
|
|
|
} |
|
|
|
} |
|
|
|
if (alertMsg6 != "") |
|
|
|
{ |
|
|
|
alertMsg6 = filename + " " + alertMsg6; |
|
|
|
strsql = "select top 1 * from t_ErrTypeLevel" + |
|
|
|
" where Code = '00'" + |
|
|
|
" order by id desc"; |
|
|
|
dsErrMail = db.Exec_DataSet(strsql); |
|
|
|
if (dsErrMail.Tables[0].Rows.Count > 0) |
|
|
|
{ |
|
|
|
//获取收件人
|
|
|
|
var mailTo = dsErrMail.Tables[0].Rows[0]["ToPerson"].ToString(); |
|
|
|
var errLvevl = dsErrMail.Tables[0].Rows[0]["ErrLevel"].ToString(); |
|
|
|
var errTypeDesc = dsErrMail.Tables[0].Rows[0]["ErrTypeDesc"].ToString(); |
|
|
|
//设置邮件标题
|
|
|
|
var title = ""; |
|
|
|
title = "LAB解析异常-错误级别-" + errLvevl + "-" + errTypeDesc; |
|
|
|
F_Mail.Send(title, alertMsg5, mailTo); |
|
|
|
|
|
|
|
//插入报警信息
|
|
|
|
var operCode = dsErrMail.Tables[0].Rows[0]["OperCode"].ToString(); |
|
|
|
strsql = "Insert into t_Error_Log(OperCode,Msg) values ('" + operCode + "','" + alertMsg6 + "')"; |
|
|
|
db.Exec_NonQuery(strsql); |
|
|
|
} |
|
|
|
} |
|
|
|
strPartMsg = filename + " " + strPartMsg; |
|
|
|
} |
|
|
|
Msg = strPartMsg; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void MoveFile(FileInfo file, string MovePath) |
|
|
|
{ |
|
|
@ -658,10 +1211,11 @@ namespace Stone.WinBiz.JISAdmin |
|
|
|
text = text.Replace("\r\n", "").Replace("\r", "").Replace("\n", ""); |
|
|
|
string[] sp_text = text.Split('\''); |
|
|
|
|
|
|
|
|
|
|
|
if (sp_text[0].Substring(0, 3) != "UNB") |
|
|
|
//LAB 调整
|
|
|
|
// if (sp_text[0].Substring(0, 3) != "UNB")
|
|
|
|
if (sp_text[0].Substring(0, 3) != "UNA") |
|
|
|
{ |
|
|
|
throw new Exception(filename + " 不以UNB开头"); |
|
|
|
throw new Exception(filename + " 不以UNA开头"); |
|
|
|
} |
|
|
|
|
|
|
|
if (sp_text[sp_text.Length - 2].Substring(0, 3) != "UNZ") |
|
|
@ -676,7 +1230,7 @@ namespace Stone.WinBiz.JISAdmin |
|
|
|
|
|
|
|
int segment_count = Convert.ToInt32(sp_text[sp_text.Length - 3].Split('+')[1]); |
|
|
|
|
|
|
|
if (segment_count != sp_text.Length - 3) |
|
|
|
if (segment_count != sp_text.Length - 4) |
|
|
|
{ |
|
|
|
throw new Exception(filename + " Segment 数量不正确"); |
|
|
|
} |
|
|
|