/// <summary>
 /// 转入生产计划
 /// </summary>
 /// <param name="SaleID"></param>
 /// <returns></returns>
 public int ToPlan(int SaleID, int FillMan)
 {
     try
     {
         DataTable                   dt    = GetList("(ID=" + SaleID + ")").Tables[0];
         Hownet.DAL.SysTem           dalST = new SysTem();
         Hownet.Model.SysTem         modST = dalST.GetModel(dalST.GetMaxId());
         Hownet.DAL.ProductionPlan   dalPP = new Hownet.DAL.ProductionPlan();
         Hownet.Model.ProductionPlan modPP = new Hownet.Model.ProductionPlan();
         modPP.SalesOrderInfoID = Convert.ToInt32(dt.Rows[0]["ID"]);
         modPP.MaterielID       = Convert.ToInt32(dt.Rows[0]["MaterielID"]);
         modPP.BrandID          = Convert.ToInt32(dt.Rows[0]["BrandID"]);
         //   modPP.Num = dalPP.NewNum(DateTime.Today, modST.NumType);
         dalPP.NewNum(DateTime.Today, modST.NumType);
         modPP.DateTime        = DateTime.Today;
         modPP.LastDate        = Convert.ToDateTime(dt.Rows[0]["LastDate"]);
         modPP.Remark          = dt.Rows[0]["Remark"].ToString();
         modPP.PWorkingID      = modPP.BomID = 0;
         modPP.CompanyID       = Convert.ToInt32(dt.Rows[0]["CompanyID"]);
         modPP.IsTicket        = modPP.IsBom = false;
         modPP.VerifyDate      = Convert.ToDateTime("1900-1-1");
         modPP.VerifyMan       = 0;
         modPP.DeparmentID     = 0;
         modPP.UpData          = 1;
         modPP.FillDate        = DateTime.Today;
         modPP.FilMan          = FillMan;
         modPP.TicketDate      = Convert.ToDateTime("1900-1-1");
         modPP.BedNO           = string.Empty;
         modPP.PackingMethodID = Convert.ToInt32(dt.Rows[0]["PackingMethodID"]);
         modPP.SewingRemark    = dt.Rows[0]["SewingRemark"].ToString();
         modPP.TypeID          = modPP.ParentID = 0;
         modPP.ParentID        = 0;
         return(dalPP.Add(modPP));
     }
     catch //(Exception ex)
     {
         return(0);
     }
 }
Exemple #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Hownet.Model.ProductionPlan model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ProductionPlan(");
            strSql.Append("SalesOrderInfoID,MaterielID,BrandID,Num,DateTime,LastDate,Remark,PWorkingID,BomID,CompanyID,IsTicket,IsBom,IsVerify,VerifyDate,VerifyMan,DeparmentID,UpData,FillDate,FilMan,TicketDate,BedNO,PackingMethodID,SewingRemark,TypeID,ParentID,AssociatedID,AssociatedMatID)");
            strSql.Append(" values (");
            strSql.Append("@SalesOrderInfoID,@MaterielID,@BrandID,@Num,@DateTime,@LastDate,@Remark,@PWorkingID,@BomID,@CompanyID,@IsTicket,@IsBom,@IsVerify,@VerifyDate,@VerifyMan,@DeparmentID,@UpData,@FillDate,@FilMan,@TicketDate,@BedNO,@PackingMethodID,@SewingRemark,@TypeID,@ParentID,@AssociatedID,@AssociatedMatID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SalesOrderInfoID", SqlDbType.Int,          4),
                new SqlParameter("@MaterielID",       SqlDbType.Int,          4),
                new SqlParameter("@BrandID",          SqlDbType.Int,          4),
                new SqlParameter("@Num",              SqlDbType.Int,          4),
                new SqlParameter("@DateTime",         SqlDbType.DateTime),
                new SqlParameter("@LastDate",         SqlDbType.DateTime),
                new SqlParameter("@Remark",           SqlDbType.NVarChar,  4000),
                new SqlParameter("@PWorkingID",       SqlDbType.Int,          4),
                new SqlParameter("@BomID",            SqlDbType.Int,          4),
                new SqlParameter("@CompanyID",        SqlDbType.Int,          4),
                new SqlParameter("@IsTicket",         SqlDbType.Bit,          1),
                new SqlParameter("@IsBom",            SqlDbType.Bit,          1),
                new SqlParameter("@IsVerify",         SqlDbType.Int,          4),
                new SqlParameter("@VerifyDate",       SqlDbType.DateTime),
                new SqlParameter("@VerifyMan",        SqlDbType.Int,          4),
                new SqlParameter("@DeparmentID",      SqlDbType.Int,          4),
                new SqlParameter("@UpData",           SqlDbType.Int,          4),
                new SqlParameter("@FillDate",         SqlDbType.DateTime),
                new SqlParameter("@FilMan",           SqlDbType.Int,          4),
                new SqlParameter("@TicketDate",       SqlDbType.DateTime),
                new SqlParameter("@BedNO",            SqlDbType.NVarChar,    50),
                new SqlParameter("@PackingMethodID",  SqlDbType.Int,          4),
                new SqlParameter("@SewingRemark",     SqlDbType.NVarChar,  4000),
                new SqlParameter("@TypeID",           SqlDbType.Int,          4),
                new SqlParameter("@ParentID",         SqlDbType.Int,          4),
                new SqlParameter("@AssociatedID",     SqlDbType.NVarChar,    50),
                new SqlParameter("@AssociatedMatID",  SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.SalesOrderInfoID;
            parameters[1].Value  = model.MaterielID;
            parameters[2].Value  = model.BrandID;
            parameters[3].Value  = model.Num;
            parameters[4].Value  = model.DateTime;
            parameters[5].Value  = model.LastDate;
            parameters[6].Value  = model.Remark;
            parameters[7].Value  = model.PWorkingID;
            parameters[8].Value  = model.BomID;
            parameters[9].Value  = model.CompanyID;
            parameters[10].Value = model.IsTicket;
            parameters[11].Value = model.IsBom;
            parameters[12].Value = model.IsVerify;
            parameters[13].Value = model.VerifyDate;
            parameters[14].Value = model.VerifyMan;
            parameters[15].Value = model.DeparmentID;
            parameters[16].Value = model.UpData;
            parameters[17].Value = model.FillDate;
            parameters[18].Value = model.FilMan;
            parameters[19].Value = model.TicketDate;
            parameters[20].Value = model.BedNO;
            parameters[21].Value = model.PackingMethodID;
            parameters[22].Value = model.SewingRemark;
            parameters[23].Value = model.TypeID;
            parameters[24].Value = model.ParentID;
            parameters[25].Value = model.AssociatedID;
            parameters[26].Value = model.AssociatedMatID;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemple #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Hownet.Model.ProductionPlan GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,SalesOrderInfoID,MaterielID,BrandID,Num,DateTime,LastDate,Remark,PWorkingID,BomID,CompanyID,IsTicket,IsBom,IsVerify,VerifyDate,VerifyMan,DeparmentID,UpData,FillDate,FilMan,TicketDate,BedNO,PackingMethodID,SewingRemark,TypeID,ParentID,AssociatedID,AssociatedMatID from ProductionPlan ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            Hownet.Model.ProductionPlan model = new Hownet.Model.ProductionPlan();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"] != null && ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SalesOrderInfoID"] != null && ds.Tables[0].Rows[0]["SalesOrderInfoID"].ToString() != "")
                {
                    model.SalesOrderInfoID = int.Parse(ds.Tables[0].Rows[0]["SalesOrderInfoID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MaterielID"] != null && ds.Tables[0].Rows[0]["MaterielID"].ToString() != "")
                {
                    model.MaterielID = int.Parse(ds.Tables[0].Rows[0]["MaterielID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["BrandID"] != null && ds.Tables[0].Rows[0]["BrandID"].ToString() != "")
                {
                    model.BrandID = int.Parse(ds.Tables[0].Rows[0]["BrandID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Num"] != null && ds.Tables[0].Rows[0]["Num"].ToString() != "")
                {
                    model.Num = int.Parse(ds.Tables[0].Rows[0]["Num"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DateTime"] != null && ds.Tables[0].Rows[0]["DateTime"].ToString() != "")
                {
                    model.DateTime = DateTime.Parse(ds.Tables[0].Rows[0]["DateTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["LastDate"] != null && ds.Tables[0].Rows[0]["LastDate"].ToString() != "")
                {
                    model.LastDate = DateTime.Parse(ds.Tables[0].Rows[0]["LastDate"].ToString());
                }
                model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                if (ds.Tables[0].Rows[0]["PWorkingID"] != null && ds.Tables[0].Rows[0]["PWorkingID"].ToString() != "")
                {
                    model.PWorkingID = int.Parse(ds.Tables[0].Rows[0]["PWorkingID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["BomID"] != null && ds.Tables[0].Rows[0]["BomID"].ToString() != "")
                {
                    model.BomID = int.Parse(ds.Tables[0].Rows[0]["BomID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CompanyID"] != null && ds.Tables[0].Rows[0]["CompanyID"].ToString() != "")
                {
                    model.CompanyID = int.Parse(ds.Tables[0].Rows[0]["CompanyID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsTicket"] != null && ds.Tables[0].Rows[0]["IsTicket"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["IsTicket"].ToString() == "1") || (ds.Tables[0].Rows[0]["IsTicket"].ToString().ToLower() == "true"))
                    {
                        model.IsTicket = true;
                    }
                    else
                    {
                        model.IsTicket = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["IsBom"] != null && ds.Tables[0].Rows[0]["IsBom"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["IsBom"].ToString() == "1") || (ds.Tables[0].Rows[0]["IsBom"].ToString().ToLower() == "true"))
                    {
                        model.IsBom = true;
                    }
                    else
                    {
                        model.IsBom = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["IsVerify"] != null && ds.Tables[0].Rows[0]["IsVerify"].ToString() != "")
                {
                    model.IsVerify = int.Parse(ds.Tables[0].Rows[0]["IsVerify"].ToString());
                }
                if (ds.Tables[0].Rows[0]["VerifyDate"] != null && ds.Tables[0].Rows[0]["VerifyDate"].ToString() != "")
                {
                    model.VerifyDate = DateTime.Parse(ds.Tables[0].Rows[0]["VerifyDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["VerifyMan"] != null && ds.Tables[0].Rows[0]["VerifyMan"].ToString() != "")
                {
                    model.VerifyMan = int.Parse(ds.Tables[0].Rows[0]["VerifyMan"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DeparmentID"] != null && ds.Tables[0].Rows[0]["DeparmentID"].ToString() != "")
                {
                    model.DeparmentID = int.Parse(ds.Tables[0].Rows[0]["DeparmentID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["UpData"] != null && ds.Tables[0].Rows[0]["UpData"].ToString() != "")
                {
                    model.UpData = int.Parse(ds.Tables[0].Rows[0]["UpData"].ToString());
                }
                if (ds.Tables[0].Rows[0]["FillDate"] != null && ds.Tables[0].Rows[0]["FillDate"].ToString() != "")
                {
                    model.FillDate = DateTime.Parse(ds.Tables[0].Rows[0]["FillDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["FilMan"] != null && ds.Tables[0].Rows[0]["FilMan"].ToString() != "")
                {
                    model.FilMan = int.Parse(ds.Tables[0].Rows[0]["FilMan"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TicketDate"] != null && ds.Tables[0].Rows[0]["TicketDate"].ToString() != "")
                {
                    model.TicketDate = DateTime.Parse(ds.Tables[0].Rows[0]["TicketDate"].ToString());
                }
                model.BedNO = ds.Tables[0].Rows[0]["BedNO"].ToString();
                if (ds.Tables[0].Rows[0]["PackingMethodID"] != null && ds.Tables[0].Rows[0]["PackingMethodID"].ToString() != "")
                {
                    model.PackingMethodID = int.Parse(ds.Tables[0].Rows[0]["PackingMethodID"].ToString());
                }
                model.SewingRemark = ds.Tables[0].Rows[0]["SewingRemark"].ToString();
                if (ds.Tables[0].Rows[0]["TypeID"] != null && ds.Tables[0].Rows[0]["TypeID"].ToString() != "")
                {
                    model.TypeID = int.Parse(ds.Tables[0].Rows[0]["TypeID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ParentID"] != null && ds.Tables[0].Rows[0]["ParentID"].ToString() != "")
                {
                    model.ParentID = int.Parse(ds.Tables[0].Rows[0]["ParentID"].ToString());
                }

                model.AssociatedID = ds.Tables[0].Rows[0]["AssociatedID"].ToString();

                if (ds.Tables[0].Rows[0]["AssociatedMatID"] != null && ds.Tables[0].Rows[0]["AssociatedMatID"].ToString() != "")
                {
                    model.AssociatedMatID = int.Parse(ds.Tables[0].Rows[0]["AssociatedMatID"].ToString());
                }
                model.A = 1;
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemple #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Hownet.Model.ProductionPlan model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ProductionPlan set ");
            strSql.Append("SalesOrderInfoID=@SalesOrderInfoID,");
            strSql.Append("MaterielID=@MaterielID,");
            strSql.Append("BrandID=@BrandID,");
            strSql.Append("Num=@Num,");
            strSql.Append("DateTime=@DateTime,");
            strSql.Append("LastDate=@LastDate,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("PWorkingID=@PWorkingID,");
            strSql.Append("BomID=@BomID,");
            strSql.Append("CompanyID=@CompanyID,");
            strSql.Append("IsTicket=@IsTicket,");
            strSql.Append("IsBom=@IsBom,");
            strSql.Append("IsVerify=@IsVerify,");
            strSql.Append("VerifyDate=@VerifyDate,");
            strSql.Append("VerifyMan=@VerifyMan,");
            strSql.Append("DeparmentID=@DeparmentID,");
            strSql.Append("UpData=@UpData,");
            strSql.Append("FillDate=@FillDate,");
            strSql.Append("FilMan=@FilMan,");
            strSql.Append("TicketDate=@TicketDate,");
            strSql.Append("BedNO=@BedNO,");
            strSql.Append("PackingMethodID=@PackingMethodID,");
            strSql.Append("SewingRemark=@SewingRemark,");
            strSql.Append("TypeID=@TypeID,");
            strSql.Append("ParentID=@ParentID,");
            strSql.Append("AssociatedID=@AssociatedID,");
            strSql.Append("AssociatedMatID=@AssociatedMatID");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SalesOrderInfoID", SqlDbType.Int,          4),
                new SqlParameter("@MaterielID",       SqlDbType.Int,          4),
                new SqlParameter("@BrandID",          SqlDbType.Int,          4),
                new SqlParameter("@Num",              SqlDbType.Int,          4),
                new SqlParameter("@DateTime",         SqlDbType.DateTime),
                new SqlParameter("@LastDate",         SqlDbType.DateTime),
                new SqlParameter("@Remark",           SqlDbType.NVarChar,  4000),
                new SqlParameter("@PWorkingID",       SqlDbType.Int,          4),
                new SqlParameter("@BomID",            SqlDbType.Int,          4),
                new SqlParameter("@CompanyID",        SqlDbType.Int,          4),
                new SqlParameter("@IsTicket",         SqlDbType.Bit,          1),
                new SqlParameter("@IsBom",            SqlDbType.Bit,          1),
                new SqlParameter("@IsVerify",         SqlDbType.Int,          4),
                new SqlParameter("@VerifyDate",       SqlDbType.DateTime),
                new SqlParameter("@VerifyMan",        SqlDbType.Int,          4),
                new SqlParameter("@DeparmentID",      SqlDbType.Int,          4),
                new SqlParameter("@UpData",           SqlDbType.Int,          4),
                new SqlParameter("@FillDate",         SqlDbType.DateTime),
                new SqlParameter("@FilMan",           SqlDbType.Int,          4),
                new SqlParameter("@TicketDate",       SqlDbType.DateTime),
                new SqlParameter("@BedNO",            SqlDbType.NVarChar,    50),
                new SqlParameter("@PackingMethodID",  SqlDbType.Int,          4),
                new SqlParameter("@SewingRemark",     SqlDbType.NVarChar,  4000),
                new SqlParameter("@TypeID",           SqlDbType.Int,          4),
                new SqlParameter("@ParentID",         SqlDbType.Int,          4),
                new SqlParameter("@AssociatedID",     SqlDbType.NVarChar,    50),
                new SqlParameter("@AssociatedMatID",  SqlDbType.Int,          4),
                new SqlParameter("@ID",               SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.SalesOrderInfoID;
            parameters[1].Value  = model.MaterielID;
            parameters[2].Value  = model.BrandID;
            parameters[3].Value  = model.Num;
            parameters[4].Value  = model.DateTime;
            parameters[5].Value  = model.LastDate;
            parameters[6].Value  = model.Remark;
            parameters[7].Value  = model.PWorkingID;
            parameters[8].Value  = model.BomID;
            parameters[9].Value  = model.CompanyID;
            parameters[10].Value = model.IsTicket;
            parameters[11].Value = model.IsBom;
            parameters[12].Value = model.IsVerify;
            parameters[13].Value = model.VerifyDate;
            parameters[14].Value = model.VerifyMan;
            parameters[15].Value = model.DeparmentID;
            parameters[16].Value = model.UpData;
            parameters[17].Value = model.FillDate;
            parameters[18].Value = model.FilMan;
            parameters[19].Value = model.TicketDate;
            parameters[20].Value = model.BedNO;
            parameters[21].Value = model.PackingMethodID;
            parameters[22].Value = model.SewingRemark;
            parameters[23].Value = model.TypeID;
            parameters[24].Value = model.ParentID;
            parameters[25].Value = model.AssociatedID;
            parameters[26].Value = model.AssociatedMatID;
            parameters[27].Value = model.ID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }