// 由销售报价单生成销售发票 public override bool Generate(bllBaseBusiness targetBLL) { if (targetBLL == null) { throw new Exception("目标窗体的业务类没有实例化!"); } if (_TargetFormType == null) { throw new Exception("没有指定目标窗体类型!"); } if (_TargetFormName == null) { throw new Exception("没有指定目标窗体名称!"); } bllIN sourceBLL = new bllIN(); DataSet sourceData = sourceBLL.GetBusinessByKey(_DocNo, false); //获取来源数据 DataTable targetMaster = targetBLL.BusinessTables[0]; //获取目标单据的主表对象 DataTable targetDetail = targetBLL.BusinessTables[1]; //获取目标单据的明细表对象 DataRow target = targetMaster.NewRow(); DataRow source = sourceData.Tables[0].Rows[0]; targetMaster.Rows.Clear();//清除主表一条记录 targetMaster.Rows.Add(target); //下面的代码将两张表关联的数据赋值 target[tb_IO.CustomerCode] = source[tb_IN.SupplierCode]; target[tb_IO.CustomerName] = source[tb_IN.SupplierName]; target[tb_IO.Deliver] = source[tb_IN.Deliver]; target[tb_IO.Department] = source[tb_IN.Department]; target[tb_IO.DocDate] = source[tb_IN.DocDate]; target[tb_IO.DocUser] = source[tb_IN.DocUser]; target[tb_IO.LocationID] = source[tb_IN.LocationID]; target[tb_IO.Remark] = source[tb_IN.Remark]; target[tb_IO.LastUpdateDate] = DateTime.Today; target[tb_IO.LastUpdatedBy] = Loginer.CurrentUser.Account; target[tb_IO.CreatedBy] = Loginer.CurrentUser.Account; target[tb_IO.CreationDate] = DateTime.Today; //复制明细表数据 targetDetail.Rows.Clear(); foreach (DataRow detail in sourceData.Tables[1].Rows) { DataRow temp = targetDetail.NewRow(); temp[tb_IOs.CreatedBy] = Loginer.CurrentUser.Account; temp[tb_IOs.CreationDate] = DateTime.Today; temp[tb_IOs.LastUpdateDate] = DateTime.Today; temp[tb_IOs.LastUpdatedBy] = Loginer.CurrentUser.Account; temp[tb_IOs.ProductCode] = detail[tb_INs.ProductCode]; temp[tb_IOs.ProductName] = detail[tb_INs.ProductName]; temp[tb_IOs.Quantity] = detail[tb_INs.Quantity]; temp[tb_IOs.Queue] = detail[tb_INs.Queue]; temp[tb_IOs.Remark] = detail[tb_INs.Remark]; targetDetail.Rows.Add(temp); } _IsSuccess = true; return(_IsSuccess); }
public virtual bool Generate(bllBaseBusiness targetBLL) { return(false); }