/// <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("订单尚未创建!"); } }
/// <summary> /// 删除出库单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripMenuItem29_Click(object sender, EventArgs e) { if(ckForm != null && !ckForm.isDisposed && ckForm.Status == 0) { DialogResult dr = MessageBox.Show(string.Format("亲,订单【{0}】没有保存,确定要删除吗?\r\n\t,这时你可以操作,按【是】进行【保存删除】,按【否】进行【不保存并删除】,按【取消】进行返回操作",ckForm.FormID), "-删除警告-",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Warning); if (dr == DialogResult.Cancel) { return; } else { try { if (dr == DialogResult.Yes) toolStripMenuItem28_Click(null, null); mainDs.Tables.Remove("outBound"); dataGridView9.DataSource = null; mainDs.Tables.Clear(); ckForm.Dispose(); ckForm = null; }catch(NullReferenceException ex) { MessageBox.Show("引用失效"+ex.StackTrace.ToString()); } catch(Exception ex) { MessageBox.Show("error"+ex.StackTrace.ToString()); } GC.Collect(); ClearControlsText(panel_ck_formInfo); ClearControlsText(panel_ck_formList); //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 不要 } }
/// <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.Yes) { ckForm = null; //还有其他操作 } else if (dr == DialogResult.No) { //进行存库删除操作 } else { return; } } }
/// <summary> /// 添加出库单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolTrip_ck_addForm_Click(object sender, EventArgs e) { if (ckForm == null || ckForm.Status == 1) { ckForm = new CK_Form(); panel_ck_formInfo.Enabled = true; panel_ck_formList.Enabled = true; { 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) MessageBox.Show(string.Format("订单【{0}】尚未保存,请完成本次出库!", ckForm.FormID)); else MessageBox.Show("订单尚未创建!"); } }
/// <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 不要 } }