コード例 #1
0
        public void TestGetShopHeadFilialeIdByFilialeId()
        {
            using (ShimsContext.Create())
            {
                //模拟返回结果
                ShimFilialeSao.GetAllFiliale = () => new List <FilialeInfo>
                {
                    new FilialeInfo {
                        ID = new Guid("1E677868-AE98-4932-B4DB-0000020DC859"), Rank = (int)FilialeRank.Head
                    },
                    new FilialeInfo {
                        ID = new Guid("2E677868-AE98-4932-B4DB-0000020DC859"), ParentId = new Guid("1E677868-AE98-4932-B4DB-0000020DC859"), Rank = (int)FilialeRank.Partial
                    },
                    new FilialeInfo {
                        ID = new Guid("3E677868-AE98-4932-B4DB-0000020DC859"), ParentId = new Guid("2E677868-AE98-4932-B4DB-0000020DC859"), Rank = (int)FilialeRank.Child
                    }
                };
                var expect1 = new Guid("1E677868-AE98-4932-B4DB-0000020DC859");
                var result1 = FilialeManager.GetShopHeadFilialeId(new Guid("3E677868-AE98-4932-B4DB-0000020DC859"));
                Assert.AreEqual(expect1, result1);

                var expect2 = new Guid("1E677868-AE98-4932-B4DB-0000020DC859");
                var result2 = FilialeManager.GetShopHeadFilialeId(new Guid("2E677868-AE98-4932-B4DB-0000020DC859"));
                Assert.AreEqual(expect2, result2);

                var expect3 = new Guid("1E677868-AE98-4932-B4DB-0000020DC859");
                var result3 = FilialeManager.GetShopHeadFilialeId(new Guid("1E677868-AE98-4932-B4DB-0000020DC859"));
                Assert.AreEqual(expect3, result3);
            }
        }
コード例 #2
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);
            }
        }
コード例 #3
0
        protected void RcbShopListItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
        {
            IDictionary <Guid, string> dics = FilialeManager.GetAllianceFilialeList()
                                              .Where(act => act.Rank == (int)FilialeRank.Partial).ToDictionary(k => k.ID, v => v.Name);
            var combo = (RadComboBox)o;

            combo.Items.Clear();
            var list = !string.IsNullOrEmpty(e.Text) && e.Text.Length >= 1 ? dics.Where(act => act.Value.Contains(e.Text))
                : dics;
            var keyValuePairs = list as KeyValuePair <Guid, string>[] ?? list.ToArray();

            if (e.NumberOfItems >= keyValuePairs.Count())
            {
                e.EndOfItems = true;
            }
            else
            {
                foreach (var item in keyValuePairs)
                {
                    var rcb = new RadComboBoxItem
                    {
                        Text  = item.Value,
                        Value = item.Key + "",
                    };
                    combo.Items.Add(rcb);
                }
            }
        }
コード例 #4
0
        public void GetParentId()
        {
            var parentId = FilialeManager.GetShopHeadFilialeId(new Guid("3C77FC44-D7A9-4DAB-87C8-50031C579214"));
            var model    = new Guid("B6B39773-E76E-4A53-9AAC-634E7DF973EA");

            Assert.AreEqual(model, parentId);
        }
コード例 #5
0
        /// <summary>
        /// 设置联盟店为可退货状态
        /// </summary>
        /// <param name="shopId"></param>
        /// <param name="isAllow"></param>
        /// <param name="remark"> </param>
        /// <param name="msg"></param>
        /// <param name="msgId"></param>
        /// <returns></returns>
        public bool SetIsAllowReturnGoods(Guid shopId, Guid msgId, bool isAllow, string remark, out string msg)
        {
            bool flag;
            Guid parentId = FilialeManager.GetShopHeadFilialeId(shopId);

            if (parentId == Guid.Empty)
            {
                msg = "未找到对应总公司信息!";
                return(false);
            }
            using (var scope = new TransactionScope())
            {
                //修改联盟店退货次数
                flag = ShopSao.SetCanReturnCount(parentId, shopId, isAllow, out msg);
                if (flag)
                {
                    //修改ERP退货留言
                    var row = _shopRefund.SetMessageState(msgId, (int)ReturnMsgState.Pass, remark);
                    if (row >= 0)
                    {
                        scope.Complete();
                    }
                    else
                    {
                        flag = false;
                        msg  = "留言审核失败!";
                    }
                }
            }
            return(flag);
        }
コード例 #6
0
ファイル: PushManager.cs プロジェクト: mkbiltek2019/ERP_6.0
        /// <summary>
        /// 推送到门店
        /// </summary>
        /// <param name="shopFilialeId">推送到的门店</param>
        /// <param name="methodName"></param>
        /// <param name="identityKey"></param>
        /// <param name="paramters"></param>
        /// <returns></returns>
        public static bool AddToShop(Guid shopFilialeId, string methodName, string identityKey, params object[] paramters)
        {
            var headFilialeId = FilialeManager.GetShopHeadFilialeId(shopFilialeId);
            var parms         = paramters.ToList();
            var pushDataInfo  = PushDataInfo.Create(GlobalConfig.ERPFilialeID, ServiceType.ERP.ToString(), headFilialeId, ServiceType.Shop.ToString(), methodName, identityKey, parms.ToArray());

            return(PUSH.Core.Instance.Add(pushDataInfo));
        }
コード例 #7
0
        /// <summary>
        /// 绑定联盟店铺
        /// </summary>
        protected void BindShopList()
        {
            IDictionary <Guid, string> dics = FilialeManager.GetAllianceFilialeList()
                                              .Where(act => act.Rank == (int)FilialeRank.Partial)
                                              .ToDictionary(k => k.ID, v => v.Name);

            RcbShopList.DataSource = dics;
            RcbShopList.DataBind();
            RcbShopList.Items.Insert(0, new RadComboBoxItem("", string.Format("{0}", Guid.Empty)));
        }
コード例 #8
0
        //门店
        protected void LoadShopData()
        {
            var shopList = FilialeManager.GetAllianceFilialeList().Where(act => act.Rank == (int)FilialeRank.Partial &&
                                                                         act.ShopJoinType == (int)ShopJoinType.DirectSales).OrderBy(act => act.Name);

            ddl_AssumeShop.DataSource     = shopList;
            ddl_AssumeShop.DataTextField  = "Name";
            ddl_AssumeShop.DataValueField = "ID";
            ddl_AssumeShop.DataBind();
            ddl_AssumeShop.Items.Insert(0, new ListItem("请选择", ""));
        }
コード例 #9
0
 public void TestGetList()
 {
     using (ShimsContext.Create())
     {
         //模拟返回结果
         ShimFilialeSao.GetAllFiliale = () => new List <FilialeInfo> {
             new FilialeInfo()
         };
         var result = FilialeManager.GetList();
         Assert.IsNotNull(result);
     }
 }
コード例 #10
0
        public void GetGoodsInfoTest()
        {
            //var list = GoodsManager.GetRealGoodsIdListByGoodsNameOrCode("4544848122");
            //var goodsInfo = GoodsManager.GetGoodsBaseInfoByGoodsCode("盘点测试01(勿动)");
            //var goodsInfo1 = GoodsManager.GetGoodsBaseInfoByGoodsCode("4544848122");

            var shopFilialeList = FilialeManager.GetAllianceFilialeList();
            var shopList        = FilialeManager.GetEntityShop();
            var info            = shopFilialeList.Where(act => act.Rank == (int)MIS.Enum.FilialeRank.Partial).ToDictionary(k => k.ID, v => v.Name);

            Assert.IsTrue(true);
        }
コード例 #11
0
        //绑定根节点和往来单位分类
        private void GetCompanyCussent()
        {
            RadTreeNode rootNode = CreateNode("往来单位", true, Guid.Empty.ToString());

            rootNode.Category = "CompanyClass";
            rootNode.Selected = true;
            RTVCompanyCussent.Nodes.Add(rootNode);
            double total = RecursivelyCompanyClass(Guid.Empty, AllCompanyBalanceList, AllCompanyBalanceDetailList, rootNode);

            rootNode.Text += "[" + total.ToString("N") + "]";

            var list            = SelectFilialeId != Guid.Empty?FilialeList.Where(ent => ent.ID != SelectFilialeId):FilialeList;
            var saleFilialeList = list.Where(ent => ent.FilialeTypes.Contains((int)FilialeType.EntityShop) && ent.ParentId == SelectFilialeId).ToList();

            if (saleFilialeList.Count > 0)
            {
                var filialeNode = CreateNode("内部公司", true, Guid.Empty.ToString());
                var saleNode    = CreateNode("销售门店", true, Guid.Empty.ToString());
                filialeNode.Nodes.Add(saleNode);
                foreach (var node in saleFilialeList.Select(item => new RadTreeNode(item.Name, item.ID.ToString())
                {
                    ToolTip = "SaleFiliale"
                }))
                {
                    saleNode.Nodes.Add(node);
                }
                RTVCompanyCussent.Nodes.Add(filialeNode);
            }

            var filiale = FilialeManager.Get(SelectFilialeId);

            if (filiale != null && filiale.FilialeTypes.Contains((int)FilialeType.SaleCompany))
            {
                var thirdNode            = CreateNode("第三方公司", true, Guid.Empty.ToString());
                var automaticaccountNode = CreateNode("冻结自动进账", true, Guid.Empty.ToString());
                thirdNode.Nodes.Add(automaticaccountNode);
                var salePlatformList = CacheCollection.SalePlatform.GetListByFilialeId(SelectFilialeId);
                foreach (
                    var node in
                    salePlatformList.Where(act => act.IsActive && act.AccountCheckingType == 2)
                    .Select(act => new RadTreeNode(act.Name, act.ID.ToString())
                {
                    ToolTip = "ThirdSaleFiliale"
                }))
                {
                    automaticaccountNode.Nodes.Add(node);
                }
                thirdNode.ToolTip = "Company";
                RTVCompanyCussent.Nodes.Add(thirdNode);
            }
        }
コード例 #12
0
 public void TestGetByFilialeId()
 {
     using (ShimsContext.Create())
     {
         //模拟返回结果
         ShimFilialeSao.GetAllFiliale = () => new List <FilialeInfo> {
             new FilialeInfo {
                 ID = new Guid("6E677868-AE98-4932-B4DB-0000020DC859")
             }
         };
         var result = FilialeManager.Get(new Guid("6E677868-AE98-4932-B4DB-0000020DC859"));
         Assert.IsNotNull(result);
     }
 }
コード例 #13
0
        private void BindSaleFiliales()
        {
            List <FilialeInfo> dataSource = new List <FilialeInfo> {
                new FilialeInfo
                {
                    ID = Guid.Empty, Name = ""
                }
            };

            dataSource.AddRange(FilialeManager.GetB2CFilialeList());
            DdlSaleFiliale.DataSource = dataSource;
            DdlSaleFiliale.DataBind();
            DdlSaleFiliale.SelectedValue = string.Format("{0}", Guid.Empty);
        }
コード例 #14
0
        /// <summary>异步完成订单生成往来账
        /// </summary>
        /// <param name="orderInfo">订单</param>
        /// <param name="orderDetailList">订单明细</param>
        /// <param name="errorMessage">异常信息</param>
        /// <returns></returns>
        public bool AddByCompleteOrder(GoodsOrderInfo orderInfo, IList <GoodsOrderDetailInfo> orderDetailList, out string errorMessage)
        {
            GoodsOrderDeliverInfo goodsOrderDeliverInfo;
            var reckoningList = NewCreateReckoningInfoList(orderInfo, orderDetailList, out goodsOrderDeliverInfo, out errorMessage).ToList();

            if (reckoningList.Count == 0)
            {
                errorMessage = "此订单无需生成往来帐!";
                return(true);
            }

            using (var tran = new System.Transactions.TransactionScope())
            {
                //增加往来帐
                foreach (var reckoning in reckoningList)
                {
                    if (FilialeManager.IsEntityShopFiliale(reckoning.FilialeId))
                    {
                        if (!AddReckoningToEntityShop(reckoning, out errorMessage))
                        {
                            errorMessage = "插入门店往来帐失败," + errorMessage + "\r\n数据:" + new Framework.Core.Serialize.JsonSerializer().Serialize(reckoning);
                            return(false);
                        }
                    }
                    else
                    {
                        var success = _reckoningDao.Insert(reckoning, out errorMessage);
                        if (!success)
                        {
                            errorMessage = "插入往来帐失败," + errorMessage + "\r\n数据:" + new Framework.Core.Serialize.JsonSerializer().Serialize(reckoning);
                            return(false);
                        }
                    }
                }
                if (goodsOrderDeliverInfo != null)
                {
                    _goodsOrderDeliver.DeleteOrderDeliver(goodsOrderDeliverInfo.OrderId);
                    var result = _goodsOrderDeliver.InsertOrderDeliver(goodsOrderDeliverInfo);
                    if (!result)
                    {
                        errorMessage = "插入订单快递运费信息失败," + errorMessage + "\r\n数据:" + new Framework.Core.Serialize.JsonSerializer().Serialize(goodsOrderDeliverInfo);
                        return(false);
                    }
                }
                tran.Complete();
                return(true);
            }
        }
コード例 #15
0
        public void TestIsAllianceShopFilialeByFilialeIdAndErrorMessage()
        {
            using (ShimsContext.Create())
            {
                string outMessage1;
                //模拟返回结果
                ShimFilialeSao.GetAllFiliale = () => new List <FilialeInfo> {
                    new FilialeInfo {
                        ID = new Guid("6E677868-AE98-4932-B4DB-0000020DC859"), Type = (int)FilialeType.EntityShop, IsActive = true
                    }
                };
                var expect1 = String.Empty;
                var result1 = FilialeManager.IsAllianceShopFiliale(new Guid("6E677868-AE98-4932-B4DB-0000020DC859"), out outMessage1);
                Assert.IsTrue(result1);
                Assert.AreEqual(expect1, outMessage1);

                string outMessage2;
                //模拟返回结果
                ShimFilialeSao.GetAllFiliale = () => new List <FilialeInfo> {
                    new FilialeInfo {
                        ID = new Guid("6E677868-AE98-4932-B4DB-0000020DC859"), Type = (int)FilialeType.EntityShop, IsActive = false
                    }
                };
                var expect2 = String.Empty;
                var result2 = FilialeManager.IsAllianceShopFiliale(new Guid("6E677868-AE98-4932-B4DB-0000020DC859"), out outMessage2);
                Assert.IsFalse(result2);
                Assert.AreEqual(expect2, outMessage2);

                string outMessage3;
                //模拟返回结果
                ShimFilialeSao.GetAllFiliale = () => new List <FilialeInfo> {
                    new FilialeInfo {
                        ID = new Guid("6E677868-AE98-4932-B4DB-0000020DC859"), Type = (int)FilialeType.SaleCompany, IsActive = true
                    }
                };
                var expect3 = String.Empty;
                var result3 = FilialeManager.IsAllianceShopFiliale(new Guid("6E677868-AE98-4932-B4DB-0000020DC859"), out outMessage3);
                Assert.IsFalse(result3);
                Assert.AreEqual(expect3, outMessage3);

                string outMessage4;
                var    expect4 = "公司信息未获取到";
                var    result4 = FilialeManager.IsAllianceShopFiliale(new Guid("00000000-0000-0000-0000-000000000000"), out outMessage4);
                Assert.IsFalse(result4);
                Assert.AreEqual(expect4, outMessage4);
            }
        }
コード例 #16
0
        public int AddNewApplyStock(ApplyStockInfo applyStockInfo, IList <ApplyStockDetailInfo> applyStockDetailInfoList, IDictionary <Guid, decimal> settledics, out string errorMsg)
        {
            var isalliance = FilialeManager.IsAllianceShopFiliale(applyStockInfo.FilialeId, out errorMsg);

            if (isalliance)//联盟店
            {
                if (applyStockInfo.CompanyWarehouseId == Guid.Empty)
                {
                    applyStockInfo.PurchaseType = (int)PurchaseType.FromPurchase;
                }

                var filialeInfo = FilialeManager.Get(applyStockInfo.CompanyId);
                applyStockInfo.CompanyName = filialeInfo != null && filialeInfo.ID != Guid.Empty ? filialeInfo.Name : "-";

                //新增加盟店采购申请添加时待确认
                if (applyStockInfo.StockState >= (int)ApplyStockState.Delivering)
                {
                    var goodsIds   = applyStockDetailInfoList.Select(ent => ent.CompGoodsID).Distinct().ToList();
                    var goodsInfos = _goodsInfoSao.GetGoodsListByGoodsIds(goodsIds);
                    if (goodsInfos == null || goodsInfos.Count != goodsIds.Count)
                    {
                        errorMsg = "GMS商品信息获取失败";
                        return(-1);
                    }
                    var hostingFilialeId = WMSSao.GetHostingFilialeIdByWarehouseIdGoodsTypes(applyStockInfo.CompanyWarehouseId, applyStockInfo.CompanyId, goodsInfos.Select(ent => ent.GoodsType).Distinct());
                    if (hostingFilialeId == Guid.Empty)
                    {
                        errorMsg = "获取仓库对应的物流公司失败";
                        return(-1);
                    }
                    var flag = IsMatchSendCondition(applyStockInfo, applyStockDetailInfoList, hostingFilialeId, goodsInfos.ToDictionary(k => k.GoodsId, v => v), settledics, out errorMsg);
                    //确认不通过修改采购申请状态为等待确认
                    if (!flag)
                    {
                        applyStockInfo.StockState = (int)ApplyStockState.Confirming;
                    }
                }
            }
            if (_applyStockDao.Insert(applyStockInfo) && _applyStockDao.InsertDetail(applyStockDetailInfoList) > 0)
            {
                errorMsg = "";
                return(applyStockInfo.StockState);
            }
            errorMsg = "添加申请明细时失败";
            return(-1);
        }
コード例 #17
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);
        }
コード例 #18
0
        public void TestIsEntityShopFilialeByFilialeId()
        {
            using (ShimsContext.Create())
            {
                //模拟返回结果
                ShimFilialeSao.GetAllFiliale = () => new List <FilialeInfo> {
                    new FilialeInfo {
                        ID = new Guid("6E677868-AE98-4932-B4DB-0000020DC859"), Type = (int)FilialeType.EntityShop
                    }
                };
                var result1 = FilialeManager.IsEntityShopFiliale(new Guid("6E677868-AE98-4932-B4DB-0000020DC859"));
                Assert.IsTrue(result1);

                var result2 = FilialeManager.IsEntityShopFiliale(new Guid("00000000-0000-0000-0000-000000000000"));
                Assert.IsFalse(result2);
            }
        }
コード例 #19
0
 public void TestGetHeadList()
 {
     using (ShimsContext.Create())
     {
         //模拟返回结果
         ShimFilialeSao.GetAllFiliale = () => new List <FilialeInfo>
         {
             new FilialeInfo {
                 ID = new Guid("1E677868-AE98-4932-B4DB-0000020DC859"), Rank = (int)FilialeRank.Head
             },
             new FilialeInfo {
                 ID = new Guid("2E677868-AE98-4932-B4DB-0000020DC859"), Rank = (int)FilialeRank.Partial
             },
             new FilialeInfo {
                 ID = new Guid("3E677868-AE98-4932-B4DB-0000020DC859"), Rank = (int)FilialeRank.Child
             }
         };
         var result = FilialeManager.GetHeadList();
         Assert.IsNotNull(result);
     }
 }
コード例 #20
0
 public void TestGetAllianceFilialeList()
 {
     using (ShimsContext.Create())
     {
         //模拟返回结果
         ShimFilialeSao.GetAllFiliale = () => new List <FilialeInfo>
         {
             new FilialeInfo {
                 ID = new Guid("6E677868-AE98-4932-B4DB-0000020DC859"), Type = (int)FilialeType.EntityShop, IsActive = false
             },
             new FilialeInfo {
                 ID = new Guid("7E677868-AE98-4932-B4DB-0000020DC859"), Type = (int)FilialeType.SaleCompany, IsActive = false
             },
             new FilialeInfo {
                 ID = new Guid("8E677868-AE98-4932-B4DB-0000020DC859"), Type = (int)FilialeType.EntityShop, IsActive = true
             }
         };
         var result = FilialeManager.GetAllianceFilialeList();
         Assert.IsNotNull(result);
     }
 }
コード例 #21
0
        /// <summary>添加往来帐到实体店系统中
        /// </summary>
        /// <param name="reckoningInfo"></param>
        /// <param name="errorMsg"></param>
        /// <returns></returns>
        private bool AddReckoningToEntityShop(ReckoningInfo reckoningInfo, out string errorMsg)
        {
            errorMsg = string.Empty;
            var info = new ReckoningRecordDTO
            {
                AccountReceivable = reckoningInfo.AccountReceivable,
                JoinTotalPrice    = reckoningInfo.JoinTotalPrice,
                AuditingState     = true,
                CompanyID         = reckoningInfo.ThirdCompanyID,
                DateCreated       = reckoningInfo.DateCreated,
                Description       = reckoningInfo.Description,
                ShopID            = reckoningInfo.FilialeId,
                NonceTotalled     = reckoningInfo.NonceTotalled,
                OriginalTradeCode = reckoningInfo.LinkTradeCode,
                ID            = reckoningInfo.ReckoningId,
                ReckoningType = reckoningInfo.ReckoningType,
                TradeCode     = reckoningInfo.TradeCode
            };

            if (info.CompanyID == info.ShopID)
            {
                errorMsg = ("往来公司ID和账目公司ID一样,故无法插入往来帐!");
                return(false);
            }
            if (!FilialeManager.IsEntityShopFiliale(info.ShopID))
            {
                errorMsg = ("往来公司ID不是门店公司,故无法插入往来帐!");
                return(false);
            }
            var headFililaleId = FilialeManager.GetShopHeadFilialeId(info.ShopID);
            var result         = PushManager.AddToShop(headFililaleId, "InsertReckoningWithPush", info.TradeCode, info);

            if (!result)
            {
                errorMsg = ("插入门店对ERP应付帐失败!");
                return(false);
            }
            return(true);
        }
コード例 #22
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;
     }
 }
コード例 #23
0
        protected bool ExecuteFinishHandle(CostReportInfo model, PersonnelInfo personnelInfo, out string errorMsg)
        {
            errorMsg = string.Empty;
            if (model.ReportKind.Equals((int)CostReportKind.FeeIncome))
            {
                model.RealityCost = -model.RealityCost;
            }

            var costReportBll = new BLL.Implement.Inventory.CostReport(_bankAccounts, _personnelSao, _costReckoning);

            #region 新增资金流
            var wasteBookInfo = costReportBll.AddWasteBookInfo(model, personnelInfo, false);
            if (_wasteBook.Insert(wasteBookInfo) <= 0)
            {
                errorMsg = "新增资金流失败!";
                return(false);
            }
            #endregion

            #region 新增帐务记录
            var costReckoningInfo = costReportBll.AddCostReckoningInfo(model, personnelInfo, false);
            if (_costReckoning.Insert(costReckoningInfo) <= 0)
            {
                errorMsg = "新增帐务记录失败!";
                return(false);
            }
            #endregion

            #region 与门店费用交互
            if (model.AssumeBranchId == new Guid(ShopBranchId) && !model.AssumeShopId.Equals(Guid.Empty))
            {
                string strErrorMsg;
                var    description = string.Format("费用申报{0}{1}可用余额!", model.ReceiptNo, model.RealityCost < 0 ? "添加" : "扣除");
                var    parentId    = FilialeManager.GetShopHeadFilialeId(model.AssumeShopId);//获取门店所属公司
                if (!ShopSao.DeductBalance(parentId, model.AssumeShopId, model.RealityCost, description, out strErrorMsg))
                {
                    errorMsg = strErrorMsg;
                    return(false);
                }

                var costRecordDto = costReportBll.AddCostRecordDto(model);
                if (!ShopSao.InsertCostRecord(parentId, costRecordDto))
                {
                    errorMsg = "扣除门店费用失败!";
                    return(false);
                }
            }
            #endregion

            #region 新增资金流(手续费)
            if (model.RealityCost >= 0 && model.Poundage > 0 && !model.ReportKind.Equals((int)CostReportKind.FeeIncome))
            {
                var wasteBookInfoPoundage = costReportBll.AddWasteBookInfo(model, personnelInfo, true);
                if (_wasteBook.Insert(wasteBookInfoPoundage) <= 0)
                {
                    errorMsg = "新增手续费失败!";
                    return(false);
                }
            }
            #endregion

            return(true);
        }
コード例 #24
0
        // 采购中
        protected void IbnPurchasing_Click(object sender, EventArgs eventArgs)
        {
            bool isHave      = false;
            var  codeManager = new CodeManager();

            foreach (GridDataItem dataItem in RG_DebitNote.Items)
            {
                var purchasingId      = new Guid(dataItem.GetDataKeyValue("PurchasingId").ToString());
                var personResponsible = new Guid(dataItem.GetDataKeyValue("PersonResponsible").ToString());
                var cbCheck           = (CheckBox)dataItem.FindControl("CB_Check");
                if (cbCheck.Checked)
                {
                    using (var ts = new TransactionScope(TransactionScopeOption.Required))
                    {
                        isHave = true;
                        _debitNoteDao.UpdateDebitNoteStateByPurchasingId(purchasingId, (int)DebitNoteState.Purchasing);
                        //生成采购单
                        DebitNoteInfo debitNoteInfo = _debitNoteDao.GetDebitNoteInfo(purchasingId) ?? new DebitNoteInfo();
                        IList <DebitNoteDetailInfo> debitNoteDetailList = _debitNoteDao.GetDebitNoteDetailList(purchasingId);
                        CompanyCussentInfo          companyCussentInfo  = CompanyCussentList.FirstOrDefault(w => w.CompanyId == debitNoteInfo.CompanyId);
                        //var warehouseInfo = WarehouseManager.Get(debitNoteInfo.WarehouseId);
                        PersonnelInfo  personnelInfo     = PersonnelList.FirstOrDefault(w => w.PersonnelId == debitNoteInfo.PersonResponsible) ?? new PersonnelInfo(null);
                        PurchasingInfo oldPurchasingInfo = _purchasing.GetPurchasingById(purchasingId);
                        var            realName          = CurrentSession.Personnel.Get().RealName;
                        var            filialeId         = string.IsNullOrWhiteSpace(debitNoteInfo.PurchasingNo) || debitNoteInfo.PurchasingNo == "-"?FilialeManager.GetHeadList().First(ent => ent.Name.Contains("可得")).ID
                            : _purchasing.GetPurchasingList(debitNoteInfo.PurchasingNo).FilialeID;
                        var pInfo = new PurchasingInfo
                        {
                            PurchasingID    = Guid.NewGuid(),
                            PurchasingNo    = codeManager.GetCode(CodeType.PH),
                            CompanyID       = debitNoteInfo.CompanyId,
                            CompanyName     = companyCussentInfo == null ? "" : companyCussentInfo.CompanyName,
                            FilialeID       = filialeId,
                            WarehouseID     = debitNoteInfo.WarehouseId,
                            PurchasingState = (int)PurchasingState.Purchasing,
                            PurchasingType  = (int)PurchasingType.Custom,
                            StartTime       = DateTime.Now,
                            EndTime         = DateTime.MaxValue,
                            //Description = "[采购类别:{0}赠品借记单][对应采购单号" + debitNoteInfo.PurchasingNo + "]" + CurrentSession.Personnel.Get().RealName,
                            Description         = string.Format("[采购类别:{0},赠品借记单对应采购单号{1};采购人:{2}]", EnumAttribute.GetKeyName(PurchasingType.Custom), debitNoteInfo.PurchasingNo, realName),
                            PmId                = personnelInfo.PersonnelId,
                            PmName              = personnelInfo.RealName,
                            ArrivalTime         = oldPurchasingInfo.ArrivalTime,
                            PersonResponsible   = personResponsible,
                            PurchasingFilialeId = filialeId
                        };
                        IList <PurchasingDetailInfo> purchasingDetailList = new List <PurchasingDetailInfo>();
                        if (debitNoteDetailList.Count > 0)
                        {
                            List <Guid> goodsIdOrRealGoodsIdList  = debitNoteDetailList.Select(w => w.GoodsId).Distinct().ToList();
                            Dictionary <Guid, GoodsInfo> dicGoods = _goodsCenterSao.GetGoodsBaseListByGoodsIdOrRealGoodsIdList(goodsIdOrRealGoodsIdList);
                            if (dicGoods != null && dicGoods.Count > 0)
                            {
                                foreach (var debitNoteDetailInfo in debitNoteDetailList)
                                {
                                    bool hasKey = dicGoods.ContainsKey(debitNoteDetailInfo.GoodsId);
                                    if (hasKey)
                                    {
                                        GoodsInfo goodsBaseInfo = dicGoods.FirstOrDefault(w => w.Key == debitNoteDetailInfo.GoodsId).Value;
                                        // 获取商品的60、30、11天销量
                                        var purchasingDetailInfo = _purchasingDetail.GetChildGoodsSale(debitNoteDetailInfo.GoodsId, debitNoteInfo.WarehouseId, DateTime.Now, pInfo.PurchasingFilialeId) ?? new PurchasingDetailInfo();
                                        var durchasingDetailInfo = new PurchasingDetailInfo
                                        {
                                            PurchasingID        = pInfo.PurchasingID,
                                            PurchasingGoodsID   = Guid.NewGuid(),
                                            GoodsID             = debitNoteDetailInfo.GoodsId,
                                            GoodsName           = debitNoteDetailInfo.GoodsName,
                                            GoodsCode           = goodsBaseInfo.GoodsCode,
                                            Specification       = debitNoteDetailInfo.Specification,
                                            CompanyID           = pInfo.CompanyID,
                                            Price               = debitNoteDetailInfo.Price,
                                            PlanQuantity        = debitNoteDetailInfo.GivingCount,
                                            RealityQuantity     = 0,
                                            State               = 0,
                                            Description         = "",
                                            Units               = goodsBaseInfo.Units,
                                            PurchasingGoodsType = (int)PurchasingGoodsType.Gift,
                                            SixtyDaySales       = purchasingDetailInfo.SixtyDaySales,
                                            ThirtyDaySales      = purchasingDetailInfo.ThirtyDaySales,
                                            ElevenDaySales      = purchasingDetailInfo.ElevenDaySales == 0 ? 0 : purchasingDetailInfo.ElevenDaySales, // 11 //日均销量(11天)
                                            CPrice              = debitNoteDetailInfo.Price
                                        };
                                        purchasingDetailList.Add(durchasingDetailInfo);
                                    }
                                }
                            }
                        }
                        if (purchasingDetailList.Count > 0)
                        {
                            _debitNoteDao.UpdateDebitNoteNewPurchasingIdByPurchasingId(purchasingId, pInfo.PurchasingID);
                            _purchasing.PurchasingInsert(pInfo);
                            _purchasing.PurchasingUpdateIsOut(pInfo.PurchasingID);
                            //报备管理生成采购单操作记录添加
                            WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, pInfo.PurchasingID, pInfo.PurchasingNo,
                                                       OperationPoint.ReportManage.DebitToAddPurchasingList.GetBusinessInfo(), string.Empty);
                            var purchasingDetailManager = new PurchasingDetailManager(_purchasingDetail, _purchasing);
                            purchasingDetailManager.Save(purchasingDetailList);
                        }
                        ts.Complete();
                    }
                }
            }
            if (isHave == false)
            {
                RAM.Alert("未勾选借记单!");
            }
            else
            {
                RAM.ResponseScripts.Add("setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
            }
        }
コード例 #25
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);
        }
コード例 #26
0
        /// <summary>
        /// 打款完成
        /// </summary>
        /// <param name="salePlatformId"></param>
        /// <param name="applyId"></param>
        protected void PayFinish(Guid salePlatformId, Guid applyId)
        {
            var errorMsg = new StringBuilder();
            MemberMentionApplyInfo memberMentionApplyInfo = MemberCenterSao.GetMemberMentionApply(salePlatformId, applyId);

            if (memberMentionApplyInfo.State == (int)MemberMentionState.Process)
            {
                var orderNoStr = string.Empty;
                if (!string.IsNullOrWhiteSpace(memberMentionApplyInfo.OrderNo))
                {
                    orderNoStr = string.Format("[订单号:{0}]", memberMentionApplyInfo.OrderNo);
                }
                if (!string.IsNullOrWhiteSpace(memberMentionApplyInfo.ThirdPartyOrderNo) || memberMentionApplyInfo.ThirdPartyOrderNo == "-")
                {
                    orderNoStr = string.Format("{0}[第三方平台订单号:{1}]", orderNoStr, memberMentionApplyInfo.ThirdPartyOrderNo);
                }
                var rdescription = string.Format("[余额提现(提现会员:{0};提现申请单号:{1};提现到:{2};操作人:{3}),资金减少,{4})]", memberMentionApplyInfo.UserName, memberMentionApplyInfo.ApplyNo, memberMentionApplyInfo.BankName, Personnel.RealName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

                var info = new WasteBookInfo(Guid.NewGuid(), new Guid(RCB_BankAccountsId.SelectedValue),
                                             memberMentionApplyInfo.ApplyNo, rdescription + orderNoStr,
                                             -memberMentionApplyInfo.Amount, (Int32)AuditingState.Yes,
                                             (Int32)WasteBookType.Decrease, memberMentionApplyInfo.SaleFilialeId)
                {
                    LinkTradeCode = memberMentionApplyInfo.ApplyNo,
                    LinkTradeType = (int)WasteBookLinkTradeType.WithdrawDeposit,
                    BankTradeCode = string.Empty,
                    State         = (int)WasteBookState.Currently,
                    IsOut         = false
                };

                var memo        = "提现" + memberMentionApplyInfo.ApplyNo + "取走余额;";
                var description = "提现" + memberMentionApplyInfo.ApplyNo + ",提走余额;" + Common.WebControl.RetrunUserAndTime("提现受理");

                #region 提现
                using (var ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    try
                    {
                        if (info.Income != 0)
                        {
                            _wasteBook.Insert(info);
                        }
                        string errorMessage;
                        var    result = MemberCenterSao.CompleteWithdrawApply(salePlatformId, applyId, memo, description, out errorMessage);
                        if (!result)
                        {
                            throw new Exception("会员名:" + memberMentionApplyInfo.UserName + "提现单号:" + memberMentionApplyInfo.ApplyNo + "   " + errorMessage);
                        }
                        //提现打款完成增加操作记录添加
                        Common.WebControl.AddOperationLog(Personnel.PersonnelId, Personnel.RealName, info.WasteBookId, info.TradeCode, OperationPoint.MemberWithdrawCash.PaySuccess.GetBusinessInfo(), string.Empty);
                        ts.Complete();
                    }
                    catch (Exception ex)
                    {
                        errorMsg.Append("提现失败!" + ex.Message).Append("\\n");
                    }
                    finally
                    {
                        ts.Dispose();
                    }
                }
                #endregion

                #region 发送短信
                try
                {
                    MemberBaseInfo memberBaseInfo = MemberCenterSao.GetUserBase(salePlatformId, memberMentionApplyInfo.MemberId);
                    if (memberBaseInfo != null)
                    {
                        if (!string.IsNullOrEmpty(memberBaseInfo.Mobile))
                        {
                            //可得完成打款发送短信
                            var keedeFilialeId = FilialeManager.GetList().First(f => f.Code.ToLower() == "kede").ID;
                            if (memberMentionApplyInfo.SaleFilialeId == keedeFilialeId)
                            {
                                const string MSG = "您好,您的提现申请已收到,现已完成打款,一般2-5个工作日到账,请注意查收。详情可致电4006202020咨询。感谢您对可得网支持!";
                                MailSMSSao.SendShortMessage(memberMentionApplyInfo.SaleFilialeId, memberMentionApplyInfo.SalePlatformId, memberBaseInfo.Mobile, MSG);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    errorMsg.Append("提现成功,短信发送失败! " + "会员名:" + memberMentionApplyInfo.UserName + "提现单号:" + memberMentionApplyInfo.ApplyNo + "   " + ex.Message).Append("\\n");
                }
                #endregion
            }

            if (!string.IsNullOrEmpty(errorMsg.ToString()))
            {
                throw new Exception(errorMsg.ToString());
            }
        }
コード例 #27
0
        public bool UpdateApplyStockState(ApplyStockInfo applyInfo, int state, bool alliance, out IDictionary <Guid, decimal> settleDics, out string msg)
        {
            msg = string.Empty;
            var dics = new Dictionary <Guid, string>();

            settleDics = new Dictionary <Guid, decimal>();
            if (state == (int)ApplyStockState.Delivering && !alliance)
            {
                var detailList = FindDetailList(applyInfo.ApplyId);
                var goodsIds   = detailList.Select(ent => ent.CompGoodsID).Distinct().ToList();
                var goodsInfos = _goodsInfoSao.GetGoodsListByGoodsIds(goodsIds);
                if (goodsInfos == null || goodsInfos.Count != goodsIds.Count)
                {
                    msg = "GMS商品信息获取失败";
                    return(false);
                }
                var hostingFilialeId = WMSSao.GetHostingFilialeIdByWarehouseIdGoodsTypes(applyInfo.CompanyWarehouseId, applyInfo.CompanyId, goodsInfos.Select(ent => ent.GoodsType).Distinct());
                if (hostingFilialeId == Guid.Empty)
                {
                    msg = "获取仓库对应的物流公司失败";
                    return(false);
                }
                settleDics = _grossSettlementDal.GetLatestUnitPriceListByMultiGoods(hostingFilialeId, goodsIds);
                var result = IsMatchSendCondition(applyInfo, detailList, hostingFilialeId, goodsInfos.ToDictionary(k => k.GoodsId, v => v), settleDics, out msg);
                if (!result)
                {
                    //更新采购申请信息
                    state = (int)ApplyStockState.Confirming;
                    dics  = detailList.Where(act => act.IsComfirmed).ToDictionary(k => k.GoodsId, v => v.ComfirmTips);
                }
            }
            bool flag = _applyStockDao.UpdateApplyStockState(applyInfo.ApplyId, state);

            //修改明细中商品需确认标识
            if (flag && dics.Count > 0)
            {
                if (dics.Select(dic => _applyStockDao.UpdateDetailTips(applyInfo.ApplyId, dic.Key, dic.Value, true)).Any(result => !result))
                {
                    flag = false;
                }
            }
            if (!flag)
            {
                msg = "修改对应门店采购申请状态失败!";
            }
            else
            {
                if (alliance)
                {
                    string message;
                    var    parenId = FilialeManager.GetShopHeadFilialeId(applyInfo.FilialeId);
                    //联盟店备注格式:[XX]
                    var result = ShopSao.UpdatePurchaseState(parenId, applyInfo.ApplyId, state, string.Empty, out message);
                    if (!result)
                    {
                        msg  = message;
                        flag = false;
                    }
                }
            }
            return(flag);
        }
コード例 #28
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>();
            }
        }
コード例 #29
0
        /// <summary>
        /// 新增门店采购单
        /// </summary>
        /// <param name="applyStockInfo"></param>
        /// <param name="applyStockDetailInfoList"></param>
        /// <param name="errorMsg"> </param>
        /// <returns>采购申请状态</returns>
        public int Add(ApplyStockInfo applyStockInfo, IList <ApplyStockDetailInfo> applyStockDetailInfoList, out string errorMsg)
        {
            int state = -1;

            try
            {
                var isalliance = FilialeManager.IsAllianceShopFiliale(applyStockInfo.FilialeId, out errorMsg);
                if (isalliance)//联盟店
                {
                    if (applyStockInfo.CompanyWarehouseId == Guid.Empty)
                    {
                        applyStockInfo.PurchaseType = (int)PurchaseType.FromPurchase;
                    }

                    var filialeInfo = FilialeManager.Get(applyStockInfo.CompanyId);
                    applyStockInfo.CompanyName = filialeInfo != null && filialeInfo.ID != Guid.Empty ? filialeInfo.Name : "-";

                    //新增加盟店采购申请添加时待确认
                    if (applyStockInfo.StockState >= (int)ApplyStockState.Delivering)
                    {
                        var goodsIds   = applyStockDetailInfoList.Select(ent => ent.CompGoodsID).Distinct().ToList();
                        var goodsInfos = _goodsInfoSao.GetGoodsListByGoodsIds(goodsIds);
                        if (goodsInfos == null || goodsInfos.Count != goodsIds.Count)
                        {
                            errorMsg = "GMS商品信息获取失败";
                            return(state);
                        }
                        var hostingFilialeId = WMSSao.GetHostingFilialeIdByWarehouseIdGoodsTypes(applyStockInfo.CompanyWarehouseId, applyStockInfo.CompanyId, goodsInfos.Select(ent => ent.GoodsType).Distinct());
                        if (hostingFilialeId == Guid.Empty)
                        {
                            errorMsg = "获取仓库对应的物流公司失败";
                            return(state);
                        }
                        var settleDics = _grossSettlementDal.GetLatestUnitPriceListByMultiGoods(hostingFilialeId, goodsIds);
                        var flag       = IsMatchSendCondition(applyStockInfo, applyStockDetailInfoList, hostingFilialeId, goodsInfos.ToDictionary(k => k.GoodsId, v => v), settleDics, out errorMsg);
                        //确认不通过修改采购申请状态为等待确认
                        if (!flag)
                        {
                            applyStockInfo.StockState = (int)ApplyStockState.Confirming;
                        }
                    }
                }
                using (var ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    bool isSuccess = _applyStockDao.Insert(applyStockInfo);
                    if (isSuccess)
                    {
                        if (_applyStockDao.InsertDetail(applyStockDetailInfoList) > 0)
                        {
                            state = applyStockInfo.StockState;
                        }
                        else
                        {
                            isSuccess = false;
                            errorMsg  = "添加申请明细时失败";
                        }
                    }
                    else
                    {
                        errorMsg = "添加申请记录失败";
                    }
                    if (isSuccess)
                    {
                        ts.Complete();
                    }
                }
                return(state);
            }
            catch (Exception exp)
            {
                SAL.LogCenter.LogService.LogError(string.Format("新增采购申请报错: applyStockInfo={0}, applyStockDetailInfoList={1}", new Framework.Core.Serialize.JsonSerializer().Serialize(applyStockInfo), new Framework.Core.Serialize.JsonSerializer().Serialize(applyStockDetailInfoList)), "采购管理", exp);
                errorMsg = exp.Message;
                return(-1);
            }
        }
コード例 #30
0
 /// <summary>获取往来单位绑定公司信息   ADD 2016年12月7日  陈重文
 /// </summary>
 /// <param name="companyId">往来单位ID</param>
 /// <returns></returns>
 public List <Guid> GetCompanyBindFilialeIds(Guid companyId)
 {
     return(companyId == default(Guid) ? new List <Guid>() : FilialeManager.GetAllHostingAndSaleFilialeList().Select(ent => ent.ID).ToList());
     //: _companyCussent.GetCompanyBindingFiliale(companyId).ToList();
 }