public override void LoadFormInfo() { try { List <string> lstAsscembly = _serviceBOM.GetAssemblyTypeList(); if (lstAsscembly != null) { cmbEdition.DataSource = lstAsscembly; if (cmbEdition.Items.Count > 0) { cmbEdition.SelectedIndex = -1; cmbDBOMVersion.DataSource = null; cmbDBOMVersion.SelectedIndex = -1; } } _billNoControl = new BillNumberControl(CE_BillTypeEnum.生产BOM变更单.ToString(), _servicePBOMChange); _lnqPBOMBill = _servicePBOMChange.GetItem(this.FlowInfo_BillNo); _listDetail = _servicePBOMChange.GetDetail(this.FlowInfo_BillNo); SetInfo(); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); } }
void GetInfo() { _lnqPBOMBill = new Bus_PBOM_Change(); _lnqPBOMBill.BillNo = txtBillNo.Text; _lnqPBOMBill.FileCode = txtFileCode.Text; if (lbDownFile.Tag != null) { _lnqPBOMBill.FileInfo = lbDownFile.Tag as Byte[]; } _lnqPBOMBill.Reason = txtReason.Text; }
private bool 生产BOM变更单_Form_CommonProcessSubmit(CustomFlowForm form, string advise) { try { Bus_PBOM_Change lnqBillInfo = form.ResultInfo as Bus_PBOM_Change; List <View_Bus_PBOM_Change_Detail> detailInfo = form.ResultList[0] as List <View_Bus_PBOM_Change_Detail>; this.OperationType = form.FlowOperationType; this.BillNo = lnqBillInfo.BillNo; string billStatus = _serviceFlow.GetNowBillStatus(this.BillNo); if (billStatus == "" || billStatus == CE_CommonBillStatus.新建单据.ToString()) { _servicePBOMChange.SaveInfo(lnqBillInfo, detailInfo); } switch (this.OperationType) { case CE_FlowOperationType.提交: this.NotifyPersonnel = form.FlowInfo_NotifyInfo; _servicePBOMChange.OperatarUnFlowBusiness(lnqBillInfo.BillNo); break; case CE_FlowOperationType.暂存: case CE_FlowOperationType.回退: case CE_FlowOperationType.未知: break; default: break; } if (!_servicePBOMChange.IsExist(lnqBillInfo.BillNo)) { MessageDialog.ShowPromptMessage("数据为空,保存失败,如需退出,请直接X掉界面"); return(false); } return(true); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return(false); } }
public Bus_PBOM_Change GetItem(string billNo) { Bus_PBOM_Change result = new Bus_PBOM_Change(); using (DepotManagementDataContext ctx = CommentParameter.DepotDataContext) { var varData = from a in ctx.Bus_PBOM_Change where a.BillNo == billNo select a; if (varData.Count() == 1) { result = varData.Single(); } else { result = null; } } return(result); }
public void SaveInfo(Bus_PBOM_Change billInfo, List <View_Bus_PBOM_Change_Detail> detail) { using (DepotManagementDataContext ctx = CommentParameter.DepotDataContext) { ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); try { var varData = from a in ctx.Bus_PBOM_Change where a.BillNo == billInfo.BillNo select a; if (varData.Count() == 1) { Bus_PBOM_Change lnqBill = varData.Single(); lnqBill.FileCode = billInfo.FileCode; lnqBill.FileInfo = billInfo.FileInfo; lnqBill.Reason = billInfo.Reason; } else { ctx.Bus_PBOM_Change.InsertOnSubmit(billInfo); } ctx.SubmitChanges(); var varDetail = from a in ctx.Bus_PBOM_Change_Detail where a.BillNo == billInfo.BillNo select a; ctx.Bus_PBOM_Change_Detail.DeleteAllOnSubmit(varDetail); foreach (View_Bus_PBOM_Change_Detail item in detail) { Bus_PBOM_Change_Detail de = new Bus_PBOM_Change_Detail(); de.ID = Guid.NewGuid(); de.BillNo = item.单据号; de.Edtion = item.总成型号; de.GoodsID = item.物品ID; de.PartType = item.零件类别; de.InvalidGoodsVersion = item.失效版次号; de.IsSelecting = item.配; de.IsInbound = item.台套领料; de.IsPurchase = item.采购; de.ParentGoodsID = item.父级物品ID; de.Usage = item.基数; de.ValidGoodsVersion = item.生效版次号; de.ValidTime = item.生效日期; de.DBOMSysVersion = item.设计BOM版本; de.Selected = item.; ctx.Bus_PBOM_Change_Detail.InsertOnSubmit(de); } ctx.SubmitChanges(); ctx.Transaction.Commit(); } catch (Exception) { ctx.Transaction.Rollback(); throw; } } }