public FormStorageChecking() { InitializeComponent(); dataGridView1.AutoGenerateColumns = false; XmlDocument doc = new XmlDocument(); string xmlFile = AppDomain.CurrentDomain.BaseDirectory + "BugsBox.Pharmacy.AppClient.SalePriceType.xml"; doc.Load(xmlFile); XmlNodeList nodeList = doc.SelectNodes("/SalePriceType/photo"); addr = nodeList[0].Attributes["Address"].Value.ToString(); dbname = nodeList[0].Attributes["database"].Value.ToString(); user = nodeList[0].Attributes["user"].Value.ToString(); pw = nodeList[0].Attributes["pw"].Value.ToString(); BindComboBoxWarehouseZones(); this.dataGridView1.DataSource = new BindingCollection <InventeryModel>(bList); sql = "Data Source=" + addr + ";Initial Catalog=" + dbname + ";User ID=" + user + ";Password="******";Min Pool Size=1"; strValue = string.Empty; tt.SetToolTip(this.dataGridView1, "批次详细"); tt.UseFading = true; tt.InitialDelay = 2000; tt.UseAnimation = true; tt.AutoPopDelay = 10000; tt.BackColor = Color.Blue; tt.IsBalloon = true; //移库至 ToolStripMenuItem tsi = new ToolStripMenuItem("移至->"); WarehouseZone[] warehousezoneArr = this.comboBox1.DataSource as WarehouseZone[]; foreach (var i in warehousezoneArr) { tsi.DropDownItems.Add(i.Name, null, DrugInventoryMoveClick); tsi.DropDownItems[tsi.DropDownItems.Count - 1].Tag = i; } cms.Items.Add("流向查看"); cms.Items.Add("-"); //cms.Items.Add("查看购销流向", null, this.button3_Click); cms.Items.Add("查看品种来源", null, DrugSouce_Click); cms.Items.Add("查看品种批次来源", null, DrugBatchSource_Click); cms.Items.Add("-"); cms.Items.Add("移库操作"); cms.Items.Add("-"); cms.Items.Add(tsi); cms.Items.Add("查看移库记录", null, delegate(object sender, EventArgs e) { Form_DrugInventoryMove frm = new Form_DrugInventoryMove(); frm.ShowDialog(); }); }
/// <summary> /// 移库右键菜单 /// </summary> /// <param name="sender">sender内含tag属性为warehousezone对象</param> /// <param name="e"></param> private void DrugInventoryMoveClick(object sender, EventArgs e) { WarehouseZone wz = ((ToolStripDropDownItem)sender).Tag as WarehouseZone; if (wz.Name == this.comboBox1.SelectedText) { return; } ApprovalFlowType aft = this.PharmacyDatabaseService.GetApprovalFlowTypeByBusiness(out msg, ApprovalType.drugsInventoryMove).FirstOrDefault(); if (aft == null) { MessageBox.Show("请先通知管理员设定移库审批,并设定其审批节点!"); return; } if (MessageBox.Show("确定需要申请该药品移库至:" + wz.Name + "吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { return; } Guid InventoryID = storage[this.dataGridView1.SelectedCells[0].RowIndex].InventoryID; DrugInventoryRecord dir = this.PharmacyDatabaseService.GetDrugInventoryRecord(out msg, InventoryID); if (dir == null) { MessageBox.Show("读取库存表失败!"); return; } DrugsInventoryMove dim = new DrugsInventoryMove(); dim.Id = Guid.NewGuid(); dim.ApprovalStatusValue = 1; dim.batchNo = dir.BatchNumber; dim.createTime = DateTime.Now; dim.createUID = BugsBox.Pharmacy.AppClient.Common.AppClientContext.currentUser.Id; dim.Deleted = false; dim.Description = "移库至" + wz.Name; dim.drugName = dir.DrugInfo.ProductGeneralName; dim.flowID = Guid.NewGuid(); dim.inventoryRecordID = dir.Id; dim.OriginWareHouseID = dir.WarehouseZoneId; dim.quantity = dir.CanSaleNum; dim.updateTime = DateTime.Now; dim.WareHouseID = wz.Id; bool b = this.PharmacyDatabaseService.AddDrugsInventoryMoveByFlowID(dim, aft.Id, "新增移库审批", out msg); if (b) { this.PharmacyDatabaseService.WriteLog(dim.createUID, "成功提交移库申请信息:" + dim.drugName + "被成功申请移至" + dim.OriginWareHouseID); if (MessageBox.Show("成功申请移库信息" + wz.Name + ",请至右键菜单->移库记录查询界面查询!需要打开移库记录查询窗口吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { return; } Form_DrugInventoryMove frm = new Form_DrugInventoryMove(); frm.ShowDialog(); } }
public StorageQuery(string type) { InitializeComponent(); dataGridView1.AutoGenerateColumns = false; this.dataGridView1.RowPostPaint += delegate(object o, DataGridViewRowPostPaintEventArgs ex) { DataGridViewOperator.SetRowNumber((DataGridView)o, ex); }; this.type = type; if (type == "ProfitOrLoss") { this.Text = "库存损益处理"; CurrentInventoryCount.Visible = false; button2.Visible = false; button3.Visible = false; button5.Visible = true; colProcess.Visible = true; colPLNum.Visible = true; CurrentInventoryCount.Visible = false; this.PurchasePrice.Visible = false; this.PruductDate.Visible = false; this.button4.Visible = true; this.button5.Left = button2.Left; this.button4.Left = button5.Left + button5.Width + 5; button6.Visible = true; } if (type == "Now") { this.Text = "现有库存"; CanSaleNum.Visible = false; } else if (type == "CanUse") { this.Text = "可用库存"; CurrentInventoryCount.Visible = false; } else if (type == "OutofStock") { this.Text = "缺货查询"; CanSaleNum.Visible = true; CurrentInventoryCount.Visible = true; } BindComboBoxWarehouseZones(); this.dataGridView1.DataSource = bList; tt.SetToolTip(this.dataGridView1, "批次详细"); tt.UseFading = true; tt.InitialDelay = 2000; tt.UseAnimation = true; tt.AutoPopDelay = 10000; tt.BackColor = Color.Blue; tt.IsBalloon = true; //移库至 ToolStripMenuItem tsi = new ToolStripMenuItem("移至->"); WarehouseZone[] warehousezoneArr = this.comboBox1.DataSource as WarehouseZone[]; foreach (var i in warehousezoneArr) { tsi.DropDownItems.Add(i.Name, null, DrugInventoryMoveClick); tsi.DropDownItems[tsi.DropDownItems.Count - 1].Tag = i; } cms.Items.Add("表格操作"); cms.Items[cms.Items.Count - 1].Enabled = false; cms.Items.Add("-"); cms.Items.Add("自动调整列宽", null, delegate(object sender, EventArgs e) { this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; }); cms.Items.Add("取消自动调整列宽", null, delegate(object sender, EventArgs e) { this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; }); cms.Items.Add("-"); cms.Items.Add("流向查看"); cms.Items[cms.Items.Count - 1].Enabled = false; cms.Items.Add("-"); cms.Items.Add("查看购销流向", null, this.button3_Click); cms.Items.Add("查看品种来源", null, DrugSouce_Click); cms.Items.Add("查看品种批次来源", null, DrugBatchSource_Click); cms.Items.Add("-"); cms.Items.Add("移库操作"); cms.Items[cms.Items.Count - 1].Enabled = false; cms.Items.Add("-"); cms.Items.Add(tsi); cms.Items.Add("查看移库记录", null, delegate(object sender, EventArgs e) { Form_DrugInventoryMove frm = new Form_DrugInventoryMove(); frm.ShowDialog(); }); }