Пример #1
0
        /// <summary>
        /// 查询库存变化单据
        /// </summary>
        /// <param name="queryFilter"></param>
        /// <returns></returns>
        public static QueryResult <InventoryItemCardInfo> QueryCardItemOrdersRelated(InventoryItemCardQueryFilter queryFilter)
        {
            QueryResult <InventoryItemCardInfo> result = new QueryResult <InventoryItemCardInfo>();

            CustomDataCommand dataCommand;

            if (!string.IsNullOrEmpty(queryFilter.StockSysNo))
            {
                dataCommand = DataCommandManager.CreateCustomDataCommandFromConfig("QueryItemsCardReLatedOrder");
                dataCommand.SetParameterValue("@WarehouseSysNo", queryFilter.StockSysNo);
            }
            else
            {
                dataCommand = DataCommandManager.CreateCustomDataCommandFromConfig("QueryItemsCardReLatedOrderWithOutWarehouseNumber");
            }

            dataCommand.SetParameterValue("@ItemSysNo", queryFilter.ProductSysNo);
            dataCommand.SetParameterValue("@MerchantSysNo", queryFilter.MerchantSysNo);

            if (queryFilter.RMAInventoryOnlineDate != null && queryFilter.RMAInventoryOnlineDate != new DateTime())
            {
                dataCommand.AddInputParameter("@RevertTime", DbType.DateTime, queryFilter.RMAInventoryOnlineDate.ToString("yyyy-MM-dd"));
            }

            dataCommand.SetParameterValue("@CompanyCode", queryFilter.CompanyCode);//8601
            using (var sqlBuilder = new DynamicQuerySqlBuilder(dataCommand.CommandText, dataCommand, queryFilter, "OrderTime DESC"))
            {
                dataCommand.CommandText = sqlBuilder.BuildQuerySql();

                List <InventoryItemCardInfo> resultList = dataCommand.ExecuteEntityList <InventoryItemCardInfo>();
                int totalCount = Convert.ToInt32(dataCommand.GetParameterValue("@TotalCount"));

                result = new QueryResult <InventoryItemCardInfo>()
                {
                    PageInfo = new PageInfo()
                    {
                        PageIndex = queryFilter.PageIndex, PageSize = queryFilter.PageSize, TotalCount = totalCount, SortBy = queryFilter.SortFields
                    }, ResultList = resultList
                };
            }

            #region 计算结存数量
            if (result.ResultList != null && result.ResultList.Count > 0)
            {
                var orderThenQty = 0;
                for (var i = result.ResultList.Count - 1; i >= 0; i--)
                {
                    InventoryItemCardInfo cardInfo = result.ResultList[i];
                    //OrderCodeFromDB=3 means po-调价(instock)(PO调价单)
                    if (cardInfo.OrderCode != "3")
                    {
                        orderThenQty += cardInfo.OrderQty;
                    }
                    cardInfo.OrderThenQty = orderThenQty;
                }
            }
            #endregion

            return(result);
        }
Пример #2
0
        public JsonResult QueryCardItemOrders()
        {
            InventoryItemCardQueryFilter qFilter = BuildQueryFilterEntity <InventoryItemCardQueryFilter>();

            qFilter.MerchantSysNo = UserAuthHelper.GetCurrentUser().SellerSysNo.ToString();
            var result = InventoryService.QueryCardItemOrders(qFilter);

            return(AjaxGridJson(result));
        }
Пример #3
0
        public QueryResult QueryCardItemOrders(InventoryItemCardQueryFilter queryFilter)
        {
            //获取RMAInventoryOnlineDate:
            queryFilter.RMAInventoryOnlineDate = ObjectFactory <InventoryItemCardAppService> .Instance.GetRMAInventoryOnlineDateForItemCardQuery("RMAInventoryOnlineDate", queryFilter.CompanyCode);

            QueryResult result        = new QueryResult();
            int         getTotalCount = 0;

            result.Data = ObjectFactory <IInventoryCardItemsQueryDA> .Instance.QueryCardItemOrdersRelated(queryFilter, out getTotalCount);

            result.TotalCount = getTotalCount;
            return(result);
        }
Пример #4
0
        /// <summary>
        /// 查询库存变化单据
        /// </summary>
        /// <param name="queryFilter"></param>
        /// <returns></returns>
        public static QueryResult <InventoryItemCardInfo> QueryCardItemOrders(InventoryItemCardQueryFilter queryFilter)
        {
            if (queryFilter == null || string.IsNullOrEmpty(queryFilter.ProductSysNo))
            {
                throw new BusinessException("请输入商品编号");
            }
            if (string.IsNullOrEmpty(queryFilter.MerchantSysNo))
            {
                throw new BusinessException("商家编号不能为空");
            }
            queryFilter.CompanyCode = "8601";

            //获取RMAInventoryOnlineDate:
            string rmaInventoryOnlineDate = CommonDA.GetSysConfigurationValue("RMAInventoryOnlineDate", queryFilter.CompanyCode);

            queryFilter.RMAInventoryOnlineDate = string.IsNullOrEmpty(rmaInventoryOnlineDate) ? new DateTime() : Convert.ToDateTime(rmaInventoryOnlineDate);

            return(InventoryDA.QueryCardItemOrdersRelated(queryFilter));
        }
Пример #5
0
        public DataTable QueryCardItemOrdersRelated(InventoryItemCardQueryFilter queryFilter, out int totalCount)
        {
            DataTable dt = new DataTable();

            if (queryFilter == null || queryFilter.ProductSysNo == null || !queryFilter.ProductSysNo.HasValue)
            {
                totalCount = 0;
                return(null);
            }
            PagingInfoEntity pagingInfo = new PagingInfoEntity()
            {
                SortField     = queryFilter.PagingInfo.SortBy,
                StartRowIndex = queryFilter.PagingInfo.PageIndex * queryFilter.PagingInfo.PageSize,
                MaximumRows   = queryFilter.PagingInfo.PageSize
            };
            CustomDataCommand dataCommand;

            if (queryFilter.StockSysNo.HasValue)
            {
                dataCommand = DataCommandManager.CreateCustomDataCommandFromConfig("QueryItemsCardReLatedOrder");
                dataCommand.SetParameterValue("@WarehouseSysNo", queryFilter.StockSysNo.Value);
            }
            else
            {
                dataCommand = DataCommandManager.CreateCustomDataCommandFromConfig("QueryItemsCardReLatedOrderWithOutWarehouseNumber");
            }

            dataCommand.SetParameterValue("@ItemSysNo", queryFilter.ProductSysNo.Value);

            if (queryFilter.RMAInventoryOnlineDate.HasValue)
            {
                dataCommand.AddInputParameter("@RevertTime", DbType.DateTime, queryFilter.RMAInventoryOnlineDate.Value);
            }

            dataCommand.SetParameterValue("@CompanyCode", "8601");//[Mark][Alan.X.Luo 硬编码]
            using (var sqlBuilder = new DynamicQuerySqlBuilder(dataCommand.CommandText, dataCommand, pagingInfo, "OrderTime DESC"))
            {
                dataCommand.CommandText = sqlBuilder.BuildQuerySql();
                dt         = dataCommand.ExecuteDataTable();
                totalCount = Convert.ToInt32(dataCommand.GetParameterValue("@TotalCount"));
            }

            #region 计算结存数量
            if (null != dt)
            {
                dt.Columns.Add("OrderThenQty", typeof(int));
            }
            var orderThenQty = 0;
            for (var i = dt.Rows.Count - 1; i >= 0; i--)
            {
                //OrderCodeFromDB=3 means po-调价(instock)(PO调价单)
                if (dt.Rows[i]["OrderCode"] != null && dt.Rows[i]["OrderCode"].ToString() != "3")
                {
                    orderThenQty += (dt.Rows[i]["OrderQty"] == null ? 0 : int.Parse(dt.Rows[i]["OrderQty"].ToString()));
                }
                dt.Rows[i]["OrderThenQty"] = orderThenQty;
            }
            #endregion

            if (null != dt && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    dr["OrderNameString"] = CodeNamePairManager.GetName("Inventory", "InventoryCardOrderType", dr["OrderName"].ToString());
                }
            }

            return(dt);
        }