private void button_3_Click(object sender, EventArgs e) { if (!this.ReadPdDataSuccess) { string str; if (string.IsNullOrEmpty(this.tbCkCode.Text)) { MessageBox.Show("仓库编码不能为空"); return; } if (this.dpPdDate.Value.CompareTo(DateTime.Today) > 0) { MessageBox.Show("盘点日期不能比当前日期晚"); return; } if (PubGlobal.PdDataInfo == null) { PubGlobal.PdDataInfo = new DBPdDataInfo(); } PubGlobal.PdDataInfo.PdDate = dpPdDate.Value.Date; PubGlobal.PdDataInfo.CkCode = tbCkCode.Text; PubGlobal.PdDataInfo.LrUser = PubGlobal.User.UserCode; PubGlobal.PdDataInfo.LrDate = DateTime.Now; if (!PdDataDAL.SavePdDataInfo(PubGlobal.PdDataInfo, out str)) { MessageBox.Show("保存盘点信息失败:" + str); return; } } base.DialogResult = DialogResult.OK; }
private void ReFlush() { this.tbCode.Text = (PubGlobal.Cur_TRFQueryPlu == null) ? string.Empty : (string.IsNullOrEmpty(PubGlobal.Cur_TRFQueryPlu[0].BARCODE) ? PubGlobal.Cur_TRFQueryPlu[0].PLUCODE : PubGlobal.Cur_TRFQueryPlu[0].BARCODE); this.tbPluName.Text = (PubGlobal.Cur_TRFQueryPlu == null) ? string.Empty : PubGlobal.Cur_TRFQueryPlu[0].PLUNAME; this.tbSpec.Text = (PubGlobal.Cur_TRFQueryPlu == null) ? string.Empty : PubGlobal.Cur_TRFQueryPlu[0].SPEC; this.tbUnit.Text = (PubGlobal.Cur_TRFQueryPlu == null) ? string.Empty : PubGlobal.Cur_TRFQueryPlu[0].UNIT; this.tbPrice.Text = (PubGlobal.Cur_TRFQueryPlu == null) ? "0" : PubGlobal.Cur_TRFQueryPlu[0].PRICE; this.tbNowQty.Text = "0"; if (PubGlobal.Cur_TRFQueryPlu != null) { string str; if (!PdDataDAL.GetPdData(PubGlobal.Cur_TRFQueryPlu[0].PLUID, out PubGlobal.PdDataModel, out str)) { this.tbLastQty.Text = "0"; if (!NewModel()) { MessageBox.Show("新建单据明细失败"); return; } } this.tbLastQty.Text = PubGlobal.PdDataModel.SjCount.ToString("F2"); this.tbNowQty.Focus(); this.tbNowQty.SelectAll(); } else { this.tbNowQty.Text = "0"; this.tbLastQty.Text = "0"; this.tbCode.Focus(); this.tbCode.SelectAll(); } }
private void button_1_Click(object sender, EventArgs e) { if (PubGlobal.PdDataModel != null) { string str; try { PubGlobal.PdDataModel.SjCount += decimal.Parse(this.tbNowQty.Text); } catch { MessageBox.Show("数量非法"); this.tbNowQty.Focus(); this.tbNowQty.SelectAll(); return; } PubGlobal.PdDataModel.LrDate = DateTime.Now; PubGlobal.PdDataModel.LrUser = PubGlobal.User.UserCode; if (PdDataDAL.SavePdData(PubGlobal.PdDataModel, out str)) { PubGlobal.JhBillModel = null; PubGlobal.Cur_TRFQueryPlu.Clear(); PubGlobal.Cur_TRFQueryPlu = null; this.ReFlush(); } else { MessageBox.Show("保存失败:" + str); } } }
private void button_2_Click(object sender, EventArgs e) { if (MessageBox.Show("发送当前盘点单数据到服务器?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) != DialogResult.Yes) { return; } DataSet ds; string msg; ShowWait("正读取盘点单...请稍候..."); if (!PdDataDAL.GetSendPdData(out ds, out msg)) { HideWait(); MessageBox.Show("提取盘点单失败:" + msg); return; } //string ywType = PubGlobal.JhBillInfo.IsCgJh ? PubGlobal.JHYW_TYPE_CGJH : PubGlobal.JHYW_TYPE_NO_CGJH; ShowWait("正在发送盘点单数据...请稍候..."); if (!Comm.Comm.RecvPdData(ds, PubGlobal.PdDataInfo.CkCode, PubGlobal.PdDataInfo.PdDate.ToString("yyyy-MM-dd"), PubGlobal.OrgCode, PubGlobal.User.UserCode, PubGlobal.User.Password, out msg)) { HideWait(); MessageBox.Show("发送盘点单失败:" + msg); return; } HideWait(); MessageBox.Show("发送盘点单成功"); if (!PdDataDAL.RemovePdData(out msg)) { MessageBox.Show("删除盘点单失败"); } pdDatas.Clear(); PubGlobal.PdDataInfo = null; dBPdDataBindingSource.ResetBindings(true); button_4_Click(null, null); }
private void FrmPdBillSend_Load(object sender, EventArgs e) { ShowWait("正在读取盘点明细...\r\n 请稍候..."); string msg; if (!PdDataDAL.GetPdDataInfo(out PubGlobal.PdDataInfo, out msg)) { MessageBox.Show("读取盘点单数据失败:" + msg); this.DialogResult = DialogResult.Cancel; HideWait(); return; } if (!PdDataDAL.ListPdData(out pdDatas, out msg)) { MessageBox.Show("查询盘点单明细失败:" + msg); this.DialogResult = DialogResult.Cancel; HideWait(); return; } else { tbPdDate.Text = PubGlobal.PdDataInfo.PdDate.ToString("yyyy-MM-dd"); tbCkCode.Text = PubGlobal.PdDataInfo.CkCode; dBPdDataBindingSource.DataSource = pdDatas; } HideWait(); }
private void FrmPdBillMx_Load(object sender, EventArgs e) { string str; ShowWait("正在读取盘点单信息\r\n请稍候..."); this.tbPdDate.Text = PubGlobal.PdDataInfo.PdDate.ToString("yyyy-MM-dd"); this.tbCkCode.Text = PubGlobal.PdDataInfo.CkCode; if (!PdDataDAL.ListPdData(out this.pdDatas, out str)) { MessageBox.Show("读取盘点单错误:" + str); HideWait(); } else { HideWait(); this.dBPdDataBindingSource.DataSource = this.pdDatas; } }
private void FrmPdBillInit_Load(object sender, EventArgs e) { string str; this.ReadPdDataSuccess = PdDataDAL.GetPdDataInfo(out PubGlobal.PdDataInfo, out str); this.dpPdDate.Enabled = !this.ReadPdDataSuccess; this.tbCkCode.Enabled = !this.ReadPdDataSuccess; if (this.ReadPdDataSuccess) { this.dpPdDate.Value = PubGlobal.PdDataInfo.PdDate; this.tbCkCode.Text = PubGlobal.PdDataInfo.CkCode; base.button_3.Focus(); } else { this.dpPdDate.Value = DateTime.Today; this.tbCkCode.Text = string.Empty; this.tbCkCode.Focus(); this.tbCkCode.SelectAll(); } }
private void button_2_Click(object sender, EventArgs e) { if (dgBillMx.CurrentRowIndex >= 0) { DBPdData pdData = (DBPdData)dBPdDataBindingSource.Current; StringBuilder strBuilder = new StringBuilder(); strBuilder.AppendFormat("是否删除【{0}】{1}", new string[] { pdData.Barcode, pdData.PluName }); if (MessageBox.Show(strBuilder.ToString(), "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { string msg; if (!PdDataDAL.DeletePdData(pdData, out msg)) { MessageBox.Show("删除失败:" + msg); } else { pdDatas.RemoveAt(pdDatas.FindIndex(a => a.ID == pdData.ID)); dBPdDataBindingSource.ResetBindings(true); } } } }
private void button_4_Click(object sender, EventArgs e) { if (PubGlobal.PdDataInfo != null) { if (MessageBox.Show("盘点单单未发送至后台。是否要删除此盘点单?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { if (MessageBox.Show("盘点单清空后将无法恢复。确认清空盘点单?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes) { return; } string msg; if (!PdDataDAL.RemovePdData(out msg)) { MessageBox.Show("清空失败:" + msg); return; } pdDatas.Clear(); dBPdDataBindingSource.Clear(); } } pdDatas = null; this.DialogResult = DialogResult.OK; }