|
|
|
@ -426,7 +426,7 @@ namespace ZJ_BYD
|
|
|
|
|
/// <param name="stationCode"></param>
|
|
|
|
|
/// <param name="barCode"></param>
|
|
|
|
|
/// <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)
|
|
|
|
|
{
|
|
|
|
@ -479,7 +479,7 @@ namespace ZJ_BYD
|
|
|
|
|
keyValItem.Val = EnumHelper.GetEnumDescription(enumVal);
|
|
|
|
|
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));
|
|
|
|
@ -488,18 +488,18 @@ namespace ZJ_BYD
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
var t_Result = result as T_Result;
|
|
|
|
|
t_Result.LineCode = Program.CurrentLineCode;
|
|
|
|
|
t_Result.LineCode = Program.CurrentLineCode.Replace("\x00", "");
|
|
|
|
|
t_Result.StationCode = stationCode;
|
|
|
|
|
//主条码
|
|
|
|
|
var M28 = list.FirstOrDefault(m => m.Key == "M28");
|
|
|
|
|
//重新读取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)
|
|
|
|
|
{
|
|
|
|
|
M28.Val = readM28.val.Replace("\r", "");
|
|
|
|
|
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");
|
|
|
|
|
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);
|
|
|
|
|
if (M5.Val != "OK" && M5.Val != "NG")
|
|
|
|
|
{
|
|
|
|
|
return (false, $"一体机数据上传反馈:产品状态异常={M5.Val},存库NG!");
|
|
|
|
|
return (false, $"一体机数据上传反馈:产品状态异常={M5.Val},存库NG!", t_Result);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -535,7 +535,7 @@ namespace ZJ_BYD
|
|
|
|
|
t_Result.Category = station.Category;
|
|
|
|
|
}
|
|
|
|
|
t_Result.TestFileName = Program.testfilename;
|
|
|
|
|
t_Result.BarCode = barCode;
|
|
|
|
|
t_Result.BarCode = barCode.Replace("\x00", "");
|
|
|
|
|
t_Result.ProgramVersion = Program.programversion;
|
|
|
|
|
t_Result.LoginUser = CurrentUser.UserName;
|
|
|
|
|
t_Result.SysMode = Program.SysMode;
|
|
|
|
@ -549,7 +549,7 @@ namespace ZJ_BYD
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(subs[i].Val))
|
|
|
|
|
{
|
|
|
|
|
strSubCode += $"{subs[i].Val},";
|
|
|
|
|
strSubCode += $"{subs[i].Val.Replace("\x00", "")},";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
t_Result.BulkParts = strSubCode.TrimEnd(',');
|
|
|
|
@ -564,22 +564,22 @@ namespace ZJ_BYD
|
|
|
|
|
if (addResult <= 0)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLog($"{stationCode}工位,新增结果失败:{JsonConvert.SerializeObject(t_Result)}");
|
|
|
|
|
return (false, "一体机数据上传反馈:存库NG!");
|
|
|
|
|
return (false, "一体机数据上传反馈:存库NG!", t_Result);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return (true, $"一体机数据上传反馈:存库OK!,产品总状态:{t_Result.TotalStatus}");
|
|
|
|
|
return (true, $"一体机数据上传反馈:存库OK!,产品总状态:{t_Result.TotalStatus}", t_Result);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLog($"一体机数据上传反馈:{stationCode}工位存库发生异常:{ex.Message}!");
|
|
|
|
|
return (false, "一体机数据上传反馈:存库NG!");
|
|
|
|
|
return (false, "一体机数据上传反馈:存库NG!",null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return (false, "一体机数据上传反馈:存库NG!");
|
|
|
|
|
return (false, "一体机数据上传反馈:存库NG!", null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|