/// <summary> /// 得到行项数据 /// </summary> private void GetCon() { foreach (var row in listViewCon.Rows) { OperCreateConExLayout CRow = (OperCreateConExLayout)row.Control; decimal Quant; if (decimal.TryParse(CRow.lblQuant.Text, out Quant) == false) { throw new Exception("耗材编号" + CRow.lblCId.Text + "的库存格式不正确。"); } decimal Quantity; if (decimal.TryParse(CRow.numQuant.Value.ToString(), out Quantity) == false) { throw new Exception("耗材编号" + CRow.lblCId.Text + "的数量格式不正确。"); } decimal Money; if (decimal.TryParse(CRow.numMoney.Value.ToString(), out Money) == false) { throw new Exception("耗材编号" + CRow.lblCId.Text + "的金额格式不正确。"); } if (Quantity > Quant) { throw new Exception("耗材编号" + CRow.lblCId.Text + "库存不足。"); } DataRow Drow = ConTable.Rows.Find(CRow.lblCId.Text); Drow["QUANT"] = Quant; Drow["QUANTITY"] = Quantity; Drow["MONEY"] = Money; } }
/// <summary> /// 得到行项数据 /// </summary> private void GetRows() { rowsInputDtos.Clear(); foreach (var row in listViewCon.Rows) { OperCreateConExLayout CRow = (OperCreateConExLayout)row.Control; decimal Quant; if (decimal.TryParse(CRow.lblQuant.Text, out Quant) == false) { throw new Exception("耗材编号" + CRow.lblCId.Text + "的库存格式不正确。"); } decimal Quantity; if (decimal.TryParse(CRow.numQuant.Value.ToString(), out Quantity) == false) { throw new Exception("耗材编号" + CRow.lblCId.Text + "的数量格式不正确。"); } decimal Money; if (decimal.TryParse(CRow.numMoney.Value.ToString(), out Money) == false) { throw new Exception("耗材编号" + CRow.lblCId.Text + "的金额格式不正确。"); } if (Quantity > Quant) { throw new Exception("耗材编号" + CRow.lblCId.Text + "库存不足。"); } OutboundOrderRowInputDto rowInput = new OutboundOrderRowInputDto { CID = CRow.lblCId.Text, MONEY = Money, NOTE = CRow.txtRNote.Text, QUANTITY = Quantity }; rowsInputDtos.Add(rowInput); } }