|
@@ -18,6 +18,7 @@ using System.Text;
|
|
|
using System.Threading;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Windows;
|
|
|
+using System.Xaml;
|
|
|
|
|
|
namespace PLCTool.ViewModels.BusinessManageViewModel
|
|
|
{
|
|
@@ -255,29 +256,40 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
|
|
|
}
|
|
|
testStatus = 99;//测试状态赋值为99
|
|
|
//状态status 没有赋值
|
|
|
-
|
|
|
- bizTestRecordDtlDto.RecordId = recordId;
|
|
|
- bizTestRecordDtlDto.SchemeDtlId = schDetailId;
|
|
|
- bizTestRecordDtlDto.StartTestTime = startTime;
|
|
|
- bizTestRecordDtlDto.FinishTestTime = endTime;
|
|
|
- bizTestRecordDtlDto.TestMode = TestMode;
|
|
|
- bizTestRecordDtlDto.Status = testStatus;
|
|
|
- bizTestRecordDtlDto.TestResult = GetTestResult();
|
|
|
- bizTestRecordDtlDto.CreateBy = Appsession.UserName;
|
|
|
- bizTestRecordDtlDto.CreateTime = startTime;
|
|
|
- bizTestRecordDtlDto.UpdateBy = Appsession.UserName;
|
|
|
- bizTestRecordDtlDto.UpdateTime = DateTime.Now;
|
|
|
+
|
|
|
//记录记录明细表中是否有这个方案明细ID的记录,没有则添加,有则更新记录状态
|
|
|
var findRecordDetail = _iBizTestRecordDtlService.FindRecordDetailBySchDtlID(schDetailId);
|
|
|
if (findRecordDetail == null)
|
|
|
{
|
|
|
-
|
|
|
- var testRecordDtl = _mapper.Map<BizTestRecordDtlDto, biz_test_record_dtl>(bizTestRecordDtlDto);
|
|
|
+ BizTestRecordDtlDto newBizTestEwDetail = new BizTestRecordDtlDto();
|
|
|
+ newBizTestEwDetail.RecordId = recordId;
|
|
|
+ newBizTestEwDetail.SchemeDtlId = schDetailId;
|
|
|
+ newBizTestEwDetail.StartTestTime = startTime;
|
|
|
+ newBizTestEwDetail.FinishTestTime = endTime;
|
|
|
+ newBizTestEwDetail.TestMode = TestMode;
|
|
|
+ newBizTestEwDetail.Status = testStatus;
|
|
|
+ newBizTestEwDetail.TestResult = GetTestResult();
|
|
|
+ newBizTestEwDetail.CreateBy = Appsession.UserName;
|
|
|
+ newBizTestEwDetail.CreateTime = startTime;
|
|
|
+ newBizTestEwDetail.UpdateBy = Appsession.UserName;
|
|
|
+ newBizTestEwDetail.UpdateTime = DateTime.Now;
|
|
|
+ var testRecordDtl = _mapper.Map<BizTestRecordDtlDto, biz_test_record_dtl>(newBizTestEwDetail);
|
|
|
_iBizTestRecordDtlService.Add(testRecordDtl);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
bizTestRecordDtlDto.RecordDtlId = findRecordDetail.record_dtl_id;
|
|
|
+ bizTestRecordDtlDto.RecordId = recordId;
|
|
|
+ bizTestRecordDtlDto.SchemeDtlId = schDetailId;
|
|
|
+ bizTestRecordDtlDto.StartTestTime = startTime;
|
|
|
+ bizTestRecordDtlDto.FinishTestTime = endTime;
|
|
|
+ bizTestRecordDtlDto.TestMode = TestMode;
|
|
|
+ bizTestRecordDtlDto.Status = testStatus;
|
|
|
+ bizTestRecordDtlDto.TestResult = GetTestResult();
|
|
|
+ bizTestRecordDtlDto.CreateBy = Appsession.UserName;
|
|
|
+ bizTestRecordDtlDto.CreateTime = startTime;
|
|
|
+ bizTestRecordDtlDto.UpdateBy = Appsession.UserName;
|
|
|
+ bizTestRecordDtlDto.UpdateTime = DateTime.Now;
|
|
|
//更新时间
|
|
|
bizTestRecordDtlDto.UpdateBy = Appsession.UserName;
|
|
|
bizTestRecordDtlDto.UpdateTime = DateTime.Now;
|
|
@@ -287,35 +299,101 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
|
|
|
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+ /// <summary>
|
|
|
+ /// 获取测试结果
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
private int GetTestResult()
|
|
|
{
|
|
|
-
|
|
|
- foreach (var item in BeforeConList)
|
|
|
+ if (SelectLogic == "OR")
|
|
|
{
|
|
|
- if (item.TestResult == "不合格" || string.IsNullOrEmpty(item.TestResult))
|
|
|
+ var find = BeforeConList.FirstOrDefault(x => x.TestResult == "合格");
|
|
|
+ if (find != null)
|
|
|
{
|
|
|
-
|
|
|
- return 0;
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (SelectLogic == "AND"|| SelectLogic == "ONLY")
|
|
|
+ {
|
|
|
+ var find = BeforeConList.FirstOrDefault(x => x.TestResult == "不合格");
|
|
|
+ if (find != null)
|
|
|
+ {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (SelectLogic == "NULL")
|
|
|
+ {
|
|
|
+
|
|
|
+ return 1;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ //输入项
|
|
|
+ if (InSelectLogic == "OR")
|
|
|
+ {
|
|
|
+ var find = InConList.FirstOrDefault(x => x.TestResult == "合格");
|
|
|
+ if (find != null)
|
|
|
+ {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
}
|
|
|
- foreach (var item in InConList)
|
|
|
+ else
|
|
|
{
|
|
|
- if (item.TestResult == "不合格" || string.IsNullOrEmpty(item.TestResult))
|
|
|
+ if (InSelectLogic == "AND" || InSelectLogic == "ONLY")
|
|
|
+ {
|
|
|
+ var find = InConList.FirstOrDefault(x => x.TestResult == "不合格");
|
|
|
+ if (find != null)
|
|
|
+ {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
+ if (InSelectLogic == "NULL")
|
|
|
+ {
|
|
|
+
|
|
|
+ return 1;
|
|
|
|
|
|
- return 0;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- foreach (var item in OutConList)
|
|
|
+
|
|
|
+ //输出项
|
|
|
+ if (OutSelectLogic == "OR")
|
|
|
{
|
|
|
- if (item.TestResult == "不合格" || string.IsNullOrEmpty(item.TestResult))
|
|
|
+ var find = OutConList.FirstOrDefault(x => x.TestResult == "合格");
|
|
|
+ if (find != null)
|
|
|
{
|
|
|
- return 0;
|
|
|
+ return 1;
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (OutSelectLogic == "AND" || OutSelectLogic == "ONLY")
|
|
|
+ {
|
|
|
+ var find = OutConList.FirstOrDefault(x => x.TestResult == "不合格");
|
|
|
+ if (find != null)
|
|
|
+ {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (OutSelectLogic == "NULL")
|
|
|
+ {
|
|
|
|
|
|
+ return 1;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return 1;
|
|
|
}
|
|
|
/// <summary>
|
|
@@ -429,7 +507,11 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
|
|
|
globalSchDetailId = schDetailId;
|
|
|
int id = Convert.ToInt32(schDetailId);
|
|
|
//界面显示
|
|
|
- GetDetailInfo(id);
|
|
|
+ System.Windows.Application.Current.Dispatcher.Invoke((delegate
|
|
|
+ {
|
|
|
+ GetDetailInfo(id);
|
|
|
+ }));
|
|
|
+
|
|
|
//递归调用
|
|
|
Start();
|
|
|
}
|
|
@@ -459,20 +541,26 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
|
|
|
{
|
|
|
case "人工判定":
|
|
|
//弹出确认的对话框
|
|
|
- MessageBoxResult boxResult = MessageBox.Show(BeforeDetail, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
|
|
|
- if (boxResult == MessageBoxResult.OK)
|
|
|
- {
|
|
|
- //前置项测试结果json转化
|
|
|
- string prefixJsonStr = ModelToJsonToStr(BeforeSelectJudge, SelectLogic, BeforeDetail, BeforeConList);
|
|
|
- //json字符串
|
|
|
- bizTestRecordDtlDto.PreconditionFinal = prefixJsonStr;
|
|
|
- bizTestRecordDtlDto.PreconditionResult = "合格";
|
|
|
- StepIndex = 1;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
+ //前置项测试结果json转化
|
|
|
+ string prefixJsonStr = ModelToJsonToStr(BeforeSelectJudge, SelectLogic, BeforeDetail, BeforeConList);
|
|
|
+ //json字符串
|
|
|
+ bizTestRecordDtlDto.PreconditionFinal = prefixJsonStr;
|
|
|
+ bizTestRecordDtlDto.PreconditionResult = "合格";
|
|
|
+ StepIndex = 1;
|
|
|
+ //MessageBoxResult boxResult = MessageBox.Show(BeforeDetail, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
|
|
|
+ //if (boxResult == MessageBoxResult.OK)
|
|
|
+ //{
|
|
|
+ // //前置项测试结果json转化
|
|
|
+ // string prefixJsonStr = ModelToJsonToStr(BeforeSelectJudge, SelectLogic, BeforeDetail, BeforeConList);
|
|
|
+ // //json字符串
|
|
|
+ // bizTestRecordDtlDto.PreconditionFinal = prefixJsonStr;
|
|
|
+ // bizTestRecordDtlDto.PreconditionResult = "合格";
|
|
|
+ // StepIndex = 1;
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // return false;
|
|
|
+ //}
|
|
|
|
|
|
break;
|
|
|
case "自动判定":
|
|
@@ -481,20 +569,26 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
|
|
|
{
|
|
|
case "NULL":
|
|
|
//弹出确认的对话框
|
|
|
- MessageBoxResult boxResultAuto = MessageBox.Show(BeforeDetail, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
|
|
|
- if (boxResultAuto == MessageBoxResult.OK)
|
|
|
- {
|
|
|
- //前置项测试结果json转化
|
|
|
- string prefixJsonStr = ModelToJsonToStr(BeforeSelectJudge, SelectLogic, BeforeDetail, BeforeConList);
|
|
|
- //json字符串
|
|
|
- bizTestRecordDtlDto.PreconditionFinal = prefixJsonStr;
|
|
|
- bizTestRecordDtlDto.PreconditionResult = "合格";
|
|
|
- StepIndex = 1;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
+ //前置项测试结果json转化
|
|
|
+ string prefixJsonStrAuto = ModelToJsonToStr(BeforeSelectJudge, SelectLogic, BeforeDetail, BeforeConList);
|
|
|
+ //json字符串
|
|
|
+ bizTestRecordDtlDto.PreconditionFinal = prefixJsonStrAuto;
|
|
|
+ bizTestRecordDtlDto.PreconditionResult = "合格";
|
|
|
+ StepIndex = 1;
|
|
|
+ //MessageBoxResult boxResultAuto = MessageBox.Show(BeforeDetail, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
|
|
|
+ //if (boxResultAuto == MessageBoxResult.OK)
|
|
|
+ //{
|
|
|
+ // //前置项测试结果json转化
|
|
|
+ // string prefixJsonStr = ModelToJsonToStr(BeforeSelectJudge, SelectLogic, BeforeDetail, BeforeConList);
|
|
|
+ // //json字符串
|
|
|
+ // bizTestRecordDtlDto.PreconditionFinal = prefixJsonStr;
|
|
|
+ // bizTestRecordDtlDto.PreconditionResult = "合格";
|
|
|
+ // StepIndex = 1;
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // return false;
|
|
|
+ //}
|
|
|
break;
|
|
|
case "AND":
|
|
|
case "ONLY":
|