public static BadReportDetail_CE ToCE(BadReportDetailEntity item)
 {
     BadReportDetail_CE target = new BadReportDetail_CE();
     target.ID=item.ID;
     target.SnNum=item.SnNum;
     target.OrderNum=item.OrderNum;
     target.ProductName=item.ProductName;
     target.BarCode=item.BarCode;
     target.ProductNum=item.ProductNum;
     target.BatchNum=item.BatchNum;
     target.Num=item.Num;
     target.InPrice=item.InPrice;
     target.Amount=item.Amount;
     target.CreateTime=item.CreateTime;
     target.StorageNum=item.StorageNum;
     target.FromLocalNum=item.FromLocalNum;
     target.ToLocalNum=item.ToLocalNum;
     return target;
 }
        public ActionResult Detail()
        {
            string orderNum = WebUtil.GetQueryStringValue<string>("orderNum", string.Empty);
            string flag = WebUtil.GetQueryStringValue<string>("flag", string.Empty);
            Bill<BadReportEntity, BadReportDetailEntity> bill = new BadOrder();
            BadReportEntity entity = new BadReportEntity();
            entity.OrderNum = orderNum;
            entity = bill.GetOrder(entity);
            entity = entity.IsNull() ? new BadReportEntity() : entity;
            entity.StatusLable = EnumHelper.GetEnumDesc<EAudite>(entity.Status);
            ViewBag.BadReport = entity;

            BadReportDetailEntity detail = new BadReportDetailEntity();
            detail.OrderNum = orderNum;
            List<BadReportDetailEntity> listResult = bill.GetOrderDetail(detail);
            listResult = listResult.IsNull() ? new List<BadReportDetailEntity>() : listResult;
            ViewBag.Detail = listResult;

            ViewBag.Flag = flag;
            return View();
        }
Exemple #3
0
 /// <summary>
 /// 查询单据分页
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="pageInfo"></param>
 /// <param name="storageNum"></param>
 /// <returns></returns>
 public List<BadReportEntity> GetList(BadReportEntity entity, ref PageInfo pageInfo, string storageNum)
 {
     entity.IncludeAll();
     entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete);
     entity.And("Status", ECondition.Eth, (int)EAudite.Pass);
     entity.OrderBy(a => a.ID, EOrderBy.DESC);
     BadReportDetailEntity badDetail = new BadReportDetailEntity();
     badDetail.Include(a => new { ProductName = a.ProductName, BarCode = a.BarCode, ProductNum = a.ProductNum });
     badDetail.Where(a => a.StorageNum == storageNum);
     entity.Left<BadReportDetailEntity>(badDetail, new Params<string, string>() { Item1 = "OrderNum", Item2 = "OrderNum" });
     int rowCount = 0;
     List<BadReportEntity> listResult = this.BadReport.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);
     int allNum = GetAllNum();
     if (!listResult.IsNullOrEmpty())
     {
         foreach (BadReportEntity item in listResult)
         {
             item.NumPCT = (item.Num * 100.00f) / allNum;
         }
     }
     pageInfo.RowCount = rowCount;
     return listResult;
 }
 public ActionResult LoadProduct([ModelBinder(typeof(JsonBinder<List<LocalProductEntity>>))]List<LocalProductEntity> list)
 {
     List<BadReportDetailEntity> ListProducts = Session[CacheKey.TEMPDATA_CACHE_BADPRODUCTDETAIL] as List<BadReportDetailEntity>;
     ListProducts = ListProducts.IsNull() ? new List<BadReportDetailEntity>() : ListProducts;
     if (!list.IsNullOrEmpty())
     {
         LocationProvider localProvider = new LocationProvider();
         foreach (LocalProductEntity item in list)
         {
             string BarCode = item.BarCode;
             string ProductNum = item.ProductNum;
             string StorageNum = item.StorageNum;
             string FromLocalNum = item.LocalNum;
             string BatchNum = item.BatchNum;
             if (ListProducts.Exists(a => a.BarCode == BarCode && a.ProductNum == ProductNum && a.BatchNum == BatchNum && a.StorageNum == StorageNum && a.FromLocalNum == FromLocalNum))
             {
                 BadReportDetailEntity entity = ListProducts.FirstOrDefault(a => a.BarCode == BarCode && a.ProductNum == ProductNum && a.BatchNum == BatchNum && a.StorageNum == StorageNum && a.FromLocalNum == FromLocalNum);
                 entity.Num += item.Num;
             }
             else
             {
                 BadReportDetailEntity entity = new BadReportDetailEntity();
                 entity.SnNum = SequenceProvider.GetSequence(typeof(BadReportDetailEntity));
                 ProductProvider provider = new ProductProvider();
                 ProductEntity product = provider.GetProductBySn(ProductNum);
                 entity.ProductName = product.ProductName;
                 entity.BarCode = product.BarCode;
                 entity.ProductNum = product.SnNum;
                 entity.BatchNum = item.BatchNum;
                 entity.LocalNum = item.Num;
                 entity.Num = item.Qty;
                 entity.Amount = product.InPrice * item.Num;
                 entity.InPrice = product.InPrice;
                 entity.CreateTime = DateTime.Now;
                 entity.StorageNum = StorageNum;
                 entity.FromLocalNum = item.LocalNum;
                 LocationEntity fromLocal = localProvider.GetSingleByNumCache(item.LocalNum);
                 if (fromLocal != null)
                 {
                     entity.FromLocalName = fromLocal.LocalName;
                 }
                 LocationEntity localtion = localProvider.GetDefaultLocal(StorageNum, ELocalType.Bad);
                 if (localtion != null)
                 {
                     entity.ToLocalNum = localtion.LocalNum;
                 }
                 ListProducts.Add(entity);
             }
         }
         Session[CacheKey.TEMPDATA_CACHE_BADPRODUCTDETAIL] = ListProducts;
     }
     return Content(string.Empty);
 }
 public ActionResult Edit()
 {
     string orderNum = WebUtil.GetQueryStringValue<string>("orderNum",string.Empty);
     if (orderNum.IsEmpty())
     {
         Response.Redirect("/Bad/Product/List");
     }
     Bill<BadReportEntity, BadReportDetailEntity> bill = new BadOrder();
     BadReportEntity entity = new BadReportEntity();
     entity.OrderNum = orderNum;
     entity = bill.GetOrder(entity);
     if (entity.IsNull())
     {
         Response.Redirect("/Bad/Product/List");
     }
     ViewBag.BadType = EnumHelper.GetOptions<EBadType>(entity.BadType, "请选择报损类型");
     ViewBag.ProductType = EnumHelper.GetOptions<EProductType>(entity.ProductType, "请选择入库产品类型");
     ViewBag.Entity = entity;
     BadReportDetailEntity detail = new BadReportDetailEntity();
     detail.OrderNum = orderNum;
     List<BadReportDetailEntity> listDetail = bill.GetOrderDetail(detail);
     Session[CacheKey.TEMPDATA_CACHE_BADPRODUCTDETAIL] = listDetail;
     return View();
 }