/// <summary> /// 插入明细 /// </summary> /// <param name="dataContext">数据上下文</param> /// <param name="billNo">单据号</param> /// <param name="listInfo">明细信息</param> /// <param name="error">错误信息</param> /// <returns>成功返回True,失败返回False</returns> bool InsertList(DepotManagementDataContext dataContext, string billNo, DataTable listInfo, out string error) { error = null; try { for (int i = 0; i < listInfo.Rows.Count; i++) { Out_ManeuverList lnqList = new Out_ManeuverList(); lnqList.Bill_ID = billNo; lnqList.GoodsID = Convert.ToInt32(listInfo.Rows[i]["物品ID"]); lnqList.ProposerCount = Convert.ToDecimal(listInfo.Rows[i]["申请数量"]); lnqList.StorageID = listInfo.Rows[i]["账务库房ID"].ToString(); lnqList.Remark = listInfo.Rows[i]["备注"].ToString(); if (listInfo.Rows[i]["发货数量"].ToString() != "" && Convert.ToDecimal(listInfo.Rows[i]["发货数量"]) != 0) { lnqList.ShipperCount = Convert.ToDecimal(listInfo.Rows[i]["发货数量"]); } if (listInfo.Rows[i]["收货数量"].ToString() != "" && Convert.ToDecimal(listInfo.Rows[i]["收货数量"]) != 0) { lnqList.ConfirmorCount = Convert.ToDecimal(listInfo.Rows[i]["收货数量"]); } if (lnqList.ShipperCount == 0) { error = "出库数不能为0"; return(false); } if (lnqList.ConfirmorCount == 0) { error = "入库数不能为0"; return(false); } dataContext.Out_ManeuverList.InsertOnSubmit(lnqList); } return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
private void dataGridView1_DoubleClick(object sender, EventArgs e) { bool blOperation = false; if (lbBillStatus.Text == "等待出库") { blOperation = true; } Out_ManeuverList lnqList = new Out_ManeuverList(); lnqList.Bill_ID = m_lnqManeuverBill.Bill_ID; lnqList.GoodsID = Convert.ToInt32(dataGridView1.CurrentRow.Cells["物品ID"].Value); lnqList.ShipperCount = dataGridView1.CurrentRow.Cells["发货数量"].Value.ToString() == "" ? Convert.ToDecimal(dataGridView1.CurrentRow.Cells["申请数量"].Value) : Convert.ToDecimal(dataGridView1.CurrentRow.Cells["发货数量"].Value); lnqList.StorageID = dataGridView1.CurrentRow.Cells["账务库房ID"].Value.ToString(); 唯一标识码录入窗体 form = new 唯一标识码录入窗体(lnqList, blOperation); form.ShowDialog(); }
public 唯一标识码录入窗体(Out_ManeuverList maneuverList, bool IsOperation) { InitializeComponent(); m_lnqManeuverList = maneuverList; if (!IsOperation) { btnAdd.Visible = false; btnDelete.Visible = false; btnSubmit.Visible = false; } dataGridView1.DataSource = m_serverIdentifier.GetInfo(m_lnqManeuverList.Bill_ID, m_lnqManeuverList.GoodsID, m_lnqManeuverList.StorageID); F_GoodsPlanCost lnqGoodsInfo = IntegrativeQuery.QueryGoodsInfo(m_lnqManeuverList.GoodsID); txtGoodsCode.Text = lnqGoodsInfo.GoodsCode; txtGoodsName.Text = lnqGoodsInfo.GoodsName; txtSpec.Text = lnqGoodsInfo.Spec; txtOperationCount.Text = m_lnqManeuverList.ShipperCount.ToString(); }