|
|
@ -426,7 +426,7 @@ namespace ZJ_BYD
|
|
|
|
/// <param name="stationCode"></param>
|
|
|
|
/// <param name="stationCode"></param>
|
|
|
|
/// <param name="barCode"></param>
|
|
|
|
/// <param name="barCode"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
public static (bool ok, string msg) SaveDb(string stationCode, string barCode)
|
|
|
|
public static (bool ok, string msg, T_Result _Result) SaveDb(string stationCode, string barCode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (Program.type == null)
|
|
|
|
if (Program.type == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -479,7 +479,7 @@ namespace ZJ_BYD
|
|
|
|
keyValItem.Val = EnumHelper.GetEnumDescription(enumVal);
|
|
|
|
keyValItem.Val = EnumHelper.GetEnumDescription(enumVal);
|
|
|
|
if (keyValItem.Val != "OK" && keyValItem.Val != "NG")
|
|
|
|
if (keyValItem.Val != "OK" && keyValItem.Val != "NG")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return (false, $"一体机数据上传反馈:{keyValItem.KeyDesc}异常={keyValItem.Val},存库NG!");
|
|
|
|
return (false, $"一体机数据上传反馈:{keyValItem.KeyDesc}异常={keyValItem.Val},存库NG!", null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
prop.SetValue(result, Convert.ChangeType(keyValItem.Val, prop.PropertyType));
|
|
|
|
prop.SetValue(result, Convert.ChangeType(keyValItem.Val, prop.PropertyType));
|
|
|
@ -488,18 +488,18 @@ namespace ZJ_BYD
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
var t_Result = result as T_Result;
|
|
|
|
var t_Result = result as T_Result;
|
|
|
|
t_Result.LineCode = Program.CurrentLineCode;
|
|
|
|
t_Result.LineCode = Program.CurrentLineCode.Replace("\x00", "");
|
|
|
|
t_Result.StationCode = stationCode;
|
|
|
|
t_Result.StationCode = stationCode;
|
|
|
|
//主条码
|
|
|
|
//主条码
|
|
|
|
var M28 = list.FirstOrDefault(m => m.Key == "M28");
|
|
|
|
var M28 = list.FirstOrDefault(m => m.Key == "M28");
|
|
|
|
//重新读取PLc中的主条码 2023-9-20新增逻辑
|
|
|
|
//重新读取PLc中的主条码 2023-9-20新增逻辑
|
|
|
|
var readM28 = PlcHelper.GetPlcVal(M28.DataType, M28.Address);
|
|
|
|
var readM28 = PlcHelper.GetPlcVal(M28.DataType, M28.Address,M28.Length);
|
|
|
|
if (readM28.ok)
|
|
|
|
if (readM28.ok)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
M28.Val = readM28.val.Replace("\r", "");
|
|
|
|
M28.Val = readM28.val.Replace("\r", "");
|
|
|
|
LogHelper.WriteLog($"存本地数据库时,获取到的壳体码={M28.Val}");
|
|
|
|
LogHelper.WriteLog($"存本地数据库时,获取到的壳体码={M28.Val}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
t_Result.ProductSfcCode = M28.Val.Replace("\r", "");
|
|
|
|
t_Result.ProductSfcCode = M28.Val.Replace("\r", "").Replace("\x00", "");
|
|
|
|
//产品总状态
|
|
|
|
//产品总状态
|
|
|
|
var M5 = list.FirstOrDefault(m => m.Key == "M5");
|
|
|
|
var M5 = list.FirstOrDefault(m => m.Key == "M5");
|
|
|
|
if (M5 != null && (M5.Val == "undefined" || M5.Val == "UNDEFINED" || M5.Val == "0.000"))
|
|
|
|
if (M5 != null && (M5.Val == "undefined" || M5.Val == "UNDEFINED" || M5.Val == "0.000"))
|
|
|
@ -518,7 +518,7 @@ namespace ZJ_BYD
|
|
|
|
M5.Val = EnumHelper.GetEnumDescription(enumVal);
|
|
|
|
M5.Val = EnumHelper.GetEnumDescription(enumVal);
|
|
|
|
if (M5.Val != "OK" && M5.Val != "NG")
|
|
|
|
if (M5.Val != "OK" && M5.Val != "NG")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return (false, $"一体机数据上传反馈:产品状态异常={M5.Val},存库NG!");
|
|
|
|
return (false, $"一体机数据上传反馈:产品状态异常={M5.Val},存库NG!", t_Result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -535,7 +535,7 @@ namespace ZJ_BYD
|
|
|
|
t_Result.Category = station.Category;
|
|
|
|
t_Result.Category = station.Category;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
t_Result.TestFileName = Program.testfilename;
|
|
|
|
t_Result.TestFileName = Program.testfilename;
|
|
|
|
t_Result.BarCode = barCode;
|
|
|
|
t_Result.BarCode = barCode.Replace("\x00", "");
|
|
|
|
t_Result.ProgramVersion = Program.programversion;
|
|
|
|
t_Result.ProgramVersion = Program.programversion;
|
|
|
|
t_Result.LoginUser = CurrentUser.UserName;
|
|
|
|
t_Result.LoginUser = CurrentUser.UserName;
|
|
|
|
t_Result.SysMode = Program.SysMode;
|
|
|
|
t_Result.SysMode = Program.SysMode;
|
|
|
@ -549,7 +549,7 @@ namespace ZJ_BYD
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!string.IsNullOrWhiteSpace(subs[i].Val))
|
|
|
|
if (!string.IsNullOrWhiteSpace(subs[i].Val))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
strSubCode += $"{subs[i].Val},";
|
|
|
|
strSubCode += $"{subs[i].Val.Replace("\x00", "")},";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
t_Result.BulkParts = strSubCode.TrimEnd(',');
|
|
|
|
t_Result.BulkParts = strSubCode.TrimEnd(',');
|
|
|
@ -564,22 +564,22 @@ namespace ZJ_BYD
|
|
|
|
if (addResult <= 0)
|
|
|
|
if (addResult <= 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogHelper.WriteLog($"{stationCode}工位,新增结果失败:{JsonConvert.SerializeObject(t_Result)}");
|
|
|
|
LogHelper.WriteLog($"{stationCode}工位,新增结果失败:{JsonConvert.SerializeObject(t_Result)}");
|
|
|
|
return (false, "一体机数据上传反馈:存库NG!");
|
|
|
|
return (false, "一体机数据上传反馈:存库NG!", t_Result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return (true, $"一体机数据上传反馈:存库OK!,产品总状态:{t_Result.TotalStatus}");
|
|
|
|
return (true, $"一体机数据上传反馈:存库OK!,产品总状态:{t_Result.TotalStatus}", t_Result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogHelper.WriteLog($"一体机数据上传反馈:{stationCode}工位存库发生异常:{ex.Message}!");
|
|
|
|
LogHelper.WriteLog($"一体机数据上传反馈:{stationCode}工位存库发生异常:{ex.Message}!");
|
|
|
|
return (false, "一体机数据上传反馈:存库NG!");
|
|
|
|
return (false, "一体机数据上传反馈:存库NG!",null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return (false, "一体机数据上传反馈:存库NG!");
|
|
|
|
return (false, "一体机数据上传反馈:存库NG!", null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|