/// <summary> /// 添加出库单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolTrip_ck_addForm_Click(object sender, EventArgs e) { if (ckForm == null || ckForm.isDisposed || ckForm.Status == 1) { ComCreateTable(); ckForm = new CK_Form(); panel_ck_formInfo.Enabled = true; panel_ck_formList.Enabled = true; { InBound inbound = new InBound(); SetLableTextNull(); Control[] arrPanel = new Control[] { panel_ck_formInfo, panel_ck_formList }; inbound.ClearControlsText(arrPanel); //以上进行初始化 tBox_ck_ID.Text = ckForm.FormID.ToString(); lbl_ck_InitTime.Text = ckForm.InitTime.ToString(); //lbl_ck_status.Text = "出库状态: 未出库"; lbl_ck_formID.Text = ckForm.FormID.ToString(); } //ckForm.mainDS = this.mainDs.Copy();//克隆数据集 tBox_ck_app_apart.Focus(); } else { if (ckForm != null && !ckForm.isDisposed && ckForm.Status ==0) MessageBox.Show(string.Format("订单【{0}】尚未保存,请完成本次出库!", ckForm.FormID)); else MessageBox.Show("订单尚未创建!"); } }
private void button4_Click(object sender, EventArgs e) { if (inBound == null || inBound.IsDisposed) inBound = new InBound(); else { inBound.WindowState = FormWindowState.Normal; inBound.Activate(); } inBound.MdiParent = this; inBound.SetDesktopLocation(300,0); inBound.Show(); }
/// <summary> /// 添加到出库单中 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_addToForm_Click(object sender, EventArgs e) { //int pre_counts = dataGridView9.Rows.Count; InBound inBound = new InBound(); Control [] arrControl = new Control[]{panel_ck_formInfo,panel_ck_formList}; if (inBound.CheckControlsNull(arrControl) == false) { MessageBox.Show("请填写完整出库信息再添加到出库表"); return; } else { if (mainDs.Tables.Contains("outBound")) { DataRow dr = mainDs.Tables["outBound"].NewRow(); dr[0] = this.yp_num; dr[1] = this.yp_name; dr[2] = this.yp_setName; dr[3] = this.yp_price; dr[4] = int.Parse(this.tBox_ck_quantity.Text.Trim()); dr[5] = this.quantity; dr[6] = this.yp_unit; dr[7] = this.mDate; dr[8] = this.eDate; try { mainDs.Tables["outBound"].Rows.Add(dr); } catch { MessageBox.Show("出库单中已经包含了该药品,请不要重复添加,如需修改出库数量,请按照操作进行修改"); } //if(++pre_counts == dataGridView9.Rows.Count) //{ // inBound.ClearControlsText(panel_ck_formList); // tBox_ck_drug_short.Focus(); //} inBound.ClearControlsText(panel_ck_formList); } else { ComCreateTable(); btn_addToForm_Click(null,null); } } }
/// <summary> /// 删除出库单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripMenuItem29_Click(object sender, EventArgs e) { if(ckForm != null && ckForm.Status == 0) { DialogResult dr = MessageBox.Show(string.Format("亲,订单【{0}】没有保存,确定要删除吗?\r\n\n\t,这时你可以操作,按【是】进行【保存删除】,按【否】进行【不保存并删除】,按【取消】进行返回操作",ckForm.FormID), "-删除警告-",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Warning); if (dr == DialogResult.Cancel) { return; } else { if(dr == DialogResult.Yes)toolStripMenuItem28_Click(null,null); mainDs.Tables.Remove("outBound"); ckForm.Dispose(); ckForm = null; InBound inbound = new InBound(); SetLableTextNull(); Control[] arrPanel = new Control[] {panel_ck_formInfo,panel_ck_formList }; inbound.ClearControlsText(arrPanel); } #region 不要的 //if(dr == DialogResult.Yes) //{ // ckForm = null; // //还有其他操作 //} //else if (dr == DialogResult.No) //{ // //进行存库删除操作 // ckForm = null; // ckForm.Dispose(); //} //else //{ // return; //} #endregion 不要 } }