//绑定根节点和往来单位分类 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); } }
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); } }
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); }
/// <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); } }
/// <summary> 转帐 add chenzhongwen /// </summary> /// <param name="inBankAccountsId">转入帐号Id</param> /// <param name="outBankAccountsId">转出帐号Id</param> /// <param name="sum">金额</param> /// <param name="poundage">手续费</param> /// <param name="description">说明</param> /// <param name="tradeCode"></param> /// <param name="outFilialeId">转出公司 </param> /// <param name="inFilialeId"> 转入公司</param> /// <param name="realName"> 操作人</param> public WasteBookInfo NewVirement(Guid inBankAccountsId, Guid outBankAccountsId, decimal sum, decimal poundage, string description, string tradeCode, Guid outFilialeId, Guid inFilialeId, string realName) { WasteBookInfo wasteBookInfo = null; if (inBankAccountsId != Guid.Empty && outBankAccountsId != Guid.Empty && sum > 0) { var inBankInfo = _bankAccounts.GetBankAccounts(inBankAccountsId); var outBankInfo = _bankAccounts.GetBankAccounts(outBankAccountsId); if (inBankInfo == null || outBankInfo == null) { return(null); } var dateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); DateTime dateCreated = DateTime.Now; decimal inNonceBalance = _wasteBookDao.GetBalance(inBankAccountsId); decimal outNonceBalance = _wasteBookDao.GetBalance(outBankAccountsId); string inDescription; string outDescription; Boolean isOut; if (inFilialeId == _reckoningElseFilialeid || outFilialeId == _reckoningElseFilialeid) { isOut = false; } else { isOut = true; } if (outFilialeId == inFilialeId) { inDescription = string.Format("[转入申请(来源银行:{0};申请备注:{1};转出申请人:{2} ;{3})]", outBankInfo.BankName + "-" + outBankInfo.AccountsName, realName, description, dateTime); outDescription = string.Format("[转出申请(目标银行:{0};申请备注:{1};转出申请人:{2};{3})]", inBankInfo.BankName + "-" + inBankInfo.AccountsName, description, realName, dateTime); } else { var inFilialeName = inFilialeId == _reckoningElseFilialeid ? "其他公司" : FilialeManager.Get(inFilialeId).Name; var outFilialeName = outFilialeId == _reckoningElseFilialeid ? "其他公司" : FilialeManager.Get(outFilialeId).Name; inDescription = string.Format("[转入申请(来源公司:{0};来源银行:{1};申请备注:{2};转出申请人:{3} ;{4})]", outFilialeName, outBankInfo.BankName + "-" + outBankInfo.AccountsName, realName, description, dateTime); outDescription = string.Format("[转出申请(目标公司:{0};目标银行:{1};申请备注:{2};转出申请人:{3};{4})]", inFilialeName, inBankInfo.BankName + "-" + inBankInfo.AccountsName, description, realName, dateTime); } const string PD_DESC = "[转出] [手续费]"; var pdWasteBookInfo = new WasteBookInfo(Guid.NewGuid(), outBankAccountsId, tradeCode, dateCreated, PD_DESC, -poundage, outNonceBalance, (int)AuditingState.Hide, (int)WasteBookType.Decrease, outFilialeId) { LinkTradeCode = string.Empty, LinkTradeType = (int)WasteBookLinkTradeType.Other, State = (int)WasteBookState.Currently, IsOut = isOut }; var inWasteBookInfo = new WasteBookInfo(Guid.NewGuid(), inBankAccountsId, tradeCode, dateCreated, inDescription, sum, inNonceBalance, (int)AuditingState.Hide, (int)WasteBookType.Increase, inFilialeId) { LinkTradeCode = string.Empty, LinkTradeType = (int)WasteBookLinkTradeType.Other, State = (int)WasteBookState.Currently, IsOut = isOut }; var outWasteBookInfo = new WasteBookInfo(Guid.NewGuid(), outBankAccountsId, tradeCode, dateCreated, outDescription, -sum, outNonceBalance, (int)AuditingState.No, (int)WasteBookType.Decrease, outFilialeId) { LinkTradeCode = string.Empty, LinkTradeType = (int)WasteBookLinkTradeType.Other, State = (int)WasteBookState.Currently, IsOut = isOut }; using (var ts = new TransactionScope(TransactionScopeOption.Required)) { try { _wasteBookDao.Insert(inWasteBookInfo); if (poundage > 0) { _wasteBookDao.Insert(pdWasteBookInfo); } _wasteBookDao.Insert(outWasteBookInfo); wasteBookInfo = outWasteBookInfo; ts.Complete(); } catch { throw new ApplicationException("转帐同步失败!"); } } } return(wasteBookInfo); }