/// <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);
        }
 /// <summary>
 /// 数据绑定
 /// </summary>
 /// <param name="source"></param>
 /// <param name="e"></param>
 protected void RgExchangedApplyListNeedDataSource(object source, GridNeedDataSourceEventArgs e)
 {
     if (!IsPostBack)
     {
         RgRechargeList.DataSource = new List <RechargeDTO>();
     }
     else
     {
         //int pageSize = RgRechargeList.PageSize;
         //int pageIndex = RgRechargeList.CurrentPageIndex + 1;
         var rechargeState = Convert.ToInt32(RcbRechargeState.SelectedValue);
         var now           = DateTime.Now;
         var sTime         = RdpStartTime.SelectedDate ?? new DateTime(now.Year, now.Month, now.Day).AddDays(-30);
         var eTime         = RdpEndTime.SelectedDate == null ? DateTime.Now : Convert.ToDateTime(RdpEndTime.SelectedDate).AddDays(1).AddSeconds(-1);
         var result        = ShopSao.SelectRechargeListByParentId(ParentID, ShopId, rechargeState, JoinType, sTime, eTime, null, null);
         if (result == null)
         {
             RAM.Alert("服务连接失败");
             return;
         }
         if (result.IsSuccess)
         {
             RgRechargeList.DataSource       = result.Data;
             RgRechargeList.VirtualItemCount = result.Total;
         }
         else
         {
             RAM.Alert(result.Message);
         }
     }
 }
Exemple #3
0
        public void AllianceServiceTest()
        {
            string msg;
            var    list = ShopSao.GetExpressCodeList(new Guid("B6B39773-E76E-4A53-9AAC-634E7DF973EA"), out msg);

            Assert.IsTrue(string.IsNullOrEmpty(msg));
        }
Exemple #4
0
        public void UpdateStorageRecord()
        {
            var flag      = false;
            var stockList = _storageManager.GetStorageRecordListByOriginalCode("04SPH1408270940");
            var stockInfo = stockList.FirstOrDefault(act => act.StockState == (int)StorageState.Pass);

            if (stockInfo != null && stockInfo.StockId != Guid.Empty)
            {
                var stockDtailList = _storageManager.GetStorageRecordDetailListByStockId(stockInfo.StockId);
                //联盟店生成调拨出库 异常差额  已审核
                var allianceOutStorage = new StockDTO()
                {
                    CompanyID         = new Guid(""),
                    DateCreated       = DateTime.Now,
                    Description       = "调拨异常差额出库",
                    OriginalTradeCode = ""
                };
                var allianceOutStorageDetails = new List <StockDetailDTO>();
                //ERP生成调拨入库 异常差额  已审核
                var erpInStoreageInfo   = new StorageRecordInfo();
                var erpInStorageDetails = new List <StorageRecordDetailInfo>();
                foreach (var storageRecordDetailInfo in stockDtailList)
                {
                    storageRecordDetailInfo.Quantity = storageRecordDetailInfo.Quantity + 1;
                    var detail    = storageRecordDetailInfo.DeepCopy() as StorageRecordDetailInfo;
                    var detailDto = new StockDetailDTO();
                    erpInStorageDetails.Add(detail);
                    allianceOutStorageDetails.Add(detailDto);
                }
                using (var ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    //修改原调拨出库单据
                    string msg;
                    _storageManager.InsertStockAndGoods(erpInStoreageInfo, erpInStorageDetails);
                    ShopSao.InsertStock(allianceOutStorage.StockID, allianceOutStorage, allianceOutStorageDetails, false, null, 0,
                                        out msg);
                    var result = _target.UpdateApplyStockState(new Guid("842B65D2-3892-43DA-8BE5-99B0F8F0E68D"), (int)ApplyStockState.Pended, false, out msg);
                    if (result)
                    {
                        ts.Complete();
                    }
                }
            }
            Assert.IsTrue(flag);
        }
Exemple #5
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);
        }
        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);
        }