private void add_toolStripButton_Click(object sender, EventArgs e) { this.KeyPreview = true; //判断是否选择库房 if (this.InWare_selTextInpt.Value == null) { WJs.alert("请选择入库库房!"); InWare_selTextInpt.Focus(); return; } //判断是否选择入库方式 if (this.InWay_selTextInpt.Value == null) { WJs.alert("请选择入库方式!"); InWay_selTextInpt.Focus(); return; } Dictionary <string, object> de = new Dictionary <string, object>(); de["生产日期"] = WJs.getDate(His.his.WebDate); de["数量"] = 0; de["发票单价"] = "0"; de["运杂费"] = "0"; de["成本单价"] = "0"; de["成本金额"] = "0"; de["有效期"] = WJs.getDate(His.his.WebDate).AddYears(1); string wareid = this.InWare_selTextInpt.Value; string ifall = LData.Es("EQWareIfall", null, new object[] { wareid }); //string wz_s = "物资"; // string wzid_s=""; if (ifall.Equals("1")) { // this.InWZ_selTextInpt.Sql = "GetInWZ0"; dataGView1.addSql("GetInEQ0", "设备", "", His.his.Choscode + "|" + wareid + "|{key}|{key}|{key}|{key}"); //this.InWZ_selTextInpt.SelParam = His.his.Choscode + "|" + wareid + "|{key}|{key}"; // dataGView1.addSql("",wz_s,wzid_s, } else { // this.InWZ_selTextInpt.Sql = "GetInWZ"; dataGView1.addSql("GetInEQ", "设备", "", His.his.Choscode + "|" + wareid + "|{key}|{key}|{key}|{key}"); } // this.dataGView1.addSql("GetSupply", "生产厂家", "", His.his.Choscode + "|{key}|{key}|{key}|{key}"); // TvList.newBind().SetCacheKey("XmDw").Load("GetSupply", new object[] { His.his.Choscode }).Bind(this.supply); this.dataGView1.CellValueChanged += new DataGridViewCellEventHandler(dataGView1_CellValueChanged); // this.dataGView1.CellEndEdit += new DataGridViewCellEventHandler(dataGView1_CellEndEdit); this.dataGView1.AddRow(de, 0); this.dataGView1.CurrentRow.Cells[eq.Index].ReadOnly = false; }
private void fromplan_toolStripButton_Click(object sender, EventArgs e) { Dictionary <string, ObjItem> dr = this.dataGView1.getRowData(); if (dr == null) { this.KeyPreview = true; //判断是否选择库房 if (this.InWare_selTextInpt.Value == null) { WJs.alert("请选择入库库房!"); InWare_selTextInpt.Focus(); return; } //判断是否选择入库方式 if (this.InWay_selTextInpt.Value == null) { WJs.alert("请选择入库方式!"); InWay_selTextInpt.Focus(); return; } this.dataGView1.CellValueChanged += new DataGridViewCellEventHandler(dataGView1_CellValueChanged); // this.dataGView1.Rows.Remove(this.dataGView1.CurrentRow); this.productdate.DataPropertyName = null; //this.validate_temp.DataPropertyName = null; this.validate.DataPropertyName = null; this.dataGView1.Url = "EQPurchasePlanDetailSearch_EQIn"; this.dataGView1.reLoad(new object[] { inware_id, His.his.Choscode }); //BindUnit2(); if (this.dataGView1.RowCount == 0) { WJs.alert("该采购计划没有明细数据,不能生成入库单"); return; } else { this.cancel_toolStripButton.Visible = false; } this.dataGView1.jsBds("发票金额=数量*发票单价"); this.dataGView1.jsBds("成本单价=发票单价+运杂费/数量"); this.dataGView1.jsBds("成本金额=成本单价*数量"); ////统计金额 this.totalmoney_yTextBox.Text = dataGView1.Sum("成本金额").ToString(); this.lstotalmoney_yTextBox.Text = dataGView1.Sum("发票金额").ToString(); this.yTextBox_YzfMoney.Text = dataGView1.Sum("运杂费").ToString(); //this.plan_selTextInpt.Enabled = false; this.dataGView1.Columns[eq.Index].ReadOnly = true; this.fromplan_toolStripButton.Enabled = false; //this.cancel_toolStripButton.Enabled = false; //this.button1.Enabled = false; this.add_toolStripButton.Enabled = false; foreach (DataGridViewRow r in this.dataGView1.Rows) { Dictionary <string, ObjItem> data = this.dataGView1.getRowData(r); if (r != null) { r.Cells[productdate.Index].Value = DateTime.Now; r.Cells[validate.Index].Value = WJs.getDate(His.his.WebDate).AddYears(1); //if (!r.Cells[validate_temp.Index].Value.ToString().Equals("")) //{ // r.Cells[validate.Index].Value = Convert.ToDateTime(r.Cells[productdate.Index].Value).AddMonths(Convert.ToInt32(r.Cells[validate_temp.Index].Value)); //} //else //{ // Convert.ToDateTime(r.Cells[productdate.Index].Value).AddMonths(12); //} } } } else { WJs.alert("该入库单已经有明细数据,不能从采购计划中生成明细信息!"); } }