Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="wareHousesId"></param>
        /// <param name="info"></param>
        private void UpdateInventoryLederInfo(int wareHousesId, XMSaleReturnProductDetails info, string platformMerchantCode)
        {
            XMInventoryLedger inventoryLeder = null;

            if (platformMerchantCode != "")
            {
                inventoryLeder = base.XMInventoryLedgerService.GetXMInventoryLedgerByParm(wareHousesId, platformMerchantCode);
                if (inventoryLeder != null)     //更新数据
                {
                    //更新入库数量(加上)
                    inventoryLeder.InCount    = (inventoryLeder.InCount == null ? 0 : inventoryLeder.InCount) + info.RejectionProdcutsCount;
                    inventoryLeder.InMoney    = info.RejectionProductsPrice * inventoryLeder.InCount;
                    inventoryLeder.UpdateDate = DateTime.Now;
                    inventoryLeder.UpdateID   = HozestERPContext.Current.User.CustomerID;
                    base.XMInventoryLedgerService.UpdateXMInventoryLedger(inventoryLeder);
                }
                else
                {
                    XMInventoryLedger inventoryLederInfo = new XMInventoryLedger();
                    inventoryLederInfo.WarehouseId          = wareHousesId;
                    inventoryLederInfo.ProductId            = info.ProductId;
                    inventoryLederInfo.PlatformMerchantCode = platformMerchantCode;
                    inventoryLederInfo.AfloatCount          = 0;
                    inventoryLederInfo.AfloatPrice          = info.ProductPrice;
                    inventoryLederInfo.AfloatMoney          = inventoryLederInfo.AfloatCount * inventoryLederInfo.AfloatPrice;
                    inventoryLederInfo.InCount    = info.ProductCount;
                    inventoryLederInfo.InPrice    = info.ProductPrice;
                    inventoryLederInfo.InMoney    = inventoryLederInfo.InCount * inventoryLederInfo.InPrice;
                    inventoryLederInfo.OutCount   = 0;
                    inventoryLederInfo.OutPrice   = info.ProductPrice;
                    inventoryLederInfo.OutMoney   = inventoryLederInfo.OutCount * inventoryLederInfo.OutPrice;
                    inventoryLederInfo.CreateDate = DateTime.Now;
                    inventoryLederInfo.CreateID   = HozestERPContext.Current.User.CustomerID;
                    base.XMInventoryLedgerService.InsertXMInventoryLedger(inventoryLederInfo);
                }
                //新增库存总账明细(入库)
                var     inventoryLederDetail = base.XMInventoryLedgerDetailService.GetXMInventoryLedgerDetailListByParm(wareHousesId, platformMerchantCode);
                decimal price = 0;
                decimal money = 0;
                XMInventoryLedgerDetail details = new XMInventoryLedgerDetail();
                details.WarehouseId          = wareHousesId;
                details.ProductId            = info.ProductId;
                details.PlatformMerchantCode = platformMerchantCode;
                details.InCount  = info.RejectionProdcutsCount;                 //入库数量
                details.InPrice  = info.RejectionProductsPrice;                 //入库单价
                details.InMoney  = info.RejectionsaleMoney;                     //金额
                details.OutCount = 0;
                details.OutPrice = price;
                details.OutMoney = money;
                if (inventoryLederDetail != null && inventoryLederDetail.Count > 0)
                {
                    //默认最后一条(余量)
                    int BalanceCount = inventoryLederDetail[0].BalanceCount.Value;
                    details.BalanceCount = BalanceCount + details.InCount;
                }
                else
                {
                    details.BalanceCount = details.InCount;
                }
                details.BalancePrice = info.RejectionProductsPrice;
                details.BalanceMoney = details.BalancePrice * details.BalanceCount;
                var saleReturns = base.XMSaleReturnService.GetXMSaleReturnById(info.SaleReturnId);
                if (saleReturns != null)
                {
                    details.RefNumber = saleReturns.Ref;
                }
                details.BizDate   = DateTime.Now;
                details.BizUserId = HozestERPContext.Current.User.CustomerID;
                int refType = 1004;              //业务类型   1 采购入库 1000 采购退货  1002 销售出库 1004 销售退货入库  1008 库存盘点-盘盈入库  1010 库存盘点-盘亏出库
                details.RefType = refType;
                base.XMInventoryLedgerDetailService.InsertXMInventoryLedgerDetail(details);
            }
        }
Example #2
0
        /// <summary>
        /// 更新出库记录
        /// </summary>
        /// <param name="wareHousesId"></param>
        /// <param name="info"></param>
        private void UpdateDeliveryInventoryLederInfo(int wareHousesId, XMAllocateProductDetails info)
        {
            var inventoryLeder = base.XMInventoryLedgerService.GetXMInventoryLedgerByParm(wareHousesId, info.PlatformMerchantCode);
            var productDetails = base.XMProductDetailsService.GetXMProductDetailsListByProductId(info.ProductId.Value);

            if (inventoryLeder != null)     //更新数据
            {
                //更新出库数量(加上)
                inventoryLeder.OutCount = (inventoryLeder.OutCount == null ? 0 : inventoryLeder.OutCount) + info.ProductCount;
                if (productDetails != null && productDetails.Count > 0)
                {
                    inventoryLeder.OutPrice = productDetails[0].Costprice;
                }
                inventoryLeder.OutMoney   = inventoryLeder.OutPrice * inventoryLeder.OutCount;
                inventoryLeder.UpdateDate = DateTime.Now;
                inventoryLeder.UpdateID   = HozestERPContext.Current.User.CustomerID;
                base.XMInventoryLedgerService.UpdateXMInventoryLedger(inventoryLeder);
            }
            else
            {
                XMInventoryLedger inventoryLederInfo = new XMInventoryLedger();
                inventoryLederInfo.OutCount             = info.ProductCount;
                inventoryLederInfo.WarehouseId          = wareHousesId;
                inventoryLederInfo.ProductId            = info.ProductId.Value;
                inventoryLederInfo.PlatformMerchantCode = info.PlatformMerchantCode;
                if (productDetails != null && productDetails.Count > 0)
                {
                    inventoryLederInfo.OutPrice = productDetails[0].Costprice;
                }
                inventoryLederInfo.OutMoney   = inventoryLederInfo.OutCount * inventoryLederInfo.OutPrice;
                inventoryLederInfo.CreateDate = DateTime.Now;
                inventoryLederInfo.CreateID   = HozestERPContext.Current.User.CustomerID;
                base.XMInventoryLedgerService.InsertXMInventoryLedger(inventoryLederInfo);
            }
            //新增库存总账明细(出库)
            var     inventoryLederDetail = base.XMInventoryLedgerDetailService.GetXMInventoryLedgerDetailListByParm(wareHousesId, info.PlatformMerchantCode);
            decimal price = 0;
            decimal money = 0;
            XMInventoryLedgerDetail details = new XMInventoryLedgerDetail();

            details.WarehouseId          = wareHousesId;
            details.ProductId            = info.ProductId;
            details.PlatformMerchantCode = info.PlatformMerchantCode;
            details.OutCount             = info.ProductCount;      //出库数量
            if (productDetails != null && productDetails.Count > 0)
            {
                details.OutPrice = productDetails[0].Costprice;              //出库单价
            }
            details.OutMoney = details.OutPrice * info.ProductCount;
            details.InCount  = 0;
            details.InPrice  = price;
            details.InMoney  = money;
            if (inventoryLederDetail != null && inventoryLederDetail.Count > 0)
            {
                //默认最后一条(余量)
                int BalanceCount = inventoryLederDetail[0].BalanceCount.Value;
                details.BalanceCount = BalanceCount - info.ProductCount;
            }
            else           //
            {
                details.BalanceCount = info.ProductCount;
            }
            details.BalancePrice = price;
            details.BalanceMoney = details.BalancePrice * details.BalanceCount;
            var dbInfo = base.XMAllocateInfoService.GetXMAllocateInfoById(info.AllocateId);

            if (dbInfo != null)
            {
                details.RefNumber = dbInfo.Ref;        //业务单号
            }
            details.BizDate   = DateTime.Now;
            details.BizUserId = HozestERPContext.Current.User.CustomerID;
            int refType = 1011;              //业务类型   1 采购入库 1000 采购退货  1002 销售出库 1004 销售退货入库  1008 库存盘点-盘盈入库  1010 库存盘点-盘亏出库  1011 调拨出库

            details.RefType = refType;
            base.XMInventoryLedgerDetailService.InsertXMInventoryLedgerDetail(details);
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="wareHousesId"></param>
        /// <param name="info"></param>
        private void UpdateInventoryLederInfo(int wareHousesId, XMPurchaseRejectedProductDetails info)
        {
            var inventoryLeder = base.XMInventoryLedgerService.GetXMInventoryLedgerByParm(wareHousesId, info.PlatformMerchantCode);

            if (inventoryLeder != null)     //更新数据
            {
                //更新出库数量
                inventoryLeder.OutCount   = (inventoryLeder.OutCount == null ? 0 : inventoryLeder.OutCount) + info.RejectionCount;
                inventoryLeder.OutPrice   = CalculateProductPrice(wareHousesId, info, 1002);
                inventoryLeder.OutMoney   = inventoryLeder.OutPrice * inventoryLeder.OutCount;
                inventoryLeder.UpdateDate = DateTime.Now;
                inventoryLeder.UpdateID   = HozestERPContext.Current.User.CustomerID;
                base.XMInventoryLedgerService.UpdateXMInventoryLedger(inventoryLeder);
            }
            else
            {
                XMInventoryLedger inventoryLederInfo = new XMInventoryLedger();
                inventoryLederInfo.WarehouseId          = wareHousesId;
                inventoryLederInfo.ProductId            = info.ProductId;
                inventoryLederInfo.PlatformMerchantCode = info.PlatformMerchantCode;
                inventoryLederInfo.OutCount             = info.RejectionCount;
                inventoryLederInfo.OutPrice             = info.RejectionProductPrice;
                inventoryLederInfo.OutMoney             = inventoryLederInfo.OutCount * inventoryLederInfo.OutPrice;
                inventoryLederInfo.InCount     = 0;
                inventoryLederInfo.InPrice     = info.RejectionProductPrice;
                inventoryLederInfo.InMoney     = inventoryLederInfo.InCount * inventoryLederInfo.InPrice;
                inventoryLederInfo.AfloatCount = 0;
                inventoryLederInfo.AfloatPrice = info.RejectionProductPrice;
                inventoryLederInfo.AfloatMoney = inventoryLederInfo.AfloatCount * inventoryLederInfo.AfloatPrice;
                inventoryLederInfo.CreateDate  = DateTime.Now;
                inventoryLederInfo.CreateID    = HozestERPContext.Current.User.CustomerID;
                base.XMInventoryLedgerService.InsertXMInventoryLedger(inventoryLederInfo);
            }
            //新增库存总账明细(出库)
            var     inventoryLederDetail = base.XMInventoryLedgerDetailService.GetXMInventoryLedgerDetailListByParm(wareHousesId, info.PlatformMerchantCode);
            decimal price = 0;
            decimal money = 0;
            XMInventoryLedgerDetail details = new XMInventoryLedgerDetail();

            details.WarehouseId          = wareHousesId;
            details.ProductId            = info.ProductId;
            details.PlatformMerchantCode = info.PlatformMerchantCode;
            details.OutCount             = info.RejectionCount;
            details.OutPrice             = info.RejectionProductPrice;
            details.OutMoney             = info.RejectionCount * info.RejectionProductPrice;
            details.InCount = 0;
            details.InPrice = price;
            details.InMoney = money;
            if (inventoryLederDetail != null && inventoryLederDetail.Count > 0)
            {
                //默认最后一条(余量)
                int BalanceCount = inventoryLederDetail[0].BalanceCount.Value;
                details.BalanceCount = BalanceCount - details.OutCount;
            }
            else
            {
                details.BalanceCount = 0;
            }
            details.BalancePrice = info.RejectionProductPrice;
            details.BalanceMoney = details.BalancePrice * details.BalanceCount;
            var purchaseRejectedInfo = base.XMPurchaseRejectedService.GetXMPurchaseRejectedById(info.PrId);

            if (purchaseRejectedInfo != null)
            {
                details.RefNumber = purchaseRejectedInfo.Ref;
            }
            details.BizDate   = DateTime.Now;
            details.BizUserId = HozestERPContext.Current.User.CustomerID;
            int refType = 1003;              //业务类型   1 采购入库 1000 采购退货  1002 销售出库  1003 采购入库退货 1004 销售退货入库  1008 库存盘点-盘盈入库  1010 库存盘点-盘亏出库

            details.RefType = refType;
            base.XMInventoryLedgerDetailService.InsertXMInventoryLedgerDetail(details);
        }
Example #4
0
        /// <summary>
        /// 库存帐查询 库存盘点 盘盈入库
        /// </summary>
        private void UpdateInventoryLederStorageInfo(int wareHouseId, XMAdjustedProductDetail details)
        {
            var inventoryLeder = base.XMInventoryLedgerService.GetXMInventoryLedgerByParm(wareHouseId, details.PlatformMerchantCode);

            if (inventoryLeder != null)     //更新数据
            {
                //更新入库数量(加上)
                inventoryLeder.InCount    = (inventoryLeder.InCount == null ? 0 : inventoryLeder.InCount) + details.ProductCount;
                inventoryLeder.InMoney    = details.ProductPrice * inventoryLeder.InCount;
                inventoryLeder.InPrice    = details.ProductPrice;
                inventoryLeder.UpdateDate = DateTime.Now;
                inventoryLeder.UpdateID   = HozestERPContext.Current.User.CustomerID;
                base.XMInventoryLedgerService.UpdateXMInventoryLedger(inventoryLeder);
            }
            else                       //新增数据
            {
                XMInventoryLedger inventoryLederInfo = new XMInventoryLedger();
                inventoryLederInfo.WarehouseId          = wareHouseId;
                inventoryLederInfo.ProductId            = details.ProductId;
                inventoryLederInfo.PlatformMerchantCode = details.PlatformMerchantCode;
                inventoryLederInfo.AfloatCount          = 0;
                inventoryLederInfo.AfloatPrice          = details.ProductPrice;
                inventoryLederInfo.AfloatMoney          = inventoryLederInfo.AfloatCount * inventoryLederInfo.AfloatPrice;
                inventoryLederInfo.InCount    = details.ProductCount;
                inventoryLederInfo.InPrice    = details.ProductPrice;
                inventoryLederInfo.InMoney    = inventoryLederInfo.InCount * inventoryLederInfo.InPrice;
                inventoryLederInfo.OutCount   = 0;
                inventoryLederInfo.OutPrice   = details.ProductPrice;
                inventoryLederInfo.OutMoney   = inventoryLederInfo.OutCount * inventoryLederInfo.OutPrice;
                inventoryLederInfo.CreateDate = DateTime.Now;
                inventoryLederInfo.CreateID   = HozestERPContext.Current.User.CustomerID;
                base.XMInventoryLedgerService.InsertXMInventoryLedger(inventoryLederInfo);
            }
            //新增库存总账明细(入库)
            var     inventoryLederDetail = base.XMInventoryLedgerDetailService.GetXMInventoryLedgerDetailListByParm(wareHouseId, details.PlatformMerchantCode);
            decimal price = 0;
            decimal money = 0;
            XMInventoryLedgerDetail detail = new XMInventoryLedgerDetail();

            detail.WarehouseId          = wareHouseId;
            detail.ProductId            = details.ProductId;
            detail.PlatformMerchantCode = details.PlatformMerchantCode;
            detail.InCount  = details.ProductCount;                 //入库数量
            detail.InPrice  = details.ProductPrice;                 //入库单价
            detail.InMoney  = details.ProductMoney;
            detail.OutCount = 0;
            detail.OutPrice = price;
            detail.OutMoney = money;
            if (inventoryLederDetail != null && inventoryLederDetail.Count > 0)
            {
                //默认最后一条(余量)
                int BalanceCount = inventoryLederDetail[0].BalanceCount.Value;
                detail.BalanceCount = BalanceCount + detail.InCount;
            }
            else           //
            {
                detail.BalanceCount = detail.InCount;
            }
            detail.BalancePrice = details.ProductPrice;
            detail.BalanceMoney = detail.BalancePrice * detail.BalanceCount;
            var adjustInfo = base.XMAdjustedInfoService.GetXMAdjustedInfoById(details.AdId);

            if (adjustInfo != null)
            {
                var pdInfo = base.XMPdInfoService.GetXMPdInfoById(adjustInfo.PdInfoId.Value);
                if (pdInfo != null)
                {
                    detail.RefNumber = pdInfo.Ref;
                }
            }
            detail.BizDate   = DateTime.Now;
            detail.BizUserId = HozestERPContext.Current.User.CustomerID;
            int refType = 1008;    //业务类型   1 采购入库 1000 采购退货  1002 销售出库 1004 销售退货入库  1008 库存盘点-盘盈入库  1010 库存盘点-盘亏出库

            detail.RefType = refType;
            base.XMInventoryLedgerDetailService.InsertXMInventoryLedgerDetail(detail);
        }