private void customContextMenuStrip_Edit1__InputEvent(DataTable dtTemp) { List <View_Business_WorkShop_BatchNoChangeDetail> lstDetail = new List <View_Business_WorkShop_BatchNoChangeDetail>(); List <string> lstType = GlobalObject.GeneralFunction.GetEumnList(typeof(CE_WorkShop_BatchNoChangeType)); foreach (DataRow dr in dtTemp.Rows) { View_F_GoodsPlanCost goodsInfo = UniversalFunction.GetGoodsInfo(dr["图号型号"].ToString().Trim(), dr["物品名称"].ToString().Trim(), dr["规格"].ToString().Trim()); if (goodsInfo == null) { throw new Exception(string.Format("【图号型号】:{0} ,【物品名称】:{1},【规格】:{2} 获取物品信息失败")); } if (!lstType.Contains(dr["管理方式"].ToString().Trim())) { throw new Exception(UniversalFunction.GetGoodsMessage(goodsInfo.序号) + " 【管理方式】不存在"); } View_Business_WorkShop_BatchNoChangeDetail detail = new View_Business_WorkShop_BatchNoChangeDetail(); detail.单据号 = txtBillNo.Text; detail.管理方式 = dr["管理方式"].ToString().Trim(); detail.规格 = goodsInfo.规格; detail.图号型号 = goodsInfo.图号型号; detail.物品ID = goodsInfo.序号; detail.物品名称 = goodsInfo.物品名称; lstDetail.Add(detail); } RefreshDataGridView(lstDetail); }
public List <View_Business_WorkShop_BatchNoChangeDetail> GetListDetail(string billNo) { List <View_Business_WorkShop_BatchNoChangeDetail> result = new List <View_Business_WorkShop_BatchNoChangeDetail>(); DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.View_Business_WorkShop_BatchNoChangeDetail where a.单据号 == billNo select a; if (varData.Count() == 0) { var varData1 = from a in ctx.ZPX_BatchNoManage join b in ctx.F_GoodsPlanCost on a.GoodsID equals b.ID select new { 物品ID = a.GoodsID, 图号型号 = b.GoodsCode, 物品名称 = b.GoodsName, 规格 = b.Spec, 管理方式 = a.ManageType, 单据号 = billNo }; foreach (var item in varData1) { View_Business_WorkShop_BatchNoChangeDetail detail = new View_Business_WorkShop_BatchNoChangeDetail(); detail.单据号 = item.单据号; detail.管理方式 = item.管理方式; detail.规格 = item.规格; detail.图号型号 = item.图号型号; detail.物品ID = item.物品ID; detail.物品名称 = item.物品名称; result.Add(detail); } } else { result = varData.ToList(); } return(result); }
List <View_Business_WorkShop_BatchNoChangeDetail> GetDetail() { List <View_Business_WorkShop_BatchNoChangeDetail> result = new List <View_Business_WorkShop_BatchNoChangeDetail>(); if (customDataGridView1.Rows.Count > 0) { foreach (DataGridViewRow dgvr in customDataGridView1.Rows) { View_Business_WorkShop_BatchNoChangeDetail detail = new View_Business_WorkShop_BatchNoChangeDetail(); detail.单据号 = txtBillNo.Text; detail.管理方式 = dgvr.Cells["管理方式"].Value.ToString(); detail.规格 = dgvr.Cells["规格"].Value.ToString(); detail.图号型号 = dgvr.Cells["图号型号"].Value.ToString(); detail.物品ID = Convert.ToInt32(dgvr.Cells["物品ID"].Value); detail.物品名称 = dgvr.Cells["物品名称"].Value.ToString(); result.Add(detail); } } return(result); }