private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Node.Nodes.Count == 0) { SelectedData = e.Node.Tag as BASE_MaterialRequisitionPurpose; cmbCode.Text = e.Node.Text; } else { SelectedData = null; cmbCode.Text = ""; } }
/// <summary> /// 双击节点 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Node.Nodes.Count > 0) { MessageDialog.ShowPromptMessage("只能选择叶子节点"); return; } SelectedData = e.Node.Tag as BASE_MaterialRequisitionPurpose; if (CheckData(SelectedData)) { this.DialogResult = DialogResult.OK; } }
private void dgvPurpose_CellClick(object sender, DataGridViewCellEventArgs e) { if (dgvPurpose.CurrentRow == null) { return; } txtPurpose_Code.Text = dgvPurpose.CurrentRow.Cells["用途代码"].Value.ToString(); txtPurpose_Name.Text = dgvPurpose.CurrentRow.Cells["用途名称"].Value.ToString(); txtPurpose_Parent.Text = dgvPurpose.CurrentRow.Cells["父级用途代码"].Value.ToString() == "Root" ? "" : dgvPurpose.CurrentRow.Cells["父级用途代码"].Value.ToString(); txtRemindWord.Text = dgvPurpose.CurrentRow.Cells["提醒语句"].Value == null ? "" : dgvPurpose.CurrentRow.Cells["提醒语句"].Value.ToString(); txtApplicableDepartment.Text = dgvPurpose.CurrentRow.Cells["适用部门"].Value == null ? "" : dgvPurpose.CurrentRow.Cells["适用部门"].Value.ToString(); if (txtApplicableDepartment.Text.Trim().Length > 0) { string strDept = ""; foreach (string str in txtApplicableDepartment.Text.Trim().Split(',').ToList()) { strDept += UniversalFunction.GetDeptCode(str) + ","; } strDept = strDept.Substring(0, strDept.Length - 1); txtApplicableDepartment.Tag = strDept; } else { txtApplicableDepartment.Tag = null; } chb_Inventory.Checked = dgvPurpose.CurrentRow.Cells["盘点"].Value == DBNull.Value ? false : Convert.ToBoolean(dgvPurpose.CurrentRow.Cells["盘点"].Value); chb_DestructiveInspection.Checked = dgvPurpose.CurrentRow.Cells["破坏性检测"].Value == DBNull.Value ? false : Convert.ToBoolean(dgvPurpose.CurrentRow.Cells["破坏性检测"].Value); chb_ThreeOutSideFit.Checked = dgvPurpose.CurrentRow.Cells["三包外装配"].Value == DBNull.Value ? false : Convert.ToBoolean(dgvPurpose.CurrentRow.Cells["三包外装配"].Value); chb_ThreeOutSideRepair.Checked = dgvPurpose.CurrentRow.Cells["三包外维修"].Value == DBNull.Value ? false : Convert.ToBoolean(dgvPurpose.CurrentRow.Cells["三包外维修"].Value); BASE_MaterialRequisitionPurpose temp = _serviceParametersSetting.GetMaterialRequisitionPurposeSingle(dgvPurpose.CurrentRow.Cells["父级用途代码"].Value.ToString()); txtPurpose_ParentName.Text = temp == null ? "领料用途" : temp.Purpose; }
private void 修改单据ToolStripMenuItem_Click(object sender, EventArgs e) { if (!CheckSelectedRow()) { return; } if (lblBillStatus.Text != MaterialReturnedInTheDepotBillStatus.新建单据.ToString()) { MessageDialog.ShowPromptMessage("您现在不是处于新建单据状态,无法进行此操作"); return; } if (!CheckUserOperation(dataGridView1.SelectedRows[0])) { return; } if (!CheckDataItem()) { return; } BASE_MaterialRequisitionPurpose purpose = txtPurpose.Tag as BASE_MaterialRequisitionPurpose; S_MaterialReturnedInTheDepot bill = new S_MaterialReturnedInTheDepot(); bill.Bill_ID = txtBill_ID.Text; bill.ReturnType = cmbType.Text; bill.Bill_Time = ServerModule.ServerTime.Time; bill.PurposeCode = purpose == null?txtPurpose.Tag.ToString() : purpose.Code; bill.ReturnReason = txtReturnedReason.Text; bill.Remark = txtRemark.Text; bill.ReturnMode = cmbMode.Text; bill.IsOnlyForRepair = chkIsOnlyForRepair.Checked; bill.StorageID = UniversalFunction.GetStorageID(cmbStorage.Text); if (!m_billServer.UpdateBill(bill, out m_queryResult, out m_error)) { MessageDialog.ShowErrorMessage(m_error); return; } RefreshDataGridView(m_queryResult); PositioningRecord(bill.Bill_ID); }
/// <summary> /// 检查数据 /// </summary> /// <param name="data">要检查的数据项</param> /// <returns>正确返回true</returns> bool CheckData(BASE_MaterialRequisitionPurpose data) { if (data == null || !data.IsEnd) { MessageDialog.ShowPromptMessage("必须要选择最终分类(即末节点), 而不允许选择大类"); return(false); } else if (data.Code == "1602") { MessageDialog.ShowPromptMessage("此选项不可选择"); return(false); } else { return(true); } }
/// <summary> /// 生成树节点 /// </summary> /// <param name="info">用来生成树节点的信息</param> /// <returns>返回生成的树节点</returns> TreeNode GenerateNode(BASE_MaterialRequisitionPurpose info) { TreeNode node = new TreeNode(); node.Name = string.Format("{0} {1}", info.Code, info.Purpose); node.Text = node.Name; node.Tag = info; if (info.IsEnd) { node.ContextMenuStrip = contextMenuStrip; m_autoCompleteSource.Add(node.Text); } else { node.ForeColor = Color.Tomato; } return(node); }
void BuildTreeView(TreeNode parentNode, List <BASE_MaterialRequisitionPurpose> lstDepotInfo) { BASE_MaterialRequisitionPurpose parentInfo = parentNode.Tag as BASE_MaterialRequisitionPurpose; for (int i = 0; i < lstDepotInfo.Count; i++) { if (parentInfo.Code.Length + 2 != lstDepotInfo[i].Code.Length) { break; } TreeNode node = GenerateNode(lstDepotInfo[i]); parentNode.Nodes.Add(node); lstDepotInfo.RemoveAt(i); i--; if (!(node.Tag as BASE_MaterialRequisitionPurpose).IsEnd) { BuildTreeView(node, lstDepotInfo); } } }
/// <summary> /// 显示信息 /// </summary> void ShowInfo() { if (m_lnqBill == null) { return; } txtBillNo.Text = m_lnqBill.BillNo; txtBillRemark.Text = m_lnqBill.Remark; BASE_MaterialRequisitionPurpose temp = m_serverPurpose.GetBillPurpose(m_lnqBill.PurposeCode); if (temp != null) { txtPurposeCode.Text = temp.Purpose; txtPurposeCode.Tag = temp.Code; } txtDepartment.Text = UniversalFunction.GetDeptName(m_lnqBill.DeptCode); txtDepartment.Tag = m_lnqBill.DeptCode; lbBillStatus.Text = m_lnqBill.BillStatus; lbAffirm.Text = m_lnqBill.Affirm == null ? "" : m_lnqBill.Affirm; lbAffirmDate.Text = m_lnqBill.AffirmDate == null ? "" : m_lnqBill.AffirmDate.ToString(); lbAudit.Text = m_lnqBill.Audit == null ? "" : m_lnqBill.Audit; lbAuditDate.Text = m_lnqBill.AuditDate == null ? "" : m_lnqBill.AuditDate.ToString(); lbPropose.Text = m_lnqBill.Proposer == null ? "" : m_lnqBill.Proposer; lbProposerDate.Text = m_lnqBill.ProposerDate == null ? "" : m_lnqBill.ProposerDate.ToString(); if (m_lnqBill.StorageID != null) { cmbStorage.Tag = m_lnqBill.StorageID; cmbStorage.Text = UniversalFunction.GetStorageName(m_lnqBill.StorageID); } dataGridView1.DataSource = m_serverLend.GetListInfo(m_lnqBill.BillNo); dataGridView1.Columns["单据号"].Visible = 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; } }
private void 设置退货清单ToolStripMenuItem_Click(object sender, EventArgs e) { string billNo = txtBill_ID.Text; try { this.dataGridView1.CellEnter -= new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEnter); if (lblBillStatus.Text != MaterialRejectBillBillStatus.新建单据.ToString()) { MessageDialog.ShowPromptMessage("您现在不是处于新建单据状态,无法进行此操作"); return; } if (!CheckDataItem()) { return; } // 如果此单据存在则检查选择行 if (m_billServer.IsExist(txtBill_ID.Text)) { if (!CheckSelectedRow()) { return; } if (!CheckUserOperation(dataGridView1.SelectedRows[0])) { return; } } else { BASE_MaterialRequisitionPurpose purpose = txtProvider.Tag as BASE_MaterialRequisitionPurpose; // 如果此单据还不存在则创建 S_MaterialRejectBill bill = new S_MaterialRejectBill(); bill.Bill_ID = txtBill_ID.Text; bill.Bill_Time = ServerModule.ServerTime.Time; bill.BillStatus = MaterialRejectBillBillStatus.新建单据.ToString(); bill.Department = BasicInfo.DeptCode; bill.FillInPersonnel = BasicInfo.LoginName; bill.FillInPersonnelCode = BasicInfo.LoginID; bill.Provider = txtProvider.Text; bill.Reason = txtReason.Text; bill.Remark = txtRemark.Text; bill.BillType = cmbBillType.Text; bill.StorageID = UniversalFunction.GetStorageID(cmbStorage.Text); if (!m_billServer.AddBill(bill, out m_queryResult, out m_error)) { MessageDialog.ShowErrorMessage(m_error); return; } } FormMaterialListRejectBill form = new FormMaterialListRejectBill(CE_BusinessOperateMode.修改, txtProvider.Text, txtBill_ID.Text); form.ShowDialog(); } finally { this.dataGridView1.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEnter); } RefreshDataGridView(m_queryResult); PositioningRecord(billNo); }
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(); }
private void 设置退库清单ToolStripMenuItem_Click(object sender, EventArgs e) { string billNo = txtBill_ID.Text; try { this.dataGridView1.CellEnter -= new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEnter); if (lblBillStatus.Text == MaterialReturnedInTheDepotBillStatus.已完成.ToString()) { MessageDialog.ShowPromptMessage("您现在不是处于新建单据状态,无法进行此操作"); return; } if (!CheckDataItem()) { return; } if (chkIsOnlyForRepair.Enabled && !chkIsOnlyForRepair.Checked) { if (MessageDialog.ShowEnquiryMessage("此单未勾选仅限于返修箱用,是否继续?") == DialogResult.No) { return; } } // 如果此单据存在则检查选择行 if (m_billServer.IsExist(txtBill_ID.Text)) { if (!CheckSelectedRow()) { return; } if (!CheckUserOperation(dataGridView1.SelectedRows[0])) { return; } } else { BASE_MaterialRequisitionPurpose purpose = txtPurpose.Tag as BASE_MaterialRequisitionPurpose; // 如果此单据还不存在则创建 S_MaterialReturnedInTheDepot bill = new S_MaterialReturnedInTheDepot(); bill.Bill_ID = txtBill_ID.Text; bill.Bill_Time = ServerModule.ServerTime.Time; bill.BillStatus = MaterialReturnedInTheDepotBillStatus.新建单据.ToString(); bill.Department = BasicInfo.DeptCode; bill.ReturnType = cmbType.Text; bill.FillInPersonnel = BasicInfo.LoginName; bill.FillInPersonnelCode = BasicInfo.LoginID; bill.PurposeCode = purpose.Code; bill.ReturnReason = txtReturnedReason.Text; bill.Remark = txtRemark.Text; bill.StorageID = UniversalFunction.GetStorageID(cmbStorage.Text); bill.ReturnMode = cmbMode.Text.Trim(); bill.IsOnlyForRepair = chkIsOnlyForRepair.Checked; if (!m_billServer.AddBill(bill, out m_queryResult, out m_error)) { MessageDialog.ShowErrorMessage(m_error); return; } } FormMaterialListReturnedInTheDepot form = new FormMaterialListReturnedInTheDepot(CE_BusinessOperateMode.修改, txtBill_ID.Text); form.StrReturnMode = cmbMode.Text.Trim(); form.BlIsOnlyForRepair = chkIsOnlyForRepair.Checked; form.ShowDialog(); } finally { this.dataGridView1.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEnter); } RefreshDataGridView(m_queryResult); PositioningRecord(billNo); }