/// <summary>
        /// 肉类溯源
        /// </summary>
        /// <param name="epc"></param>
        /// <param name="orCode"></param>
        /// <returns></returns>
        public List <ProductTraceDto> GetProductTrace(string epc, string orCode)
        {
            var list = new List <ProductTraceDto>();

            var productBase = GetProProductByEpc(epc, orCode);

            if (productBase != null)
            {
                var model = new ProductTraceDto()
                {
                    Type = 6
                };
                //销售仓库
                var warehouse = (from s in Context.ProductBase
                                 join stock in Context.WareHouseStock on s.ProductID equals stock.ProductID
                                 join ware in Context.WareHouseBase on stock.WareHouseID equals ware.WareHouseID
                                 where s.ProductID == productBase.ProductID
                                 select new ProductTraceDto()
                {
                    Code = ware.WareHouseID,
                    Name = ware.WareHouseName,
                    Type = 6,
                    Image = _ImageUrl
                }).FirstOrDefault();

                if (warehouse != null)
                {
                    model = warehouse;
                    var details = GetSaleCompanyWarehouse(warehouse.Code, epc, orCode);
                    model.DetailData = details;
                }
                list.Add(model);
                //销售公司
                var baseSale = GetSaleBaseByEpc(epc, orCode);
                if (baseSale != null)
                {
                    var saleModel = new ProductTraceDto()
                    {
                        Type = 7
                    };
                    var saleCompany = (from com in Context.Company
                                       where com.CompanyID == baseSale.CompanyID
                                       select new ProductTraceDto
                    {
                        Code = com.CompanyID,
                        Name = com.CompanyName,
                        Type = 7,
                        Image = _ImageUrl
                    }).FirstOrDefault();

                    if (saleCompany != null)
                    {
                        saleModel = saleCompany;
                        var details = GetSaleCompany(saleCompany.Code);
                        saleModel.DetailData = details;
                    }
                    list.Add(saleModel);
                }


                //加工厂
                var processModel = new ProductTraceDto()
                {
                    Type = 5
                };
                var procFactory = (from com in Context.Company
                                   join batch in Context.ProcessBatch on com.CompanyID equals batch.CompanyID
                                   join batchd in Context.ProcessBatchDetail on batch.PApplyID equals batchd.PApplyID
                                   where batchd.ProcessEPC == productBase.ProcessEPC
                                   select new ProductTraceDto()
                {
                    Code = com.CompanyID,
                    Name = com.CompanyName,
                    Type = 5,
                    Image = _ImageUrl
                }).FirstOrDefault();

                if (procFactory != null)
                {
                    processModel = procFactory;
                    var details = GetProcessFactory(procFactory.Code, epc, orCode);
                    processModel.DetailData = details;
                }
                list.Add(processModel);

                //屠宰场
                var killModel = new ProductTraceDto()
                {
                    Type = 3
                };
                var killFatory = (from com in Context.Company
                                  join k in Context.KillCull on com.CompanyID equals k.CompanyID
                                  where k.KillEpc == productBase.ProcessEPC
                                  select new ProductTraceDto()
                {
                    Code = k.KillCullID,
                    Name = com.CompanyName,
                    Type = 3,
                    Image = _ImageUrl
                }).FirstOrDefault();

                if (killFatory != null)
                {
                    killModel = killFatory;
                    var details = GetKillFactory(killFatory.Code, epc, orCode);
                    killModel.DetailData = details;
                }
                list.Add(killModel);

                //养殖场
                var culModel = new ProductTraceDto()
                {
                    Type = 2
                };
                var cultivate = (
                    from b in Context.BreedBase
                    join c in Context.CultivationBase on b.BreedID equals c.BreedID
                    join kill in Context.KillCull on c.CultivationEpc equals kill.CultivationEpc
                    where kill.KillEpc == productBase.ProcessEPC
                    select new ProductTraceDto()
                {
                    Code = c.CultivationID,
                    Name = b.BreedName,
                    Type = 2,
                    Image = _ImageUrl
                }).FirstOrDefault();

                if (cultivate != null)
                {
                    culModel = cultivate;
                    var details = GetCultivation(cultivate.Code, epc, orCode);
                    culModel.DetailData = details;
                }
                list.Add(culModel);

                //个体
                var unitModel = new ProductTraceDto()
                {
                    Type = 1
                };
                var unit = (from c in Context.CultivationBase
                            join kill in Context.KillCull on c.CultivationEpc equals kill.CultivationEpc
                            where kill.KillEpc == productBase.ProcessEPC
                            select new ProductTraceDto()
                {
                    Code = c.CultivationID,
                    Name = c.VarietyName,
                    Type = 1,
                    Image = _ImageUrl
                }).FirstOrDefault();

                if (unit != null)
                {
                    unitModel = unit;
                    var details = GetTraceUint(unit.Code);
                    unitModel.DetailData = details;
                }
                list.Add(unitModel);

                //母
                var mModel = new ProductTraceDto()
                {
                    Type = 10
                };
                //var fModel = new ProductTraceDto() { Type = 9 };
                var unitParent = (from c in Context.CultivationBase
                                  join kill in Context.KillCull on c.CultivationEpc equals kill.CultivationEpc
                                  where kill.KillEpc == productBase.ProcessEPC
                                  select c).FirstOrDefault();
                if (unitParent != null)
                {
                    var parentMother = (from c in Context.CultivationBase
                                        where c.CultivationID == unitParent.MontherID
                                        select new ProductTraceDto()
                    {
                        Code = c.CultivationID,
                        Name = c.VarietyName,
                        Type = 10,
                        Image = _ImageUrl
                    }).FirstOrDefault();
                    if (parentMother != null)
                    {
                        mModel = parentMother;
                        var details = GetTraceUint(parentMother.Code);
                        mModel.DetailData = details;
                    }
                }
                list.Add(mModel);
                //list.Add(fModel);
            }
            return(list);
        }
        /// <summary>
        /// 种植流程追溯
        /// </summary>
        /// <param name="epc"></param>
        /// <param name="orCode"></param>
        /// <returns></returns>
        public List <ProductTraceDto> GetProductPlantTrace(string epc, string orCode)
        {
            var list = new List <ProductTraceDto>();

            var productBase = GetProProductByEpc(epc, orCode);

            if (productBase != null)
            {
                var model = new ProductTraceDto()
                {
                    Type = 6
                };
                //销售仓库
                var warehouse = (from s in Context.ProductBase
                                 join stock in Context.WareHouseStock on s.ProductID equals stock.ProductID
                                 join ware in Context.WareHouseBase on stock.WareHouseID equals ware.WareHouseID
                                 where s.ProductID == productBase.ProductID
                                 select new ProductTraceDto()
                {
                    Code = ware.WareHouseID,
                    Name = ware.WareHouseName,
                    Type = 6,
                    Image = ""
                }).FirstOrDefault();

                if (warehouse != null)
                {
                    model = warehouse;
                    var details = GetSaleCompanyWarehouse(warehouse.Code, epc, orCode);
                    model.DetailData = details;
                }
                list.Add(model);
                //销售公司
                var baseSale = GetSaleBaseByEpc(epc, orCode);
                if (baseSale != null)
                {
                    var saleModel = new ProductTraceDto()
                    {
                        Type = 7
                    };
                    var saleCompany = (from com in Context.Company
                                       where com.CompanyID == baseSale.CompanyID
                                       select new ProductTraceDto
                    {
                        Code = com.CompanyID,
                        Name = com.CompanyName,
                        Type = 7,
                        Image = ""
                    }).FirstOrDefault();

                    if (saleCompany != null)
                    {
                        saleModel = saleCompany;
                        var details = GetSaleCompany(saleCompany.Code);
                        saleModel.DetailData = details;
                    }
                    list.Add(saleModel);
                }


                //加工厂
                var processModel = new ProductTraceDto()
                {
                    Type = 5
                };
                var procFactory = (from com in Context.Company
                                   join batch in Context.ProcessBatch on com.CompanyID equals batch.CompanyID
                                   join batchd in Context.ProcessBatchDetail on batch.PApplyID equals batchd.PApplyID
                                   where batchd.ProcessEPC == productBase.ProcessEPC
                                   select new ProductTraceDto()
                {
                    Code = com.CompanyID,
                    Name = com.CompanyName,
                    Type = 5,
                    Image = ""
                }).FirstOrDefault();

                if (procFactory != null)
                {
                    processModel = procFactory;
                    var details = GetProcessFactory(procFactory.Code, epc, orCode);
                    processModel.DetailData = details;
                }
                list.Add(processModel);

                //种植基地
                var plantModel = new ProductTraceDto()
                {
                    Type = 11
                };
                var plantFactory = (from lbase in Context.LandBase
                                    join lb in Context.LandBlock on lbase.LandID equals lb.LandID
                                    join pb in Context.PlansBatch on lb.BlockID equals pb.BlockID
                                    where pb.BatchCode == productBase.ProcessEPC
                                    select new ProductTraceDto()
                {
                    Code = lbase.LandID,
                    Name = lbase.LandName,
                    Type = 2,
                    Image = ""
                }).FirstOrDefault();
                if (plantFactory != null)
                {
                    plantModel = plantFactory;
                    var details = GetPlantModeL(productBase.ProcessEPC);
                    plantModel.DetailData = details;
                }
                list.Add(plantModel);

                //种子
                var seedModel = new ProductTraceDto()
                {
                    Type = 12
                };
                var seed = (from s in Context.SeedBase
                            join pb in Context.PlansBatch on s.SeedID equals pb.SeedID
                            where pb.BatchCode == productBase.ProcessEPC
                            select new ProductTraceDto()
                {
                    Code = s.SeedID,
                    Name = s.SeedName,
                    Type = 12,
                    Image = ""
                }).FirstOrDefault();
                if (seed != null)
                {
                    seedModel = seed;
                    var details = GetSeedModel(seed.Code);
                    seedModel.DetailData = details;
                }
                list.Add(seedModel);
            }

            return(list);
        }