/// <summary>
        /// 得到新增sql
        /// </summary>
        public string GetAddSQL(DrawPlan DrawPlan)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into DrawPlan(");
            strSql.Append("DrawPlanGuid,DrawPlanID,DrawPlanDate,Remark,CreateGuid,CreateDate");
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append("'" + DrawPlan.DrawPlanGuid + "',");
            strSql.Append("'" + DrawPlan.DrawPlanID + "',");
            if (DrawPlan.DrawPlanDate == DateTime.Parse("1900-01-01"))
            {
                strSql.Append("null,");
            }
            else
            {
                strSql.Append("'" + DrawPlan.DrawPlanDate + "',");
            }
            strSql.Append("'" + DrawPlan.Remark + "',");
            strSql.Append("'" + DrawPlan.CreateGuid + "',");

            if (DrawPlan.CreateDate == DateTime.Parse("1900-01-01"))
            {
                strSql.Append("null,");
            }
            else
            {
                strSql.Append("'" + DrawPlan.CreateDate + "'");
            }

            strSql.Append(")");
            return(strSql.ToString());
        }
        ///<summary>
        /// 保存数据----点击保存时用
        /// </summary>
        /// <param name="pObj">信息集实体类</param>
        /// <returns>返回保存成功(true)或失败(false)</returns>
        public void SaveBill(DrawPlan DrawPlan, List <DrawPlanDetail> DrawPlanDetail, List <DrawPlanCalcSumDetail> DrawPlanCalcSumDetail)
        {
            CommonInterface pComm = CommonFactory.CreateInstance(CommonData.sql);

            try
            {
                pComm.BeginTrans();

                //保存单据主表数据
                //先删除主表数据
                string strDeleteSql = "Delete from DrawPlan where  DrawPlanGuid='" + DrawPlan.DrawPlanGuid + "'";
                pComm.Execute(strDeleteSql);

                //插入主表数据
                string strInsertSql = GetAddSQL(DrawPlan);
                pComm.Execute(strInsertSql);


                //删除明细表
                strDeleteSql = "Delete from DrawPlanDetail where  DrawPlanGuid='" + DrawPlan.DrawPlanGuid + "'";
                pComm.Execute(strDeleteSql);

                //插入明细表数据
                for (int i = 0; i < DrawPlanDetail.Count; i++)
                {
                    strInsertSql = GetAddDetailSQL(DrawPlanDetail[i]);
                    pComm.Execute(strInsertSql);
                }


                //删除计算明细
                strDeleteSql = "Delete from DrawPlanCalcSum where  DrawPlanGuid='" + DrawPlan.DrawPlanGuid + "'";
                pComm.Execute(strDeleteSql);

                //插入明细表数据
                for (int i = 0; i < DrawPlanCalcSumDetail.Count; i++)
                {
                    strInsertSql = GetAddCalcSumSQL(DrawPlanCalcSumDetail[i]);
                    pComm.Execute(strInsertSql);
                }


                pComm.CommitTrans();
            }
            catch (Exception e)
            {
                pComm.RollbackTrans();
                pComm.Close();
                throw e;
            }
        }