Beispiel #1
0
        public void TestAddToStockRequirementDetail()
        {
            var storageRecordInfo = new StorageRecordInfo
            {
                FilialeId   = new Guid("7AE62AF0-EB1F-49C6-8FD1-128D77C84698"),
                WarehouseId = new Guid("B5BCDF6E-95D5-4AEE-9B19-6EE218255C05")
            };

            IList <StorageRecordDetailInfo> storageRecordDetailInfos = new List <StorageRecordDetailInfo>
            {
                new StorageRecordDetailInfo
                {
                    RealGoodsId = new Guid("D2F69F05-C02F-4549-93C8-D3CE768D82E2")
                }
            };

            _stockCenterSao.GetGoodsQuantityByRealGoodsIdsIEnumerableOfGuidGuidGuid = (guids, guid, arg3) =>
                                                                                      new List <GoodsStockQuantityInfo>
            {
                new GoodsStockQuantityInfo
                {
                    RealGoodsId = new Guid("D2F69F05-C02F-4549-93C8-D3CE768D82E2")
                }
            };
            try
            {
                _goodsStockCurrent = new GoodsStockCurrent(_stubIGoodsStockCurrent, _stockCenterSao);
                _goodsStockCurrent.AddToStockRequirementDetail(storageRecordInfo, storageRecordDetailInfos, string.Empty, string.Empty, true);
                Assert.IsTrue(true);
            }
            catch (Exception)
            {
                Assert.IsFalse(false);
            }
        }
Beispiel #2
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);
        }