/// <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); }
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); } }
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); }
/// <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)); }
/// <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); }
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); }
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); }