void SetInfo() { if (m_lnqBillInfo != null) { lbBillStatus.Text = m_serverFlow.GetNowBillStatus(m_lnqBillInfo.BillNo); txtBillNo.Text = m_lnqBillInfo.BillNo; txtFileCode.Text = m_lnqBillInfo.FileCode; txtReason.Text = m_lnqBillInfo.Reason; m_byteData = m_lnqBillInfo.FileInfo.ToArray(); } else { lbBillStatus.Text = CE_CommonBillStatus.新建单据.ToString(); m_lnqBillInfo = new Business_Base_BomChange(); txtBillNo.Text = this.FlowInfo_BillNo; m_lnqBillInfo.BillNo = txtBillNo.Text; this.FlowInfo_BillNo = txtBillNo.Text; } m_listStruct = m_serviceStatement.GetListStructInfo(m_lnqBillInfo.BillNo); List <View_Business_Base_BomChange_PartsLibrary> listLibrary = m_serviceStatement.GetListLibraryInfo(m_lnqBillInfo.BillNo); RefreshDataGridView(listLibrary, m_listStruct); SetStructShowTextBoxSql(); }
bool frm_CommonProcessSubmit(CustomFlowForm form, string advise) { try { Business_Base_BomChange lnqBillInfo = form.ResultInfo as Business_Base_BomChange; List <View_Business_Base_BomChange_Struct> structInfo = form.ResultList[0] as List <View_Business_Base_BomChange_Struct>; List <View_Business_Base_BomChange_PartsLibrary> libraryInfo = form.ResultList[1] as List <View_Business_Base_BomChange_PartsLibrary>; this.OperationType = form.FlowOperationType; this.BillNo = lnqBillInfo.BillNo; switch (this.OperationType) { case CE_FlowOperationType.提交: this.NotifyPersonnel = form.FlowInfo_NotifyInfo; m_serviceStatement.SaveInfo(lnqBillInfo, libraryInfo, structInfo); m_serviceStatement.OperatarUnFlowBusiness(lnqBillInfo.BillNo); break; case CE_FlowOperationType.暂存: m_serviceStatement.SaveInfo(lnqBillInfo, libraryInfo, structInfo); break; case CE_FlowOperationType.回退: break; case CE_FlowOperationType.未知: break; default: break; } if (!m_serviceStatement.IsExist(lnqBillInfo.BillNo)) { MessageDialog.ShowPromptMessage("数据为空,保存失败,如需退出,请直接X掉界面"); return(false); } return(true); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return(false); } }
public override void LoadFormInfo() { try { m_billNoControl = new BillNumberControl(CE_BillTypeEnum.设计BOM变更单.ToString(), m_serviceStatement); m_lnqBillInfo = m_serviceStatement.GetSingleBillInfo(this.FlowInfo_BillNo); this.图号型号.m_OnCompleteSearch += new DelegateCollection.NonArgumentHandle(图号型号_m_OnCompleteSearch); SetInfo(); switch (GlobalObject.GeneralFunction.StringConvertToEnum <CE_CommonBillStatus>(lbBillStatus.Text)) { case CE_CommonBillStatus.新建单据: break; case CE_CommonBillStatus.等待审核: case CE_CommonBillStatus.单据完成: txtFileCode.Enabled = false; lbUpFile.Enabled = false; txtReason.Enabled = false; btnLibraryAdd.Enabled = false; btnLibraryDelete.Enabled = false; btnParentAdd.Enabled = false; btnParentDelete.Enabled = false; dataGridViewStruct.ContextMenuStrip = null; break; default: break; } } catch (Exception ex) { MessageDialog.ShowErrorMessage(ex.Message); } }
/// <summary> /// 保存信息 /// </summary> /// <param name="billInfo">单据信息</param> /// <param name="invoiceInfo">发票信息列表</param> /// <param name="detailInfo">明细信息列表</param> public void SaveInfo(Business_Base_BomChange billInfo, List <View_Business_Base_BomChange_PartsLibrary> libraryInfo, List <View_Business_Base_BomChange_Struct> structInfo) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); try { var varData = from a in ctx.Business_Base_BomChange where a.BillNo == billInfo.BillNo select a; if (varData.Count() == 1) { Business_Base_BomChange lnqBill = varData.Single(); lnqBill.FileCode = billInfo.FileCode; lnqBill.FileInfo = billInfo.FileInfo; lnqBill.Reason = billInfo.Reason; } else if (varData.Count() == 0) { ctx.Business_Base_BomChange.InsertOnSubmit(billInfo); } else { throw new Exception("单据数据不唯一"); } var varTemp1 = from a in ctx.Business_Base_BomChange_Struct where a.BillNo == billInfo.BillNo select a; ctx.Business_Base_BomChange_Struct.DeleteAllOnSubmit(varTemp1); ctx.SubmitChanges(); if (structInfo != null && structInfo.Count > 0) { foreach (View_Business_Base_BomChange_Struct item in structInfo) { Business_Base_BomChange_Struct lnqTemp = new Business_Base_BomChange_Struct(); lnqTemp.BillNo = billInfo.BillNo; lnqTemp.AssemblingGoodsID = item.父级物品ID; lnqTemp.PartGoodsID = item.物品ID; lnqTemp.Usage = item.基数; ctx.Business_Base_BomChange_Struct.InsertOnSubmit(lnqTemp); } } var varTemp2 = from a in ctx.Business_Base_BomChange_PartsLibrary where a.BillNo == billInfo.BillNo select a; ctx.Business_Base_BomChange_PartsLibrary.DeleteAllOnSubmit(varTemp2); ctx.SubmitChanges(); foreach (View_Business_Base_BomChange_PartsLibrary item in libraryInfo) { Business_Base_BomChange_PartsLibrary lnqTemp = new Business_Base_BomChange_PartsLibrary(); lnqTemp.BillNo = billInfo.BillNo; lnqTemp.GoodsID = item.物品ID; lnqTemp.Material = item.材质; lnqTemp.OperationType = item.操作类型; lnqTemp.PartType = item.零件类型; lnqTemp.PivotalPart = item.关键件; lnqTemp.Remark = item.备注; lnqTemp.Version = item.版次号; ctx.Business_Base_BomChange_PartsLibrary.InsertOnSubmit(lnqTemp); } ctx.SubmitChanges(); ctx.Transaction.Commit(); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }