示例#1
0
        public void TestGetNameByFilialeId()
        {
            using (ShimsContext.Create())
            {
                //模拟返回结果
                ShimFilialeSao.GetAllFiliale = () => new List <FilialeInfo> {
                    new FilialeInfo {
                        ID = new Guid("6E677868-AE98-4932-B4DB-0000020DC859"), Name = "tester"
                    }
                };
                var expect1 = "tester";
                var result1 = FilialeManager.GetName(new Guid("6E677868-AE98-4932-B4DB-0000020DC859"));
                Assert.AreEqual(expect1, result1);

                //模拟返回结果
                ShimFilialeSao.GetAllFiliale = () => new List <FilialeInfo> {
                    new FilialeInfo {
                        ID = new Guid("6E677868-AE98-4932-B4DB-0000020DC859"), Name = "tester"
                    }
                };
                var expect2 = String.Empty;
                var result2 = FilialeManager.GetName(new Guid("00000000-0000-0000-0000-000000000000"));
                Assert.AreEqual(expect2, result2);
            }
        }
示例#2
0
        protected string GetCompName(string compId)
        {
            var list = RelatedCompany.Instance.ToList();

            if (list == null)
            {
                return("-");
            }
            var info = list.FirstOrDefault(o => o.CompanyId == new Guid(compId));

            if (info == null)
            {
                var filialeName = FilialeManager.GetName(new Guid(compId));
                return(string.IsNullOrEmpty(filialeName) ? "-" : filialeName);
            }
            return(info.CompanyName);
        }
示例#3
0
 private void BindValue(InvoiceApplyInfo applyInfo)
 {
     TbAddress.Text     = applyInfo.Address;
     TbTelephone.Text   = applyInfo.Telephone;
     TbReceiver.Text    = applyInfo.Receiver;
     TbApplyRemark.Text = applyInfo.ApplyRemark;
     TbRetreat.Text     = applyInfo.RetreatRemark;
     TbLeagueName.Text  = FilialeManager.GetName(applyInfo.TargetId);
     TbInvoiceType.Text = EnumAttribute.GetKeyName((ApplyInvoiceType)applyInfo.ApplyType);
     TbTitleType.Text   = EnumAttribute.GetKeyName((ApplyInvoiceTitleType)applyInfo.InvoiceTitleType);
     TbTitle.Text       = applyInfo.Title;
     TbPerTitle.Text    = applyInfo.Title;
     BtSave.Text        = IsAudit ? "核准" : "开票";
     BtBack.Text        = IsAudit ? "核退" : "退回";
     if (applyInfo.InvoiceTitleType == (int)ApplyInvoiceTitleType.Company)
     {
         TbContactAddress.Text = applyInfo.ContactAddress;
         TbContactPhone.Text   = applyInfo.ContactTelephone;
         TbTaxNumber.Text      = applyInfo.TaxpayerNumber;
         TbBankName.Text       = applyInfo.BankName;
         TbBankAccountNo.Text  = applyInfo.BankAccountNo;
     }
 }
示例#4
0
        /// <summary>新架构完成订单创建所需往来账   2015-01-19  陈重文
        /// </summary>
        /// <param name="goodsOrderInfo">订单信息</param>
        /// <param name="goodsOrderDetailInfoList">订单明细</param>
        /// <param name="goodsOrderDeliverInfo">订单运费信息</param>
        /// <param name="errorMsg">错误信息</param>
        /// <returns></returns>
        public IEnumerable <ReckoningInfo> NewCreateReckoningInfoList(GoodsOrderInfo goodsOrderInfo, IList <GoodsOrderDetailInfo> goodsOrderDetailInfoList, out GoodsOrderDeliverInfo goodsOrderDeliverInfo, out string errorMsg)
        {
            if (goodsOrderInfo.HostingFilialeId == Guid.Empty)
            {
                goodsOrderInfo.HostingFilialeId = WMSSao.GetHostingFilialeIdByWarehouseIdGoodsTypes(goodsOrderInfo.DeliverWarehouseId, goodsOrderInfo.SaleFilialeId, goodsOrderDetailInfoList.Select(ent => ent.GoodsType).Distinct());
            }
            //所需添加的往来帐集合
            IList <ReckoningInfo> reckoningList = new List <ReckoningInfo>();

            goodsOrderDeliverInfo = null;
            var orderCarriageInfo = _wmsSao.GetOrderNoCarriage(goodsOrderInfo.OrderNo, out errorMsg);

            if (orderCarriageInfo == null)
            {
                return(reckoningList);
            }
            var carriage = orderCarriageInfo.Carriage;

            if (carriage != 0)
            {
                goodsOrderDeliverInfo = new GoodsOrderDeliverInfo
                {
                    OrderId       = goodsOrderInfo.OrderId,
                    TotalWeight   = orderCarriageInfo.PackageWeight == 0 ? 0 : Convert.ToDouble(orderCarriageInfo.PackageWeight) / 1000,
                    CarriageFee   = Convert.ToDouble(orderCarriageInfo.Carriage),
                    ExpressId     = goodsOrderInfo.ExpressId,
                    ExpressNo     = goodsOrderInfo.ExpressNo,
                    MaxWrongValue = 0,
                    ProvinceName  = orderCarriageInfo.Province,
                    CityName      = orderCarriageInfo.City
                };
            }

            #region [检查快递往来单位信息]

            Guid companyId = Express.Instance.Get(goodsOrderInfo.ExpressId).CompanyId;
            CompanyCussentInfo expressCompanyInfo = _companyCussent.GetCompanyCussent(companyId);
            if (expressCompanyInfo == null)
            {
                errorMsg = "快递公司的往来对账信息没有建立!";
                return(new List <ReckoningInfo>());
            }

            #endregion

            //获取销售公司名称
            string saleFilialeName    = FilialeManager.GetName(goodsOrderInfo.SaleFilialeId);
            string hostingFilialeName = FilialeManager.GetName(goodsOrderInfo.HostingFilialeId);
            #region [运费往来帐]
            if (carriage > 0)
            {
                #region [销售公司对快递公司应付快递运费帐]
                //销售公司对快递公司的应付快递运费帐
                var saleFilialeToCarriage = new ReckoningInfo
                {
                    ContructType       = ContructType.Insert,
                    ReckoningId        = Guid.NewGuid(),
                    TradeCode          = _codeManager.GetCode(CodeType.PY),
                    DateCreated        = DateTime.Now,
                    ReckoningType      = (int)ReckoningType.Defray,
                    State              = (int)ReckoningStateType.Currently,
                    IsChecked          = (int)CheckType.NotCheck,
                    AuditingState      = (int)AuditingState.Yes,
                    LinkTradeCode      = goodsOrderInfo.ExpressNo,
                    WarehouseId        = goodsOrderInfo.DeliverWarehouseId,
                    FilialeId          = goodsOrderInfo.HostingFilialeId,
                    ThirdCompanyID     = expressCompanyInfo.CompanyId,
                    Description        = string.Format("[完成订单,{0}对快递公司{1}运费应付款]", hostingFilialeName, expressCompanyInfo.CompanyName),
                    AccountReceivable  = -carriage,
                    JoinTotalPrice     = -carriage,
                    ReckoningCheckType = (int)ReckoningCheckType.Carriage,
                    IsOut              = goodsOrderInfo.IsOut,
                    LinkTradeType      = (int)ReckoningLinkTradeType.Express,
                };
                reckoningList.Add(saleFilialeToCarriage);
                #endregion
            }
            #endregion

            #region 销售公司对快递公司的订单代收帐

            if (goodsOrderInfo.PayMode == (int)PayMode.COD || goodsOrderInfo.PayMode == (int)PayMode.COM)
            {
                #region [销售公司对快递公司的订单代收帐]

                //销售公司对快递公司的订单代收帐
                var saleFilialeToRealTotalPrice = new ReckoningInfo
                {
                    ContructType       = ContructType.Insert,
                    ReckoningId        = Guid.NewGuid(),
                    TradeCode          = _codeManager.GetCode(CodeType.GT),
                    DateCreated        = DateTime.Now,
                    ReckoningType      = (int)ReckoningType.Income,
                    State              = (int)ReckoningStateType.Currently,
                    IsChecked          = (int)CheckType.NotCheck,
                    AuditingState      = (int)AuditingState.Yes,
                    LinkTradeCode      = goodsOrderInfo.ExpressNo,
                    WarehouseId        = goodsOrderInfo.DeliverWarehouseId,
                    FilialeId          = goodsOrderInfo.SaleFilialeId,
                    ThirdCompanyID     = expressCompanyInfo.CompanyId,
                    Description        = string.Format("[完成订单,{0}对快递公司{1}的订单应收货款]", saleFilialeName, expressCompanyInfo.CompanyName),
                    AccountReceivable  = WebRudder.ReadInstance.CurrencyValue(goodsOrderInfo.RealTotalPrice),
                    ReckoningCheckType = (int)ReckoningCheckType.Collection,
                    IsOut              = goodsOrderInfo.IsOut,
                    LinkTradeType      = (int)ReckoningLinkTradeType.GoodsOrder,
                };

                reckoningList.Add(saleFilialeToRealTotalPrice);
                #endregion
            }
            #endregion

            return(reckoningList);
        }
示例#5
0
        //绑定往来账数据源
        protected void RgReckoningNeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            if (Page.IsPostBack && RTVCompanyCussent.SelectedNode.Level >= 1)
            {
                if (RTVCompanyCussent.SelectedNode.Level == 1 && RTVCompanyCussent.SelectedNode.ToolTip != "Company")
                {
                    RGReckoning.DataSource = new List <ReckoningInfo>();
                    return;
                }
                if (RTVCompanyCussent.SelectedNode.Level == 2 && RTVCompanyCussent.SelectedNode.ToolTip == "CompanyClass")
                {
                    RGReckoning.DataSource = new List <ReckoningInfo>();
                    return;
                }

                //添加按金额搜索
                int minmoney;
                int maxmoney;

                int[] moneys = null;
                if (int.TryParse(TB_MinMoney.Text, out minmoney))
                {
                    if (int.TryParse(TB_MaxMoney.Text, out maxmoney))
                    {
                        if (maxmoney > minmoney)
                        {
                            moneys = new[] { minmoney, maxmoney }
                        }
                        ;
                    }
                    else
                    {
                        moneys = new[] { minmoney, int.MaxValue }
                    };
                }
                else
                {
                    if (int.TryParse(TB_MaxMoney.Text, out maxmoney))
                    {
                        moneys = new[] { int.MinValue, maxmoney }
                    }
                    ;
                }
                var pageSize = RGReckoning.PageSize;
                RGReckoning.CurrentPageIndex = PageIndex;
                int recordCount;
                var endDate = DateTime.Now;
                if (RDP_EndDate.SelectedDate != null)
                {
                    endDate = Convert.ToDateTime(Convert.ToDateTime(RDP_EndDate.SelectedDate).AddDays(1).ToString("yyyy-MM-dd 00:00:00"));
                }

                bool?isOut   = null;
                var  rtvNode = RTVCompanyCussent.SelectedNode;
                if (rtvNode.ToolTip.Equals("ThirdSaleFiliale"))
                {
                    isOut = !CB_IsOut.Checked;
                }

                var list = _reckoning.GetValidateDataPage(CompanyClassId, CompanyId, FilialeId, StartDate, endDate, (CheckType)IsChecked, CurrentAuditingState, CurrentReceiptType, txtTradeCode.Text, new Guid(RCB_Warehouse.SelectedValue), GlobalConfig.KeepYear, RGReckoning.CurrentPageIndex * pageSize, pageSize, out recordCount, -1, Type, isOut, moneys);
                foreach (var info in list)
                {
                    info.FilialeName = FilialeManager.GetName(info.FilialeId);
                    if (string.IsNullOrEmpty(info.CompanyName))
                    {
                        info.CompanyName = FilialeManager.GetName(info.ThirdCompanyID);
                    }
                    if (string.IsNullOrEmpty(info.CompanyName))
                    {
                        var salePlatformInfo = CacheCollection.SalePlatform.Get(info.ThirdCompanyID);
                        info.CompanyName = salePlatformInfo == null?string.Empty: salePlatformInfo.Name;
                    }
                }

                RGReckoning.DataSource       = list;
                RGReckoning.VirtualItemCount = recordCount;
            }
            else
            {
                RGReckoning.DataSource = new List <ReckoningInfo>();
            }
        }
示例#6
0
 public string GetSalePlatformName(object salePlatformId)
 {
     return(FilialeManager.GetName(new Guid(salePlatformId.ToString())));
 }
示例#7
0
 public string GetFilialeName(string targetId)
 {
     return(FilialeManager.GetName(new Guid(targetId)));
 }