private void lookupText1_valueSetted(object sender, LookupArg arg) { //转移控件焦点,使得能够重新生成历史price if (dataGridView1.Rows.Count > 0 && dataGridView1.Columns["totalPrice"].Visible == true) { dataGridView1.CurrentCell = dataGridView1.Rows[0].Cells["totalPrice"]; } //有两个地方修改serial,initCirculation和company_valueChange //如果有涉及到initCirculation,那么initCirculation应该放在valueChange后面 //valueChange也是在serialType2时才需要修改serial string serialType = ConfUtility.GetSerialType(); //add 2018-4-13如果为已审核,就不需要重新计算previousArrear、serial、lastPayReceipt if (arg != null) { //新增、初始化编辑,编辑(未审核) //编辑初始化时serial是不用重新计算的,但是要判断编辑初始化比较困难,为了代码方便,一刀切,在initCirculation那里会重新设回serial if (circulation == null || circulation.Status <= 1) { Customer customer = CustomerDao.getInstance().FindByID((int)arg.Value); this.textBox_previousArrears.Text = (this.conf.arrearsDirection * customer.arrear).ToString(); //2018-3-28修复 if (serialType == "serialType2") { int max = cirDao.getMaxCode(string.Format("{0}-ID{1}-{2}-", conf.code, customer.ID, DateTime.Now.ToString("yyyyMM"))); this.textBox_serial.Text = string.Format("{0}-ID{1}-{2}-{3:000}", conf.code, customer.ID, DateTime.Now.ToString("yyyyMM"), max + 1); } if (this.panel_lastPayReceipt.Visible) { setLastPayReceipt(customer.ID); } } //编辑(已审核)不需要重新计算 } //新增初始化 else { if (serialType == "serialType2") { this.textBox_serial.Text = ""; } this.textBox_previousArrears.Text = ""; this.label_lastPayReceipt.Text = ""; } resetNeedSave(true); }
private void initCirculation() { if (openMode == 0) { switchMode(openMode); this.dateTime_sellTime.Value = DateTime.Now; this.textBox_comment.Text = null; this.lookupText1.LookupArg = null; this.lookupText1.Text_Lookup = null; //23018-04-20 //重新设置company后,如果company为null(这种情况发生在原来编辑页面打开新增页面) //会引发changed事件,从而修改serial,所以这段代码要放在company设定之后 // if (ConfUtility.GetSerialType() == "serialType1" || (int)conf.type > 4) { int max = cirDao.getMaxCode(string.Format("{0}-{1}-", conf.code, DateTime.Now.ToString("yyyyMMdd"))); this.textBox_serial.Text = string.Format("{0}-{1}-{2:0000}", conf.code, DateTime.Now.ToString("yyyyMMdd"), max + 1); } this.textBox_operator.Text = ConfDao.getInstance().Get(5).ToString(); this.dataGridView1.Rows.Clear(); this.dataGridView2[1, 0].Value = null; this.textBox_cutoff.Text = "100"; this.textBox_realTotal.Text = ""; this.textBox_previousArrears.Text = null; this.textBox_thisPayed.Text = null; this.textBox_accumulative.Text = null; this.textBox_freight.Text = null; this.resetNeedSave(false); this.recordChanged = false; return; } circulation = cirDao.FindByID(circulationID); this.textBox_serial.Text = circulation.Code; this.dateTime_sellTime.Value = circulation.CirculationTime; this.textBox_comment.Text = circulation.Comment; this.textBox_operator.Text = circulation.Oper; this.dataGridView2[1, 0].Value = circulation.Total; this.backgroundWorker.RunWorkerAsync(circulation.ID); this.invokeBeginLoadNotify(); }
public CirSettingForm() { InitializeComponent(); string serialType = ConfUtility.GetSerialType(); //string可以用==,String就不行? if (serialType == "serialType2") { this.radioButton2.Checked = true; } else { this.radioButton1.Checked = true; } string backFreight = ConfUtility.GetBackFreightOpen(); if (backFreight == "backFreightOpen") { this.checkBox_backFreight.Checked = true; } string printLetter = ConfUtility.GetPrintLetterOpen(); if (printLetter == "printLetterOpen") { this.checkBox_printLetter.Checked = true; } string lastPayReceipt = ConfUtility.GetLastPayReceiptOpen(); if (lastPayReceipt == "lastPayReceiptOpen") { this.checkBox_lastPayReceipt.Checked = true; } }