/// <summary> /// 操作流程以外的业务 /// </summary> /// <param name="billNo">单据号</param> public void OperatarUnFlowBusiness(string billNo) { IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); string billStatus = serviceFlow.GetNextBillStatus(billNo); if (billStatus == null) { throw new Exception("单据状态为空,请重新确认"); } if (billStatus != CE_CommonBillStatus.单据完成.ToString()) { return; } DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; dataContxt.Connection.Open(); dataContxt.Transaction = dataContxt.Connection.BeginTransaction(); try { dataContxt.ExecuteCommand("exec BASE_PBOM_SaveSysVersion {0}", billNo); dataContxt.Transaction.Commit(); } catch (Exception ex) { dataContxt.Transaction.Rollback(); throw new Exception(ex.Message); } }
public void OperationBusiness(string billNo) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); try { if (serviceFlow.GetNextBillStatus(billNo) != CE_CommonBillStatus.单据完成.ToString()) { return; } var varData = from a in ctx.Business_Finance_Budget_Year where a.BillNo == billNo select a; if (varData.Count() != 1) { throw new Exception("未找到主表信息"); } List <CommonProcessInfo> lstPersonnel = serviceFlow.GetFlowData(billNo); string createUser = lstPersonnel[lstPersonnel.Count() - 1].人员; Business_Finance_Budget_Year yearInfo = varData.Single(); var varDelete = from a in ctx.Business_Finance_BudgetInfo where a.YearValue == yearInfo.YearValue && a.DeptCode == yearInfo.DeptCode select a; ctx.Business_Finance_BudgetInfo.DeleteAllOnSubmit(varDelete); var varDetail = from a in ctx.Business_Finance_Budget_YearDetail where a.BillNo == billNo select a; foreach (Business_Finance_Budget_YearDetail detail in varDetail) { Business_Finance_BudgetInfo budgetInfo = new Business_Finance_BudgetInfo(); budgetInfo.ID = Guid.NewGuid(); budgetInfo.BudgetAmountYear = detail.BudgetAmount; budgetInfo.CreateDate = ServerTime.Time; budgetInfo.CreateUser = createUser; budgetInfo.DeptCode = yearInfo.DeptCode; budgetInfo.ProjectID = detail.ProjectID; budgetInfo.MonthValue = detail.MonthValue; budgetInfo.YearValue = yearInfo.YearValue; ctx.Business_Finance_BudgetInfo.InsertOnSubmit(budgetInfo); } ctx.SubmitChanges(); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <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.Business_InspectionJudge_JudgeReport where a.BillNo == billNo select a; ctx.Business_InspectionJudge_JudgeReport.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); } }
/// <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.Business_QualityManagement_Isolation where a.BillNo == billNo select a; UpdateStockGoodsStatus(ctx, varData.Single(), (int)CE_StockGoodsStatus.正常); ctx.Business_QualityManagement_Isolation.DeleteAllOnSubmit(varData); serverFlow.FlowDelete(ctx, billNo); ctx.SubmitChanges(); ctx.Transaction.Commit(); billNoControl.CancelBill(billNo); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }
/// <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.Business_CWQC_CreativePersentation where a.BillNo == billNo select a; if (varData.Count() == 1) { Business_CWQC_CreativePersentation tempInfo = varData.Single(); if (tempInfo.ImproveConditions_After_FileNo != null && tempInfo.ImproveConditions_After_FileNo.Trim().Length > 0) { string[] pathArray = tempInfo.ImproveConditions_After_FileNo.Split(','); for (int i = 0; i < pathArray.Length; i++) { UniversalControlLibrary.FileOperationService.File_Delete(new Guid(pathArray[i]), GlobalObject.GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.文件传输方式])); } } if (tempInfo.ImproveConditions_Before_FileNo != null && tempInfo.ImproveConditions_Before_FileNo.Trim().Length > 0) { string[] pathArray = tempInfo.ImproveConditions_Before_FileNo.Split(','); for (int i = 0; i < pathArray.Length; i++) { UniversalControlLibrary.FileOperationService.File_Delete(new Guid(pathArray[i]), GlobalObject.GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.文件传输方式])); } } } ctx.Business_CWQC_CreativePersentation.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); } }
/// <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); } }
/// <summary> /// 赋值账务信息_出 /// </summary> /// <param name="ctx">数据上下文</param> /// <param name="lnqOutPut">单据信息</param> /// <param name="detail1">明细信息</param> /// <returns>返回账务信息对象</returns> S_FetchGoodsDetailBill AssignDetailInfo_Out(DepotManagementDataContext ctx, Business_WarehouseOutPut_OutPut lnqOutPut, View_Business_WarehouseOutPut_OutPutDetail detail1) { ServerModule.IStoreServer storeService = ServerModule.ServerModuleFactory.GetServerModule <ServerModule.IStoreServer>(); IFlowServer serverFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); CommonProcessInfo processInfo = new CommonProcessInfo(); CE_OutPutBusinessType OutPutType = GlobalObject.GeneralFunction.StringConvertToEnum <CE_OutPutBusinessType>(lnqOutPut.BillType); S_FetchGoodsDetailBill fetchDetail = new S_FetchGoodsDetailBill(); fetchDetail.AssociatedBillNo = detail1.关联业务; fetchDetail.AssociatedBillType = CE_BillTypeEnum.入库申请单.ToString(); fetchDetail.BatchNo = detail1.批次号; fetchDetail.BillTime = ServerTime.Time; fetchDetail.DepartDirector = ""; fetchDetail.Department = lnqOutPut.ApplyingDepartment; fetchDetail.Depot = UniversalFunction.GetGoodsInfo(detail1.物品ID).物品类别名称; fetchDetail.Price = 0; //Math.Round(detail1.单价 * detail1.数量, 2); fetchDetail.UnitPrice = 0; //detail1.单价; processInfo = serverFlow.GetFlowData(detail1.关联业务).First(); fetchDetail.FillInDate = Convert.ToDateTime(processInfo.时间); fetchDetail.FillInPersonnel = processInfo.人员; fetchDetail.FetchBIllID = lnqOutPut.BillNo; fetchDetail.FetchCount = detail1.数量; fetchDetail.GoodsID = detail1.物品ID; fetchDetail.OperationType = (int)GlobalObject.EnumOperation.OutPutBusinessTypeConvertToSubsidiaryOperationType(OutPutType); fetchDetail.Provider = detail1.供应商; fetchDetail.Remark = detail1.备注; fetchDetail.StorageID = lnqOutPut.StorageID; DataTable stockTable = storeService.GetGoodsStockInfo(fetchDetail.GoodsID, fetchDetail.BatchNo, fetchDetail.Provider, fetchDetail.StorageID); if (stockTable != null && stockTable.Rows.Count > 0) { fetchDetail.ProviderBatchNo = stockTable.Rows[0]["ProviderBatchNo"].ToString(); } else { fetchDetail.ProviderBatchNo = ""; } fetchDetail.Using = lnqOutPut.BillTypeDetail; return(fetchDetail); }
/// <summary> /// 操作 /// </summary> /// <param name="listInfo">清单明细</param> /// <param name="billNo">单号</param> /// <param name="edition">总成型号</param> /// <param name="applicable">适用范围</param> public void OperationInfo(List <View_S_DebitSchedule> listInfo, string billNo, string edition, CE_DebitScheduleApplicable applicable) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); try { IFlowServer serverFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); if (serverFlow.GetNextBillStatus(billNo) == ProductOrderListStatus.单据完成.ToString()) { var varOrder = from a in ctx.BASE_ProductOrder where a.Edition == edition && a.Applicable == applicable.ToString() select a; JudgeAssembly(ctx, listInfo, edition, applicable); ctx.BASE_ProductOrder.DeleteAllOnSubmit(varOrder); ctx.SubmitChanges(); int intOrder = 0; foreach (View_S_DebitSchedule item in listInfo) { if (item.基数 > 0) { BASE_ProductOrder order = new BASE_ProductOrder(); order.Edition = edition; order.Applicable = applicable.ToString(); order.GoodsID = item.物品ID; order.Redices = item.基数; order.OnceTheWholeIssue = item.一次性整台份发料; order.Position = ++intOrder; ctx.BASE_ProductOrder.InsertOnSubmit(order); } } ctx.SubmitChanges(); } ctx.Transaction.Commit(); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }
public void AutoFirstMaterialRequisition(string billNo, out List <string> listBillNo) { listBillNo = null; DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); IFlowServer serverFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); string billStatus = serverFlow.GetNextBillStatus(billNo); if (billStatus == null) { throw new Exception("单据状态为空,请重新确认"); } try { if (billStatus == CE_CommonBillStatus.单据完成.ToString()) { var varBill = from a in ctx.Business_WarehouseOutPut_WholeMachineRequisition where a.BillNo == billNo select a; Business_WarehouseOutPut_WholeMachineRequisition lnqWholeBill = varBill.Single(); var varDetail = from a in ctx.Business_WarehouseOutPut_WholeMachineRequisitionDetail where a.BillNo == billNo select a; List <Business_WarehouseOutPut_WholeMachineRequisitionDetail> listDetail = varDetail.ToList(); var varStorage = from a in ctx.Business_WarehouseOutPut_WholeMachineRequisition_StorageID where a.BillNo == billNo select a; List <Business_WarehouseOutPut_WholeMachineRequisition_StorageID> listStorage = varStorage.ToList(); CreateMaterialRequisition(ctx, lnqWholeBill, listDetail, listStorage, out listBillNo); ctx.Transaction.Commit(); } } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }
/// <summary> /// 提交发料清单 /// </summary> /// <param name="listInfo">清单明细</param> /// <param name="billNo">单号</param> /// <param name="edition">总成型号</param> /// <param name="applicable">适用范围</param> public void SaveInfo(List <View_S_DebitSchedule> listInfo, string billNo, string edition, CE_DebitScheduleApplicable applicable) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); IFlowServer serverFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); string billStatus = serverFlow.GetNextBillStatus(billNo); if (billStatus == null) { throw new Exception("单据状态为空,请重新确认"); } try { var varData = from a in ctx.S_DebitSchedule where a.BillNo == billNo select a; ctx.S_DebitSchedule.DeleteAllOnSubmit(varData); ctx.SubmitChanges(); foreach (View_S_DebitSchedule item in listInfo) { S_DebitSchedule templnq = new S_DebitSchedule(); templnq.BillNo = billNo; templnq.Edition = edition; templnq.Applicable = applicable.ToString(); templnq.GoodsID = item.物品ID; templnq.Redices = item.基数; templnq.OnceTheWholeIssue = item.一次性整台份发料; ctx.S_DebitSchedule.InsertOnSubmit(templnq); } ctx.SubmitChanges(); ctx.Transaction.Commit(); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }
/// <summary> /// 保存业务信息 /// </summary> /// <param name="billInfo">业务总单信息</param> /// <param name="effectValue">业务明细信息</param> public void SaveInfo(Bus_FocalWork_MonthlyProgress billInfo, List <Bus_FocalWork_MonthlyProgress_Content> lstContent, List <Bus_FocalWork_MonthlyProgress_KeyPoint> lstKeyPoint) { using (DepotManagementDataContext ctx = CommentParameter.DepotDataContext) { ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); try { var varData = from a in ctx.Bus_FocalWork_MonthlyProgress where a.BillNo == billInfo.BillNo select a; Bus_FocalWork_MonthlyProgress lnqBill = new Bus_FocalWork_MonthlyProgress(); if (varData.Count() == 1) { lnqBill = varData.Single(); lnqBill.CreateUser = BasicInfo.LoginID; lnqBill.YearMonth = billInfo.YearMonth; SaveDetail(ctx, billInfo.BillNo, lstContent, lstKeyPoint); } else if (varData.Count() == 0) { ctx.Bus_FocalWork_MonthlyProgress.InsertOnSubmit(billInfo); SaveDetail(ctx, billInfo.BillNo, lstContent, lstKeyPoint); } else { throw new Exception("单据数据不唯一"); } ctx.SubmitChanges(); ctx.Transaction.Commit(); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } } }
public void OperationBusiness(string billNo) { try { ITrainPlanCollect serviceCollect = Service_Peripheral_HR.ServerModuleFactory.GetServerModule <ITrainPlanCollect>(); IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); if (serviceFlow.GetNextBillStatus(billNo) == CE_CommonBillStatus.单据完成.ToString()) { serviceCollect.GenerateCollectPlan_Temp(billNo); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public void OperationBusiness(DataTable detailTable, string billNo) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); try { if (serviceFlow.GetNextBillStatus(billNo) != CE_CommonBillStatus.单据完成.ToString()) { return; } Business_Finance_Budget_Month billInfo = GetBillSingleInfo(ctx, billNo); if (billInfo == null) { throw new Exception("单据不存在"); } var varDetail = from a in ctx.Business_Finance_Budget_MonthDetail where a.BillNo == billInfo.BillNo select a; foreach (Business_Finance_Budget_MonthDetail detail in varDetail) { var varInfo = from a in ctx.Business_Finance_BudgetInfo where a.DeptCode == billInfo.DeptCode && a.YearValue == billInfo.YearValue && a.MonthValue == billInfo.MonthValue && a.ProjectID == detail.ProjectID select a; if (varInfo.Count() == 1) { varInfo.Single().BudgetAmountMonth = detail.BudgetAmount; varInfo.Single().ActualAmount = detail.ActualAmount; } } ctx.SubmitChanges(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public void OperationBusiness(string billNo) { IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); try { if (serviceFlow.GetNextBillStatus(billNo) != CE_CommonBillStatus.单据完成.ToString()) { return; } var varData = from a in ctx.ZPX_BatchNoManage select a; ctx.ZPX_BatchNoManage.DeleteAllOnSubmit(varData); ctx.SubmitChanges(); var varDetail = from a in ctx.Business_WorkShop_BatchNoChangeDetail where a.BillNo == billNo select a; foreach (Business_WorkShop_BatchNoChangeDetail item in varDetail) { ZPX_BatchNoManage batchNoInfo = new ZPX_BatchNoManage(); batchNoInfo.ManageType = item.ManageType; batchNoInfo.GoodsID = item.GoodsID; ctx.ZPX_BatchNoManage.InsertOnSubmit(batchNoInfo); } ctx.SubmitChanges(); ctx.Transaction.Commit(); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }
public void DeleteInfo(string billNo) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; try { IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); var varData = from a in ctx.Business_Project_TCU_SoftwareUpdate_DID where a.BillNo == billNo select a; ctx.Business_Project_TCU_SoftwareUpdate_DID.DeleteAllOnSubmit(varData); var varData1 = from a in ctx.Business_Project_TCU_SoftwareUpdate where a.BillNo == billNo select a; if (varData1.Count() == 1) { Business_Project_TCU_SoftwareUpdate tempInfo = varData1.Single(); UniversalControlLibrary.FileOperationService.File_Delete(tempInfo.ProgramUnique, GlobalObject.GeneralFunction.StringConvertToEnum <CE_CommunicationMode> (BasicInfo.BaseSwitchInfo[(int)CE_SwitchName.文件传输方式])); if (tempInfo.TestReport != null) { UniversalControlLibrary.FileOperationService.File_Delete((Guid)tempInfo.TestReport, GlobalObject.GeneralFunction.StringConvertToEnum <CE_CommunicationMode> (BasicInfo.BaseSwitchInfo[(int)CE_SwitchName.文件传输方式])); } ctx.Business_Project_TCU_SoftwareUpdate.DeleteAllOnSubmit(varData1); } serviceFlow.FlowDelete(ctx, billNo); ctx.SubmitChanges(); } catch (Exception ex) { throw new Exception(ex.Message); } }
void SetInfo() { IFlowServer serverFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); if (_LnqBillInfo != null) { lbBillStatus.Text = serverFlow.GetNowBillStatus(_LnqBillInfo.BillNo); txtBillNo.Text = _LnqBillInfo.BillNo; txtAssetsNo.Text = _LnqBillInfo.AssetsNo; txtContact.Text = _LnqBillInfo.Contact; txtEvaluation.Text = _LnqBillInfo.Evaluation; txtMalfunctionApproach.Text = _LnqBillInfo.MalfunctionApproach; txtMalfunctionReason.Text = _LnqBillInfo.MalfunctionReason; txtMalfunctionSymptom.Text = _LnqBillInfo.MalfunctionSymptom; txtMalfunctionAddress.Text = _LnqBillInfo.MalfunctionAddress; numElapsedTime.Value = _LnqBillInfo.ElapsedTime == null ? 0 : (decimal)_LnqBillInfo.ElapsedTime; numExpenses.Value = _LnqBillInfo.Expenses == null ? 0 : (decimal)_LnqBillInfo.Expenses; numSatisfaction.Value = _LnqBillInfo.Satisfaction == null ? 0 : (decimal)_LnqBillInfo.Satisfaction; cmbSymptomType.Text = _LnqBillInfo.SymptomType == null ? "" : _LnqBillInfo.SymptomType; if (_LnqBillInfo.Solve != null) { GlobalObject.GeneralFunction.SetRadioButton(_LnqBillInfo.Solve, customGroupBox3); } List <CommonProcessInfo> lstTemp = serverFlow.GetFlowData(_LnqBillInfo.BillNo); CommonProcessInfo info = lstTemp.OrderBy(k => k.时间).First(); txtLinkPersonnel.Text = info.人员; } else { lbBillStatus.Text = CE_CommonBillStatus.新建单据.ToString(); _LnqBillInfo = new Business_Composite_ComputerMalfunction(); txtBillNo.Text = this.FlowInfo_BillNo; _LnqBillInfo.BillNo = txtBillNo.Text; txtLinkPersonnel.Text = BasicInfo.LoginName; } }
/// <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.HR_Train_Plan where a.BillNo == billNo select a; var varData1 = from a in ctx.HR_Train_PlanCourse where a.BillNo == billNo select a; var varData2 = from a in ctx.HR_Train_PlanUser join b in ctx.HR_Train_PlanCourse on a.PlanCourseID equals b.ID where b.BillNo == billNo select a; ctx.HR_Train_PlanUser.DeleteAllOnSubmit(varData2); ctx.HR_Train_PlanCourse.DeleteAllOnSubmit(varData1); ctx.HR_Train_Plan.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); } }
/// <summary> /// 赋值账务信息_入 /// </summary> /// <param name="ctx">数据上下文</param> /// <param name="lnqOutPut">单据信息</param> /// <param name="detail1">明细信息</param> /// <returns>返回账务信息对象</returns> S_InDepotDetailBill AssignDetailInfo_In(DepotManagementDataContext ctx, Business_WarehouseOutPut_OutPut lnqOutPut, View_Business_WarehouseOutPut_OutPutDetail detail1) { IFlowServer serverFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); CommonProcessInfo processInfo = new CommonProcessInfo(); CE_OutPutBusinessType OutPutType = GlobalObject.GeneralFunction.StringConvertToEnum <CE_OutPutBusinessType>(lnqOutPut.BillType); S_InDepotDetailBill inDepotDetail = new S_InDepotDetailBill(); inDepotDetail.AffrimPersonnel = BasicInfo.LoginName; inDepotDetail.BatchNo = detail1.批次号; inDepotDetail.BillTime = ServerTime.Time; inDepotDetail.Department = UniversalFunction.GetDeptName(lnqOutPut.ApplyingDepartment); inDepotDetail.Depot = UniversalFunction.GetGoodsInfo(detail1.物品ID).物品类别名称; inDepotDetail.FactPrice = 0; //Math.Round(detail1.单价 * detail1.数量, 2); inDepotDetail.FactUnitPrice = 0; //detail1.单价; inDepotDetail.Price = inDepotDetail.FactPrice; inDepotDetail.UnitPrice = inDepotDetail.FactUnitPrice; inDepotDetail.InvoicePrice = null; inDepotDetail.InvoiceUnitPrice = null; processInfo = serverFlow.GetFlowData(detail1.关联业务).First(); inDepotDetail.FillInDate = Convert.ToDateTime(processInfo.时间); inDepotDetail.FillInPersonnel = processInfo.人员; inDepotDetail.InDepotBillID = lnqOutPut.BillNo; inDepotDetail.InDepotCount = -detail1.数量; inDepotDetail.GoodsID = detail1.物品ID; inDepotDetail.OperationType = (int)GlobalObject.EnumOperation.OutPutBusinessTypeConvertToSubsidiaryOperationType(OutPutType); inDepotDetail.Provider = detail1.供应商; inDepotDetail.Remark = detail1.备注; inDepotDetail.StorageID = lnqOutPut.StorageID; return(inDepotDetail); }
public void SaveInfo(DataTable detailTable, Business_Finance_Budget_Year billInfo) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); try { if (serviceFlow.GetNowBillStatus(billInfo.BillNo) != CE_CommonBillStatus.新建单据.ToString()) { return; } if (detailTable == null) { throw new Exception("无明细信息,无法保存"); } var varDetail = from a in ctx.Business_Finance_Budget_YearDetail where a.BillNo == billInfo.BillNo select a; var varBill = from a in ctx.Business_Finance_Budget_Year where a.BillNo == billInfo.BillNo select a; ctx.Business_Finance_Budget_YearDetail.DeleteAllOnSubmit(varDetail); ctx.Business_Finance_Budget_Year.DeleteAllOnSubmit(varBill); billInfo.DeptCode = UniversalFunction.GetDept_Belonge(ctx, BasicInfo.DeptCode).DeptCode; ctx.Business_Finance_Budget_Year.InsertOnSubmit(billInfo); List <Business_Finance_Budget_YearDetail> lstDetail = new List <Business_Finance_Budget_YearDetail>(); Business_Finance_Budget_YearDetail detail = new Business_Finance_Budget_YearDetail(); foreach (DataRow dr in detailTable.Rows) { detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 1; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["1月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 2; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["2月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 3; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["3月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 4; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["4月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 5; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["5月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 6; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["6月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 7; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["7月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 8; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["8月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 9; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["9月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 10; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["10月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 11; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["11月"]); lstDetail.Add(detail); detail = new Business_Finance_Budget_YearDetail(); detail.BillNo = billInfo.BillNo; detail.MonthValue = 12; detail.ProjectID = dr["科目ID"].ToString(); detail.BudgetAmount = Convert.ToDecimal(dr["12月"]); lstDetail.Add(detail); } ctx.Business_Finance_Budget_YearDetail.InsertAllOnSubmit(lstDetail); ctx.SubmitChanges(); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 提交单据 /// </summary> /// <param name="billNo">单号</param> /// <param name="listInfo">明细信息</param> /// <param name="error">错误信息</param> /// <returns>成功返回True,否则False</returns> public bool SubmitInfo(string billNo, System.Collections.Generic.List <View_S_GoodsEnteringBill> listInfo, out string error) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); IFlowServer serverFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); string billStatus = serverFlow.GetNextBillStatus(billNo); if (billStatus == null) { throw new Exception("单据状态为空,请重新确认"); } error = null; try { EditListInfo(ctx, billNo, listInfo); if (billStatus == GoodsEnteringBillStatus.单据完成.ToString()) { foreach (View_S_GoodsEnteringBill item in listInfo) { F_GoodsPlanCost tempGoodsInfo = new F_GoodsPlanCost(); tempGoodsInfo.Date = ServerTime.Time; tempGoodsInfo.GoodsCode = item.图号型号; tempGoodsInfo.GoodsName = item.物品名称; if (item.材料类别编码 == null || item.材料类别编码.Trim().Length == 0) { throw new Exception("材料类别不能为空"); } tempGoodsInfo.GoodsType = item.材料类别编码; tempGoodsInfo.GoodsUnitPrice = 0; tempGoodsInfo.IsDisable = false; tempGoodsInfo.PY = ctx.Fun_get_bm(item.物品名称, 1); tempGoodsInfo.WB = ctx.Fun_get_bm(item.物品名称, 0); tempGoodsInfo.Remark = item.备注; tempGoodsInfo.Spec = item.规格; tempGoodsInfo.UnitID = item.单位 == "" ? 1 : Convert.ToInt32(UniversalFunction.GetUnitID(item.单位)); List <Flow_FlowData> tempList = serverFlow.GetBusinessOperationInfo(billNo, GoodsEnteringBillStatus.新建单据.ToString()); if (tempList == null) { throw new Exception("获取操作人员失败"); } tempGoodsInfo.UserCode = tempList[0].OperationPersonnel; ctx.F_GoodsPlanCost.InsertOnSubmit(tempGoodsInfo); } } ctx.SubmitChanges(); ctx.Transaction.Commit(); return(true); } catch (Exception ex) { error = ex.Message; ctx.Transaction.Rollback(); return(false); } }
public void SaveInfo(Business_WorkShop_BatchNoChange changeInfo, List <View_Business_WorkShop_BatchNoChangeDetail> lstDetail) { IFlowServer service = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); try { if (service.GetNowBillStatus(changeInfo.BillNo) != CE_CommonBillStatus.新建单据.ToString()) { return; } var varData = from a in ctx.Business_WorkShop_BatchNoChange where a.BillNo == changeInfo.BillNo select a; ctx.Business_WorkShop_BatchNoChange.DeleteAllOnSubmit(varData); var varDetail = from a in ctx.Business_WorkShop_BatchNoChangeDetail where a.BillNo == changeInfo.BillNo select a; ctx.Business_WorkShop_BatchNoChangeDetail.DeleteAllOnSubmit(varDetail); ctx.SubmitChanges(); ctx.Business_WorkShop_BatchNoChange.InsertOnSubmit(changeInfo); ctx.SubmitChanges(); foreach (View_Business_WorkShop_BatchNoChangeDetail item in lstDetail) { Business_WorkShop_BatchNoChangeDetail detail = new Business_WorkShop_BatchNoChangeDetail(); detail.ID = Guid.NewGuid(); detail.BillNo = changeInfo.BillNo; detail.GoodsID = item.物品ID; detail.ManageType = item.管理方式; if (detail.GoodsID == null || detail.GoodsID == 0) { throw new Exception("存在未选择【物品】的记录行"); } if (detail.ManageType.Trim().Length == 0) { throw new Exception(UniversalFunction.GetGoodsMessage(ctx, (int)detail.GoodsID) + "未选择【管理方式】"); } ctx.Business_WorkShop_BatchNoChangeDetail.InsertOnSubmit(detail); } ctx.SubmitChanges(); ctx.Transaction.Commit(); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }
/// <summary> /// 操作流程以外的业务 /// </summary> /// <param name="billNo">单据号</param> public void OperatarUnFlowBusiness(string billNo) { IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); string billStatus = serviceFlow.GetNextBillStatus(billNo); if (billStatus == null) { throw new Exception("单据状态为空,请重新确认"); } if (billStatus != CE_CommonBillStatus.单据完成.ToString()) { return; } DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; dataContxt.Connection.Open(); dataContxt.Transaction = dataContxt.Connection.BeginTransaction(); try { List <View_Business_Base_BomChange_Struct> lstStruct = GetListStructInfo(billNo); List <View_Business_Base_BomChange_PartsLibrary> lstLibrary = GetListLibraryInfo(billNo); List <Flow_FlowData> tempList = serviceFlow.GetBusinessOperationInfo(billNo, CE_CommonBillStatus.新建单据.ToString()); if (tempList == null) { throw new Exception("获取操作人员失败"); } JudgeAssembly(dataContxt, lstStruct); string personnel = tempList[0].OperationPersonnel; #region 零件库变更 foreach (var item2 in lstLibrary) { CE_OperatorMode operationMode = GlobalObject.GeneralFunction.StringConvertToEnum <CE_OperatorMode>(item2.操作类型); switch (operationMode) { case CE_OperatorMode.添加: var varTemp4 = from a in dataContxt.BASE_BomPartsLibrary where a.GoodsID == item2.物品ID select a; if (varTemp4 != null && varTemp4.Count() == 1) { BASE_BomPartsLibrary library1 = varTemp4.Single(); library1.CreateDate = ServerTime.Time; library1.CreatePersonnel = personnel; library1.Material = item2.材质; library1.PartType = item2.零件类型; library1.PivotalPart = item2.关键件; library1.Remark = item2.备注; library1.Version = item2.版次号; } else if (varTemp4.Count() == 0) { BASE_BomPartsLibrary library = new BASE_BomPartsLibrary(); library.CreateDate = ServerTime.Time; library.CreatePersonnel = personnel; library.GoodsID = item2.物品ID; library.Material = item2.材质; library.PartType = item2.零件类型; library.PivotalPart = item2.关键件; library.Remark = item2.备注; library.Version = item2.版次号; dataContxt.BASE_BomPartsLibrary.InsertOnSubmit(library); } break; case CE_OperatorMode.修改: var varTemp2 = from a in dataContxt.BASE_BomPartsLibrary where a.GoodsID == item2.物品ID select a; if (varTemp2 != null && varTemp2.Count() == 1) { BASE_BomPartsLibrary library1 = varTemp2.Single(); library1.CreateDate = ServerTime.Time; library1.CreatePersonnel = personnel; library1.Material = item2.材质; library1.PartType = item2.零件类型; library1.PivotalPart = item2.关键件; library1.Remark = item2.备注; library1.Version = item2.版次号; } break; case CE_OperatorMode.除: var varTemp3 = from a in dataContxt.BASE_BomPartsLibrary where a.GoodsID == item2.物品ID select a; dataContxt.BASE_BomPartsLibrary.DeleteAllOnSubmit(varTemp3); break; default: break; } } dataContxt.SubmitChanges(); #endregion #region 结构变更 var varData = (from a in lstStruct select new { a.父级图号, a.父级物品ID }).Distinct(); foreach (var item in varData) { var varTemp = from a in dataContxt.BASE_BomStruct where a.ParentID == item.父级物品ID select a; decimal sysVersion = varTemp.Count() == 0 ? 0 : varTemp.Select(r => r.SysVersion).Distinct().ToList()[0]; dataContxt.BASE_BomStruct.DeleteAllOnSubmit(varTemp); dataContxt.SubmitChanges(); var varTemp1 = from a in lstStruct where a.父级物品ID == item.父级物品ID select a; foreach (var item1 in varTemp1) { if (item1.物品ID == null) { break; } BASE_BomStruct tempStruct = new BASE_BomStruct(); tempStruct.CreateDate = ServerTime.Time; tempStruct.CreatePersonnel = personnel; tempStruct.GoodsID = (int)item1.物品ID; tempStruct.ParentID = item1.父级物品ID; tempStruct.Usage = (decimal)item1.基数; tempStruct.SysVersion = sysVersion + (decimal)0.01; dataContxt.BASE_BomStruct.InsertOnSubmit(tempStruct); } } dataContxt.SubmitChanges(); #endregion dataContxt.ExecuteCommand("exec BASE_DBOM_SaveSysVersion {0}", billNo); dataContxt.Transaction.Commit(); } catch (Exception ex) { dataContxt.Transaction.Rollback(); throw new Exception(ex.Message); } }
void SetInfo() { IFlowServer serverFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); dataGridView1.DataSource = m_mainService.GetReferenceInfo(dataGridView1.Tag.ToString()); dataGridView2.DataSource = m_mainService.GetReferenceInfo(dataGridView2.Tag.ToString()); dataGridView3.DataSource = m_mainService.GetReferenceInfo(dataGridView3.Tag.ToString()); if (m_lnqBillInfo != null) { lbBillStatus.Text = serverFlow.GetNowBillStatus(m_lnqBillInfo.BillNo); txtBillNo.Text = m_lnqBillInfo.BillNo; Flow_FlowInfo flowInfo = serverFlow.GetNowFlowInfo(serverFlow.GetBusinessTypeID(CE_BillTypeEnum.创意提案, null), m_lnqBillInfo.BillNo); Flow_FlowData flowData = serverFlow.GetBusinessOperationInfo(txtBillNo.Text, CE_CommonBillStatus.新建单据.ToString())[0]; View_HR_Personnel sqrInfo = UniversalFunction.GetPersonnelInfo(m_lnqBillInfo.Propose); txtDept.Text = sqrInfo.部门名称; txtPropose.Text = sqrInfo.姓名; txtPropose.Tag = sqrInfo.工号; txtImproveConditions_After.Text = m_lnqBillInfo.ImproveConditions_After; txtImproveConditions_Before.Text = m_lnqBillInfo.ImproveConditions_Before; txtTask.Text = m_lnqBillInfo.Task; dtpImproveEndDate.Value = m_lnqBillInfo.ImproveEndDate; dtpImproveStartDate.Value = m_lnqBillInfo.ImproveStartDate; cmbExtensionCoverage.Text = m_lnqBillInfo.ExtensionCoverage; txtValueEffect.Text = m_lnqBillInfo.ValueEffect.ToString(); numFGLD_Abstract.Value = m_lnqBillInfo.FGLD_Abstract == null ? 0 : (int)m_lnqBillInfo.FGLD_Abstract; numFGLD_Apply.Value = m_lnqBillInfo.FGLD_Apply == null ? 0 : (int)m_lnqBillInfo.FGLD_Apply; numFGLD_Economy.Value = m_lnqBillInfo.FGLD_Economy == null ? 0 : (int)m_lnqBillInfo.FGLD_Economy; numFGLD_Ideas.Value = m_lnqBillInfo.FGLD_Ideas == null ? 0 : (int)m_lnqBillInfo.FGLD_Ideas; numFGLD_Strive.Value = m_lnqBillInfo.FGLD_Strive == null ? 0 : (int)m_lnqBillInfo.FGLD_Strive; numFZR_Abstract.Value = m_lnqBillInfo.FZR_Abstract == null ? 0 : (int)m_lnqBillInfo.FZR_Abstract; numFZR_Apply.Value = m_lnqBillInfo.FZR_Apply == null ? 0 : (int)m_lnqBillInfo.FZR_Apply; numFZR_Economy.Value = m_lnqBillInfo.FZR_Economy == null ? 0 : (int)m_lnqBillInfo.FZR_Economy; numFZR_Ideas.Value = m_lnqBillInfo.FZR_Ideas == null ? 0 : (int)m_lnqBillInfo.FZR_Ideas; numFZR_Strive.Value = m_lnqBillInfo.FZR_Strive == null ? 0 : (int)m_lnqBillInfo.FZR_Strive; lbImproveConditions_After_FileNo_Look.Tag = m_lnqBillInfo.ImproveConditions_After_FileNo; lbImproveConditions_Before_FileNo_Look.Tag = m_lnqBillInfo.ImproveConditions_Before_FileNo; List <string> lstCheck = m_lnqBillInfo.ProposalType.Split(',').ToList(); foreach (Control cl in customGroupBox1.Controls) { if (cl is CheckBox) { CheckBox cb = cl as CheckBox; if (lstCheck.Contains(cb.Text)) { cb.Checked = true; } } } foreach (Control cl in tabPage1.Controls) { if (cl is CustomGroupBox) { CustomGroupBox gb = cl as CustomGroupBox; if (gb.Tag != null && gb.Tag.ToString().Trim().Length > 0) { if (flowInfo.FlowID == Convert.ToInt32(gb.Tag)) { gb.Enabled = true; } else { gb.Enabled = false; } } } } if (lbBillStatus.Text != CE_CommonBillStatus.新建单据.ToString()) { txtImproveConditions_After.ReadOnly = true; txtImproveConditions_Before.ReadOnly = true; } } else { lbBillStatus.Text = CE_CommonBillStatus.新建单据.ToString(); m_lnqBillInfo = new Business_CWQC_CreativePersentation(); txtBillNo.Text = this.FlowInfo_BillNo; m_lnqBillInfo.BillNo = txtBillNo.Text; View_HR_Personnel sqrInfo = UniversalFunction.GetPersonnelInfo(BasicInfo.LoginID); txtDept.Text = sqrInfo.部门名称; txtPropose.Text = sqrInfo.姓名; txtPropose.Tag = sqrInfo.工号; if (!isDirectAdd) { customGroupBox6.Enabled = false; customGroupBox7.Enabled = false; } } if (lbBillStatus.Text == CE_CommonBillStatus.新建单据.ToString()) { lbImproveConditions_After_FileNo_Up.Visible = true; lbImproveConditions_Before_FileNo_Up.Visible = true; } else { lbImproveConditions_After_FileNo_Up.Visible = false; lbImproveConditions_Before_FileNo_Up.Visible = false; } if (lbImproveConditions_After_FileNo_Look.Tag != null && lbImproveConditions_After_FileNo_Look.Tag.ToString().Trim().Length > 0) { lbImproveConditions_After_FileNo_Look.Visible = true; } else { lbImproveConditions_After_FileNo_Look.Visible = false; } if (lbImproveConditions_Before_FileNo_Look.Tag != null && lbImproveConditions_Before_FileNo_Look.Tag.ToString().Trim().Length > 0) { lbImproveConditions_Before_FileNo_Look.Visible = true; } else { lbImproveConditions_Before_FileNo_Look.Visible = false; } FZRSetInfo(); FGLDSetInfo(); SetInfo_EffectValue(); }
public void AutoSupplementaryRequisition(string billNo, out List <string> listBillNo) { listBillNo = null; DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); IFlowServer serverFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); string billStatus = serverFlow.GetNowBillStatus(billNo); if (billStatus == null) { throw new Exception("单据状态为空,请重新确认"); } try { if (billStatus == CE_CommonBillStatus.单据完成.ToString()) { var varBill = from a in ctx.Business_WarehouseOutPut_WholeMachineRequisition where a.BillNo == billNo select a; Business_WarehouseOutPut_WholeMachineRequisition lnqWholeBill = varBill.Single(); string error = ""; Hashtable hsTable = new Hashtable(); hsTable.Add("@BillNo", billNo); DataTable tempTable = GlobalObject.DatabaseServer.QueryInfoPro("Business_WarehouseOutPut_WholeMachineRequisition_GetLastShortageInfo", hsTable, out error); List <Business_WarehouseOutPut_WholeMachineRequisitionDetail> listDetail = new List <Business_WarehouseOutPut_WholeMachineRequisitionDetail>(); if (tempTable != null && tempTable.Rows.Count > 0) { foreach (DataRow dr in tempTable.Rows) { Business_WarehouseOutPut_WholeMachineRequisitionDetail detail = new Business_WarehouseOutPut_WholeMachineRequisitionDetail(); detail.BillNo = billNo; detail.Cardinality = 0; detail.GoodsCount = Convert.ToDecimal(dr["NeedCount"]); detail.GoodsID = Convert.ToInt32(dr["GoodsID"]); listDetail.Add(detail); } } else { throw new Exception("无物品可生成补领的【领料单】"); } var varStorage = from a in ctx.Business_WarehouseOutPut_WholeMachineRequisition_StorageID where a.BillNo == billNo select a; List <Business_WarehouseOutPut_WholeMachineRequisition_StorageID> listStorage = varStorage.ToList(); CreateMaterialRequisition(ctx, lnqWholeBill, listDetail, listStorage, out listBillNo); ctx.Transaction.Commit(); } } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }
/// <summary> /// 操作流程以外的业务 /// </summary> /// <param name="billNo">单据号</param> public void OperatarUnFlowBusiness(string billNo) { IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); string billStatus = serviceFlow.GetNextBillStatus(billNo); if (billStatus == null) { throw new Exception("单据状态为空,请重新确认"); } if (billStatus != CE_CommonBillStatus.单据完成.ToString()) { return; } DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; dataContxt.Connection.Open(); dataContxt.Transaction = dataContxt.Connection.BeginTransaction(); try { List <View_Business_Settlement_ProcurementStatementDetail> lstDetail = GetListViewDetailInfo(billNo); foreach (View_Business_Settlement_ProcurementStatementDetail detailInfo in lstDetail) { var varBillType = from a in dataContxt.BASE_BillType where a.TypeCode == GlobalObject.GeneralFunction.ScreenString(CE_ScreenType.字母, detailInfo.入库单号) select a; if (varBillType.Count() != 1) { throw new Exception("找不到此单据的单据类型或者此单据类型重复"); } switch (GlobalObject.GeneralFunction.StringConvertToEnum <CE_BillTypeEnum>(varBillType.Single().TypeName)) { case CE_BillTypeEnum.报检入库单: ChangePrice_S_CheckOutInDepotBill(dataContxt, detailInfo); break; case CE_BillTypeEnum.委外报检入库单: ChangePrice_S_CheckOutInDepotForOutsourcingBill(dataContxt, detailInfo); break; case CE_BillTypeEnum.普通入库单: ChangePrice_S_OrdinaryInDepotGoodsBill(dataContxt, detailInfo); break; case CE_BillTypeEnum.采购退货单: ChangePrice_S_MaterialRejectBill(dataContxt, detailInfo); break; default: throw new Exception("此单据类型为非入库业务" + detailInfo.入库单号); } ChangePrice_S_InDepotDetailBill(dataContxt, detailInfo); } dataContxt.Transaction.Commit(); } catch (Exception ex) { dataContxt.Transaction.Rollback(); throw new Exception(ex.Message); } }
void CreateMaterialRequisition(DepotManagementDataContext ctx, Business_WarehouseOutPut_WholeMachineRequisition billInfo, List <Business_WarehouseOutPut_WholeMachineRequisitionDetail> listDetail, List <Business_WarehouseOutPut_WholeMachineRequisition_StorageID> listStorage, out List <string> listBillNo) { listBillNo = null; ServerModule.IMaterialRequisitionGoodsServer serviceGoods = ServerModule.ServerModuleFactory.GetServerModule <ServerModule.IMaterialRequisitionGoodsServer>(); ServerModule.IMaterialRequisitionServer serviceBill = ServerModule.ServerModuleFactory.GetServerModule <ServerModule.IMaterialRequisitionServer>(); ServerModule.IStoreServer serviceStore = ServerModule.ServerModuleFactory.GetServerModule <ServerModule.IStoreServer>(); IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); ServerModule.IMaterialRequisitionPurposeServer servicePurpose = ServerModule.ServerModuleFactory.GetServerModule <ServerModule.IMaterialRequisitionPurposeServer>(); BillNumberControl billControl = new BillNumberControl(CE_BillTypeEnum.领料单, serviceBill); List <CommonProcessInfo> listProcessInfo = serviceFlow.GetFlowData(billInfo.BillNo); try { List <GoodsInfo> listGoodsInfo = new List <GoodsInfo>(); foreach (Business_WarehouseOutPut_WholeMachineRequisitionDetail detail in listDetail) { decimal requstCount = detail.GoodsCount; foreach (Business_WarehouseOutPut_WholeMachineRequisition_StorageID storage in listStorage) { if (requstCount == 0) { break; } List <View_S_Stock> lstStock = serviceStore.GetGoodsStoreOnlyForAssembly(detail.GoodsID, storage.StorageID).ToList(); foreach (View_S_Stock stock in lstStock) { if (requstCount == 0) { break; } if (stock.库存数量 <= requstCount) { GoodsInfo goodsInfo = new GoodsInfo(); goodsInfo.GoodsID = detail.GoodsID; goodsInfo.BatchNo = stock.批次号; goodsInfo.Provider = stock.供货单位; goodsInfo.GoodsCount = stock.库存数量; goodsInfo.ListInfo = new List <string>(); goodsInfo.ListInfo.Add(listGoodsInfo.Count.ToString()); goodsInfo.ListInfo.Add(storage.StorageID); goodsInfo.ListInfo.Add(stock.库存数量.ToString()); listGoodsInfo.Add(goodsInfo); requstCount = requstCount - stock.库存数量; } else { GoodsInfo goodsInfo = new GoodsInfo(); goodsInfo.GoodsID = detail.GoodsID; goodsInfo.BatchNo = stock.批次号; goodsInfo.Provider = stock.供货单位; goodsInfo.GoodsCount = requstCount; goodsInfo.ListInfo = new List <string>(); goodsInfo.ListInfo.Add(listGoodsInfo.Count.ToString()); goodsInfo.ListInfo.Add(storage.StorageID); goodsInfo.ListInfo.Add(detail.GoodsCount.ToString()); listGoodsInfo.Add(goodsInfo); requstCount = 0; } } } } if (listGoodsInfo != null && listGoodsInfo.Count > 0) { listBillNo = new List <string>(); CommonProcessInfo firstProcess = new CommonProcessInfo(); CommonProcessInfo SecondProcess = new CommonProcessInfo(); CommonProcessInfo ThridProcess = new CommonProcessInfo(); var varTemp = from a in listProcessInfo where a.操作节点 == "新建" orderby a.时间 descending select a; if (varTemp.Count() != 0) { firstProcess = varTemp.First(); } else { throw new Exception("此单据无【新建】流程"); } varTemp = from a in listProcessInfo where a.操作节点 == "审核" orderby a.时间 descending select a; if (varTemp.Count() != 0) { SecondProcess = varTemp.First(); } else { throw new Exception("此单据无【审核】流程"); } varTemp = from a in listProcessInfo where a.操作节点 == "确认" orderby a.时间 descending select a; if (varTemp.Count() != 0) { ThridProcess = varTemp.First(); } foreach (Business_WarehouseOutPut_WholeMachineRequisition_StorageID storage in listStorage) { List <GoodsInfo> listGoodsInfoTemp = (from a in listGoodsInfo where a.ListInfo[1].ToString() == storage.StorageID orderby Convert.ToInt32(a.ListInfo[0]) select a).ToList(); if (listGoodsInfoTemp.Count > 0) { string error = ""; S_MaterialRequisition bill = new S_MaterialRequisition(); bill.AssociatedBillNo = billInfo.BillNo; bill.AssociatedBillType = CE_BillTypeEnum.整台份请领单.ToString(); bill.Bill_ID = billControl.GetNewBillNo(ctx); bill.Bill_Time = ServerTime.Time; bill.BillStatus = "等待出库"; View_HR_Personnel personnelInfo = UniversalFunction.GetPersonnelInfo(firstProcess.工号); bill.Department = personnelInfo.部门编码; bill.DepartmentDirector = SecondProcess.人员; bill.DepotManager = ThridProcess == new CommonProcessInfo() ? BasicInfo.LoginName : ThridProcess.人员; bill.FetchCount = (int)billInfo.MachineCount; bill.FetchType = FetchGoodsType.整台领料.ToString(); bill.FillInPersonnel = firstProcess.人员; bill.FillInPersonnelCode = personnelInfo.工号; bill.ProductType = billInfo.ProductType; bill.PurposeCode = servicePurpose.GetBillPurpose(ctx, billInfo.BillTypeDetail).Code; bill.Remark = billInfo.Remark; bill.StorageID = storage.StorageID; if (!serviceBill.AutoCreateBill(ctx, bill, out error)) { throw new Exception(error); } listBillNo.Add(bill.Bill_ID); for (int i = 0; i < listGoodsInfoTemp.Count; i++) { S_MaterialRequisitionGoods goodsInfo = new S_MaterialRequisitionGoods(); goodsInfo.BasicCount = Convert.ToDecimal(listGoodsInfoTemp[i].ListInfo[2]); goodsInfo.BatchNo = listGoodsInfoTemp[i].BatchNo; goodsInfo.Bill_ID = bill.Bill_ID; goodsInfo.GoodsID = listGoodsInfoTemp[i].GoodsID; goodsInfo.ProviderCode = listGoodsInfoTemp[i].Provider; goodsInfo.RealCount = listGoodsInfoTemp[i].GoodsCount; goodsInfo.Remark = GetWorkBench_WashFlag(billInfo.ProductType, goodsInfo.GoodsID); goodsInfo.RequestCount = listGoodsInfoTemp[i].GoodsCount; IProductOrder serviceProductOrder = ServerModuleFactory.GetServerModule <IProductOrder>(); goodsInfo.ShowPosition = 0; //serviceProductOrder.GetPosition(ctx, billInfo.ProductType, goodsInfo.GoodsID); if (!serviceGoods.AutoCreateGoods(ctx, goodsInfo, out error)) { throw new Exception(error); } } } ctx.SubmitChanges(); } } } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 结束业务 /// </summary> /// <param name="billNo">业务编号</param> public void FinishBill(string billNo) { IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); Flow_FlowInfo flowInfo = _serviceFlow.GetNowFlowInfo(_serviceFlow.GetBusinessTypeID(CE_BillTypeEnum.合格品隔离处置单, null), billNo); if (flowInfo == null) { throw new Exception("单据状态为空,请重新确认"); } DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); try { Business_QualityManagement_Isolation billInfo = GetSingleBillInfo(billNo); if (billInfo == null || billInfo.BillNo.Length == 0) { throw new Exception("此单据不存在"); } switch (flowInfo.FlowID) { case 57: UpdateStockGoodsStatus(ctx, billInfo, (int)CE_StockGoodsStatus.隔离); break; case 59: if (billInfo.QC_ScraptCount != null && billInfo.QC_ScraptCount > 0) { InsertIntoMaterialRequisition(ctx, billInfo); } if ((decimal)billInfo.QC_QualifiedCount == billInfo.GoodsCount) { UpdateStockGoodsStatus(ctx, billInfo, (int)CE_StockGoodsStatus.正常); } break; case 60: QueryCondition_Store stockQuery = new QueryCondition_Store(); stockQuery.BatchNo = billInfo.BatchNo; stockQuery.GoodsID = billInfo.GoodsID; stockQuery.StorageID = billInfo.StorageID; stockQuery.Provider = billInfo.Provider; S_Stock stockInfo = UniversalFunction.GetStockInfo(ctx, stockQuery); if (stockInfo == null) { throw new Exception("获取库存信息失败"); } if (billInfo.QC_ConcessionCount == null || billInfo.QC_QualifiedCount == null) { if (stockInfo.ExistCount != billInfo.PH_QualifiedCount) { throw new Exception("此物品的当前库存为【" + stockInfo.ExistCount + "】不等于【处理人】的【合格数】," + "请根据处理方式要求采购员开【领料单】或者【采购退货单】减库存"); } } else { if (stockInfo.ExistCount != billInfo.QC_ConcessionCount + billInfo.QC_QualifiedCount) { throw new Exception("此物品的当前库存为【" + stockInfo.ExistCount + "】不等于【QC】的【让步数】+【合格数】," + "请根据处理方式要求采购员开【领料单】或者【采购退货单】减库存"); } } UpdateStockGoodsStatus(ctx, billInfo, (int)CE_StockGoodsStatus.正常); break; default: break; } ctx.SubmitChanges(); ctx.Transaction.Commit(); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }
/// <summary> /// 结束业务 /// </summary> /// <param name="billNo">业务编号</param> public void FinishBill(string billNo) { IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); string billStatus = serviceFlow.GetNextBillStatus(billNo); if (billStatus == null) { throw new Exception("单据状态为空,请重新确认"); } if (billStatus != CE_CommonBillStatus.单据完成.ToString()) { return; } DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); try { Business_PurchasingMG_PartsBelongPriovderChange billInfo = GetSingleBillInfo(billNo); if (billInfo == null || billInfo.BillNo.Length == 0) { throw new Exception("此单据不存在"); } List <View_Business_PurchasingMG_PartsBelongPriovderChangeDetail> listDetail = GetListViewDetailInfo(billInfo.BillNo); foreach (View_Business_PurchasingMG_PartsBelongPriovderChangeDetail item in listDetail) { CE_LV providerLV = GlobalObject.GeneralFunction.StringConvertToEnum <CE_LV>(item.供应商等级); B_AccessoryDutyInfo lnqTemp = GetDutyInfo(ctx, item.物品ID); List <string> LVA = new List <string>(); List <string> LVB = new List <string>(); List <string> LVC = new List <string>(); switch (billInfo.ChangeType) { case "准入": if (lnqTemp == null) { lnqTemp = new B_AccessoryDutyInfo(); List <CommonProcessInfo> lstTemp = serviceFlow.GetFlowData(billInfo.BillNo); lnqTemp.CreatePersonnel = (lstTemp == null || lstTemp.Count() == 0) ? BasicInfo.LoginID : serviceFlow.GetFlowData(billInfo.BillNo).OrderBy(k => k.时间).First().人员; lnqTemp.CreateDate = ServerTime.Time; lnqTemp.Grade = item.难度等级; lnqTemp.Remark = item.说明; lnqTemp.Sort = item.零件类型; lnqTemp.GoodsID = item.物品ID; List <string> lstProvider = new List <string>(); lstProvider.Add(billInfo.Provider); SetProviderLV(ref lnqTemp, providerLV, lstProvider); ctx.B_AccessoryDutyInfo.InsertOnSubmit(lnqTemp); } else if (lnqTemp != null) { LVA = GetListProviderLV(lnqTemp, CE_LV.A); LVB = GetListProviderLV(lnqTemp, CE_LV.B); LVC = GetListProviderLV(lnqTemp, CE_LV.C); LVA.Remove(billInfo.Provider); LVB.Remove(billInfo.Provider); LVC.Remove(billInfo.Provider); switch (providerLV) { case CE_LV.A: LVA.Add(billInfo.Provider); break; case CE_LV.B: LVB.Add(billInfo.Provider); break; case CE_LV.C: LVC.Add(billInfo.Provider); break; default: break; } SetProviderLV(ref lnqTemp, CE_LV.A, LVA); SetProviderLV(ref lnqTemp, CE_LV.B, LVB); SetProviderLV(ref lnqTemp, CE_LV.C, LVC); } else { throw new Exception("信息重复,无法操作"); } break; case "等级变更": if (lnqTemp == null) { throw new Exception("无此零件信息,无法操作【等级变更】"); } LVA = GetListProviderLV(lnqTemp, CE_LV.A); LVB = GetListProviderLV(lnqTemp, CE_LV.B); LVC = GetListProviderLV(lnqTemp, CE_LV.C); LVA.Remove(billInfo.Provider); LVB.Remove(billInfo.Provider); LVC.Remove(billInfo.Provider); switch (providerLV) { case CE_LV.A: LVA.Add(billInfo.Provider); break; case CE_LV.B: LVB.Add(billInfo.Provider); break; case CE_LV.C: LVC.Add(billInfo.Provider); break; default: break; } SetProviderLV(ref lnqTemp, CE_LV.A, LVA); SetProviderLV(ref lnqTemp, CE_LV.B, LVB); SetProviderLV(ref lnqTemp, CE_LV.C, LVC); break; case "淘汰": if (lnqTemp != null) { LVA = GetListProviderLV(lnqTemp, CE_LV.A); LVB = GetListProviderLV(lnqTemp, CE_LV.B); LVC = GetListProviderLV(lnqTemp, CE_LV.C); LVA.Remove(billInfo.Provider); LVB.Remove(billInfo.Provider); LVC.Remove(billInfo.Provider); SetProviderLV(ref lnqTemp, CE_LV.A, LVA); SetProviderLV(ref lnqTemp, CE_LV.B, LVB); SetProviderLV(ref lnqTemp, CE_LV.C, LVC); if ((lnqTemp.ProviderA == null || lnqTemp.ProviderA.Length == 0) && (lnqTemp.ProviderB == null || lnqTemp.ProviderB.Length == 0) && (lnqTemp.ProviderC == null || lnqTemp.ProviderC.Length == 0)) { ctx.B_AccessoryDutyInfo.DeleteOnSubmit(lnqTemp); } } break; default: break; } ctx.SubmitChanges(); } ctx.SubmitChanges(); ctx.Transaction.Commit(); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }
public void SaveInfo(DataTable detailTable, Business_Finance_Budget_Month billInfo) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); try { if (serviceFlow.GetNowBillStatus(billInfo.BillNo) == CE_CommonBillStatus.新建单据.ToString()) { if (detailTable == null) { throw new Exception("无明细信息,无法保存"); } var varDetail = from a in ctx.Business_Finance_Budget_MonthDetail where a.BillNo == billInfo.BillNo select a; var varBill = from a in ctx.Business_Finance_Budget_Month where a.BillNo == billInfo.BillNo select a; ctx.Business_Finance_Budget_MonthDetail.DeleteAllOnSubmit(varDetail); ctx.Business_Finance_Budget_Month.DeleteAllOnSubmit(varBill); billInfo.DeptCode = UniversalFunction.GetDept_Belonge(ctx, BasicInfo.DeptCode).DeptCode; ctx.Business_Finance_Budget_Month.InsertOnSubmit(billInfo); List <Business_Finance_Budget_MonthDetail> lstDetail = new List <Business_Finance_Budget_MonthDetail>(); Business_Finance_Budget_MonthDetail detail = new Business_Finance_Budget_MonthDetail(); foreach (DataRow dr in detailTable.Rows) { decimal yeardec = Convert.ToDecimal(dr["年度预算"]); decimal monthdec = Convert.ToDecimal(dr["月度预算"]); if (monthdec > 0 && monthdec >= yeardec * (decimal)1.2 && GlobalObject.GeneralFunction.IsNullOrEmpty(dr["差异说明(年)"].ToString())) { throw new Exception("请填写【差异说明(年)】"); } detail = new Business_Finance_Budget_MonthDetail(); detail.BillNo = billInfo.BillNo; detail.BudgetAmount = dr["月度预算"] == null ? 0 : Convert.ToDecimal(dr["月度预算"]); detail.ProjectID = dr["科目ID"].ToString(); detail.ActualAmount = 0; detail.DifferenceRemarkYear = dr["差异说明(年)"] == null ? "" : dr["差异说明(年)"].ToString(); lstDetail.Add(detail); } ctx.Business_Finance_Budget_MonthDetail.InsertAllOnSubmit(lstDetail); } else if (serviceFlow.GetNextBillStatus(billInfo.BillNo) == CE_CommonBillStatus.等待确认.ToString()) { foreach (DataRow dr in detailTable.Rows) { var varDataDetail = from a in ctx.Business_Finance_Budget_MonthDetail where a.BillNo == billInfo.BillNo && a.ProjectID == dr["科目ID"].ToString() select a; if (varDataDetail.Count() == 1) { varDataDetail.Single().ActualAmount = dr["实际金额"] == null ? 0 : Convert.ToDecimal(dr["实际金额"]); } } } else if (serviceFlow.GetNextBillStatus(billInfo.BillNo) == CE_CommonBillStatus.单据完成.ToString()) { foreach (DataRow dr in detailTable.Rows) { decimal monthdec = Convert.ToDecimal(dr["月度预算"]); decimal actarldec = Convert.ToDecimal(dr["实际金额"]); if (actarldec > 0 && actarldec >= monthdec * (decimal)1.2 && GlobalObject.GeneralFunction.IsNullOrEmpty(dr["差异说明(月)"].ToString())) { throw new Exception("请填写【差异说明(月)】"); } var varDataDetail = from a in ctx.Business_Finance_Budget_MonthDetail where a.BillNo == billInfo.BillNo && a.ProjectID == dr["科目ID"].ToString() select a; if (varDataDetail.Count() == 1) { varDataDetail.Single().DifferenceRemarkMonth = dr["差异说明(月)"] == null ? "" : dr["差异说明(月)"].ToString(); } } } ctx.SubmitChanges(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public void SaveInfo(HR_Train_Plan planInfo, List <View_HR_Train_PlanCourse> lstPlanCourse, List <View_HR_Train_PlanUser> lstUser) { IFlowServer service = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>(); DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); try { if (service.GetNowBillStatus(planInfo.BillNo) != CE_CommonBillStatus.新建单据.ToString()) { return; } var varData = from a in ctx.HR_Train_Plan where a.BillNo == planInfo.BillNo select a; var varData1 = from a in ctx.HR_Train_PlanCourse where a.BillNo == planInfo.BillNo select a; var varData2 = from a in ctx.HR_Train_PlanUser join b in ctx.HR_Train_PlanCourse on a.PlanCourseID equals b.ID where b.BillNo == planInfo.BillNo select a; ctx.HR_Train_PlanUser.DeleteAllOnSubmit(varData2); ctx.HR_Train_PlanCourse.DeleteAllOnSubmit(varData1); ctx.HR_Train_Plan.DeleteAllOnSubmit(varData); planInfo.Department = UniversalFunction.GetDept_Belonge(ctx, planInfo.Department).DeptCode; ctx.HR_Train_Plan.InsertOnSubmit(planInfo); foreach (View_HR_Train_PlanCourse course in lstPlanCourse) { HR_Train_PlanCourse tempCourse = new HR_Train_PlanCourse(); tempCourse.BillNo = planInfo.BillNo; tempCourse.CourseID = course.课程ID; tempCourse.ID = course.ID; tempCourse.MonthValue = course.月份; ctx.HR_Train_PlanCourse.InsertOnSubmit(tempCourse); } foreach (View_HR_Train_PlanUser user in lstUser) { HR_Train_PlanUser tempUser = new HR_Train_PlanUser(); tempUser.PlanCourseID = user.PlanCourseID; tempUser.WorkID = user.员工编号; ctx.HR_Train_PlanUser.InsertOnSubmit(tempUser); } ctx.SubmitChanges(); ctx.Transaction.Commit(); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }