public ActionResult Print() { string orderNum = WebUtil.GetQueryStringValue <string>("orderNum", string.Empty); Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder(); OutStorageEntity entity = new OutStorageEntity(); entity.OrderNum = orderNum; entity = bill.GetOrder(entity); entity = entity.IsNull() ? new OutStorageEntity() : entity; ViewBag.Entity = entity; OutStoDetailEntity detail = new OutStoDetailEntity(); detail.OrderNum = orderNum; List <OutStoDetailEntity> listResult = bill.GetOrderDetail(detail); listResult = listResult.IsNull() ? new List <OutStoDetailEntity>() : listResult; OrderProvider orderProvider = new OrderProvider(); foreach (OutStoDetailEntity item in listResult) { OrderDetailEntity orderDetail = new OrderDetailEntity(); orderDetail.Where(a => a.SnNum == item.ContractSn).And(a => a.OrderNum == item.ContractOrder); orderDetail = orderProvider.GetOrderDetail(orderDetail); if (orderDetail != null) { item.Qty = orderDetail.Num; } } ViewBag.Detail = listResult; return(View()); }
public ActionResult Detail() { string orderNum = WebUtil.GetQueryStringValue <string>("orderNum", string.Empty); string flag = WebUtil.GetQueryStringValue <string>("flag", string.Empty); Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder(); OutStorageEntity entity = new OutStorageEntity(); entity.OrderNum = orderNum; entity = bill.GetOrder(entity); entity = entity.IsNull() ? new OutStorageEntity() : entity; ViewBag.Entity = entity; ViewBag.OutType = EnumHelper.GetEnumDesc <EOutType>(entity.OutType); ViewBag.Status = EnumHelper.GetEnumDesc <EAudite>(entity.Status); OutStoDetailEntity detail = new OutStoDetailEntity(); detail.OrderNum = orderNum; List <OutStoDetailEntity> listResult = bill.GetOrderDetail(detail); listResult = listResult.IsNull() ? new List <OutStoDetailEntity>() : listResult; ProductProvider provider = new ProductProvider(); List <ProductEntity> list = provider.GetListByCache(); list = list.IsNull() ? new List <ProductEntity>() : list; listResult.ForEach(a => { ProductEntity product = null; if (a.BarCode.IsEmpty()) { product = list.SingleOrDefault(b => b.SnNum == a.ProductNum); } else { product = list.SingleOrDefault(b => b.SnNum == a.ProductNum && b.BarCode == a.BarCode); } if (product.IsNotNull()) { a.Size = product.Size.IsEmpty() ? "" : product.Size; } else { a.Size = ""; } }); ViewBag.Detail = listResult; ViewBag.Flag = flag; return(View()); }
public ActionResult Edit() { string orderNum = WebUtil.GetQueryStringValue <string>("orderNum", string.Empty); Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder(); OutStorageEntity entity = new OutStorageEntity(); entity.OrderNum = orderNum; entity = bill.GetOrder(entity); entity = entity.IsNull() ? new OutStorageEntity() : entity; ViewBag.Entity = entity; ViewBag.OutType = EnumHelper.GetOptions <EInType>(entity.OutType, "请选择入库单类型"); ViewBag.ProductType = EnumHelper.GetOptions <EProductType>(entity.ProductType, "请选择入库产品类型"); OutStoDetailEntity detail = new OutStoDetailEntity(); detail.OrderNum = orderNum; List <OutStoDetailEntity> listResult = bill.GetOrderDetail(detail); listResult = listResult.IsNull() ? new List <OutStoDetailEntity>() : listResult; ProductProvider provider = new ProductProvider(); List <ProductEntity> list = provider.GetListByCache(); list = list.IsNull() ? new List <ProductEntity>() : list; listResult.ForEach(a => { ProductEntity product = null; if (a.BarCode.IsEmpty()) { product = list.SingleOrDefault(b => b.SnNum == a.ProductNum); } else { product = list.SingleOrDefault(b => b.SnNum == a.ProductNum && b.BarCode == a.BarCode); } a.OutPrice = product != null ? product.OutPrice : 0; if (product != null) { a.Size = product.Size.IsEmpty() ? "" : product.Size; } else { a.Size = ""; } }); Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] = listResult; return(View()); }
public ActionResult Detail() { string SnNum = WebUtil.GetQueryStringValue <string>("SnNum"); OutStorageEntity entity = null; if (!SnNum.IsEmpty()) { ITopClient client = new TopClientDefault(); Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("CompanyID", CompanyID); dic.Add("SnNum", SnNum); string result = client.Execute(OutStorageApiName.OutStorageApiName_GetOrder, dic); DataResult <OutStorageEntity> dataResult = JsonConvert.DeserializeObject <DataResult <OutStorageEntity> >(result); entity = dataResult.Result; } entity = entity.IsNull() ? new OutStorageEntity() : entity; ViewBag.Entity = entity; return(View()); }
public ActionResult Add() { string SnNum = WebUtil.GetQueryStringValue <string>("SnNum"); OutStorageEntity entity = null; List <OutStoDetailEntity> list = null; if (!SnNum.IsEmpty()) { ITopClient client = new TopClientDefault(); Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("CompanyID", CompanyID); dic.Add("SnNum", SnNum); string result = client.Execute(OutStorageApiName.OutStorageApiName_GetOrder, dic); DataResult <OutStorageEntity> dataResult = JsonConvert.DeserializeObject <DataResult <OutStorageEntity> >(result); entity = dataResult.Result; result = client.Execute(OutStorageApiName.OutStorageApiName_GetDetail, dic); DataResult <List <OutStoDetailEntity> > dataList = JsonConvert.DeserializeObject <DataResult <List <OutStoDetailEntity> > >(result); list = dataList.Result; } if (entity.IsNull()) { entity = new OutStorageEntity(); entity.CreateUser = this.LoginUser.UserNum; entity.CreateUserName = this.LoginUser.UserName; entity.CreateTime = DateTime.Now; entity.SendDate = DateTime.Now; } ViewBag.Entity = entity; list = list.IsNull() ? new List <OutStoDetailEntity>() : list; Session[SessionKey.SESSION_OUTSTORAGE_DETAIL] = list; ViewBag.OutType = EnumHelper.GetOptions <EOutType>(entity.OutType); return(View()); }