Beispiel #1
0
        /// <summary>
        /// 获得单据详细信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override List <InStorDetailEntity> GetOrderDetail(InStorDetailEntity entity)
        {
            InStorDetailEntity detail = new InStorDetailEntity();

            detail.IncludeAll();
            detail.Where(a => a.OrderSnNum == entity.OrderSnNum)
            .And(a => a.CompanyID == this.CompanyID)
            ;
            List <InStorDetailEntity> list = this.InStorDetail.GetList(detail);

            if (!list.IsNullOrEmpty())
            {
                List <LocationEntity> listLocation = new LocationProvider(this.CompanyID).GetList();
                listLocation = listLocation == null ? new List <LocationEntity>() : listLocation;
                List <ProductEntity> listProduct = new ProductProvider(this.CompanyID).GetList();
                listProduct = listProduct == null ? new List <ProductEntity>() : listProduct;
                foreach (InStorDetailEntity item in list)
                {
                    LocationEntity location = listLocation.FirstOrDefault(a => a.LocalNum == item.LocalNum);
                    item.LocalName   = location == null ? "" : location.LocalName;
                    item.StorageName = location == null ? "" : location.StorageName;

                    ProductEntity product = listProduct.FirstOrDefault(a => a.SnNum == item.ProductNum);
                    item.Size = product.IsNull() ? string.Empty : product.Size;
                }
            }
            return(list);
        }
Beispiel #2
0
        public ActionResult Add()
        {
            string        SnNum  = WebUtil.GetQueryStringValue <string>("SnNum", string.Empty);
            ProductEntity entity = null;
            ITopClient    client = new TopClientDefault();

            if (!SnNum.IsEmpty())
            {
                Dictionary <string, string> dic = new Dictionary <string, string>();
                dic.Add("CompanyID", CompanyID);
                dic.Add("SnNum", SnNum);

                string result = client.Execute(ProductApiName.ProductApiName_Single, dic);
                DataResult <ProductEntity> dataResult = JsonConvert.DeserializeObject <DataResult <ProductEntity> >(result);
                entity = dataResult.Result;
            }

            entity         = entity.IsNull() ? new ProductEntity() : entity;
            ViewBag.Entity = entity;

            ViewBag.Unit    = DropDownHelper.GetUnit(entity.UnitNum, this.CompanyID);
            ViewBag.Cate    = DropDownHelper.GetCate(entity.CateNum, this.CompanyID);
            ViewBag.Storage = DropDownHelper.GetStorage(entity.StorageNum, this.CompanyID);
            return(View());
        }
Beispiel #3
0
        public ActionResult AutoSinProduct(string ProductNum)
        {
            ProductProvider      provider = new ProductProvider();
            List <ProductEntity> list     = provider.GetListByCache();
            ProductEntity        entity   = null;

            if (!list.IsNullOrEmpty() && !ProductNum.IsEmpty())
            {
                entity = list.FirstOrDefault(a => a.SnNum == ProductNum);
            }
            entity = entity.IsNull() ? new ProductEntity() : entity;
            List <ProductEntity> listSource = new List <ProductEntity>();

            listSource.Add(entity);
            StringBuilder sb         = new StringBuilder();
            JsonObject    jsonObject = null;

            foreach (ProductEntity t in listSource)
            {
                jsonObject = new JsonObject();
                jsonObject.AddProperty("BarCode", t.BarCode);
                jsonObject.AddProperty("ProductName", t.ProductName);
                jsonObject.AddProperty("SnNum", t.SnNum);
                jsonObject.AddProperty("CateNum", t.CateNum);
                jsonObject.AddProperty("CateName", t.CateName);
                jsonObject.AddProperty("InPrice", t.InPrice);
                jsonObject.AddProperty("Unit", t.UnitNum);
                jsonObject.AddProperty("UnitName", t.UnitName);
                jsonObject.AddProperty("Size", t.Size.Escape());
                jsonObject.AddProperty("Num", t.Num);
                sb.Append(jsonObject.ToString() + "\n");
            }
            if (sb.Length == 0)
            {
                sb.Append("\n");
            }
            return(Content(sb.ToString()));
        }