Beispiel #1
0
        public static Msg EnsureInBunch(Tbl_ProductBatch oBunch, Tbl_ProductStorage oStorage)
        {
            Msg msg = null;

            if (oBunch != null)
            {
                try
                {
                    using (var en = new LingYunEntities())
                    {
                        var oPlan = en.Tbl_Plan.Where(a => a.PlanID == oBunch.PlanID).FirstOrDefault();
                        oPlan.ProductAdmStatus = 128;
                        en.Tbl_ProductBatch.AddObject(oBunch);
                        en.SaveChanges();
                        var obj = en.Tbl_ProductBatch.Where(a => a.MateriesID == oBunch.MateriesID).FirstOrDefault();
                        oStorage.BuildBatchID = int.Parse(obj.BuildBatchID.ToString());
                        en.AddToTbl_ProductStorage(oStorage);

                        msg = Msg.Default;
                    }
                }
                catch (Exception ex)
                {
                    msg = new Msg()
                    {
                        Status = false, Message = ex.Message
                    };
                }
            }
            return(msg);
        }
Beispiel #2
0
        public static Msg AddMateries(List <Tbl_Materies> oMatries)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    foreach (Tbl_Materies ma in oMatries)
                    {
                        en.AddToTbl_Materies(ma);
                    }
                    en.SaveChanges();
                    msg = Msg.Default;
                }
            }
            catch (Exception ex)
            {
                msg = new Msg(false)
                {
                    Message = ex.Message
                };
            }
            return(msg);
        }
Beispiel #3
0
        /// <summary>
        /// 更新出库批次表
        /// </summary>
        /// <returns></returns>
        public static Msg UpdateOutBunch(int BuildBunchId, int count)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    Tbl_OutCenterStorage oBunch = en.Tbl_OutCenterStorage.Where(a => a.BuildBatchID == BuildBunchId).FirstOrDefault();

                    if (oBunch != null)
                    {
                        oBunch.Count = count;
                    }
                    en.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                msg = new Msg(false)
                {
                    Message = ex.Message
                };
            }
            return(msg);
        }
Beispiel #4
0
        /// <summary>
        /// 更新出库批次表批次表
        /// </summary>
        /// <param name="matriesId"></param>
        /// <param name="count"></param>
        /// <param name="oStorage">仓储表</param>
        /// <returns></returns>
        public static Msg UpdateOutBunch(Tbl_OutProductBatch oStorage, Tbl_CenterStorageBatch oCenterBunch)
        {
            Msg msg = null;

            if (oStorage != null)
            {
                try
                {
                    using (var en = new LingYunEntities())
                    {
                        var obj = en.Tbl_OutProductBatch.Where(a => a.BuildBatchID == oStorage.BuildBatchID).FirstOrDefault();
                        obj.Count        = oStorage.Count;
                        obj.PreAdmStatus = 128;
                        obj.PreAdmTime   = DateTime.Now;

                        var oProductStorage = en.Tbl_ProductStorage.Where(b => b.BuildBatchID == oStorage.BuildBatchID).FirstOrDefault();
                        oProductStorage.NowAdmStatus = 128;
                        oProductStorage.NowAdmTime   = DateTime.Now;
                        en.Tbl_CenterStorageBatch.AddObject(oCenterBunch);//插入入库记录
                        en.SaveChanges();
                        msg = Msg.Default;
                    }
                }
                catch (Exception ex)
                {
                    msg = new Msg()
                    {
                        Status = false, Message = ex.Message
                    };
                }
            }
            return(msg);
        }
Beispiel #5
0
        /// <summary>
        /// 新编辑出库批次表
        /// </summary>
        /// <param name="matriesId"></param>
        /// <param name="count"></param>
        /// <param name="oStorage">仓储表</param>
        /// <returns></returns>
        public static Msg NEditOurBunch(List <Tbl_OutProductBatch> list)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    foreach (Tbl_OutProductBatch oPro in list)
                    {
                        en.Tbl_OutProductBatch.AddObject(oPro);
                        en.SaveChanges();
                    }
                    msg = Msg.Default;
                }
            }
            catch (Exception ex)
            {
                msg = new Msg()
                {
                    Status = false, Message = ex.Message
                };
            }


            return(msg);
        }
Beispiel #6
0
        /// <summary>
        /// android端确认
        /// </summary>
        /// <param name="oMatries"></param>
        /// <returns></returns>
        public static Msg AndroidEnsure(int iPlanid)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    Tbl_Materies obj = en.Tbl_Materies.Where(a => a.MateriesID == iPlanid).FirstOrDefault();
                    obj.NowAdmStatus = 128;
                    obj.NowDate      = DateTime.Now.ToString();
                    Tbl_Plan oPlan = en.Tbl_Plan.Where(b => b.PlanID == obj.PlanID).FirstOrDefault();
                    if (oPlan != null)
                    {
                        oPlan.DesignAdmStatus = 128;
                    }



                    en.SaveChanges();
                    msg = Msg.Default;
                }
            }
            catch (Exception ex)
            {
                msg = new Msg(false)
                {
                    Message = ex.Message
                };
            }
            return(msg);
        }
Beispiel #7
0
        /// <summary>
        /// 根据编号查询入库批次表
        /// </summary>
        /// <returns></returns>
        public static Msg EnsureInBunch(int iBuildBunch, Tbl_SiteStorage oStorage)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    Tbl_OutCenterStorage oCenterBunch = en.Tbl_OutCenterStorage.Where(a => a.BuildBatchID == iBuildBunch).FirstOrDefault();
                    if (oCenterBunch != null)
                    {
                        oCenterBunch.NowAdmStatus = 128;
                        oCenterBunch.NowAdmTime   = DateTime.Now;
                    }
                    Tbl_SiteStorageBatch oSiteInBunch = en.Tbl_SiteStorageBatch.Where(a => a.BuildBatchID == iBuildBunch).FirstOrDefault();
                    if (oCenterBunch != null)
                    {
                        oSiteInBunch.NowAdmStatus = 128;
                        oCenterBunch.NowAdmTime   = DateTime.Now;
                    }
                    en.Tbl_SiteStorage.AddObject(oStorage);
                    en.SaveChanges();
                    msg = Msg.Default;
                }
            }
            catch (Exception ex)
            {
                msg = new Msg(false)
                {
                    Message = ex.Message
                };
            }
            return(msg);
        }
Beispiel #8
0
        //创建人:梁林
        //时间:3/29
        /// <summary>
        ///向项目汇总表增加一条项目
        /// </summary>
        /// <param name="oPlan">项目表对象</param>
        /// <returns>消息传输实体</returns>
        public static Msg AddPlan(Tbl_Plan oPlan)
        {
            Msg msg = null;

            if (oPlan != null)
            {
                try
                {
                    using (var en = new LingYunEntities())
                    {
                        en.Tbl_Plan.AddObject(oPlan);
                        en.SaveChanges();
                        msg = Msg.Default;
                    }
                }
                catch (Exception ex)
                {
                    msg = new Msg()
                    {
                        Status = false, Message = ex.Message
                    };
                }
            }
            return(msg);
        }
Beispiel #9
0
        /// <summary>
        ///新插入出库批次表
        /// </summary>
        /// <returns></returns>
        public static Msg NEditOutBunch(List <Tbl_OutCenterStorage> list)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    foreach (Tbl_OutCenterStorage obj in list)
                    {
                        en.Tbl_OutCenterStorage.AddObject(obj);
                    }


                    en.SaveChanges();
                    msg = Msg.Default;
                }
            }
            catch (Exception ex)
            {
                msg = new Msg(false)
                {
                    Message = ex.Message
                };
            }
            return(msg);
        }
Beispiel #10
0
        public static Msg AndroidOutBatch(int iBatchid)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    var obj = en.Tbl_SiteStorage.Where(a => a.BuildBatchID == iBatchid).FirstOrDefault();
                    obj.NowAdmStatus = 128;
                    obj.NowAdmTime   = DateTime.Now;
                    var oOut = en.Tbl_OutSiteStorage.Where(a => a.BuildBatchID == iBatchid).FirstOrDefault();
                    oOut.PreAdmStatus = 128;
                    oOut.PreAdmTime   = DateTime.Now;

                    en.SaveChanges();
                    msg = Msg.Default;
                }
            }
            catch (Exception ex)
            {
                msg = new Msg(false);
            }
            return(msg);
        }
Beispiel #11
0
        /// <summary>
        /// 更新入库批次表
        /// </summary>
        /// <param name="matriesId"></param>
        /// <param name="count"></param>
        /// <param name="oStorage">仓储表</param>
        /// <returns></returns>
        public static Msg UpdateInBunch(int matriesId, int count, Tbl_CenterStorage oStorage)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    Tbl_OutProductBatch oProduct = en.Tbl_OutProductBatch.Where(a => a.BuildBatchID == matriesId).FirstOrDefault();

                    oProduct.NowAdmStatus = 128;
                    oProduct.NowAdmTime   = DateTime.Now;
                    ////Tbl_CenterStorageBatch oCenter = en.Tbl_CenterStorageBatch.Where(a => a.BuildBatchID == matriesId).FirstOrDefault();
                    ////oCenter.Count = count;
                    ////oCenter.NowAdmStatus = 128;
                    //oCenter.NowAdmTime = DateTime.Now;
                    //en.AddToTbl_CenterStorage(oStorage);
                    en.SaveChanges();
                    msg = Msg.Default;
                }
            }
            catch (Exception ex)
            {
                msg = new Msg()
                {
                    Status = false, Message = ex.Message
                };
            }


            return(msg);
        }
Beispiel #12
0
        /// <summary>
        /// 确认出库批次表
        /// </summary>
        /// <returns></returns>
        public static Msg EnsureOutBunch(int iBuildBunch, int count)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    Tbl_SiteStorage oSiteStorage = en.Tbl_SiteStorage.Where(a => a.BuildBatchID == iBuildBunch).FirstOrDefault();
                    if (oSiteStorage != null)
                    {
                        oSiteStorage.NowAdmStatus = 128;
                        oSiteStorage.NowAdmTime   = DateTime.Now;
                    }
                    Tbl_OutSiteStorage oSiteBunch = en.Tbl_OutSiteStorage.Where(a => a.BuildBatchID == iBuildBunch).FirstOrDefault();
                    if (oSiteStorage != null)
                    {
                        oSiteBunch.PreAdmStatus = 128;
                        oSiteBunch.PreAdmTime   = DateTime.Now;
                        oSiteBunch.Count        = count;
                    }

                    en.SaveChanges();
                    msg = Msg.Default;
                }
            }
            catch (Exception ex)
            {
                msg = new Msg(false)
                {
                    Message = ex.Message
                };
            }
            return(msg);
        }
Beispiel #13
0
        public static Msg UpdateMateries(Tbl_Materies oMatries)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    Tbl_Materies obj = en.Tbl_Materies.Where(a => a.PlanID == oMatries.PlanID).FirstOrDefault();
                    obj.Date          = oMatries.Date;
                    obj.BuildNum      = oMatries.BuildNum;
                    obj.BuildName     = oMatries.BuildName;
                    obj.NowAdmStatus  = oMatries.NowAdmStatus;
                    obj.TotalNum      = oMatries.TotalNum;
                    obj.MateriesType  = oMatries.MateriesType;
                    obj.ProcessingNum = oMatries.ProcessingNum;
                    en.SaveChanges();
                    msg = Msg.Default;
                }
            }
            catch (Exception ex)
            {
                msg = new Msg(false)
                {
                    Message = ex.Message
                };
            }
            return(msg);
        }
Beispiel #14
0
        public static Msg EnsureMateries(Tbl_Materies oMatries)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    Tbl_Materies obj = en.Tbl_Materies.Where(a => a.PlanID == oMatries.PlanID).FirstOrDefault();
                    obj.Date          = oMatries.Date;
                    obj.BuildNum      = oMatries.BuildNum;
                    obj.BuildName     = oMatries.BuildName;
                    obj.NowAdmStatus  = oMatries.NowAdmStatus;
                    obj.TotalNum      = oMatries.TotalNum;
                    obj.MateriesType  = oMatries.MateriesType;
                    obj.NowDate       = DateTime.Now.ToString();
                    obj.ProcessingNum = oMatries.ProcessingNum;
                    Tbl_Plan oPlan = en.Tbl_Plan.Where(b => b.PlanID == oMatries.PlanID).FirstOrDefault();
                    if (oPlan != null)
                    {
                        oPlan.DesignAdmStatus = 128;
                    }
                    en.SaveChanges();
                    msg = Msg.Default;
                }
            }
            catch (Exception ex)
            {
                msg = new Msg(false)
                {
                    Message = ex.Message
                };
            }
            return(msg);
        }
Beispiel #15
0
        /// <summary>
        /// 新确认入库批次表
        /// </summary>
        /// <param name="matriesId"></param>
        /// <param name="count"></param>
        /// <param name="oStorage">仓储表</param>
        /// <returns></returns>
        public static Msg NEnsureInBunch(List <Tbl_ProductStorage> list)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    foreach (Tbl_ProductStorage oPro in list)

                    {
                        var oMatries = en.Tbl_Materies.Where(a => a.MateriesID == oPro.MateriesID).FirstOrDefault();
                        oMatries.NowAdmStatus = 128;
                        oMatries.NowDate      = DateTime.Now.ToString();
                        var oBatch = en.Tbl_ProductBatch.Where(a => a.BuildBatchID == oPro.BuildBatchID).FirstOrDefault();
                        oBatch.NowAdmStatus = 128;
                        oBatch.NowAdmTime   = DateTime.Now;

                        en.Tbl_ProductStorage.AddObject(oPro);
                    }
                    en.SaveChanges();
                    msg = Msg.Default;
                }
            }
            catch (Exception ex)
            {
                msg = new Msg()
                {
                    Status = false, Message = ex.Message
                };
            }


            return(msg);
        }
Beispiel #16
0
        public static Msg EnsureInBunch(Tbl_CenterStorageBatch oBunch, Tbl_CenterStorage oStorage)
        {
            Msg msg = null;

            if (oBunch != null)
            {
                try
                {
                    using (var en = new LingYunEntities())
                    {
                        var obj = en.Tbl_OutProductBatch.Where(a => a.BuildBatchID == oBunch.BuildBatchID).FirstOrDefault();
                        obj.NowAdmStatus = 128;
                        en.Tbl_CenterStorageBatch.AddObject(oBunch);
                        en.SaveChanges();
                    }
                }
                catch (Exception ex)
                {
                    msg = new Msg()
                    {
                        Status = false, Message = ex.Message
                    };
                }
            }
            return(msg);
        }
Beispiel #17
0
        public static Msg EditOutBunch(Tbl_OutProductBatch oBunch)
        {
            Msg msg = null;

            if (oBunch != null)
            {
                try
                {
                    using (var en = new LingYunEntities())
                    {
                        Tbl_OutProductBatch obj = en.Tbl_OutProductBatch.Where(a => a.PlanID == oBunch.PlanID && oBunch.MateriesID == a.MateriesID).FirstOrDefault();
                        if (obj == null)
                        {
                            en.Tbl_OutProductBatch.AddObject(oBunch);
                        }
                        else
                        {
                            obj.Count = oBunch.Count;
                        }
                        en.SaveChanges();
                        msg = Msg.Default;
                    }
                }
                catch (Exception ex)
                {
                    msg = new Msg()
                    {
                        Status = false, Message = ex.Message
                    };
                }
            }
            return(msg);
        }
Beispiel #18
0
        /// <summary>
        /// 更新入库批次表
        /// </summary>
        /// <param name="matriesId"></param>
        /// <param name="count"></param>
        /// <param name="oStorage">仓储表</param>
        /// <returns></returns>
        public static Msg UpdateInBunch(int matriesId, int count, Tbl_ProductStorage oStorage)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    var obj = en.Tbl_ProductBatch.Where(a => a.BuildBatchID == oStorage.BuildBatchID).FirstOrDefault();
                    obj.Count        = count;
                    obj.NowAdmStatus = 128;
                    obj.NowAdmTime   = DateTime.Now;

                    en.AddToTbl_ProductStorage(oStorage);
                    en.SaveChanges();

                    List <Tbl_ProductBatch> list = en.Tbl_ProductBatch.Where(a => a.PlanID == oStorage.PlanID && a.NowAdmStatus == 128).ToList();

                    int proCount = 0;
                    foreach (Tbl_ProductBatch oPro in list)
                    {
                        proCount += oPro.Count;
                    }
                    Tbl_Materies oMa = en.Tbl_Materies.Where(a => a.PlanID == oStorage.PlanID).FirstOrDefault(); //最后如果确认完成对加工主管状态改变
                    if (oMa.TotalNum == proCount)
                    {
                        var oPlan = en.Tbl_Plan.Where(a => a.PlanID == oStorage.PlanID).FirstOrDefault();
                        oPlan.ProductAdmStatus = 128;
                        en.SaveChanges();
                    }
                    msg = Msg.Default;
                }
            }
            catch (Exception ex)
            {
                msg = new Msg()
                {
                    Status = false, Message = ex.Message
                };
            }


            return(msg);
        }
Beispiel #19
0
        public static Msg AndroidInEnsure(int iBatchId)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    var last = en.Tbl_OutProductBatch.Where(a => a.BuildBatchID == iBatchId).FirstOrDefault();
                    last.NowAdmStatus = 128;
                    last.NowAdmTime   = DateTime.Now;

                    var obj = en.Tbl_CenterStorageBatch.Where(a => a.BuildBatchID == iBatchId).FirstOrDefault();
                    obj.NowAdmStatus = 128;
                    obj.NowAdmTime   = DateTime.Now;

                    Tbl_CenterStorage oStorage = new Tbl_CenterStorage();
                    oStorage.PlanID     = obj.PlanID;
                    oStorage.Time       = DateTime.Now;
                    oStorage.MateriesID = obj.MateriesID;
                    oStorage.BuildID    = obj.BuildID;
                    oStorage.BuildName  = obj.BuildName;

                    oStorage.MateriesType = obj.MateriesType;
                    oStorage.PreAdmTime   = DateTime.Now;
                    oStorage.PreAdmStatus = 128;
                    oStorage.NowAdmStatus = 1;
                    oStorage.NowAdmTime   = DateTime.Now;
                    oStorage.ProjectName  = obj.ProjectName;
                    oStorage.WorkMapID    = obj.WorkMapID;
                    oStorage.InCount      = obj.Count;
                    en.Tbl_CenterStorage.AddObject(oStorage);
                    en.SaveChanges();
                    msg = Msg.Default;
                }
            }
            catch (Exception ex)
            {
                msg = new Msg()
                {
                    Status = false, Message = ex.Message
                };
            }


            return(msg);
        }
Beispiel #20
0
        /// <summary>
        /// 安卓端用户首次登录验证
        /// </summary>
        /// <param name="username"></param>
        /// <param name="encodePsd"></param>
        /// <returns></returns>
        public static Msg Login(string username, string encodePsd, string Imei)
        {
            Msg      loginMsg = new Msg();
            Tbl_User userInfo = new Tbl_User();;

            try
            {
                using (var en = new LingYunEntities())
                {
                    Tbl_User Users = en.Tbl_User.Where(b => b.Name == username && b.CheckPwd == encodePsd).FirstOrDefault();
                    if (Users != null)
                    {
                        if (Users.CheckPwd == encodePsd)
                        {
                            Users.APP = Imei;
                            en.SaveChanges();
                            loginMsg = new Msg(true)
                            {
                                UserData = Users
                            };
                        }
                        else
                        {
                            loginMsg = new Msg {
                                Message = "error:用户名或密码不正确"
                            };
                        }
                    }
                    else
                    {
                        loginMsg = new Msg {
                            Message = "error:用户名不存在"
                        };
                    }
                }
            }
            catch (Exception ex)
            {
                loginMsg = new Msg {
                    Message = ex.Message
                };
            }
            return(loginMsg);
        }
Beispiel #21
0
        public static Msg AndroidOutBatch(int iBatchid)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    var obj = en.Tbl_CenterStorage.Where(a => a.BuildBatchID == iBatchid).FirstOrDefault();
                    obj.NowAdmStatus = 128;
                    obj.NowAdmTime   = DateTime.Now;
                    var oOut = en.Tbl_OutCenterStorage.Where(a => a.BuildBatchID == iBatchid).FirstOrDefault();
                    oOut.PreAdmStatus = 128;
                    oOut.PreAdmTime   = DateTime.Now;
                    //出库批次表
                    Tbl_SiteStorageBatch oCenterBunch = new Tbl_SiteStorageBatch();
                    oCenterBunch.PlanID           = oOut.PlanID;
                    oCenterBunch.MateriesTasbleID = oOut.MateriesTasbleID;
                    oCenterBunch.BuildID          = oOut.BuildID;
                    oCenterBunch.BuildBatchID     = oOut.BuildBatchID;
                    oCenterBunch.Time             = DateTime.Now;
                    oCenterBunch.ProjectName      = oOut.ProjectName;
                    oCenterBunch.BuildName        = oOut.BuildName;
                    oCenterBunch.ProjectName      = oOut.ProjectName;
                    oCenterBunch.MateriesID       = oOut.MateriesID;
                    oCenterBunch.MateriesType     = oOut.MateriesType;
                    oCenterBunch.WorkMapID        = oOut.WorkMapID;
                    oCenterBunch.Count            = oOut.Count
                    ;
                    oCenterBunch.NowAdmStatus = 1;
                    oCenterBunch.PreAdmStatus = 128;
                    oCenterBunch.PreAdmTime   = DateTime.Now;
                    oCenterBunch.NowAdmTime   = DateTime.Now;
                    en.SaveChanges();
                    msg = Msg.Default;
                }
            }
            catch (Exception ex)
            {
                msg = new Msg(false);
            }
            return(msg);
        }
Beispiel #22
0
        /// <summary>
        ///向项目汇总表增加一条项目
        /// </summary>
        /// <param name="oPlan">项目表对象</param>
        /// <returns>消息传输实体</returns>
        public static Msg EditPlan(Tbl_Plan oPlan)
        {
            Msg msg = null;

            if (oPlan != null)
            {
                try
                {
                    using (var en = new LingYunEntities())
                    {
                        Tbl_Plan obj = en.Tbl_Plan.Where(a => a.PlanID == oPlan.PlanID).FirstOrDefault();
                        if (obj != null)
                        {
                            obj.ProjectName      = oPlan.ProjectName;
                            obj.ProductAdm       = oPlan.ProductAdm;
                            obj.DesignAdm        = oPlan.DesignAdm;
                            obj.CenterStorageAdm = obj.CenterStorageAdm;
                            obj.SiteStorageAdm   = obj.SiteStorageAdm;
                            obj.PlanDate         = DateTime.Now;
                            en.SaveChanges();
                            msg = Msg.Default;
                        }
                        else
                        {
                            msg = new Msg(false)
                            {
                                Message = "没有查到要确认的项目"
                            };
                        }
                    }
                }
                catch (Exception ex)
                {
                    msg = new Msg(false)
                    {
                        Message = "没有查到要确认的项目"
                    };
                }
            }
            return(msg);
        }
Beispiel #23
0
        /// <summary>
        /// 新确认出库批次表
        /// </summary>
        /// <returns></returns>
        public static Msg NEnsureOutBunch(List <Tbl_SiteStorageBatch> list)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    foreach (Tbl_SiteStorageBatch oSite in list)
                    {
                        Tbl_CenterStorage oStorage = en.Tbl_CenterStorage.Where(a => a.BuildBatchID == oSite.BuildBatchID).FirstOrDefault();
                        if (oStorage != null)
                        {
                            oStorage.NowAdmStatus = 128;
                            oStorage.NowAdmTime   = DateTime.Now;
                        }
                        Tbl_OutCenterStorage oSiteBunch = en.Tbl_OutCenterStorage.Where(a => a.BuildBatchID == oSite.BuildBatchID).FirstOrDefault();
                        if (oSiteBunch != null)
                        {
                            oSiteBunch.PreAdmStatus = 128;
                            oSiteBunch.PreAdmTime   = DateTime.Now;
                        }
                        en.Tbl_SiteStorageBatch.AddObject(oSite);
                    }
                    en.SaveChanges();
                    msg = Msg.Default;
                }
            }
            catch (Exception ex)
            {
                msg = new Msg(false)
                {
                    Message = ex.Message
                };
            }
            return(msg);
        }
Beispiel #24
0
        /// 新确认出库批次表批次表
        /// </summary>
        /// <param name="matriesId"></param>
        /// <param name="count"></param>
        /// <param name="oStorage">仓储表</param>
        /// <returns></returns>
        public static Msg NEnsureOutBunch(List <Tbl_CenterStorageBatch> list)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    foreach (Tbl_CenterStorageBatch oPro in list)
                    {
                        var obj = en.Tbl_OutProductBatch.Where(a => a.BuildBatchID == oPro.BuildBatchID).FirstOrDefault();

                        obj.PreAdmStatus = 128;
                        obj.PreAdmTime   = DateTime.Now;

                        var oProductStorage = en.Tbl_ProductStorage.Where(b => b.BuildBatchID == oPro.BuildBatchID).FirstOrDefault();
                        oProductStorage.NowAdmStatus = 128;
                        oProductStorage.NowAdmTime   = DateTime.Now;
                        en.Tbl_CenterStorageBatch.AddObject(oPro);//插入入库记录
                    }
                    en.SaveChanges();
                    msg = Msg.Default;
                }
            }

            catch (Exception ex)
            {
                msg = new Msg()
                {
                    Status = false, Message = ex.Message
                };
            }


            return(msg);
        }
Beispiel #25
0
        /// <summary>
        /// 批量确认
        /// </summary>
        /// <param name="oMatries"></param>
        /// <returns></returns>
        public static Msg EnsureMateries(List <Tbl_Materies> lMatries)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    foreach (Tbl_Materies oMatries in lMatries)
                    {
                        Tbl_Materies obj = en.Tbl_Materies.Where(a => a.MateriesID == oMatries.MateriesID).FirstOrDefault();
                        obj.Date            = oMatries.Date;
                        obj.BuildNum        = oMatries.BuildNum;
                        obj.BuildName       = oMatries.BuildName;
                        obj.NowAdmStatus    = oMatries.NowAdmStatus;
                        obj.TotalNum        = oMatries.TotalNum;
                        obj.MateriesType    = oMatries.MateriesType;
                        obj.BeforeAdmStatus = 128;
                        obj.PreDate         = DateTime.Now.ToString();
                        obj.NowAdmStatus    = 1;
                        obj.NowDate         = DateTime.Now.ToString();
                        obj.ProcessingNum   = oMatries.ProcessingNum;
                    }
                    en.SaveChanges();
                    msg = Msg.Default;
                }
            }
            catch (Exception ex)
            {
                msg = new Msg(false)
                {
                    Message = ex.Message
                };
            }
            return(msg);
        }
Beispiel #26
0
        /// <summary>
        /// 插入出库批次表
        /// </summary>
        /// <returns></returns>
        public static Msg EditOutBunch(Tbl_OutSiteStorage oBunch)
        {
            Msg msg = null;

            try
            {
                using (var en = new LingYunEntities())
                {
                    en.Tbl_OutSiteStorage.AddObject(oBunch);


                    en.SaveChanges();
                    msg = Msg.Default;
                }
            }
            catch (Exception ex)
            {
                msg = new Msg(false)
                {
                    Message = ex.Message
                };
            }
            return(msg);
        }
Beispiel #27
0
        public static Msg EditInBunch(Tbl_ProductBatch oBunch)
        {
            //构造调码对象
            List <Tbl_BarCodeBatch> lBarcode = new List <Tbl_BarCodeBatch>();

            //    List<Tbl_BarCodeInfo> lBarCodeInfo = new List<Tbl_BarCodeInfo>();

            Msg msg = null;

            if (oBunch != null)
            {
                try
                {
                    using (var en = new LingYunEntities())
                    {
                        Tbl_ProductBatch obj = en.Tbl_ProductBatch.Where(a => a.PlanID == oBunch.PlanID && oBunch.MateriesID == a.MateriesID).FirstOrDefault();
                        //if (obj == null)
                        {
                            en.Tbl_ProductBatch.AddObject(oBunch);
                            en.SaveChanges();
                            Tbl_ProductBatch oProduct = en.Tbl_ProductBatch.Where(a => a.PlanID == oBunch.PlanID).ToList().LastOrDefault();

                            //批次
                            List <string>    lCodes        = BarCode.BuildBarCode(oProduct.WorkMapID, (int)BarCodeType.批次);
                            Tbl_BarCodeBatch oBunchBarCode = new Tbl_BarCodeBatch();
                            oBunchBarCode.BarCodeBatchID = oProduct.BuildBatchID;
                            oBunchBarCode.BarCodeType    = (int)BarCodeType.批次;
                            oBunchBarCode.BarCodeNo      = lCodes[0];
                            oBunchBarCode.CreateTime     = DateTime.Now;
                            oBunchBarCode.BuildBatchID   = oProduct.BuildBatchID;
                            Tbl_BarCodeInfo oBarCodeInfo = new Tbl_BarCodeInfo();
                            oBarCodeInfo.BarCodeInfoID  = oProduct.BuildBatchID;
                            oBarCodeInfo.BuildName      = oBunch.BuildName;
                            oBarCodeInfo.CreateTime     = DateTime.Now;
                            oBarCodeInfo.MateriesType   = oBunch.MateriesType;
                            oBarCodeInfo.WorkMapID      = oBunch.WorkMapID;
                            oBarCodeInfo.ProjectName    = oBunch.ProjectName;
                            oBarCodeInfo.BarCodeBatchID = oProduct.BuildBatchID;
                            en.Tbl_BarCodeBatch.AddObject(oBunchBarCode);
                            en.Tbl_BarCodeInfo.AddObject(oBarCodeInfo);

                            //
                            List <string> lSigleCodes = BarCode.BuildBarCode(oProduct.WorkMapID, (int)BarCodeType.单件, oBunch.Count);
                            for (int i = 0; i < lSigleCodes.Count; i++)
                            {
                                Tbl_BarCodeBatch oSigleBunch = new Tbl_BarCodeBatch();
                                oSigleBunch.BarCodeBatchID = oProduct.BuildBatchID;
                                oSigleBunch.BarCodeType    = (int)BarCodeType.单件;
                                oSigleBunch.BarCodeNo      = lSigleCodes[i];
                                oSigleBunch.CreateTime     = DateTime.Now;
                                Tbl_BarCodeInfo oSigleInfo = new Tbl_BarCodeInfo();
                                oSigleInfo.BarCodeBatchID = oProduct.BuildBatchID;
                                oSigleInfo.BarCodeInfoID  = oProduct.BuildBatchID;
                                oSigleInfo.BuildName      = oBunch.BuildName;
                                oSigleInfo.CreateTime     = DateTime.Now;
                                oSigleInfo.MateriesType   = oBunch.MateriesType;
                                oSigleInfo.WorkMapID      = oBunch.WorkMapID;
                                oSigleInfo.ProjectName    = oBunch.ProjectName;
                                en.Tbl_BarCodeBatch.AddObject(oSigleBunch);
                                en.Tbl_BarCodeInfo.AddObject(oSigleInfo);
                            }


                            en.SaveChanges();
                            msg = new Msg(true)
                            {
                                UserData = lCodes
                            };
                        }
                        //else
                        //{
                        //    obj.Count = oBunch.Count;

                        //    List<Tbl_BarCodeBatch> lDelBunch = en.Tbl_BarCodeBatch.Where(a => a.BuildBatchID == obj.BuildBatchID).ToList();
                        //    List<Tbl_BarCodeInfo> lDelInfo = en.Tbl_BarCodeInfo.Where(a => a.BarCodeBatchID == obj.BuildBatchID).ToList();
                        //     for(int j=0;j<lDelBunch.Count;j++)
                        //     {
                        //         en.Tbl_BarCodeBatch.DeleteObject(lDelBunch[j]);
                        //         en.Tbl_BarCodeInfo.DeleteObject(lDelInfo[j]);

                        //     }en.SaveChanges();


                        //     string conStr = ConfigurationManager.AppSettings["ConStr"];
                        //     SqlConnection con = new SqlConnection(conStr);
                        //     con.Open();
                        //    //插入单件
                        //  //   SqlTransaction tran = con.BeginTransaction();//开始事务
                        //    List<string> lSigleCodes = BarCode.BuildBarCode(int.Parse(obj.BuildBatchID.ToString()), (int)BarCodeType.单件, oBunch.Count);
                        //    for (int i = 0; i < lSigleCodes.Count; i++)
                        //    {
                        //        Tbl_BarCodeBatch oSigleBunch = new Tbl_BarCodeBatch();
                        //        oSigleBunch.BuildBatchID = obj.BuildBatchID;
                        //        oSigleBunch.BarCodeType = (int)BarCodeType.单件;
                        //        oSigleBunch.BarCodeNo = lSigleCodes[i];
                        //        oSigleBunch.CreateTime = DateTime.Now;
                        //        Tbl_BarCodeInfo oSigleInfo = new Tbl_BarCodeInfo();
                        //        oSigleInfo.BarCodeBatchID = obj.BuildBatchID;
                        //        oSigleInfo.BuildName = oBunch.BuildName;
                        //        oSigleInfo.CreateTime = DateTime.Now;
                        //        oSigleInfo.MateriesType = oBunch.MateriesType;
                        //        oSigleInfo.WorkMapID = oBunch.WorkMapID;
                        //        oSigleInfo.ProjectName = oBunch.ProjectName;
                        //        //en.Tbl_BarCodeBatch.AddObject(oSigleBunch);
                        //        //en.Tbl_BarCodeInfo.AddObject(oSigleInfo);
                        //        SqlCommand com1 = new SqlCommand("insert into Tbl_BarCodeBatch(BuildBatchID,BarCodeNo,CreateTime,BarCodeType) values(" + oSigleBunch.BuildBatchID + ",'" + oSigleBunch.BarCodeNo + "','" + oSigleBunch.CreateTime + "'," + oSigleBunch.BarCodeType + ")", con);
                        //        SqlCommand com2 = new SqlCommand("insert into Tbl_BarCodeInfo(BarCodeBatchID,CreateTime,ProjectName,BuildName,MateriesType,WorkMapID) values(" + oSigleInfo.BarCodeBatchID + ",'" + oSigleInfo.CreateTime + "','" + oSigleInfo.ProjectName + "','" + oSigleInfo.BuildName + "','" + oSigleInfo.MateriesType + "','" + oSigleInfo.WorkMapID + "')", con);
                        //        com1.ExecuteScalar();
                        //        com2.ExecuteScalar();

                        //    }



                        //    //批次
                        //    List<string> lCodes = BarCode.BuildBarCode(int.Parse(obj.BuildBatchID.ToString()), (int)BarCodeType.批次);
                        //    Tbl_BarCodeBatch oBunchBarCode = new Tbl_BarCodeBatch();
                        //    oBunchBarCode.BuildBatchID = obj.BuildBatchID;
                        //    oBunchBarCode.BarCodeType = (int)BarCodeType.批次;
                        //    oBunchBarCode.BarCodeNo = lCodes[0];
                        //    oBunchBarCode.CreateTime = DateTime.Now;

                        //    Tbl_BarCodeInfo oBarCodeInfo = new Tbl_BarCodeInfo();
                        //    oBarCodeInfo.BarCodeBatchID = obj.BuildBatchID;
                        //    oBarCodeInfo.BuildName = oBunch.BuildName;
                        //    oBarCodeInfo.CreateTime = DateTime.Now;
                        //    oBarCodeInfo.MateriesType = oBunch.MateriesType;
                        //    oBarCodeInfo.WorkMapID = oBunch.WorkMapID;
                        //    oBarCodeInfo.ProjectName = oBunch.ProjectName;

                        //    SqlCommand com3 = new SqlCommand("insert into Tbl_BarCodeBatch(BuildBatchID,BarCodeNo,CreateTime,BarCodeType) values(" + oBunchBarCode.BuildBatchID + ",'" + oBunchBarCode.BarCodeNo + "','" + oBunchBarCode.CreateTime + "'," + oBunchBarCode.BarCodeType + ")", con);
                        //    SqlCommand com4 = new SqlCommand("insert into Tbl_BarCodeInfo(BarCodeBatchID,CreateTime,ProjectName,BuildName,MateriesType,WorkMapID) values(" + oBarCodeInfo.BarCodeBatchID + ",'" + oBarCodeInfo.CreateTime + "','" + oBarCodeInfo.ProjectName + "','" + oBarCodeInfo.BuildName + "','" + oBarCodeInfo.MateriesType + "','" + oBarCodeInfo.WorkMapID + "')", con);
                        //    com3.ExecuteScalar();
                        //    com4.ExecuteScalar();
                        //   // tran.Commit();
                        //    con.Close();
                        //    msg = new Msg(true) { UserData = lCodes };
                    }
                }
                catch (Exception ex)
                {
                    msg = new Msg()
                    {
                        Status = false, Message = ex.Message
                    };
                }
            }
            return(msg);
        }
Beispiel #28
0
        /// <summary>
        /// 新编辑如库
        /// </summary>
        /// <param name="oBunch"></param>
        /// <returns></returns>
        public static Msg NEditInBunch(List <Tbl_ProductBatch> list)
        {
            Msg msg = null;
            //构造调码对象
            List <Tbl_BarCodeBatch> lBarcode = new List <Tbl_BarCodeBatch>();

            //    List<Tbl_BarCodeInfo> lBarCodeInfo = new List<Tbl_BarCodeInfo>();



            try
            {
                using (var en = new LingYunEntities())
                {
                    List <string> BarCodes = new List <string>();
                    foreach (Tbl_ProductBatch oPro in list)
                    {
                        en.Tbl_ProductBatch.AddObject(oPro);
                        en.SaveChanges();
                        Tbl_ProductBatch oProduct = en.Tbl_ProductBatch.Where(a => a.MateriesID == oPro.MateriesID).ToList().LastOrDefault();

                        //批次
                        List <string> lCodes = BarCode.BuildBarCode(oProduct.WorkMapID, (int)BarCodeType.批次);
                        BarCodes.Add(lCodes[0]);
                        Tbl_BarCodeBatch oBunchBarCode = new Tbl_BarCodeBatch();
                        oBunchBarCode.BarCodeBatchID = oProduct.BuildBatchID;
                        oBunchBarCode.BarCodeType    = (int)BarCodeType.批次;
                        oBunchBarCode.BarCodeNo      = lCodes[0];
                        oBunchBarCode.CreateTime     = DateTime.Now;
                        oBunchBarCode.BuildBatchID   = oProduct.BuildBatchID;
                        Tbl_BarCodeInfo oBarCodeInfo = new Tbl_BarCodeInfo();
                        oBarCodeInfo.BarCodeInfoID  = oProduct.BuildBatchID;
                        oBarCodeInfo.BuildName      = oPro.BuildName;
                        oBarCodeInfo.CreateTime     = DateTime.Now;
                        oBarCodeInfo.MateriesType   = oPro.MateriesType;
                        oBarCodeInfo.WorkMapID      = oPro.WorkMapID;
                        oBarCodeInfo.ProjectName    = oPro.ProjectName;
                        oBarCodeInfo.BarCodeBatchID = oProduct.BuildBatchID;
                        en.Tbl_BarCodeBatch.AddObject(oBunchBarCode);
                        en.Tbl_BarCodeInfo.AddObject(oBarCodeInfo);

                        //
                        List <string> lSigleCodes = BarCode.BuildBarCode(oProduct.WorkMapID, (int)BarCodeType.单件, oPro.Count);
                        for (int i = 0; i < lSigleCodes.Count; i++)
                        {
                            Tbl_BarCodeBatch oSigleBunch = new Tbl_BarCodeBatch();
                            oSigleBunch.BarCodeBatchID = oProduct.BuildBatchID;
                            oSigleBunch.BarCodeType    = (int)BarCodeType.单件;
                            oSigleBunch.BarCodeNo      = lSigleCodes[i];
                            oSigleBunch.CreateTime     = DateTime.Now;
                            Tbl_BarCodeInfo oSigleInfo = new Tbl_BarCodeInfo();
                            oSigleInfo.BarCodeBatchID = oProduct.BuildBatchID;
                            oSigleInfo.BarCodeInfoID  = oProduct.BuildBatchID;
                            oSigleInfo.BuildName      = oPro.BuildName;
                            oSigleInfo.CreateTime     = DateTime.Now;
                            oSigleInfo.MateriesType   = oPro.MateriesType;
                            oSigleInfo.WorkMapID      = oPro.WorkMapID;
                            oSigleInfo.ProjectName    = oPro.ProjectName;
                            en.Tbl_BarCodeBatch.AddObject(oSigleBunch);
                            en.Tbl_BarCodeInfo.AddObject(oSigleInfo);
                        }
                    }
                    en.SaveChanges();
                    msg = new Msg(true)
                    {
                        UserData = BarCodes
                    };
                }
            }
            catch (Exception ex)
            {
                msg = new Msg()
                {
                    Status = false, Message = ex.Message
                };
            }


            return(msg);
        }