Exemplo n.º 1
0
        /// <summary>
        /// 编辑入库单详细数量
        /// </summary>
        /// <param name="snNum"></param>
        /// <param name="num"></param>
        /// <returns></returns>
        public int EditInOrderNum(string snNum, double num)
        {
            InStorDetailEntity detail = new InStorDetailEntity();

            detail = new InStorDetailEntity();
            detail.Include(a => new { a.OrderNum, a.Num, a.InPrice });
            detail.Where(a => a.SnNum == snNum);
            detail = this.InStorDetail.GetSingle(detail);

            int line = 0;

            if (detail != null)
            {
                InStorDetailEntity editEntity = new InStorDetailEntity();
                editEntity.IncludeNum(true).IncludeAmount(true);
                editEntity.Num    = num;
                editEntity.Amount = num * detail.InPrice;
                editEntity.Where(a => a.SnNum == snNum);
                line = this.InStorDetail.Update(editEntity);

                string orderNum = detail.OrderNum;
                detail = new InStorDetailEntity();
                detail.IncludeNum(true).IncludeAmount(true);
                detail.Where(a => a.OrderNum == orderNum);
                List <InStorDetailEntity> list = this.InStorDetail.GetList(detail);

                double          total  = list.Sum(a => a.Num);
                double          amount = list.Sum(a => a.Amount);
                InStorageEntity entity = new InStorageEntity();
                entity.Num    = total;
                entity.Amount = amount;
                entity.IncludeNum(true).IncludeAmount(true);
                entity.Where(a => a.OrderNum == orderNum);

                line += this.InStorage.Update(entity);
            }
            return(line);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获得某个供应商的所有订购产品数量
        /// </summary>
        /// <param name="supNum"></param>
        /// <param name="queryTime"></param>
        /// <param name="storageNum"></param>
        /// <returns></returns>
        public double GetNumBySupNum(string supNum, int queryTime, string storageNum)
        {
            InStorageEntity entity = new InStorageEntity();

            entity.IncludeNum(true);
            entity.Where("CreateTime", ECondition.Between, DateTime.Now.AddDays(-queryTime), DateTime.Now);
            entity.And("StorageNum", ECondition.Eth, storageNum);
            entity.And("SupNum", ECondition.Eth, supNum);
            entity.And("Status", ECondition.Eth, (int)EAudite.Pass);
            entity.And("IsDelete", ECondition.Eth, (int)EIsDelete.NotDelete);
            double allNum = 0;

            try
            {
                allNum = this.InStorage.Sum <double>(entity);
            }
            catch (Exception e)
            {
                allNum = 0;
                log.Info(e.Message);
            }
            return(allNum);
        }