Ejemplo n.º 1
0
        /// <summary>
        /// 修改换货申请列表
        /// </summary>
        /// <param name="applyDetailInfo"></param>
        /// <param name="detailInfos"></param>
        /// <returns></returns>
        public bool UpdateBarterApplyGoodsList(ShopExchangedApplyInfo applyDetailInfo,
                                               IList <ShopExchangedApplyDetailInfo> detailInfos)
        {
            string errorMsg;

            return(_shopExchangedApplyBllWrite.UpdateShopExchangedApply(applyDetailInfo, detailInfos, out errorMsg));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 添加退换货申请
 /// </summary>
 /// <param name="applyInfo"></param>
 public void InsertShopExchangedApply(ShopExchangedApplyInfo applyInfo)
 {
     try
     {
         using (SqlConnection conn = Databases.GetSqlConnection(GlobalConfig.ERP_DB_NAME, false))
         {
             conn.Execute(SQL_INSERT_SHOPEXCHANGEDAPPLY, new
             {
                 ApplyID        = applyInfo.ApplyID,
                 ApplyNo        = applyInfo.ApplyNo,
                 ShopID         = applyInfo.ShopID,
                 ShopName       = applyInfo.ShopName,
                 ApplyTime      = applyInfo.ApplyTime,
                 SubQuantity    = applyInfo.SubQuantity,
                 SubPrice       = applyInfo.SubPrice,
                 ExchangedState = applyInfo.ExchangedState,
                 IsBarter       = applyInfo.IsBarter,
                 Description    = applyInfo.Description,
                 MsgID          = applyInfo.MsgID,
             });
         }
     }
     catch (Exception ex)
     {
         throw new ApplicationException("退换货申请插入失败!", ex);
     }
 }
        public void GetShopExchangedApplyInfoTest1()
        {
            ShopExchangedApplyInfo actual = _target.GetShopExchangedApplyInfo(new Guid("0F75230F-A2E4-4029-8666-8BC85D0943CF"));

            Assert.IsTrue(actual.IsBarter);
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }
        public void GetShopExchangedApplyInfoTest()
        {
            var applyId = new Guid("3A64377A-15BB-47F2-99EB-AC7810D7F410");
            ShopExchangedApplyInfo actual = _target.GetShopExchangedApplyInfo(applyId);

            Assert.AreEqual(applyId, actual.ApplyID);
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }
        public void UpdateShopExchangedApplyTest()
        {
            ShopExchangedApplyInfo applyInfo = null;
            IList <ShopExchangedApplyDetailInfo> applyDetailInfos = null;
            string msg         = string.Empty;
            string msgExpected = string.Empty;
            bool   expected    = false; //
            bool   actual;

            actual = _target.UpdateShopExchangedApply(applyInfo, applyDetailInfos, out msg);
            Assert.AreEqual(msgExpected, msg);
            Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }
Ejemplo n.º 6
0
        /// <summary> pass
        /// 添加退货申请列表
        /// </summary>
        /// <param name="applyInfo"></param>
        /// <param name="detailInfos"></param>
        /// <returns></returns>
        public bool AddRefundApplyGoodsList(ShopExchangedApplyInfo applyInfo, IList <ShopApplyDetailInfo> detailInfos)
        {
            string errorMsg;

            if (applyInfo.MsgID == Guid.Empty)//因为直营店不需要走退货申请,故如果门店是直营店的话,MsgID字段门店前台会赋上一个随机的值,所以不会走此分支 zal 2016-04-21
            {
                var msgId = _shopRefundMessage.GetLastedRefundMsgId(applyInfo.ShopID, (byte)ReturnMsgState.Pass);
                if (msgId == Guid.Empty)
                {
                    return(false);
                }
                applyInfo.MsgID = msgId;
            }
            return(_shopExchangedApplyBllWrite.AddShopRefundApply(applyInfo, detailInfos, out errorMsg));
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 修改换货申请
 /// </summary>
 /// <returns></returns>
 public bool UpdateShopExchangedApply(ShopExchangedApplyInfo applyInfo,
                                      IList <ShopExchangedApplyDetailInfo> applyDetailInfos, out string msg)
 {
     try
     {
         var flag = false;
         using (var tran = new TransactionScope(TransactionScopeOption.Required))
         {
             var row = _shopRefund.UpdateShopExchangedApply(applyInfo);
             if (row > 0)
             {
                 var count = _shopApplyDetail.DeleteShopExchangedApplyDetails(applyInfo.ApplyID);
                 if (count > 0)
                 {
                     foreach (var applyDetailInfo in applyDetailInfos)
                     {
                         _shopApplyDetail.InsertShopExchangedApplyDetail(applyDetailInfo);
                     }
                     tran.Complete();
                     msg  = string.Empty;
                     flag = true;
                 }
                 else if (count == 0)
                 {
                     msg = "未找到相对应的换货申请明细记录";
                 }
                 else
                 {
                     msg = "原换货申请明细删除失败!";
                 }
             }
             else if (row == 0)
             {
                 msg = "更新时未找到对应的换货申请";
             }
             else
             {
                 msg = "更新对应的换货申请失败";
             }
         }
         return(flag);
     }
     catch (Exception ex)
     {
         msg = ex.Message;
     }
     return(false);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 修改退换货申请
 /// 数量、金额、时间、备注、状态(可修改)
 /// </summary>
 /// <param name="applyInfo"></param>
 /// <returns></returns>
 public int UpdateShopExchangedApply(ShopExchangedApplyInfo applyInfo)
 {
     try
     {
         using (SqlConnection conn = Databases.GetSqlConnection(GlobalConfig.ERP_DB_NAME, false))
         {
             return(conn.Execute(SQL_UPDATE_SHOPEXCHANGEDAPPLY, new
             {
                 ApplyTime = applyInfo.ApplyTime,
                 SubQuantity = applyInfo.SubQuantity,
                 SubPrice = applyInfo.SubPrice,
                 ExchangedState = applyInfo.ExchangedState,
                 Description = applyInfo.Description,
                 ApplyID = applyInfo.ApplyID
             }));
         }
     }
     catch (Exception ex)
     {
         throw new ApplicationException("退换货申请修改失败!", ex);
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 添加退货申请,存在则修改原单据,反之则添加
 /// </summary>
 /// <param name="applyInfo"></param>
 /// <param name="applyDetailInfos"></param>
 /// <param name="msg"> </param>
 /// <returns></returns>
 public bool AddShopRefundApply(ShopExchangedApplyInfo applyInfo, IList <ShopApplyDetailInfo> applyDetailInfos, out string msg)
 {
     try
     {
         using (var tran = new TransactionScope(TransactionScopeOption.Required))
         {
             _shopRefund.InsertShopExchangedApply(applyInfo);
             foreach (var applyDetailInfo in applyDetailInfos)
             {
                 _shopApplyDetail.InsertShopdApplyDetail(applyDetailInfo);
             }
             tran.Complete();
         }
         msg = string.Empty;
         return(true);
     }
     catch (Exception ex)
     {
         msg = ex.Message;
     }
     return(false);
 }
        public void AddShopRefundApplyTest()
        {
            var applyInfo = new ShopExchangedApplyInfo(Guid.NewGuid(), "TH-SH0820001", _shopId, "万店联盟1", DateTime.Now, 200, 10, (byte)ExchangedState.CheckPending, true, "退货");
            IList <ShopApplyDetailInfo> applyDetailInfos = new List <ShopApplyDetailInfo>();

            applyDetailInfos.Add(new ShopApplyDetailInfo(Guid.NewGuid()
                                                         , applyInfo.ApplyID,
                                                         new Guid("6EE68825-9ED5-4AEE-9B19-6EE688255C05"),
                                                         new Guid("6EE68825-9ED5-4AEE-9B19-6EE688255C05"), "ceshi6", "goodscode6",
                                                         "", 20, 5, "盒"));
            applyDetailInfos.Add(new ShopApplyDetailInfo(Guid.NewGuid()
                                                         , applyInfo.ApplyID,
                                                         new Guid("88255C05-9ED5-4AEE-9B19-6EE688255C05"),
                                                         new Guid("88255C05-9ED5-4AEE-9B19-6EE688255C05"), "ceshi7", "goodscode7",
                                                         "", 20, 5, "盒"));
            string msg; // TODO: 初始化为适当的值
            bool   actual = _target.AddShopRefundApply(applyInfo, applyDetailInfos, out msg);

            //Assert.IsTrue(string.IsNullOrEmpty(msg));
            Assert.IsTrue(actual);
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }
        public void UpdateShopRefundApplyTest()
        {
            var applyInfo = new ShopExchangedApplyInfo(new Guid("E777743C-DE00-4D27-91F9-BABC711F359E"), "TH-SH0820001", _shopId, "万店联盟1", DateTime.Now, 10, 100, (byte)ExchangedState.CheckPending, true, "退货");
            IList <ShopApplyDetailInfo> applyDetailInfos = new List <ShopApplyDetailInfo>();

            applyDetailInfos.Add(new ShopApplyDetailInfo(Guid.NewGuid()
                                                         , applyInfo.ApplyID,
                                                         new Guid("BABC711F-9ED5-4AEE-9B19-6EE688255C05"),
                                                         new Guid("BABC711F-9ED5-4AEE-9B19-6EE688255C05"), "ceshi6", "goodscode6",
                                                         "", 10, 5, "盒"));
            applyDetailInfos.Add(new ShopApplyDetailInfo(Guid.NewGuid()
                                                         , applyInfo.ApplyID,
                                                         new Guid("BABC711F-9ED5-4AEE-9B19-6EE688255C05"),
                                                         new Guid("BABC711F-9ED5-4AEE-9B19-6EE688255C05"), "ceshi7", "goodscode7",
                                                         "", 10, 5, "盒"));
            string msg;
            bool   actual = _target.UpdateShopRefundApply(applyInfo, applyDetailInfos, out msg);

            //Assert.AreEqual(msgExpected, msg);
            Assert.IsTrue(actual);
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }
        public void AddShopExchangedApplyTest()
        {
            var applyInfo = new ShopExchangedApplyInfo(Guid.NewGuid(), "TH0819001", _shopId, "万店联盟1", DateTime.Now, 200, 10, (byte)ExchangedState.CheckPending, false, "换货");
            IList <ShopExchangedApplyDetailInfo> applyDetailInfos = new List <ShopExchangedApplyDetailInfo>();

            applyDetailInfos.Add(new ShopExchangedApplyDetailInfo(Guid.NewGuid()
                                                                  , applyInfo.ApplyID,
                                                                  new Guid("DB195F6E-9ED5-4AEE-9B19-6EE688255C05"),
                                                                  new Guid("DB195F6E-9ED5-4AEE-9B19-6EE688255C05"), "ceshi", "goodscode",
                                                                  "", 20, 5, "盒", new Guid("52EE8255-9525-4AEE-9B19-6EE688255C05"),
                                                                  new Guid("52EE8255-9525-4AEE-9B19-6EE688255C05"), "ceshi2", "goodscode2", ""));
            applyDetailInfos.Add(new ShopExchangedApplyDetailInfo(Guid.NewGuid()
                                                                  , applyInfo.ApplyID,
                                                                  new Guid("4AEE5F6E-9ED5-4AEE-9B19-6EE688255C05"),
                                                                  new Guid("4AEE5F6E-9ED5-4AEE-9B19-6EE688255C05"), "ceshi4", "goodscode4",
                                                                  "", 20, 5, "盒", new Guid("59B19255-9525-4AEE-9B19-6EE688255C05"),
                                                                  new Guid("59B19255-9525-4AEE-9B19-6EE688255C05"), "ceshi5", "goodscode5", ""));
            string msg;
            bool   actual = _target.AddShopExchangedApply(applyInfo, applyDetailInfos, out msg);

            Assert.IsTrue(string.IsNullOrEmpty(msg));
            Assert.IsTrue(actual);
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 联盟店出库审核
        /// </summary>
        /// <param name="stockId"></param>
        /// <param name="goodsStockList"></param>
        /// <param name="semiStock"></param>
        /// <param name="dicGoods"></param>
        /// <param name="goodsInfoList"></param>
        /// <param name="errorMsg"></param>
        /// <returns></returns>
        public bool IsSuccess(Guid stockId, IList <StorageRecordDetailInfo> goodsStockList, StorageRecordInfo semiStock,
                              Dictionary <Guid, ERP.Model.Goods.GoodsInfo> dicGoods, List <ERP.Model.Goods.GoodsInfo> goodsInfoList, out string errorMsg)
        {
            var isSuccess = false;

            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    foreach (StorageRecordDetailInfo gsi in goodsStockList)
                    {
                        gsi.Quantity = -gsi.Quantity;

                        _current.AddToStockRequirementDetail(semiStock, new[] { gsi },
                                                             "调拨出库-[编辑]",
                                                             "操作人:111202",
                                                             -Math.Abs(gsi.Quantity));
                    }
                    string description = "[受理通过] 111202"
                                         + "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]";
                    var stockInfo = semiStock;
                    stockInfo.DateCreated = DateTime.Now;
                    stockInfo.StockType   = (int)StorageType.TransferStockOut;
                    stockInfo.Transactor  = "111202";
                    _storageManager.Insert(stockInfo, goodsStockList, semiStock.TradeCode, dicGoods);
                    _storageManager.SetStateStorageRecord(stockId, StorageState.Pass, description);

                    //更新结算价
                    foreach (var goodsInfo in goodsInfoList)
                    {
                        _storageManager.UpdateStorageRecordDetailToSettlementPrice(stockId, goodsInfo.GoodsId,
                                                                                   goodsInfo.ExpandInfo.SettlementPrice, goodsInfo.ExpandInfo.JoinPrice);
                    }

                    //同步新增门店的入库申请
                    ApplyStockInfo         shopApplyStockInfo = null;
                    ShopExchangedApplyInfo exchangedApplyInfo = null;
                    if (semiStock.OriginalCode.Contains("HH-SH")) //换货出库
                    {
                        exchangedApplyInfo =
                            _exchangedApplyBll.GetShopExchangedApplyInfoByApplyNo(semiStock.OriginalCode);
                    }
                    else  //采购出库
                    {
                        shopApplyStockInfo = _target.GetApplyInfoByTradeCode(semiStock.OriginalCode);
                    }

                    if (shopApplyStockInfo != null || exchangedApplyInfo != null)
                    {
                        if (shopApplyStockInfo != null)
                        {
                            //修改采购申请状态
                            isSuccess = _target.UpdateApplyStockState(shopApplyStockInfo.ApplyId, (int)ApplyStockState.Finishing,
                                                                      false, out errorMsg);
                        }
                        else
                        {
                            isSuccess = _exchangedApplyBll.SetShopExchangedState(exchangedApplyInfo.ApplyID,
                                                                                 (byte)ExchangedState.Bartering, "换货出库",
                                                                                 out errorMsg) > 0;
                        }
                        if (isSuccess)
                        {
                            //提交事务操作
                            ts.Complete();
                        }
                    }
                    else
                    {
                        errorMsg = "找不到与之相对应的采购/换货申请记录";
                    }
                }
                catch (Exception ex)
                {
                    errorMsg = string.Format("审核失败!{0}", ex.Message);
                }
            }
            return(isSuccess);
        }