private bool customForm_PanelGetDateInfo(CE_FlowOperationType flowOperationType) { try { if (!CheckData()) { return(false); } m_lnqBillInfo = new Business_InspectionJudge_InspectionReport(); m_lnqBillInfo.BillNo = txtBillNo.Text; m_lnqBillInfo.InspectionReportNo = txtInspectionReportNo.Text; m_lnqBillInfo.BatchNo = txtBatchNo.Text; m_lnqBillInfo.BillRelate = txtBillRelate.Text; m_lnqBillInfo.Checker = txtChecker.Tag.ToString(); m_lnqBillInfo.GoodsCount = numGoodsCount.Value; m_lnqBillInfo.GoodsID = Convert.ToInt32(txtGoodsCode.Tag); m_lnqBillInfo.GoodsImportance = cmbGoodsImportance.Text; m_lnqBillInfo.GoodsType1 = cmbGoodsType1.Text; m_lnqBillInfo.GoodsType2 = cmbGoodsType2.Text; m_lnqBillInfo.InspectionExplain = txtInspectionExplain.Text; m_lnqBillInfo.IsQualified = chbIsQualified.Checked; m_lnqBillInfo.Provider = txtProvider.Text; m_lnqBillInfo.CheckDate = dtpCheckDate.Value; List <View_Business_InspectionJudge_InspectionReport_Item> listTemp = new List <View_Business_InspectionJudge_InspectionReport_Item>(); foreach (DataGridViewRow dgvr in customDataGridView1.Rows) { View_Business_InspectionJudge_InspectionReport_Item detailTemp = new View_Business_InspectionJudge_InspectionReport_Item(); detailTemp.检验项目 = dgvr.Cells["检验项目"].Value == null ? "" : dgvr.Cells["检验项目"].Value.ToString(); detailTemp.检验结果 = dgvr.Cells["检验结果"].Value == null ? "" : dgvr.Cells["检验结果"].Value.ToString(); detailTemp.单据号 = txtBillNo.Text; listTemp.Add(detailTemp); } this.FlowInfo_BillNo = txtBillNo.Text; this.ResultInfo = listTemp; this.ResultList = new List <object>(); this.ResultList.Add(m_lnqBillInfo); this.ResultList.Add(flowOperationType); return(true); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return(false); } }
public override void LoadFormInfo() { try { m_billNoControl = new BillNumberControl(CE_BillTypeEnum.检验报告.ToString(), m_serviceInspectionReport); m_lnqBillInfo = m_serviceInspectionReport.GetSingleBillInfo(this.FlowInfo_BillNo); SetInfo(); } catch (Exception ex) { MessageDialog.ShowErrorMessage(ex.Message); } }
private bool 检验报告_Form_CommonProcessSubmit(CustomFlowForm form, string advise) { IInspectionReportService serviceInspectionReport = Service_Quality_QC.ServerModuleFactory.GetServerModule <IInspectionReportService>(); try { List <View_Business_InspectionJudge_InspectionReport_Item> detailInfo = form.ResultInfo as List <View_Business_InspectionJudge_InspectionReport_Item>; Business_InspectionJudge_InspectionReport lnqInspectionReport = form.ResultList[0] as Business_InspectionJudge_InspectionReport; this.OperationType = GeneralFunction.StringConvertToEnum <CE_FlowOperationType>(form.ResultList[1].ToString()); this.BillNo = lnqInspectionReport.BillNo; switch (this.OperationType) { case CE_FlowOperationType.提交: serviceInspectionReport.SaveInfo(lnqInspectionReport, detailInfo); break; case CE_FlowOperationType.暂存: serviceInspectionReport.SaveInfo(lnqInspectionReport, detailInfo); break; case CE_FlowOperationType.回退: break; case CE_FlowOperationType.未知: break; default: break; } if (!serviceInspectionReport.IsExist(lnqInspectionReport.BillNo)) { MessageDialog.ShowPromptMessage("数据为空,保存失败,如需退出,请直接X掉界面"); return(false); } return(true); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return(false); } }
void SetInfo() { if (m_lnqBillInfo != null) { lbBillStatus.Text = m_serverFlow.GetNowBillStatus(m_lnqBillInfo.BillNo); txtBillNo.Text = m_lnqBillInfo.BillNo; txtInspectionReportNo.Text = m_lnqBillInfo.InspectionReportNo; txtBillRelate.Text = m_lnqBillInfo.BillRelate; View_F_GoodsPlanCost goodsInfo = UniversalFunction.GetGoodsInfo(m_lnqBillInfo.GoodsID); txtGoodsCode.Text = goodsInfo.图号型号; txtGoodsName.Text = goodsInfo.物品名称; txtSpec.Text = goodsInfo.规格; txtGoodsCode.Tag = goodsInfo.序号; lbUnit.Text = goodsInfo.单位; txtBatchNo.Text = m_lnqBillInfo.BatchNo; txtChecker.Tag = m_lnqBillInfo.Checker; txtChecker.Text = UniversalFunction.GetPersonnelName(m_lnqBillInfo.Checker); txtInspectionExplain.Text = m_lnqBillInfo.InspectionExplain; txtProvider.Text = m_lnqBillInfo.Provider; cmbGoodsImportance.Text = m_lnqBillInfo.GoodsImportance; cmbGoodsType1.Text = m_lnqBillInfo.GoodsType1; cmbGoodsType2.Text = m_lnqBillInfo.GoodsType2; numGoodsCount.Value = m_lnqBillInfo.GoodsCount; dtpCheckDate.Value = m_lnqBillInfo.CheckDate; } else { lbBillStatus.Text = CE_CommonBillStatus.新建单据.ToString(); m_lnqBillInfo = new Business_InspectionJudge_InspectionReport(); txtBillNo.Text = this.FlowInfo_BillNo; m_lnqBillInfo.BillNo = txtBillNo.Text; } m_listViewDetail = m_serviceInspectionReport.GetListViewDetailInfo(m_lnqBillInfo.BillNo); RefreshDataGridView(m_listViewDetail); }
public List <View_Business_InspectionJudge_JudgeReportDetail> GetJudgeReportDetail <T>(string billNo, string judgeReportBillNo, List <T> listDetail) { List <View_Business_InspectionJudge_JudgeReportDetail> detailSource = new List <View_Business_InspectionJudge_JudgeReportDetail>(); if (listDetail != null) { foreach (var item in listDetail) { View_Business_InspectionJudge_JudgeReportDetail tempDetail = new View_Business_InspectionJudge_JudgeReportDetail(); if (typeof(T) == typeof(View_Business_WarehouseInPut_RequisitionDetail)) { View_Business_WarehouseInPut_RequisitionDetail itemTemp = item as View_Business_WarehouseInPut_RequisitionDetail; tempDetail.单据号 = judgeReportBillNo; tempDetail.单位 = itemTemp.单位; tempDetail.供应商 = itemTemp.供应商; tempDetail.关联业务 = billNo; tempDetail.规格 = itemTemp.规格; tempDetail.批次号 = itemTemp.批次号; tempDetail.数量 = itemTemp.数量; tempDetail.图号型号 = itemTemp.图号型号; tempDetail.物品ID = itemTemp.物品ID; tempDetail.物品名称 = itemTemp.物品名称; } else if (typeof(T) == typeof(View_Business_WarehouseInPut_AOGDetail)) { View_Business_WarehouseInPut_AOGDetail itemTemp = item as View_Business_WarehouseInPut_AOGDetail; tempDetail.单据号 = judgeReportBillNo; tempDetail.单位 = itemTemp.单位; tempDetail.供应商 = itemTemp.供应商; tempDetail.关联业务 = billNo; tempDetail.规格 = itemTemp.规格; tempDetail.批次号 = itemTemp.批次号; tempDetail.数量 = itemTemp.数量; tempDetail.图号型号 = itemTemp.图号型号; tempDetail.物品ID = itemTemp.物品ID; tempDetail.物品名称 = itemTemp.物品名称; } else if (typeof(T) == typeof(Business_InspectionJudge_InspectionReport)) { Business_InspectionJudge_InspectionReport itemTemp = item as Business_InspectionJudge_InspectionReport; View_F_GoodsPlanCost goodsInfo = UniversalFunction.GetGoodsInfo(itemTemp.GoodsID); tempDetail.单据号 = judgeReportBillNo; tempDetail.单位 = goodsInfo.单位; tempDetail.供应商 = itemTemp.Provider; tempDetail.关联业务 = billNo; tempDetail.规格 = goodsInfo.规格; tempDetail.批次号 = itemTemp.BatchNo; tempDetail.数量 = itemTemp.GoodsCount; tempDetail.图号型号 = goodsInfo.图号型号; tempDetail.物品ID = itemTemp.GoodsID; tempDetail.物品名称 = goodsInfo.物品名称; } detailSource.Add(tempDetail); } } return(detailSource); }
/// <summary> /// 保存业务信息 /// </summary> /// <param name="billInfo">业务总单信息</param> /// <param name="detailInfo">业务明细信息</param> public void SaveInfo(Business_InspectionJudge_InspectionReport billInfo, List <View_Business_InspectionJudge_InspectionReport_Item> detailInfo) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); try { var varData = from a in ctx.Business_InspectionJudge_InspectionReport where a.BillNo == billInfo.BillNo select a; if (varData.Count() == 1) { Business_InspectionJudge_InspectionReport lnqBill = varData.Single(); lnqBill.BillNo = billInfo.BillNo; lnqBill.BatchNo = billInfo.BatchNo; lnqBill.BillRelate = billInfo.BillRelate; lnqBill.CheckDate = billInfo.CheckDate; lnqBill.Checker = billInfo.Checker; lnqBill.GoodsCount = billInfo.GoodsCount; lnqBill.GoodsID = billInfo.GoodsID; lnqBill.GoodsImportance = billInfo.GoodsImportance; lnqBill.GoodsType1 = billInfo.GoodsType1; lnqBill.GoodsType2 = billInfo.GoodsType2; lnqBill.InspectionExplain = billInfo.InspectionExplain; lnqBill.IsQualified = billInfo.IsQualified; lnqBill.Provider = billInfo.Provider; } else if (varData.Count() == 0) { ctx.Business_InspectionJudge_InspectionReport.InsertOnSubmit(billInfo); } else { throw new Exception("单据数据不唯一"); } var varDetail = from a in ctx.Business_InspectionJudge_InspectionReport_Item where a.BillNo == billInfo.BillNo select a; ctx.Business_InspectionJudge_InspectionReport_Item.DeleteAllOnSubmit(varDetail); ctx.SubmitChanges(); foreach (View_Business_InspectionJudge_InspectionReport_Item item in detailInfo) { Business_InspectionJudge_InspectionReport_Item lnqDetail = new Business_InspectionJudge_InspectionReport_Item(); lnqDetail.BillNo = billInfo.BillNo; lnqDetail.InspectionItem = item.检验项目; lnqDetail.InspectionResult = item.检验结果; ctx.Business_InspectionJudge_InspectionReport_Item.InsertOnSubmit(lnqDetail); } ctx.SubmitChanges(); ctx.Transaction.Commit(); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }