void OperationInfo(CE_OperatorMode mode) { WS_MaterialsTransferExceptionListDispose tempLnq = new WS_MaterialsTransferExceptionListDispose(); tempLnq.ID = dataGridView2.CurrentRow == null ? 0 : Convert.ToInt32(dataGridView2.CurrentRow.Cells["ID"].Value); tempLnq.BatchNo = txtBatchNo.Text; tempLnq.Counts = numOperationCount.Value; tempLnq.GoodsID = Convert.ToInt32(txtCode.Tag); tempLnq.ListID = Convert.ToInt32(dataGridView1.CurrentRow.Cells["ID"].Value); m_serverException.OperationDisposeInfo(mode, tempLnq, out m_strError); dataGridView2.DataSource = m_serverException.GetDisposeInfo((int)dataGridView1.CurrentRow.Cells["ID"].Value); switch (mode) { case CE_OperatorMode.添加: case CE_OperatorMode.修改: PositioningRecord(tempLnq.GoodsID, tempLnq.BatchNo); break; case CE_OperatorMode.除: break; default: break; } }
public void Operation_SubjectsPurpose(CE_OperatorMode mode, Business_Base_FinanceRelationInfo_Subjects_Purpose info) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.Business_Base_FinanceRelationInfo_Subjects_Purpose where a.SubjectsCode == info.SubjectsCode && a.PurposeCode == info.PurposeCode select a; switch (mode) { case CE_OperatorMode.添加: if (varData.Count() > 0) { throw new Exception("【代码】:" + info.SubjectsCode + "重复, 无法录入"); } ctx.Business_Base_FinanceRelationInfo_Subjects_Purpose.InsertOnSubmit(info); break; case CE_OperatorMode.除: ctx.Business_Base_FinanceRelationInfo_Subjects_Purpose.DeleteAllOnSubmit(varData); break; default: break; } ctx.SubmitChanges(); }
public void OperationInfo(CE_OperatorMode mode, Business_Project_Timesheets timesheets) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; switch (mode) { case CE_OperatorMode.添加: timesheets.RecordDate = ServerTime.Time; timesheets.RecordPersonnel = BasicInfo.LoginID; ctx.Business_Project_Timesheets.InsertOnSubmit(timesheets); break; case CE_OperatorMode.除: var varData = from a in ctx.Business_Project_Timesheets where a.ID == timesheets.ID select a; ctx.Business_Project_Timesheets.DeleteAllOnSubmit(varData); break; default: break; } ctx.SubmitChanges(); }
void SetFormBusinessInfo(DataGridView dgvr, CE_OperatorMode operatorMode, CE_BillTypeEnum billType, string keyName, ref FormCommonProcess frm) { List <object> resultList = new List <object>(); foreach (DataGridViewRow dr in dgvr.Rows) { Entity_BusinessOperationInfo info = new Entity_BusinessOperationInfo(); info.BillType = billType; info.BusinessNo = dr.Cells[keyName].Value.ToString(); info.OperatorMode = operatorMode; info.FlowInfoList = null; info.FlowMagicDic = null; if (dgvr.CurrentRow == dr) { frm.BusinessList_Object = info; } resultList.Add(info); } frm.BusinessList = resultList; }
/// <summary> /// 操作采购清单 /// </summary> /// <param name="operatorMode">操作模式</param> /// <param name="goodsID">物品ID</param> /// <param name="safeStockCount">安全库存数</param> /// <param name="DicNumberOfProduct">基数</param> public void OperatorInfo(CE_OperatorMode operatorMode, int goodsID, decimal safeStockCount, Dictionary <string, int> DicNumberOfProduct) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); try { switch (operatorMode) { case CE_OperatorMode.添加: Operation_Add(ctx, goodsID, DicNumberOfProduct, safeStockCount); break; case CE_OperatorMode.修改: Operation_Modify(ctx, goodsID, DicNumberOfProduct, safeStockCount); break; case CE_OperatorMode.除: Operation_Delete(ctx, goodsID); break; default: break; } ctx.SubmitChanges(); ctx.Transaction.Commit(); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }
public void Operation_FinanceSubjects(CE_OperatorMode mode, Business_Base_FinanceSubjects info) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.Business_Base_FinanceSubjects where a.SubjectsCode == info.SubjectsCode select a; switch (mode) { case CE_OperatorMode.添加: if (varData.Count() > 0) { throw new Exception("【代码】:" + info.SubjectsCode + "重复, 无法录入"); } ctx.Business_Base_FinanceSubjects.InsertOnSubmit(info); break; case CE_OperatorMode.修改: if (varData.Count() != 1) { throw new Exception("【代码】:" + info.SubjectsCode + "为空或者不唯一, 无法录入"); } Business_Base_FinanceSubjects temp = varData.Single(); temp.SubjectsName = info.SubjectsName; temp.ParentCode = info.ParentCode; break; case CE_OperatorMode.除: var varData1 = from a in ctx.Business_Base_FinanceRelationInfo_Subjects_Purpose where a.SubjectsCode == info.SubjectsCode select a; var varData2 = from a in ctx.Business_Base_FinanceRelationInfo_Subjects_Storage where a.SubjectsCode == info.SubjectsCode select a; if (varData1.Count() > 0 || varData2.Count() > 0) { throw new Exception("存在关联关系,无法删除"); } ctx.Business_Base_FinanceSubjects.DeleteAllOnSubmit(varData); break; default: break; } ctx.SubmitChanges(); }
/// <summary> /// 更新量检具信息 /// </summary> /// <param name="gaugeStandingBook">量检具信息</param> /// <param name="mode">操作类型</param> public void SaveInfo(S_GaugeStandingBook gaugeStandingBook, CE_OperatorMode mode) { using (DepotManagementDataContext ctx = CommentParameter.DepotDataContext) { try { var varGauge = from a in ctx.S_GaugeStandingBook where a.GaugeCoding == gaugeStandingBook.GaugeCoding select a; if (varGauge.Count() == 1) { if (mode == CE_OperatorMode.添加) { throw new Exception("已存在【量检具编号】:" + gaugeStandingBook.GaugeCoding + ", 无法添加"); } S_GaugeStandingBook lnqGauge = varGauge.Single(); lnqGauge.Manufacturer = gaugeStandingBook.Manufacturer; lnqGauge.Remark = gaugeStandingBook.Remark; lnqGauge.Validity = gaugeStandingBook.Validity; lnqGauge.EffectiveDate = gaugeStandingBook.EffectiveDate; lnqGauge.DutyUser = gaugeStandingBook.DutyUser; lnqGauge.InputDate = gaugeStandingBook.InputDate; lnqGauge.MaterialDate = gaugeStandingBook.MaterialDate; lnqGauge.CheckType = gaugeStandingBook.CheckType; lnqGauge.GaugeType = gaugeStandingBook.GaugeType; lnqGauge.FactoryNo = gaugeStandingBook.FactoryNo; } else if (varGauge.Count() == 0) { if (mode == CE_OperatorMode.修改) { throw new Exception("不存在【量检具编号】:" + gaugeStandingBook.GaugeCoding + ", 无法修改"); } gaugeStandingBook.F_Id = Guid.NewGuid().ToString(); ctx.S_GaugeStandingBook.InsertOnSubmit(gaugeStandingBook); } else { throw new Exception("【量检具编号】重复"); } ctx.SubmitChanges(); } catch (Exception) { throw; } } }
/// <summary> /// 添加基础信息日志 /// </summary> /// <typeparam name="T">对象类型</typeparam> /// <param name="ctx">数据上下文</param> /// <param name="logID">日志唯一编码</param> /// <param name="mode">操作类型</param> void AddMainInfo <T>(DepotManagementDataContext ctx, Guid logID, CE_OperatorMode mode) { SystemLog_Main lnqMain = new SystemLog_Main(); lnqMain.LogID = logID; lnqMain.OperationTime = ServerTime.Time; lnqMain.OperationType = mode.ToString(); lnqMain.Operator = BasicInfo.LoginID; lnqMain.TableName = typeof(T).Name; ctx.SystemLog_Main.InsertOnSubmit(lnqMain); }
/// <summary> /// 操作数据库 /// </summary> void OperatorInfo(CE_OperatorMode operatorMode) { try { m_serverCBOM.OperatorInfo(operatorMode, Convert.ToInt32(tbsGoods.Tag), numSafeStockCount.Value, m_dicNumber); MessageDialog.ShowPromptMessage(operatorMode.ToString() + "成功"); RefreshData(); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); } }
public void Operation_BudgetProject(CE_OperatorMode mode, Business_Base_Finance_Budget_ProjectItem info) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.Business_Base_Finance_Budget_ProjectItem where a.ProjectID == info.ProjectID select a; switch (mode) { case CE_OperatorMode.添加: ctx.Business_Base_Finance_Budget_ProjectItem.InsertOnSubmit(info); break; case CE_OperatorMode.修改: if (varData.Count() != 1) { throw new Exception("【代码】:" + info.ProjectID + "为空或者不唯一, 无法录入"); } Business_Base_Finance_Budget_ProjectItem temp = varData.Single(); temp.ProjectName = info.ProjectName; temp.PerentProjectID = info.PerentProjectID; break; case CE_OperatorMode.除: if (varData.Count() != 1) { throw new Exception("【代码】:" + info.ProjectID + "为空或者不唯一, 无法录入"); } Business_Base_Finance_Budget_ProjectItem temp1 = varData.Single(); temp1.IsDisable = true; break; default: break; } ctx.SubmitChanges(); }
/// <summary> /// 记录日志 /// </summary> /// <typeparam name="T">对象类型</typeparam> /// <param name="mode">操作模式</param> /// <param name="explainContent">操作说明</param> public void RecordLog <T>(CE_OperatorMode mode, string explainContent) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; try { Guid guid = Guid.NewGuid(); AddMainInfo <T>(ctx, guid, mode); ctx.SubmitChanges(); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 构造函数 /// </summary> /// <param name="billType">单据类型</param> /// <param name="billNo">单据号</param> /// <param name="loadPanel">界面对象</param> /// <param name="flowInfo">流程信息,仅对自定义</param> /// <param name="flowMagic">流程逻辑,仅对自定义</param> /// <param name="operationMode">操作类型</param> public FormCommonProcess(CE_BillTypeEnum billType, string version, CustomFlowForm form, CE_OperatorMode operationMode) { InitializeComponent(); m_customForm = form; m_billType = billType; m_operationMode = operationMode; m_FlowBusinessVersion = version; m_customForm.FormBorderStyle = FormBorderStyle.None; m_customForm.TopLevel = false; m_customForm.Show(); m_customForm.Parent = panel6; m_customForm.Dock = DockStyle.Fill; m_customForm.AutoScroll = true; }
/// <summary> /// 记录日志 /// </summary> /// <typeparam name="T">对象类型</typeparam> /// <param name="mode">操作模式</param> /// <param name="operationContent">操作对象</param> /// <param name="NoUpdatedContent">操作前对象</param> public void RecordLog <T>(CE_OperatorMode mode, T operationContent, T NoUpdatedContent) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; try { List <string> listFeildName = GlobalObject.GeneralFunction.GetFeildList <T>(); object objOperationContent, objNoUpdatedContent; Guid guid = Guid.NewGuid(); AddMainInfo <T>(ctx, guid, mode); AddPrimaryKeyInfo <T>(ctx, guid, NoUpdatedContent); foreach (string propertyName in listFeildName) { objOperationContent = GlobalObject.GeneralFunction.GetItemValue <T>(operationContent, propertyName); objNoUpdatedContent = GlobalObject.GeneralFunction.GetItemValue <T>(NoUpdatedContent, propertyName); if (mode == CE_OperatorMode.修改) { if (objOperationContent == objNoUpdatedContent) { continue; } } SystemLog_Content lnqContent = new SystemLog_Content(); lnqContent.FieldName = propertyName; lnqContent.LogID = guid; lnqContent.NoUpdatedContent = objNoUpdatedContent == null ? null : objNoUpdatedContent.ToString(); lnqContent.OperationContent = objOperationContent == null ? null : objOperationContent.ToString(); ctx.SystemLog_Content.InsertOnSubmit(lnqContent); } ctx.SubmitChanges(); } catch (Exception ex) { throw new Exception(ex.Message); } }
void MainOperation(CE_OperatorMode mode) { S_StockLackCustomTemplates tempLnq = new S_StockLackCustomTemplates(); tempLnq.ID = dataGridView1.CurrentRow == null ? 0 : Convert.ToInt32(dataGridView1.CurrentRow.Cells["ID"].Value); tempLnq.TemplatesName = txtTemplatesName.Text; if (!m_serverLack.OperationMain(mode, tempLnq, out m_strErr)) { MessageDialog.ShowPromptMessage(m_strErr); return; } else { MessageDialog.ShowPromptMessage(mode.ToString() + "成功"); } BindingMainInfo(); PositioningRecord1(tempLnq.TemplatesName); }
public override void LoadFormInfo() { if (BusinessList_Object != null) { if (BusinessList_Object.GetType() == typeof(Entity_BusinessOperationInfo)) { Entity_BusinessOperationInfo businessInfo = BusinessList_Object as Entity_BusinessOperationInfo; m_customForm.FlowInfo_BillNo = businessInfo.BusinessNo; m_customForm.Custom_FlowInfo = businessInfo.FlowInfoList; m_customForm.Custom_FlowMagic = businessInfo.FlowMagicDic; m_billType = businessInfo.BillType; m_operationMode = businessInfo.OperatorMode; } } m_flowInfo = m_customForm.Custom_FlowInfo; m_flowMagic = m_customForm.Custom_FlowMagic; labelTitle.Text = m_customForm.Text; this.Text = m_customForm.Text; if (m_operationMode != CE_OperatorMode.查看) { bool visible = PanelVisible(m_customForm.FlowInfo_BillNo); panel1.Visible = visible; panel3.Visible = visible; } else { panel1.Visible = false; panel3.Visible = false; } base.LoadFormInfo(); m_customForm.LoadFormInfo(); }
void ListOperation(CE_OperatorMode mode) { S_StockLackCustomTemplatesList tempLnq = new S_StockLackCustomTemplatesList(); tempLnq.ID = dataGridView2.CurrentRow == null ? 0 : Convert.ToInt32(dataGridView2.CurrentRow.Cells["ID"].Value); tempLnq.Counts = numOperationCount.Value; tempLnq.GoodsID = Convert.ToInt32(txtCode.Tag); tempLnq.ListID = Convert.ToInt32(dataGridView1.CurrentRow.Cells["ID"].Value); if (!m_serverLack.OperationList(mode, tempLnq, out m_strErr)) { MessageDialog.ShowPromptMessage(m_strErr); return; } else { MessageDialog.ShowPromptMessage(mode.ToString() + "成功"); } BindingListInfo(tempLnq.ListID); PositioningRecord2(tempLnq.GoodsID); }
/// <summary> /// 记录日志 /// </summary> /// <typeparam name="T">对象类型</typeparam> /// <param name="mode">操作模式</param> /// <param name="tObj">操作对象</param> /// <param name="listContent">操作内容日志列表</param> public void RecordLog <T>(CE_OperatorMode mode, T tObj, List <SystemLog_Content> listContent) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; try { Guid guid = Guid.NewGuid(); AddMainInfo <T>(ctx, guid, mode); AddPrimaryKeyInfo <T>(ctx, guid, tObj); foreach (SystemLog_Content content in listContent) { content.LogID = guid; ctx.SystemLog_Content.InsertOnSubmit(content); } ctx.SubmitChanges(); } catch (Exception ex) { 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); } }
/// <summary> /// 对体系文件类别进行操作 /// </summary> /// <param name="mode">操作类别</param> /// <param name="sort">LINQ数据集</param> /// <param name="error">错误信息</param> /// <returns>成功返回True,失败返回False</returns> public bool Operator(CE_OperatorMode mode, FM_FileSort sort, out string error) { error = null; try { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; FM_FileSort lnqTemp = new FM_FileSort(); var varData = from a in ctx.FM_FileSort select a; switch (mode) { case CE_OperatorMode.添加: varData = from a in ctx.FM_FileSort where a.ParentID == sort.ParentID && a.SortName == sort.SortName select a; if (varData.Count() > 0) { error = "数据重复"; return(false); } else { lnqTemp.SortName = sort.SortName; lnqTemp.ParentID = sort.ParentID; lnqTemp.FileType = sort.FileType; ctx.FM_FileSort.InsertOnSubmit(sort); } break; case CE_OperatorMode.修改: varData = from a in ctx.FM_FileSort where a.SortID == sort.SortID select a; if (varData.Count() != 1) { error = "数据错误"; return(false); } else { lnqTemp = varData.Single(); lnqTemp.SortName = sort.SortName; lnqTemp.ParentID = sort.ParentID; } break; case CE_OperatorMode.除: varData = from a in ctx.FM_FileSort where a.SortID == sort.SortID select a; ctx.FM_FileSort.DeleteAllOnSubmit(varData); break; default: break; } ctx.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 按条件上传文件 /// </summary> /// <param name="linklb">LinkLabel空间</param> /// <param name="guid">序号</param> /// <param name="ftpServerPath">文件路径</param> /// <param name="fileType">文件类型</param> /// <param name="mode">操作模式</param> void ConditionUpdateFile(LinkLabel linklb, ref Guid guid, string ftpServerPath, string fileType, CE_OperatorMode mode) { if (linklb.Tag == null || linklb.Tag.ToString().Trim().Length == 0) { guid = Guid.NewGuid(); m_serverFileBasicInfo.AddFile(guid, ftpServerPath + guid.ToString(), fileType); } else { guid = new Guid(linklb.Tag.ToString()); if (mode == CE_OperatorMode.添加) { m_serverFileBasicInfo.UpdateFile(guid, fileType); } } }
/// <summary> /// 明细操作 /// </summary> /// <param name="ctx">数据上下文</param> /// <param name="billNo">单据号</param> /// <param name="detailInfo">明细信息</param> /// <param name="mode">操作类型</param> void OperationDetailInfo(DepotManagementDataContext ctx, string billNo, S_MaterialRequisitionGoods detailInfo, CE_OperatorMode mode) { try { var varBill = from a in ctx.S_MaterialRequisition where a.Bill_ID == billNo select a; if (varBill.Count() != 1) { throw new Exception("【单据号】:" + billNo + " 不存在或者不唯一"); } if (varBill.Single().BillStatus == MaterialRequisitionBillStatus.已出库.ToString()) { throw new Exception("【单据号】:" + billNo + " 已出库 无法进行操作"); } if (mode == CE_OperatorMode.添加 || mode == CE_OperatorMode.除 || mode == CE_OperatorMode.修改) { if (detailInfo == null) { throw new Exception("需要操作的记录为空,无法操作【" + mode.ToString() + "】"); } var varData = from a in ctx.S_MaterialRequisitionGoods where a.ID == detailInfo.ID select a; switch (mode) { case CE_OperatorMode.添加: if (varData.Count() == 1) { S_MaterialRequisitionGoods tempInfo = varData.Single(); tempInfo.Bill_ID = billNo; tempInfo.GoodsID = detailInfo.GoodsID; tempInfo.BatchNo = detailInfo.BatchNo; tempInfo.BasicCount = detailInfo.BasicCount; tempInfo.ProviderCode = detailInfo.ProviderCode; tempInfo.RealCount = detailInfo.RealCount; tempInfo.Remark = detailInfo.Remark; tempInfo.RepairStatus = detailInfo.RepairStatus; tempInfo.RequestCount = detailInfo.RequestCount; tempInfo.ShowPosition = detailInfo.ShowPosition; } else if (varData.Count() == 0) { detailInfo.Bill_ID = billNo; ctx.S_MaterialRequisitionGoods.InsertOnSubmit(detailInfo); } else { throw new Exception(UniversalFunction.GetGoodsMessage(ctx, detailInfo.GoodsID) + "【批次号】:" + detailInfo.BatchNo + "【供应商】:" + detailInfo.ProviderCode + " 数据不唯一"); } break; case CE_OperatorMode.修改: if (varData.Count() == 1) { S_MaterialRequisitionGoods tempInfo = varData.Single(); tempInfo.Bill_ID = billNo; tempInfo.GoodsID = detailInfo.GoodsID; tempInfo.BatchNo = detailInfo.BatchNo; tempInfo.BasicCount = detailInfo.BasicCount; tempInfo.ProviderCode = detailInfo.ProviderCode; tempInfo.RealCount = detailInfo.RealCount; tempInfo.Remark = detailInfo.Remark; tempInfo.RepairStatus = detailInfo.RepairStatus; tempInfo.RequestCount = detailInfo.RequestCount; tempInfo.ShowPosition = detailInfo.ShowPosition; } else { throw new Exception(UniversalFunction.GetGoodsMessage(ctx, detailInfo.GoodsID) + "【批次号】:" + detailInfo.BatchNo + "【供应商】:" + detailInfo.ProviderCode + " 数据不唯一或者为空"); } break; case CE_OperatorMode.除: ctx.S_MaterialRequisitionGoods.DeleteAllOnSubmit(varData); break; default: break; } } else if (mode == CE_OperatorMode.批量删除) { if (billNo == null) { throw new Exception("单据号为空,无法操作【" + mode.ToString() + "】"); } var varAllDelete = from a in ctx.S_MaterialRequisitionGoods where a.Bill_ID == billNo select a; ctx.S_MaterialRequisitionGoods.DeleteAllOnSubmit(varAllDelete); } } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 操作自定义模板明细 /// </summary> /// <param name="mode">操作模式</param> /// <param name="list">LNQ信息</param> /// <param name="error">错误信息</param> /// <returns>成功返回True,失败返回False </returns> public bool OperationList(CE_OperatorMode mode, S_StockLackCustomTemplatesList list, out string error) { error = null; try { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.S_StockLackCustomTemplatesList select a; S_StockLackCustomTemplatesList tempLnq = new S_StockLackCustomTemplatesList(); switch (mode) { case CE_OperatorMode.添加: tempLnq.Counts = list.Counts; tempLnq.GoodsID = list.GoodsID; tempLnq.ListID = list.ListID; ctx.S_StockLackCustomTemplatesList.InsertOnSubmit(tempLnq); break; case CE_OperatorMode.修改: varData = from a in ctx.S_StockLackCustomTemplatesList where a.ID == list.ID select a; if (varData.Count() != 1) { throw new Exception("数据不唯一"); } else { tempLnq = varData.Single(); tempLnq.Counts = list.Counts; tempLnq.GoodsID = list.GoodsID; } break; case CE_OperatorMode.除: varData = from a in ctx.S_StockLackCustomTemplatesList where a.ID == list.ID select a; ctx.S_StockLackCustomTemplatesList.DeleteAllOnSubmit(varData); break; default: break; } ctx.SubmitChanges(); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
void OperationInfo(CE_OperatorMode mode, Control cl) { try { if (GlobalObject.GeneralFunction.ParentControlIsExist <TabPage>(cl, tpSubjects.Name)) { if (txtSubjects_Code.Text.Trim().Length == 0) { MessageDialog.ShowPromptMessage("请录入【科目代码】"); return; } if (txtSubjects_Name.Text.Trim().Length == 0) { MessageDialog.ShowPromptMessage("请录入【科目名称】"); return; } if (txtSubjects_Parent.Text.Trim().Length == 0) { MessageDialog.ShowPromptMessage("请选择【父级科目】"); return; } Business_Base_FinanceSubjects subjects = new Business_Base_FinanceSubjects(); subjects.SubjectsName = txtSubjects_Name.Text; subjects.SubjectsCode = txtSubjects_Code.Text; subjects.ParentCode = txtSubjects_Parent.Tag == null ? "" : txtSubjects_Parent.Tag.ToString(); _serviceParametersSetting.Operation_FinanceSubjects(mode, subjects); } else if (GlobalObject.GeneralFunction.ParentControlIsExist <TabPage>(cl, tpPurpose.Name)) { if (txtPurpose_Code.Text.Trim().Length == 0) { MessageDialog.ShowPromptMessage("请输入【用途代码】"); return; } if (txtPurpose_Name.Text.Trim().Length == 0) { MessageDialog.ShowPromptMessage("请输入【用途名称】"); return; } if (txtPurpose_ParentName.Text.Trim().Length == 0) { MessageDialog.ShowPromptMessage("请选择【父级用途】"); return; } if (txtPurpose_Parent.Text.Trim().Length >= txtPurpose_Code.Text.Trim().Length || txtPurpose_Code.Text.Trim().Substring(0, txtPurpose_Parent.Text.Trim().Length) != txtPurpose_Parent.Text.ToString()) { MessageDialog.ShowPromptMessage("【用途代码】中前面字符未包含【父级用途】代码,例如:【父级代码】:99,则【用途代码】应为:9901、 9902等等"); return; } BASE_MaterialRequisitionPurpose purpose = new BASE_MaterialRequisitionPurpose(); purpose.Inventory = chb_Inventory.Checked; purpose.Code = txtPurpose_Code.Text; purpose.IsDisable = true; purpose.IsEnd = true; purpose.Purpose = txtPurpose_Name.Text; purpose.DestructiveInspection = chb_DestructiveInspection.Checked; purpose.ThreeOutSideFit = chb_ThreeOutSideFit.Checked; purpose.ThreeOutSideRepair = chb_ThreeOutSideRepair.Checked; purpose.ApplicableDepartment = txtApplicableDepartment.Tag == null ? "" : txtApplicableDepartment.Tag.ToString(); purpose.RemindWord = txtRemindWord.Text; _serviceParametersSetting.Operation_MaterialRequisitionPurpose(mode, purpose, txtPurpose_Parent.Text.Trim()); } else if (GlobalObject.GeneralFunction.ParentControlIsExist <TabPage>(cl, tpStorage.Name)) { if (txtStorage_Code.Text.Trim().Length == 0) { MessageDialog.ShowPromptMessage("请录入【库房代码】"); return; } if (txtStorage_Name.Text.Trim().Length == 0) { MessageDialog.ShowPromptMessage("请录入【库房名称】"); return; } if (txtStorage_Subjects.Text.Trim().Length == 0) { MessageDialog.ShowPromptMessage("请选择【所属科目】"); return; } BASE_Storage storage = new BASE_Storage(); storage.Aftermarket = chbAftermarket.Checked; storage.AftermarketParts = chbAftermarketParts.Checked; storage.AssemblyWarehouse = chbAssemblyWarehouse.Checked; storage.FinancialAccountingFlag = chbFinancialAccountingFlag.Checked; storage.PartInPlanCalculation = chbPartInPlanCalculation.Checked; storage.SingleFinancialAccountingFlag = chbSingleFinancialAccountingFlag.Checked; storage.WorkShopCurrentAccount = chbWorkShopCurrentAccount.Checked; storage.ZeroCostFlag = chbZeroCostFlag.Checked; storage.StorageID = txtStorage_Code.Text; storage.StorageName = txtStorage_Name.Text; storage.StorageLv = 1; Business_Base_FinanceRelationInfo_Subjects_Storage storageSubjects = new Business_Base_FinanceRelationInfo_Subjects_Storage(); storageSubjects.StorageID = txtStorage_Code.Text; storageSubjects.SubjectsCode = txtStorage_Subjects.Tag == null ? "" : txtStorage_Subjects.Tag.ToString(); _serviceParametersSetting.Operation_StorageInfo(mode, storage, storageSubjects); } else if (GlobalObject.GeneralFunction.ParentControlIsExist <TabPage>(cl, tpSubjectsPurpose.Name)) { if (txtSubjectsPurpose_Code.Text.Trim().Length == 0) { MessageDialog.ShowPromptMessage("请选择【领料用途】"); return; } if (txtSubjectsPurpose_Subjects.Text.Trim().Length == 0) { MessageDialog.ShowPromptMessage("请选择【所属科目】"); return; } Business_Base_FinanceRelationInfo_Subjects_Purpose purposeSubjects = new Business_Base_FinanceRelationInfo_Subjects_Purpose(); purposeSubjects.PurposeCode = txtSubjectsPurpose_Code.Text; purposeSubjects.SubjectsCode = txtSubjectsPurpose_Subjects.Tag == null ? "" : txtSubjectsPurpose_Subjects.Tag.ToString(); _serviceParametersSetting.Operation_SubjectsPurpose(mode, purposeSubjects); } else if (GlobalObject.GeneralFunction.ParentControlIsExist <TabPage>(cl, tpBudgetProject.Name)) { if (txtBudgetProject.Text.Trim().Length == 0) { MessageDialog.ShowPromptMessage("请录入【科目名称】"); return; } if (txtBudgetProject_Parent.Text.Trim().Length == 0) { MessageDialog.ShowPromptMessage("请选择【父级科目】"); return; } if (txtBudgetProject_Code.Text.Trim().Length == 0) { MessageDialog.ShowPromptMessage("请录入【科目代码】"); return; } Business_Base_Finance_Budget_ProjectItem project = new Business_Base_Finance_Budget_ProjectItem(); project.PerentProjectID = txtBudgetProject_Parent.Tag == null ? "" : txtBudgetProject_Parent.Tag.ToString(); project.ProjectName = txtBudgetProject.Text; project.ProjectID = txtBudgetProject_Code.Text; _serviceParametersSetting.Operation_BudgetProject(mode, project); } MessageDialog.ShowPromptMessage("操作成功"); ShowInfo(); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return; } }
public void Operation_StorageInfo(CE_OperatorMode mode, BASE_Storage info, Business_Base_FinanceRelationInfo_Subjects_Storage info_Relation) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.BASE_Storage where a.StorageID == info.StorageID select a; switch (mode) { case CE_OperatorMode.添加: if (varData.Count() > 0) { throw new Exception("【代码】:" + info.StorageID + "重复, 无法录入"); } ctx.BASE_Storage.InsertOnSubmit(info); ctx.Business_Base_FinanceRelationInfo_Subjects_Storage.InsertOnSubmit(info_Relation); break; case CE_OperatorMode.修改: if (varData.Count() != 1) { throw new Exception("【代码】:" + info.StorageID + "为空或者不唯一, 无法录入"); } BASE_Storage temp = varData.Single(); temp.StorageName = info.StorageName; temp.StorageLv = 1; temp.Aftermarket = info.Aftermarket; temp.AftermarketParts = info.AftermarketParts; temp.AssemblyWarehouse = info.AssemblyWarehouse; temp.FinancialAccountingFlag = info.FinancialAccountingFlag; temp.PartInPlanCalculation = info.PartInPlanCalculation; temp.SingleFinancialAccountingFlag = info.SingleFinancialAccountingFlag; temp.WorkShopCurrentAccount = temp.WorkShopCurrentAccount; temp.ZeroCostFlag = temp.ZeroCostFlag; var varDataX = from a in ctx.Business_Base_FinanceRelationInfo_Subjects_Storage where a.StorageID == info.StorageID select a; ctx.Business_Base_FinanceRelationInfo_Subjects_Storage.DeleteAllOnSubmit(varDataX); ctx.Business_Base_FinanceRelationInfo_Subjects_Storage.InsertOnSubmit(info_Relation); break; case CE_OperatorMode.除: var varData1 = from a in ctx.S_Stock where a.StorageID == info.StorageID select a; var varData2 = from a in ctx.S_InDepotDetailBill where a.StorageID == info.StorageID select a; var varData3 = from a in ctx.S_FetchGoodsDetailBill where a.StorageID == info.StorageID select a; if (varData1.Count() > 0 || varData2.Count() > 0 || varData3.Count() > 0) { throw new Exception("已产生业务,无法删除"); } ctx.BASE_Storage.DeleteAllOnSubmit(varData); varDataX = from a in ctx.Business_Base_FinanceRelationInfo_Subjects_Storage where a.StorageID == info.StorageID select a; ctx.Business_Base_FinanceRelationInfo_Subjects_Storage.DeleteAllOnSubmit(varDataX); break; default: break; } ctx.SubmitChanges(); }
public void Operation_MaterialRequisitionPurpose(CE_OperatorMode mode, BASE_MaterialRequisitionPurpose info, string parentCode) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.BASE_MaterialRequisitionPurpose where a.Code == info.Code select a; BASE_MaterialRequisitionPurpose temp = new BASE_MaterialRequisitionPurpose(); switch (mode) { case CE_OperatorMode.添加: if (varData.Count() > 0) { throw new Exception("【代码】:" + info.Code + "重复, 无法录入"); } temp.Inventory = info.Inventory; temp.DestructiveInspection = info.DestructiveInspection; temp.ApplicableDepartment = info.ApplicableDepartment; temp.RemindWord = info.RemindWord; temp.ThreeOutSideFit = info.ThreeOutSideFit; temp.ThreeOutSideRepair = info.ThreeOutSideRepair; info.UpdateDate = ServerTime.Time; info.UpdatePerson = BasicInfo.LoginID; info.IsEnd = true; info.IsDisable = true; varData = from a in ctx.BASE_MaterialRequisitionPurpose where a.Code == parentCode select a; if (varData.Count() == 1) { temp = varData.Single(); temp.IsEnd = false; } ctx.BASE_MaterialRequisitionPurpose.InsertOnSubmit(info); break; case CE_OperatorMode.修改: var varData2 = from a in ctx.BASE_MaterialRequisitionPurpose where a.Code == info.Code select a; if (varData2.Count() > 0) { temp = varData.Single(); temp.Purpose = info.Purpose; temp.Inventory = info.Inventory; temp.DestructiveInspection = info.DestructiveInspection; temp.ApplicableDepartment = info.ApplicableDepartment; temp.RemindWord = info.RemindWord; temp.ThreeOutSideFit = info.ThreeOutSideFit; temp.ThreeOutSideRepair = info.ThreeOutSideRepair; temp.IsDisable = true; temp.UpdatePerson = BasicInfo.LoginID; temp.UpdateDate = ServerTime.Time; } break; case CE_OperatorMode.除: var varData1 = from a in ctx.S_MaterialRequisition where a.PurposeCode == info.Code select a; if (varData1.Count() > 0) { temp = varData.Single(); temp.IsDisable = false; } else { ctx.BASE_MaterialRequisitionPurpose.DeleteAllOnSubmit(varData); } break; default: break; } ctx.SubmitChanges(); }
void OperationBusiness() { string type = GetMode(panel2); string mode = GetMode(panel3); if (type.Trim().Length == 0 || mode.Trim().Length == 0) { MessageDialog.ShowPromptMessage("请选择【单据类型】、【操作类型】"); return; } CE_HR_AttendanceExceptionType billType = GlobalObject.GeneralFunction.StringConvertToEnum <CE_HR_AttendanceExceptionType>(type); CE_OperatorMode operationMode = GlobalObject.GeneralFunction.StringConvertToEnum <CE_OperatorMode>(mode); if (!CheckData()) { return; } List <object> lstInfo = new List <object>(); List <PersonnelBasicInfo> lstPersonnel = new List <PersonnelBasicInfo>(); lstInfo.Add(ServerTime.ConvertToDateTime(dtp_BeginTime.Value)); lstInfo.Add(ServerTime.ConvertToDateTime(dtp_EndTime.Value)); lstInfo.Add(cmb_BusinessType.Text); lstInfo.Add(txtContent.Text.Trim()); lstInfo.Add(num_Hours.Value); if (operationMode == CE_OperatorMode.添加) { lstInfo.Add(null); MessageDialog.ShowPromptMessage(string.Format("请设置需要【{0}】的人员", billType.ToString())); FormSelectPersonnel2 frm = new FormSelectPersonnel2(); if (frm.ShowDialog() != DialogResult.OK) { return; } else { if (frm.SelectedNotifyPersonnelInfo.UserType != BillFlowMessage_ReceivedUserType.用户.ToString()) { MessageDialog.ShowPromptMessage("请选择【用户】"); return; } else { lstPersonnel = frm.SelectedNotifyPersonnelInfo.PersonnelBasicInfoList; } } _serviceAnalysis.Operation_Exception(billType, operationMode, lstInfo, lstPersonnel); } else if (operationMode == CE_OperatorMode.修改) { lstInfo.Add((int)customDataGridView1.CurrentRow.Cells["单据号"].Value); if (MessageDialog.ShowEnquiryMessage("你确定要【" + operationMode.ToString() + "】?") == DialogResult.No) { return; } _serviceAnalysis.Operation_Exception(billType, operationMode, lstInfo, lstPersonnel); } else if (operationMode == CE_OperatorMode.除) { if (MessageDialog.ShowEnquiryMessage("你确定要【" + operationMode.ToString() + "】?") == DialogResult.No) { return; } if (customDataGridView1.SelectedRows.Count == 0) { MessageDialog.ShowPromptMessage("请选择需要【删除】的记录"); return; } foreach (DataGridViewRow dgvr in customDataGridView1.SelectedRows) { lstInfo.Add((int)dgvr.Cells["单据号"].Value); lstPersonnel = new List <PersonnelBasicInfo>(); PersonnelBasicInfo personnel = new PersonnelBasicInfo(); personnel.工号 = dgvr.Cells["执行人"].Value.ToString(); lstPersonnel.Add(personnel); _serviceAnalysis.Operation_Exception(billType, operationMode, lstInfo, lstPersonnel); } } MessageDialog.ShowPromptMessage(string.Format("【{0}单{1}成功】", billType.ToString(), operationMode.ToString())); RefreshDataGridView(); }