Esempio n. 1
0
        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));
        }