/// <summary> /// 主表赋值 /// </summary> /// <param name="billInfo">界面数据</param> /// <param name="tempInfo">逻辑数据</param> void AssignmentValue(Bus_Quality_8DReport billInfo, int flowID, ref Bus_Quality_8DReport tempInfo) { switch (flowID) { case 1109: tempInfo.GoodsInfo = billInfo.GoodsInfo; tempInfo.HappenDate = billInfo.HappenDate; tempInfo.HappenSite = billInfo.HappenSite; tempInfo.Involve = billInfo.Involve; tempInfo.Theme = billInfo.Theme; tempInfo.Badness = billInfo.Badness; tempInfo.BatchNo = billInfo.BatchNo; tempInfo.BillNo = billInfo.BillNo; tempInfo.D1_DescribePhenomenon = billInfo.D1_DescribePhenomenon; tempInfo.D1_DescribePhenomenon_Accessory = billInfo.D1_DescribePhenomenon_Accessory; tempInfo.D1_DutyDepartment = billInfo.D1_DutyDepartment; tempInfo.D1_InfluenceElseProduct_Explain = billInfo.D1_InfluenceElseProduct_Explain; tempInfo.D1_LastHappenTime = billInfo.D1_LastHappenTime; break; case 1111: tempInfo.D2_DutyPersonnel = billInfo.D2_DutyPersonnel; break; case 1112: tempInfo.D3_Reason_Incoming = billInfo.D3_Reason_Incoming; tempInfo.D3_Reason_Producted = billInfo.D3_Reason_Producted; tempInfo.D3_Reason_Production = billInfo.D3_Reason_Production; tempInfo.D3_Reason_Send = billInfo.D3_Reason_Send; tempInfo.D4_Else_Measure = billInfo.D4_Else_Measure; tempInfo.D4_Else_NG = billInfo.D4_Else_NG; tempInfo.D4_Else_OK = billInfo.D4_Else_OK; tempInfo.D4_FinishClient_Measure = billInfo.D4_FinishClient_Measure; tempInfo.D4_FinishClient_NG = billInfo.D4_FinishClient_NG; tempInfo.D4_FinishClient_OK = billInfo.D4_FinishClient_OK; tempInfo.D4_FinishCom_Measure = billInfo.D4_FinishCom_Measure; tempInfo.D4_FinishCom_NG = billInfo.D4_FinishCom_NG; tempInfo.D4_FinishCom_OK = billInfo.D4_FinishCom_OK; tempInfo.D4_HowIdentify = billInfo.D4_HowIdentify; tempInfo.D4_Loading_Measure = billInfo.D4_Loading_Measure; tempInfo.D4_Loading_NG = billInfo.D4_Loading_NG; tempInfo.D4_Loading_OK = billInfo.D4_Loading_OK; tempInfo.D4_Semi_Measure = billInfo.D4_Semi_Measure; tempInfo.D4_Semi_NG = billInfo.D4_Semi_NG; tempInfo.D4_Semi_OK = billInfo.D4_Semi_OK; tempInfo.D5_ReasonAnalysis = billInfo.D5_ReasonAnalysis; tempInfo.D5_ReasonAnalysis_Accessory = billInfo.D5_ReasonAnalysis_Accessory; break; case 1114: tempInfo.D8_Unfulfillment_Explain = billInfo.D8_Unfulfillment_Explain; break; default: break; } }
/// <summary> /// 删除业务 /// </summary> /// <param name="billNo">业务号</param> public void DeleteInfo(string billNo) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); IFlowServer serverFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); BillNumberControl billNoControl = new BillNumberControl(CE_BillTypeEnum.纠正预防措施报告.ToString(), this); try { var varData = from a in ctx.Bus_Quality_8DReport where a.BillNo == billNo select a; //删除附件 if (varData.Count() == 1) { Bus_Quality_8DReport reportInfo = varData.Single(); if (!GeneralFunction.IsNullOrEmpty(reportInfo.D1_DescribePhenomenon_Accessory)) { foreach (string fileItem in reportInfo.D1_DescribePhenomenon_Accessory.ToString().Split(',')) { UniversalControlLibrary.FileOperationService.File_Delete(new Guid(fileItem), GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)CE_SwitchName.文件传输方式])); } } if (!GeneralFunction.IsNullOrEmpty(reportInfo.D5_ReasonAnalysis_Accessory)) { foreach (string fileItem in reportInfo.D5_ReasonAnalysis_Accessory.ToString().Split(',')) { UniversalControlLibrary.FileOperationService.File_Delete(new Guid(fileItem), GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)CE_SwitchName.文件传输方式])); } } } ctx.Bus_Quality_8DReport.DeleteAllOnSubmit(varData); ctx.SubmitChanges(); serverFlow.FlowDelete(ctx, billNo); ctx.Transaction.Commit(); billNoControl.CancelBill(billNo); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }
public override void LoadFormInfo() { try { m_billNoControl = new BillNumberControl(CE_BillTypeEnum.纠正预防措施报告.ToString(), _Service_EightDReport); _Lnq_BillInfo = _Service_EightDReport.GetSingleBillInfo(this.FlowInfo_BillNo); SetInfo(); } catch (Exception ex) { MessageDialog.ShowErrorMessage(ex.Message); } }
private bool 纠正预防措施报告_Form_CommonProcessSubmit(CustomFlowForm form, string advise) { IEightDReport serviceEightD = Service_Quality_QC.ServerModuleFactory.GetServerModule <IEightDReport>(); try { Bus_Quality_8DReport reportInfo = form.ResultInfo as Bus_Quality_8DReport; this.OperationType = GeneralFunction.StringConvertToEnum <CE_FlowOperationType>(form.ResultList[0].ToString()); this.BillNo = reportInfo.BillNo; switch (this.OperationType) { case CE_FlowOperationType.提交: CheckData(reportInfo); serviceEightD.SaveInfo(reportInfo); break; case CE_FlowOperationType.暂存: serviceEightD.SaveInfo(reportInfo); break; case CE_FlowOperationType.回退: break; case CE_FlowOperationType.未知: break; default: break; } if (!serviceEightD.IsExist(reportInfo.BillNo)) { MessageDialog.ShowPromptMessage("数据为空,保存失败,如需退出,请直接X掉界面"); return(false); } return(true); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return(false); } }
/// <summary> /// 获得单条业务总单信息 /// </summary> /// <param name="billNo">业务号</param> /// <returns>返回业务总单信息</returns> public Bus_Quality_8DReport GetSingleBillInfo(string billNo) { if (billNo == null) { return(null); } DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.Bus_Quality_8DReport where a.BillNo == billNo select a; if (varData.Count() == 1) { Bus_Quality_8DReport resultInfo = varData.Single(); resultInfo.Bus_Quality_8DReport_D2_Crew.SetSource((from a in ctx.Bus_Quality_8DReport_D2_Crew where a.ReportId == resultInfo.F_Id select a).AsEnumerable()); resultInfo.Bus_Quality_8DReport_D5_Reason.SetSource((from a in ctx.Bus_Quality_8DReport_D5_Reason where a.ReportId == resultInfo.F_Id select a).AsEnumerable()); resultInfo.Bus_Quality_8DReport_D6_Countermeasure.SetSource((from a in ctx.Bus_Quality_8DReport_D6_Countermeasure where a.ReportId == resultInfo.F_Id select a).AsEnumerable()); resultInfo.Bus_Quality_8DReport_D7_Prevent.SetSource((from a in ctx.Bus_Quality_8DReport_D7_Prevent where a.ReportId == resultInfo.F_Id select a).AsEnumerable()); resultInfo.Bus_Quality_8DReport_D8_Verify.SetSource((from a in ctx.Bus_Quality_8DReport_D8_Verify where a.ReportId == resultInfo.F_Id select a).AsEnumerable()); return(resultInfo); } else { return(null); } }
void CheckData(Bus_Quality_8DReport reportInfo) { Flow_FlowInfo info = _serviceFlow.GetNowFlowInfo(_serviceFlow.GetBusinessTypeID(CE_BillTypeEnum.纠正预防措施报告, null), reportInfo.BillNo); switch (info.FlowID) { case 1109: if (GeneralFunction.IsNullOrEmpty(reportInfo.Theme)) { throw new Exception("请填写【主题】"); } if (GeneralFunction.IsNullOrEmpty(reportInfo.GoodsInfo)) { throw new Exception("请填写【名称及图号】"); } if (GeneralFunction.IsNullOrEmpty(reportInfo.HappenSite)) { throw new Exception("请填写【发生地点】"); } if (reportInfo.HappenDate == null) { throw new Exception("请选择【发生时间】"); } if (GeneralFunction.IsNullOrEmpty(reportInfo.HappenSite)) { throw new Exception("请填写【不良数量/不良率】"); } if (GeneralFunction.IsNullOrEmpty(reportInfo.HappenSite)) { throw new Exception("请填写【涉及数量】"); } if (GeneralFunction.IsNullOrEmpty(reportInfo.D1_DescribePhenomenon)) { throw new Exception("请填写【D1描述现象】"); } break; case 1112: if (reportInfo.Bus_Quality_8DReport_D2_Crew == null || reportInfo.Bus_Quality_8DReport_D2_Crew.ToList().Count() == 0) { throw new Exception("请选择并添加【D2改善小组组员】"); } if (GeneralFunction.IsNullOrEmpty(reportInfo.D5_ReasonAnalysis)) { throw new Exception("请填写并添加【D5根本原因分析】"); } if (reportInfo.Bus_Quality_8DReport_D5_Reason == null || reportInfo.Bus_Quality_8DReport_D5_Reason.ToList().Where(k => k.ReasonType == "产生原因").Count() == 0) { throw new Exception("请填写并添加【D5产生原因】"); } if (reportInfo.Bus_Quality_8DReport_D6_Countermeasure == null || reportInfo.Bus_Quality_8DReport_D6_Countermeasure.ToList().Where(k => k.CountermeasureType == "产生对策").Count() == 0) { throw new Exception("请填写并添加【D6产生对策】"); } if (reportInfo.Bus_Quality_8DReport_D7_Prevent == null || reportInfo.Bus_Quality_8DReport_D7_Prevent.ToList().Count() == 0) { throw new Exception("请勾选并填写【D7预防措施】"); } break; case 1114: if (reportInfo.Bus_Quality_8DReport_D8_Verify == null || reportInfo.Bus_Quality_8DReport_D8_Verify.ToList().Count() == 0) { throw new Exception("请填写并添加【D8效果确认】"); } break; default: break; } }
/// <summary> /// 保存业务信息 /// </summary> /// <param name="billInfo">业务总单信息</param> public void SaveInfo(Bus_Quality_8DReport billInfo) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); try { Flow_FlowInfo info = _serviceFlow.GetNowFlowInfo(_serviceFlow.GetBusinessTypeID(CE_BillTypeEnum.纠正预防措施报告, null), billInfo.BillNo); Bus_Quality_8DReport tempInfo = new Bus_Quality_8DReport(); var varData = from a in ctx.Bus_Quality_8DReport where a.BillNo == billInfo.BillNo select a; if (varData.Count() == 1) { tempInfo = varData.Single(); AssignmentValue(billInfo, info.FlowID, ref tempInfo); } else if (varData.Count() == 0) { tempInfo.F_Id = Guid.NewGuid().ToString(); AssignmentValue(billInfo, info.FlowID, ref tempInfo); ctx.Bus_Quality_8DReport.InsertOnSubmit(tempInfo); } else { throw new Exception("单据数据不唯一"); } ctx.SubmitChanges(); switch (info.FlowID) { case 1112: //D2 var varData1 = from a in ctx.Bus_Quality_8DReport_D2_Crew where a.ReportId == tempInfo.F_Id select a; ctx.Bus_Quality_8DReport_D2_Crew.DeleteAllOnSubmit(varData1); foreach (Bus_Quality_8DReport_D2_Crew item in billInfo.Bus_Quality_8DReport_D2_Crew.ToList()) { Bus_Quality_8DReport_D2_Crew tempItem = new Bus_Quality_8DReport_D2_Crew(); tempItem.F_Id = Guid.NewGuid().ToString(); tempItem.ReportId = tempInfo.F_Id; tempItem.PersonnelWorkId = item.PersonnelWorkId; ctx.Bus_Quality_8DReport_D2_Crew.InsertOnSubmit(tempItem); } ctx.SubmitChanges(); //D5 var varData2 = from a in ctx.Bus_Quality_8DReport_D5_Reason where a.ReportId == tempInfo.F_Id select a; ctx.Bus_Quality_8DReport_D5_Reason.DeleteAllOnSubmit(varData2); foreach (Bus_Quality_8DReport_D5_Reason item in billInfo.Bus_Quality_8DReport_D5_Reason.ToList()) { Bus_Quality_8DReport_D5_Reason tempItem = new Bus_Quality_8DReport_D5_Reason(); tempItem.F_Id = Guid.NewGuid().ToString(); tempItem.ReportId = tempInfo.F_Id; tempItem.Description = item.Description; tempItem.ReasonType = item.ReasonType; ctx.Bus_Quality_8DReport_D5_Reason.InsertOnSubmit(tempItem); } ctx.SubmitChanges(); //D6 var varData3 = from a in ctx.Bus_Quality_8DReport_D6_Countermeasure where a.ReportId == tempInfo.F_Id select a; ctx.Bus_Quality_8DReport_D6_Countermeasure.DeleteAllOnSubmit(varData3); foreach (Bus_Quality_8DReport_D6_Countermeasure item in billInfo.Bus_Quality_8DReport_D6_Countermeasure.ToList()) { Bus_Quality_8DReport_D6_Countermeasure tempItem = new Bus_Quality_8DReport_D6_Countermeasure(); tempItem.F_Id = Guid.NewGuid().ToString(); tempItem.ReportId = tempInfo.F_Id; tempItem.Description = item.Description; tempItem.CountermeasureType = item.CountermeasureType; tempItem.Duty = item.Duty; tempItem.FinishDate = item.FinishDate; ctx.Bus_Quality_8DReport_D6_Countermeasure.InsertOnSubmit(tempItem); } ctx.SubmitChanges(); //D7 var varData4 = from a in ctx.Bus_Quality_8DReport_D7_Prevent where a.ReportId == tempInfo.F_Id select a; ctx.Bus_Quality_8DReport_D7_Prevent.DeleteAllOnSubmit(varData4); foreach (Bus_Quality_8DReport_D7_Prevent item in billInfo.Bus_Quality_8DReport_D7_Prevent.ToList()) { Bus_Quality_8DReport_D7_Prevent tempItem = new Bus_Quality_8DReport_D7_Prevent(); tempItem.F_Id = Guid.NewGuid().ToString(); tempItem.ReportId = tempInfo.F_Id; tempItem.Department = item.Department; tempItem.ItemsType = item.ItemsType; tempItem.OperationTime = item.OperationTime; ctx.Bus_Quality_8DReport_D7_Prevent.InsertOnSubmit(tempItem); } ctx.SubmitChanges(); break; case 1114: //D8 var varData5 = from a in ctx.Bus_Quality_8DReport_D8_Verify where a.ReportId == tempInfo.F_Id select a; ctx.Bus_Quality_8DReport_D8_Verify.DeleteAllOnSubmit(varData5); foreach (Bus_Quality_8DReport_D8_Verify item in billInfo.Bus_Quality_8DReport_D8_Verify.ToList()) { Bus_Quality_8DReport_D8_Verify tempItem = new Bus_Quality_8DReport_D8_Verify(); tempItem.F_Id = Guid.NewGuid().ToString(); tempItem.ReportId = tempInfo.F_Id; tempItem.OperationDate = item.OperationDate; tempItem.Result = item.Result; tempItem.WayMode = item.WayMode; tempItem.Duty = item.Duty; tempItem.Effect = item.Effect; ctx.Bus_Quality_8DReport_D8_Verify.InsertOnSubmit(tempItem); } ctx.SubmitChanges(); break; default: break; } ctx.Transaction.Commit(); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }
void SetInfo() { if (_Lnq_BillInfo == null) { lbBillStatus.Text = CE_CommonBillStatus.新建单据.ToString(); _Lnq_BillInfo = new Bus_Quality_8DReport(); txtBillNo.Text = this.FlowInfo_BillNo; _Lnq_BillInfo.BillNo = txtBillNo.Text; _Lnq_BillInfo.F_Id = Guid.NewGuid().ToString(); } else { lbBillStatus.Text = _Service_Flow.GetNowBillStatus(_Lnq_BillInfo.BillNo); txtBillNo.Text = _Lnq_BillInfo.BillNo; txtBatchNo.Text = _Lnq_BillInfo.BatchNo; txtBadness.Text = _Lnq_BillInfo.Badness; txtTheme.Text = _Lnq_BillInfo.Theme; txtInvolve.Text = _Lnq_BillInfo.Involve; txtHappenSite.Text = _Lnq_BillInfo.HappenSite; dtpHappenDate.Value = _Lnq_BillInfo.HappenDate == null ? ServerTime.Time : (DateTime)dtpHappenDate.Value; txtGoodsInfo.Text = _Lnq_BillInfo.GoodsInfo; //D1 txtD1_DescribePhenomenon.Text = _Lnq_BillInfo.D1_DescribePhenomenon; if (_Lnq_BillInfo.D1_DescribePhenomenon_Accessory != null) { llbD1_DescribePhenomenon_Accessory.Tag = _Lnq_BillInfo.D1_DescribePhenomenon_Accessory; llbD1_DescribePhenomenon_Accessory.Enabled = true; llbD1_DescribePhenomenon_Accessory_DownLoad.Enabled = true; } if (_Lnq_BillInfo.D1_LastHappenTime != null) { dtpD1_LastHappenTime.Value = (DateTime)_Lnq_BillInfo.D1_LastHappenTime; PanelRadioButtonSetChecked(plD1_LastHappenTime, "是"); } if (_Lnq_BillInfo.D1_InfluenceElseProduct_Explain != null) { txtD1_InfluenceElseProduct_Explain.Text = _Lnq_BillInfo.D1_InfluenceElseProduct_Explain; PanelRadioButtonSetChecked(plD1_InfluenceElseProduct_Explain, "是"); } if (_Lnq_BillInfo.D1_DutyDepartment != null) { foreach (Control cl in plD1_DutyDepartment.Controls) { if (cl is RadioButton) { RadioButton rb = cl as RadioButton; if (rb.Text == _Lnq_BillInfo.D1_DutyDepartment) { rb.Checked = true; break; } } } } //D2 if (_Lnq_BillInfo.D2_DutyPersonnel != null) { txtD2_DutyPersonnel.Text = UniversalFunction.GetPersonnelInfo(_Lnq_BillInfo.D2_DutyPersonnel).姓名; txtD2_DutyPersonnel.Tag = _Lnq_BillInfo.D2_DutyPersonnel; } foreach (Bus_Quality_8DReport_D2_Crew item in _Lnq_BillInfo.Bus_Quality_8DReport_D2_Crew.ToList()) { View_HR_Personnel personnelInfo = UniversalFunction.GetPersonnelInfo(item.PersonnelWorkId); dgvD2_Crew.Rows.Add(new object[] { personnelInfo.姓名, personnelInfo.部门名称, personnelInfo.工号 }); } //D3 if (_Lnq_BillInfo.D3_Reason_Incoming != null) { txtD3_Reason_Incoming.Text = _Lnq_BillInfo.D3_Reason_Incoming; PanelRadioButtonSetChecked(plD3_Reason_Incoming, "是"); } if (_Lnq_BillInfo.D3_Reason_Producted != null) { txtD3_Reason_Producted.Text = _Lnq_BillInfo.D3_Reason_Producted; PanelRadioButtonSetChecked(plD3_Reason_Producted, "是"); } if (_Lnq_BillInfo.D3_Reason_Production != null) { txtD3_Reason_Production.Text = _Lnq_BillInfo.D3_Reason_Production; PanelRadioButtonSetChecked(plD3_Reason_Production, "是"); } if (_Lnq_BillInfo.D3_Reason_Send != null) { txtD3_Reason_Send.Text = _Lnq_BillInfo.D3_Reason_Send; PanelRadioButtonSetChecked(plD3_Reason_Send, "是"); } //D4 if (_Lnq_BillInfo.D4_Else_Measure != null) { txtD4_Else_Measure.Text = _Lnq_BillInfo.D4_Else_Measure; txtD4_Else_NG.Text = _Lnq_BillInfo.D4_Else_NG; txtD4_Else_OK.Text = _Lnq_BillInfo.D4_Else_OK; PanelRadioButtonSetChecked(plD4_Else, "是"); } if (_Lnq_BillInfo.D4_FinishClient_Measure != null) { txtD4_FinishClient_Measure.Text = _Lnq_BillInfo.D4_FinishClient_Measure; txtD4_FinishClient_NG.Text = _Lnq_BillInfo.D4_FinishClient_NG; txtD4_FinishClient_OK.Text = _Lnq_BillInfo.D4_FinishClient_OK; PanelRadioButtonSetChecked(plD4_FinishClient, "是"); } if (_Lnq_BillInfo.D4_FinishCom_Measure != null) { txtD4_FinishCom_Measure.Text = _Lnq_BillInfo.D4_FinishCom_Measure; txtD4_FinishCom_NG.Text = _Lnq_BillInfo.D4_FinishCom_NG; txtD4_FinishCom_OK.Text = _Lnq_BillInfo.D4_FinishCom_OK; PanelRadioButtonSetChecked(plD4_FinishCom, "是"); } if (_Lnq_BillInfo.D4_Loading_Measure != null) { txtD4_Loading_Measure.Text = _Lnq_BillInfo.D4_Loading_Measure; txtD4_Loading_NG.Text = _Lnq_BillInfo.D4_Loading_NG; txtD4_Loading_OK.Text = _Lnq_BillInfo.D4_Loading_OK; PanelRadioButtonSetChecked(plD4_Loading, "是"); } if (_Lnq_BillInfo.D4_Semi_Measure != null) { txtD4_Semi_Measure.Text = _Lnq_BillInfo.D4_Semi_Measure; txtD4_Semi_NG.Text = _Lnq_BillInfo.D4_Semi_NG; txtD4_Semi_OK.Text = _Lnq_BillInfo.D4_Semi_OK; PanelRadioButtonSetChecked(plD4_Semi, "是"); } txtD4_HowIdentify.Text = _Lnq_BillInfo.D4_HowIdentify; //D5 txtD5_ReasonAnalysis.Text = _Lnq_BillInfo.D5_ReasonAnalysis; if (_Lnq_BillInfo.D5_ReasonAnalysis_Accessory != null) { llbD5_ReasonAnalysis_Accessory.Tag = _Lnq_BillInfo.D5_ReasonAnalysis_Accessory; llbD5_ReasonAnalysis_Accessory.Enabled = true; llbD5_ReasonAnalysis_Accessory_DownLoad.Enabled = true; } foreach (Bus_Quality_8DReport_D5_Reason item in _Lnq_BillInfo.Bus_Quality_8DReport_D5_Reason.Where(k => k.ReasonType == dgvD5_Reason_Out.Parent.Text).ToList()) { dgvD5_Reason_Out.Rows.Add(new object[] { item.Description }); } foreach (Bus_Quality_8DReport_D5_Reason item in _Lnq_BillInfo.Bus_Quality_8DReport_D5_Reason.Where(k => k.ReasonType == dgvD5_Reason_Pro.Parent.Text).ToList()) { dgvD5_Reason_Pro.Rows.Add(new object[] { item.Description }); } //D6 foreach (Bus_Quality_8DReport_D6_Countermeasure item in _Lnq_BillInfo.Bus_Quality_8DReport_D6_Countermeasure.Where(k => k.CountermeasureType == dgvD6_Countermeasure_Out.Parent.Text).ToList()) { dgvD6_Countermeasure_Out.Rows.Add(new object[] { item.Description, item.Duty, item.FinishDate }); } foreach (Bus_Quality_8DReport_D6_Countermeasure item in _Lnq_BillInfo.Bus_Quality_8DReport_D6_Countermeasure.Where(k => k.CountermeasureType == dgvD6_Countermeasure_Pro.Parent.Text).ToList()) { dgvD6_Countermeasure_Pro.Rows.Add(new object[] { item.Description, item.Duty, item.FinishDate }); } //D7 List <Bus_Quality_8DReport_D7_Prevent> lstPrevent = _Lnq_BillInfo.Bus_Quality_8DReport_D7_Prevent.ToList(); foreach (string item in _Arrary_PreventType) { List <Bus_Quality_8DReport_D7_Prevent> lstTemp = lstPrevent.Where(k => k.ItemsType == item).ToList(); if (lstTemp.Count() == 1) { dgvD7_Prevent.Rows.Add(new object[] { true, item, lstTemp.Single().Department, lstTemp.Single().OperationTime }); } else { dgvD7_Prevent.Rows.Add(new object[] { false, item, "", "" }); } } foreach (DataGridViewRow dgvr in dgvD7_Prevent.Rows) { if (Convert.ToBoolean(dgvr.Cells[0].Value)) { dgvr.Cells[2].ReadOnly = false; dgvr.Cells[3].ReadOnly = false; } else { dgvr.Cells[2].ReadOnly = true; dgvr.Cells[3].ReadOnly = true; dgvr.Cells[2].Value = null; dgvr.Cells[3].Value = null; } dgvr.Cells[1].ReadOnly = true; } //D8 if (_Lnq_BillInfo.D8_Unfulfillment_Explain != null) { txtD8_Unfulfillment_Explain.Text = _Lnq_BillInfo.D8_Unfulfillment_Explain; PanelRadioButtonSetChecked(plD8_Unfulfillment_Explain, "否"); } foreach (Bus_Quality_8DReport_D8_Verify item in _Lnq_BillInfo.Bus_Quality_8DReport_D8_Verify.ToList()) { dgvD8_Verify.Rows.Add(new object[] { item.WayMode, item.Result, item.Duty, item.OperationDate, item.Effect }); } } }