示例#1
0
        public IQueryable <PalletDefine> GetPalletDefinesByCustItem(string custItemCode)
        {
            ShippmentEntities db     = new ShippmentEntities();
            string            partNo = db.CustProducts.FirstOrDefault(p => p.CusItemCode == custItemCode && !p.IsDeleted).PartNo;

            return(GetAll(partNo));
        }
示例#2
0
        public static int GetCustproductId(string custCode, string custItemCode)
        {
            ShippmentEntities db  = new ShippmentEntities();
            CustProduct       prd = db.CustProducts.FirstOrDefault(p => p.CustCode == custCode && p.CusItemCode == custItemCode && !p.IsDeleted);

            return(prd.Id);
        }
示例#3
0
        public ErrorInfo Edit(int id, TruckDefine truckDefine)
        {
            if (id != truckDefine.Id)
            {
                return(ErrorInfo.Err_Bad_Request_Information);
            }
            ShippmentEntities db    = new ShippmentEntities();
            TruckDefine       truck = db.TruckDefines.FirstOrDefault(p => p.Id == id);

            if (truck != null)
            {
                truck.Name            = truckDefine.Name;
                truck.Length_mm       = truckDefine.Length_mm;
                truck.Width_mm        = truckDefine.Width_mm;
                truck.Height_mm       = truckDefine.Height_mm;
                truck.MaxLoad_T       = truckDefine.MaxLoad_T;
                truck.CarriagePlans   = truckDefine.CarriagePlans;
                db.Entry(truck).State = EntityState.Modified;
                if (db.SaveChanges() > 0)
                {
                    return(ErrorInfo.Succeed);
                }
            }
            return(ErrorInfo.Err_Internal_Error);
        }
示例#4
0
        public List <FullPackagePlan> GetLoadedPackageByPallet(int palletId)
        {
            ShippmentEntities      db     = new ShippmentEntities();
            List <FullPackagePlan> list   = new List <FullPackagePlan>();
            PalletDefine           pallet = db.PalletDefines.FirstOrDefault(p => p.Id == palletId && !p.IsDeleted);

            if (pallet != null)
            {
                foreach (var pp in pallet.PackagePlans)
                {
                    FullPackagePlan plan = new FullPackagePlan();
                    plan.Id             = pp.PackageDefineId;
                    plan.pkgQty         = pp.Qty;
                    plan.palletDefineId = pp.PalletDefineId;
                    plan.Material       = pp.PackageDefine.Material;
                    plan.Length_mm      = pp.PackageDefine.Length_mm;
                    plan.Width_mm       = pp.PackageDefine.Width_mm;
                    plan.Height_mm      = pp.PackageDefine.Height_mm;
                    plan.NetWeight_kg   = pp.PackageDefine.NetWeight_kg;
                    plan.GrossWeight_kg = pp.PackageDefine.GrossWeight_kg;
                    plan.Note           = pp.PackageDefine.Note;
                    plan.PartNo         = pp.PackageDefine.PartNo;
                    plan.Qty            = pp.PackageDefine.Qty;
                    plan.Unit           = pp.PackageDefine.Unit;
                    list.Add(plan);
                }
            }
            return(list);
        }
示例#5
0
        public bool Add(BoardingPhoto obj)
        {
            ShippmentEntities db = new ShippmentEntities();

            db.BoardingPhotoes.Add(obj);
            return(db.SaveChanges() > 0);
        }
示例#6
0
        public ErrorInfo Edit(int id, Package package)
        {
            if (id != package.Id)
            {
                return(ErrorInfo.Err_Bad_Request_Information);
            }
            ShippmentEntities db    = new ShippmentEntities();
            Package           truck = db.Packages.FirstOrDefault(p => p.Id == id && !p.IsDeleted);

            if (truck != null)
            {
                truck.GWeightReal     = package.GWeightReal;
                truck.Status          = package.Status;
                truck.IsDeleted       = package.IsDeleted;
                truck.Boxname         = package.Boxname;
                truck.SealedTime      = package.SealedTime;
                truck.PackNo          = package.PackNo;
                truck.Packer          = package.Packer;
                truck.PackTime        = package.PackTime;
                truck.PartNo          = package.PartNo;
                truck.LotNo           = package.LotNo;
                db.Entry(truck).State = EntityState.Modified;
                if (db.SaveChanges() > 0)
                {
                    return(ErrorInfo.Succeed);
                }
            }
            return(ErrorInfo.Err_Internal_Error);
        }
示例#7
0
        public ErrorInfo Edit(int id, PalletDefine palletDefine)
        {
            if (id != palletDefine.Id)
            {
                return(ErrorInfo.Err_Bad_Request_Information);
            }
            ShippmentEntities db     = new ShippmentEntities();
            PalletDefine      pallet = db.PalletDefines.FirstOrDefault(p => p.Id == id && !p.IsDeleted);

            if (pallet != null)
            {
                pallet.Material        = palletDefine.Material;
                pallet.Length_mm       = palletDefine.Length_mm;
                pallet.Width_mm        = palletDefine.Width_mm;
                pallet.Height_mm       = palletDefine.Height_mm;
                pallet.NetWeight_kg    = palletDefine.NetWeight_kg;
                pallet.GrossWeight_kg  = palletDefine.GrossWeight_kg;
                pallet.Note            = palletDefine.Note;
                pallet.IsDeleted       = palletDefine.IsDeleted;
                db.Entry(pallet).State = System.Data.Entity.EntityState.Modified;
                if (db.SaveChanges() > 0)
                {
                    return(ErrorInfo.Succeed);
                }
                else
                {
                    return(ErrorInfo.Err_Internal_Error);
                }
            }
            else
            {
                return(ErrorInfo.Err_Resource_NotExist);
            }
        }
示例#8
0
        public ErrorInfo Edit(int id, CustProduct custProduct)
        {
            if (id != custProduct.Id)
            {
                return(ErrorInfo.Err_Bad_Request_Information);
            }
            ShippmentEntities db  = new ShippmentEntities();
            CustProduct       prd = db.CustProducts.FirstOrDefault(p => p.Id == id && !p.IsDeleted);

            if (prd == null)
            {
                return(ErrorInfo.Err_Resource_NotExist);
            }
            else
            {
                prd.CustCode        = custProduct.CustCode;
                prd.Original        = custProduct.Original;
                prd.CusItemCode     = custProduct.CusItemCode;
                prd.CusVersion      = custProduct.CusVersion;
                prd.CusModelNo      = custProduct.CusModelNo;
                prd.CusDescription  = custProduct.CusDescription;
                prd.IsDeleted       = custProduct.IsDeleted;
                prd.PartNo          = custProduct.PartNo;
                db.Entry(prd).State = EntityState.Modified;
                if (db.SaveChanges() > 0)
                {
                    return(ErrorInfo.Succeed);
                }
                else
                {
                    return(ErrorInfo.Err_Internal_Error);
                }
            }
        }
示例#9
0
        public IQueryable <PhotoDefine> GetAll()
        {
            ShippmentEntities        db   = new ShippmentEntities();
            IQueryable <PhotoDefine> list = from p in db.PhotoDefines
                                            select p;

            return(list);
        }
示例#10
0
        public IQueryable <BoardingPhoto> GetAllPhotos()
        {
            ShippmentEntities          db   = new ShippmentEntities();
            IQueryable <BoardingPhoto> list = from p in db.BoardingPhotoes
                                              select p;

            return(list);
        }
示例#11
0
        public IQueryable <CarriagePlan> GetAll()
        {
            ShippmentEntities         db   = new ShippmentEntities();
            IQueryable <CarriagePlan> list = from p in db.CarriagePlans
                                             select p;

            return(list);
        }
示例#12
0
        public static IQueryable <HwProductPlan> GetAll()
        {
            ShippmentEntities          db   = new ShippmentEntities();
            IQueryable <HwProductPlan> list = from p in db.HwProductPlans
                                              select p;

            return(list);
        }
示例#13
0
        public IQueryable <CustProduct> GetAll()
        {
            ShippmentEntities        db   = new ShippmentEntities();
            IQueryable <CustProduct> list = from p in db.CustProducts
                                            where !p.IsDeleted
                                            select p;

            return(list);
        }
示例#14
0
        public TruckDefine Get(int id)
        {
            ShippmentEntities db    = new ShippmentEntities();
            TruckDefine       truck = (from p in db.TruckDefines
                                       where p.Id == id
                                       select p).FirstOrDefault();

            return(truck);
        }
示例#15
0
        public CarriagePlan Get(int id)
        {
            ShippmentEntities db       = new ShippmentEntities();
            CarriagePlan      carriage = (from p in db.CarriagePlans
                                          where p.Id == id
                                          select p).FirstOrDefault();

            return(carriage);
        }
示例#16
0
        public Package Get(int id)
        {
            ShippmentEntities db    = new ShippmentEntities();
            Package           truck = (from p in db.Packages
                                       where p.Id == id
                                       select p).FirstOrDefault();

            return(truck);
        }
示例#17
0
        public BoardingPhoto GetPhoto(int id)
        {
            ShippmentEntities db    = new ShippmentEntities();
            BoardingPhoto     photo = (from p in db.BoardingPhotoes
                                       where p.Id == id
                                       select p).FirstOrDefault();

            return(photo);
        }
示例#18
0
        public PhotoDefine Get(int id)
        {
            ShippmentEntities db    = new ShippmentEntities();
            PhotoDefine       photo = (from p in db.PhotoDefines
                                       where p.Id == id
                                       select p).FirstOrDefault();

            return(photo);
        }
示例#19
0
        /// <summary>
        /// 根据物料代码找出所有定义过的托板定义
        /// </summary>
        /// <param name="partno">内部物料代码</param>
        /// <returns></returns>
        public IQueryable <PalletDefine> GetAll(string partno)
        {
            ShippmentEntities db = new ShippmentEntities();
            var pallets          = from p in db.R_PalletPackage
                                   where p.PackageDefine.PartNo == partno
                                   select p.PalletDefine;

            return(pallets);
        }
示例#20
0
        /// <summary>
        /// 根据HW发货订单号查找发货产品计划
        /// </summary>
        /// <param name="hwShipOrderId"></param>
        /// <returns></returns>
        public static IQueryable <HwProductPlan> Get(int hwShipOrderId)
        {
            ShippmentEntities db = new ShippmentEntities();
            var plan             = from p in db.HwProductPlans
                                   where p.HwShipOrderId == hwShipOrderId
                                   select p;

            return(plan);
        }
示例#21
0
        public static HwProductPlan Get(int hwShipOrderId, int custProductId)
        {
            ShippmentEntities db  = new ShippmentEntities();
            HwProductPlan     prd = (from p in db.HwProductPlans
                                     where p.CustProductId == custProductId && p.HwShipOrderId == hwShipOrderId
                                     select p).FirstOrDefault();

            return(prd);
        }
示例#22
0
        public PackageDefine Get(int id)
        {
            ShippmentEntities db   = new ShippmentEntities();
            PackageDefine     pack = (from p in db.PackageDefines
                                      where p.Id == id && !p.IsDeleted
                                      select p).FirstOrDefault();

            return(pack);
        }
示例#23
0
        public IQueryable <PackageDefine> GetAll()
        {
            ShippmentEntities          db   = new ShippmentEntities();
            IQueryable <PackageDefine> list = from p in db.PackageDefines
                                              where !p.IsDeleted
                                              select p;

            return(list);
        }
示例#24
0
        public static bool Exist(HwProductPlan prodPlan)
        {
            ShippmentEntities db = new ShippmentEntities();
            var plans            = (from m in db.HwProductPlans
                                    where m.HwShipOrderId == prodPlan.HwShipOrderId &&
                                    m.CustProduct.Id == prodPlan.CustProduct.Id
                                    select m).ToList();

            return(plans.Count > 0);
        }
示例#25
0
        public string GetPartNo(string custItemCode)
        {
            ShippmentEntities db     = new ShippmentEntities();
            string            partno = db.CustProducts.FirstOrDefault(p => p.CusItemCode == custItemCode && !p.IsDeleted).PartNo;

            if (string.IsNullOrEmpty(partno))
            {
                partno = custItemCode;
            }
            return(partno);
        }
示例#26
0
        public ErrorInfo Delete(int id)
        {
            ShippmentEntities db  = new ShippmentEntities();
            CustProduct       prd = db.CustProducts.FirstOrDefault(p => p.Id == id && !p.IsDeleted);

            if (prd == null)
            {
                return(ErrorInfo.Err_Resource_NotExist);
            }
            prd.IsDeleted = true;
            return(Edit(id, prd));
        }
示例#27
0
        public CustProduct Get(int id)
        {
            if (id == 0)
            {
                return(new CustProduct());
            }
            ShippmentEntities db  = new ShippmentEntities();
            CustProduct       prd = (from p in db.CustProducts
                                     where p.Id == id && !p.IsDeleted
                                     select p).FirstOrDefault();

            return(prd);
        }
示例#28
0
        public IQueryable <PackageDefine> Get(string partNo)
        {
            IQueryable <PackageDefine> packageDefines = null;
            ShippmentEntities          db             = new ShippmentEntities();

            if (!string.IsNullOrEmpty(partNo))
            {
                packageDefines = from p in db.PackageDefines
                                 where p.PartNo == partNo && !p.IsDeleted
                                 select p;
            }
            return(packageDefines);
        }
示例#29
0
        public IQueryable <PackageDefine> GetPackageDefinesByCustItem(string custItemCode)
        {
            IQueryable <PackageDefine> packageDefines = null;
            ShippmentEntities          db             = new ShippmentEntities();
            string partNo = db.CustProducts.FirstOrDefault(p => p.CusItemCode == custItemCode && !p.IsDeleted).PartNo;

            if (!string.IsNullOrEmpty(partNo))
            {
                packageDefines = from p in db.PackageDefines
                                 where p.PartNo == partNo && !p.IsDeleted
                                 select p;
            }
            return(packageDefines);
        }
示例#30
0
        public ErrorInfo Add(PackageDefine packageDefine)
        {
            ShippmentEntities db = new ShippmentEntities();

            db.PackageDefines.Add(packageDefine);
            if (db.SaveChanges() > 0)
            {
                return(ErrorInfo.Succeed);
            }
            else
            {
                return(ErrorInfo.Err_Internal_Error);
            }
        }