|
|
@ -36,6 +36,8 @@ namespace ProductionSystem.Forms
|
|
|
|
private readonly PlcPointService _plcPointService = new PlcPointService();
|
|
|
|
private readonly PlcPointService _plcPointService = new PlcPointService();
|
|
|
|
private readonly ProductTypeService _productTypeService = new ProductTypeService();
|
|
|
|
private readonly ProductTypeService _productTypeService = new ProductTypeService();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DataProductService dataProductService = new DataProductService();
|
|
|
|
|
|
|
|
|
|
|
|
private static string iniFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SystemConfig.ini");
|
|
|
|
private static string iniFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SystemConfig.ini");
|
|
|
|
private bool topIsCanRound = true;//展示PLC采集数据时,是否可以进入下一次循环
|
|
|
|
private bool topIsCanRound = true;//展示PLC采集数据时,是否可以进入下一次循环
|
|
|
|
private bool middleIsCanRound = true;//展示PLC采集数据时,是否可以进入下一次循环
|
|
|
|
private bool middleIsCanRound = true;//展示PLC采集数据时,是否可以进入下一次循环
|
|
|
@ -59,6 +61,9 @@ namespace ProductionSystem.Forms
|
|
|
|
Program.ProductType = usedProductType?.ProductTypeCode;
|
|
|
|
Program.ProductType = usedProductType?.ProductTypeCode;
|
|
|
|
//初始化中间的采集项目
|
|
|
|
//初始化中间的采集项目
|
|
|
|
InitMiddleTestItems();
|
|
|
|
InitMiddleTestItems();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void HomeForm_Load(object sender, EventArgs e)
|
|
|
|
private void HomeForm_Load(object sender, EventArgs e)
|
|
|
@ -66,7 +71,10 @@ namespace ProductionSystem.Forms
|
|
|
|
|
|
|
|
|
|
|
|
#region 各工序的采集点位
|
|
|
|
#region 各工序的采集点位
|
|
|
|
Program.BZ1 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ1").ToList();
|
|
|
|
Program.BZ1 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ1").ToList();
|
|
|
|
Program.BZ2 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ1_DB").ToList();
|
|
|
|
Program.BZ2 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ2").ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var entity = Program.BZ2;
|
|
|
|
|
|
|
|
|
|
|
|
Program.BZ3 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ3").ToList();
|
|
|
|
Program.BZ3 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ3").ToList();
|
|
|
|
Program.BZ4 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ4").ToList();
|
|
|
|
Program.BZ4 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ4").ToList();
|
|
|
|
Program.BZ5 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ5").ToList();
|
|
|
|
Program.BZ5 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ5").ToList();
|
|
|
@ -154,6 +162,9 @@ namespace ProductionSystem.Forms
|
|
|
|
}, cancellationTokenSource.Token);
|
|
|
|
}, cancellationTokenSource.Token);
|
|
|
|
|
|
|
|
|
|
|
|
hslCurveHistory.RemoveAllCurve();
|
|
|
|
hslCurveHistory.RemoveAllCurve();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SetMiddleData("BZ1_DB");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -461,7 +472,10 @@ namespace ProductionSystem.Forms
|
|
|
|
Size = new Size(200, 29),
|
|
|
|
Size = new Size(200, 29),
|
|
|
|
TestResultPLCPointCode = testResult?.Key,
|
|
|
|
TestResultPLCPointCode = testResult?.Key,
|
|
|
|
TestValPLCPointCode = testVal?.Key,
|
|
|
|
TestValPLCPointCode = testVal?.Key,
|
|
|
|
TabIndex = j
|
|
|
|
TabIndex = j,
|
|
|
|
|
|
|
|
ParaCategory= paraCategorys[i].DicCode,
|
|
|
|
|
|
|
|
ParaCode= currentParaConfigs[j].ParaCode,
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
layoutControlItem.Control = myTestResultControl;
|
|
|
|
layoutControlItem.Control = myTestResultControl;
|
|
|
|
layoutItemArr[j] = layoutControlItem;
|
|
|
|
layoutItemArr[j] = layoutControlItem;
|
|
|
@ -1195,6 +1209,69 @@ namespace ProductionSystem.Forms
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void SetMiddleData(string paraCategory)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var groupControls = middleFlowLayoutPanel.Controls.OfType<GroupControl>().FirstOrDefault(m => m.Tag.ToString().Contains(paraCategory));
|
|
|
|
|
|
|
|
//如果有GroupControl控件
|
|
|
|
|
|
|
|
if (groupControls != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var layOutControl = groupControls.Controls.OfType<LayoutControl>().FirstOrDefault(m => m.Name.Contains(paraCategory));
|
|
|
|
|
|
|
|
if (layOutControl != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var middleMyTestResultControls = layOutControl.Controls.OfType<MyTestResultControl>().ToList();
|
|
|
|
|
|
|
|
if (middleMyTestResultControls.Any())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for (int j = 0; j < middleMyTestResultControls.Count; j++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (middleMyTestResultControls[j].IsHandleCreated && !middleMyTestResultControls[j].IsDisposed)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var result = string.Empty;
|
|
|
|
|
|
|
|
var val = string.Empty;
|
|
|
|
|
|
|
|
var testResultPoint = middleMyTestResultControls[j].TestResultPLCPointCode;
|
|
|
|
|
|
|
|
var testValPoint = middleMyTestResultControls[j].TestValPLCPointCode;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取点位
|
|
|
|
|
|
|
|
var paraCode = middleMyTestResultControls[j].ParaCode;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(testResultPoint) || string.IsNullOrEmpty(testValPoint))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//进行sql 进行查询sql
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val=dataProductService.QueryDataProduct(paraCategory, paraCode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.Invoke(new Action(() =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (middleMyTestResultControls[j].LblItemText == "总状态")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
result = val;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
middleMyTestResultControls[j].TestResultText = result == "1.000" ? "OK" : (result == "2.000" ? "NG" : "");
|
|
|
|
|
|
|
|
middleMyTestResultControls[j].TestResultForeColor = Color.White;
|
|
|
|
|
|
|
|
middleMyTestResultControls[j].TestResultBackColor = result == "1.000" ? Color.Green : (result == "2.000" ? Color.Red : Color.Gainsboro);
|
|
|
|
|
|
|
|
middleMyTestResultControls[j].TestValText = val;
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
LogHelper.Error(ex, $"给中间部分控件赋值时异常!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 清空中间控件的数据
|
|
|
|
/// 清空中间控件的数据
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|