public ActionResult AddOrderDetailProduct([ModelBinder(typeof(JsonBinder<string[]>))] string[] ProductItems,
            [ModelBinder(typeof(JsonBinder<string[]>))] string[] SnItems,
            [ModelBinder(typeof(JsonBinder<int[]>))]int[] QtyItems)
        {
            List<OutStoDetailEntity> list = Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] as List<OutStoDetailEntity>;
            list = list.IsNull() ? new List<OutStoDetailEntity>() : list;

            OrderProvider provider = new OrderProvider();
            for (int i = 0; i < ProductItems.Length; i++)
            {
                string snNum = SnItems[i];
                int qty = QtyItems[i];
                string productNum = ProductItems[i];
                OrderDetailEntity detail = provider.GetOrderDetailBySnNum(snNum);
                detail = detail.IsNull() ? new OrderDetailEntity() : detail;
                if (detail.IsNotNull())
                {
                    list.Remove(a => a.ContractSn == detail.SnNum);
                    OutStoDetailEntity entity = new OutStoDetailEntity();
                    entity.SnNum = SequenceProvider.GetSequence(typeof(OutStoDetailEntity));
                    entity.ProductName = detail.ProductName;
                    entity.BarCode = detail.BarCode;
                    entity.ContractOrder = detail.OrderNum;
                    entity.ContractSn = detail.SnNum;
                    entity.BatchNum = "";
                    entity.ProductNum = detail.ProductNum;
                    entity.LocalNum = ResourceManager.GetSettingEntity("STORE_DEFAULT_MATERIAL_LocalNum").Value;//detail.LocalNum;
                    entity.LocalName = ResourceManager.GetSettingEntity("STORE_DEFAULT_MATERIAL_LocalName").Value;//detail.LocalName;
                    entity.StorageNum = this.DefaultStore;
                    entity.Num = qty;
                    entity.IsPick = (int)EBool.No;
                    entity.Size = detail.Size.IsEmpty() ? "" : detail.Size;
                    entity.RealNum = detail.RealNum;
                    entity.OutPrice = 0;//detail.InPrice;
                    entity.Amount = 0;//detail.InPrice * entity.Num;
                    entity.CreateTime = DateTime.Now;
                    list.Add(entity);
                }
            }
            if (!list.IsNullOrEmpty())
            {
                Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] = list;
            }
            return Content(string.Empty);
        }
 public ActionResult GetList()
 {
     int Status = WebUtil.GetFormValue<int>("Status", 0);
     string OrderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
     string CusName = WebUtil.GetFormValue<string>("CusName", string.Empty);
     string beginTime = WebUtil.GetFormValue<string>("beginTime", string.Empty);
     string endTime = WebUtil.GetFormValue<string>("endTime", string.Empty);
     string order = WebUtil.GetFormValue<string>("order", string.Empty);
     int OutType = WebUtil.GetFormValue<int>("OutType", 0);
     string planNum = WebUtil.GetFormValue<string>("planNum");
     int pageSize = WebUtil.GetFormValue<int>("PageSize", 10);
     int pageIndex = WebUtil.GetFormValue<int>("PageIndex", 1);
     PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
     OutStorageEntity entity = new OutStorageEntity();
     if (Status > 0)
     {
         entity.Where(a => a.Status == Status);
     }
     if (!OrderNum.IsEmpty())
     {
         entity.Where("OrderNum", ECondition.Like, "%" + OrderNum + "%");
     }
     if (!CusName.IsEmpty())
     {
         entity.Begin<OutStorageEntity>()
             .And<OutStorageEntity>("CusNum", ECondition.Like, "%" + CusName + "%")
             .Or<OutStorageEntity>("CusName", ECondition.Like, "%" + CusName + "%")
             .End<OutStorageEntity>()
             ;
     }
     if (!beginTime.IsEmpty() && !endTime.IsEmpty())
     {
         entity.Where("OrderTime", ECondition.Between, ConvertHelper.ToType<DateTime>(beginTime), ConvertHelper.ToType<DateTime>(endTime));
     }
     entity.And(a => a.StorageNum == this.DefaultStore);
     if (!order.IsEmpty())
     {
         OrderProvider orderProvider = new OrderProvider();
         List<string> listContractOrder = orderProvider.GetOrderPlan(order);
         listContractOrder = listContractOrder.IsNull() ? new List<string>() : listContractOrder;
         if (listContractOrder.Count == 0)
         {
             listContractOrder.Add(order);
         }
         entity.And("ContractOrder", ECondition.In, listContractOrder.ToArray());
     }
     if (OutType > 0)
     {
         entity.And(a => a.OutType == OutType);
     }
     if (!planNum.IsEmpty())
     {
         OutStoDetailEntity detail = new OutStoDetailEntity();
         detail.Where("ContractOrder", ECondition.Like, "%" + planNum + "%");
         entity.Left<OutStoDetailEntity>(detail, new Params<string, string>() { Item1 = "OrderNum", Item2 = "OrderNum" });
     }
     Bill<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
     List<OutStorageEntity> listResult = bill.GetList(entity, ref pageInfo);
     listResult = listResult == null ? new List<OutStorageEntity>() : listResult;
     string json = ConvertJson.ListToJson<OutStorageEntity>(listResult, "List");
     this.ReturnJson.AddProperty("Data", json);
     this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
     return Content(this.ReturnJson.ToString());
 }
        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();
        }