Пример #1
0
        /// <summary>
        /// 查询对象(为配送业务提供)
        /// </summary>
        /// <param name="res"></param>
        /// <param name="param"></param>
        private void GetModelForPs(BaseResult res, Hashtable param)
        {
            var             fptzd1 = DAL.GetItem <Td_Ps_Fptzd_1>(typeof(Td_Ps_Fptzd_1), param);
            FptzdQueryModel model  = new FptzdQueryModel();

            if (fptzd1 != null)
            {
                param.Clear();
                param.Add("id_bill", fptzd1.id);
                model.Fptzd2List = DAL.QueryList <Td_Ps_Fptzd_2_Query>(typeof(Td_Ps_Fptzd_2), param).ToList();
                if (model.Fptzd2List.Any())
                {
                    var id_sps     = (from d in model.Fptzd2List select d.id_sp).ToArray();
                    var id_shop_ck = fptzd1.id_shop_ck;
                    param.Clear();
                    param.Add("id_sp_array", id_sps);
                    param.Add("id_shop", id_shop_ck);
                    var list = DAL.QueryList <Tb_Shopsp>(typeof(Tb_Shopsp), param).ToList();
                    if (list.Any())
                    {
                        model.Fptzd2List.ForEach(d =>
                        {
                            var firstOrDefault = list.FirstOrDefault(b => b.id_sp == d.id_sp);
                            if (firstOrDefault != null)
                            {
                                d.id_shopsp = firstOrDefault.id;
                                d.id_kcsp   = firstOrDefault.id_kcsp;
                            }
                        });
                    }
                }
            }
            model.Fptzd1 = fptzd1;
            res.Data     = model;
        }
Пример #2
0
        public override BaseResult Get(Hashtable param)
        {
            BaseResult res = new BaseResult()
            {
                Success = true
            };

            if (param != null && param.Contains("forps"))
            {
                param.Remove("forps");
                GetModelForPs(res, param);
                return(res);
            }
            var             fptzd1 = DAL.GetItem <Td_Ps_Fptzd_1>(typeof(Td_Ps_Fptzd_1), param);
            FptzdQueryModel model  = new FptzdQueryModel();

            if (fptzd1 != null)
            {
                param.Clear();
                param.Add("id_bill", fptzd1.id);
                param.Add("sort", "  sort_id  ");
                model.Fptzd2List = DAL.QueryList <Td_Ps_Fptzd_2_Query>(typeof(Td_Ps_Fptzd_2), param).ToList();
                if (!string.IsNullOrEmpty(fptzd1.id_create))
                {
                    param.Clear();
                    List <string> arr = new List <string>();
                    arr.Add(fptzd1.id_create);
                    if (!string.IsNullOrEmpty(fptzd1.id_user_sh))
                    {
                        arr.Add(fptzd1.id_user_sh);
                    }
                    param.Add("id_users", arr.ToArray());
                    var users = DAL.QueryList <Tb_User>(typeof(Tb_User), param).ToList();
                    if (users.Any())
                    {
                        var user_zdr = users.FirstOrDefault(a => a.id == fptzd1.id_create);
                        if (user_zdr != null)
                        {
                            model.zdr = user_zdr.username;
                        }
                        if (!string.IsNullOrEmpty(fptzd1.id_user_sh))
                        {
                            var user_shr = users.FirstOrDefault(a => a.id == fptzd1.id_user_sh);
                            if (user_shr != null)
                            {
                                model.shr = user_shr.username;
                            }
                        }
                    }
                }
            }
            model.Fptzd1 = fptzd1;
            res.Data     = model;
            return(res);
        }