From 85e98cfeb38817ad4d79cdb1f82b4c2ef5e93241 Mon Sep 17 00:00:00 2001 From: luanhui <1029149336@qq.com> Date: Thu, 12 Apr 2018 09:24:02 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TypeIOCs/SaleOutStoreBLTypeIoc.cs | 24 +++++++++++++++---- B3QingDaoWanFu/Utils/WanFuOnlineConfig.cs | 14 +++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/B3QingDaoWanFu/TypeIOCs/SaleOutStoreBLTypeIoc.cs b/B3QingDaoWanFu/TypeIOCs/SaleOutStoreBLTypeIoc.cs index 7a3a610..85d018f 100644 --- a/B3QingDaoWanFu/TypeIOCs/SaleOutStoreBLTypeIoc.cs +++ b/B3QingDaoWanFu/TypeIOCs/SaleOutStoreBLTypeIoc.cs @@ -13,6 +13,7 @@ using Forks.EnterpriseServices.SqlDoms; using Forks.Utils; using TSingSoft.WebPluginFramework; using BWP.B3ButcherManage.BO; +using BWP.B3QingDaoWanFu.Utils; namespace BWP.B3QingDaoWanFu.TypeIOCs { @@ -26,15 +27,30 @@ namespace BWP.B3QingDaoWanFu.TypeIOCs detail.FactoryPrice = GetFactoryPrice(context, dmo, detail.SaleGoods_ID); } - var query=new DmoQuery(typeof(SaleGoods_Accounting_Store)); - query.Where.Conditions.Add(DQCondition.EQ("AccountingUnit_ID",dmo.AccountingUnit_ID)); - query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("SaleGoods_ID"),dmo.Details.Select(x=>DQExpression.Value(x.SaleGoods_ID)).ToArray())); + CheckStoreGoodsConsistent(context,dmo); + } + + void CheckStoreGoodsConsistent(IDmoContext context, SaleOutStore dmo) + { + var notchntrolstoreids= new WanFuOnlineConfig().SaleoutstoreSaveNotCheckStoreGoodsConsistent.Value.ToList(); + if (notchntrolstoreids.Count == 0) + { + return; + } + if (notchntrolstoreids.Contains(Convert.ToInt32((dmo.Store_ID ?? 0)) )) + { + return; + } + + var query = new DmoQuery(typeof(SaleGoods_Accounting_Store)); + query.Where.Conditions.Add(DQCondition.EQ("AccountingUnit_ID", dmo.AccountingUnit_ID)); + query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("SaleGoods_ID"), dmo.Details.Select(x => DQExpression.Value(x.SaleGoods_ID)).ToArray())); var list = context.Session.ExecuteList(query).Cast().ToList(); foreach (SaleGoods_Accounting_Store storeset in list) { if (storeset.Store_ID != dmo.Store_ID) { - throw new Exception(storeset.SaleGoods_Name+"配置的仓库:"+storeset.Store_Name+" 与单据上的仓库不一致,不允许保存"); + throw new Exception(storeset.SaleGoods_Name + "配置的仓库:" + storeset.Store_Name + " 与单据上的仓库不一致,不允许保存"); } } } diff --git a/B3QingDaoWanFu/Utils/WanFuOnlineConfig.cs b/B3QingDaoWanFu/Utils/WanFuOnlineConfig.cs index b59b4e6..d487c20 100644 --- a/B3QingDaoWanFu/Utils/WanFuOnlineConfig.cs +++ b/B3QingDaoWanFu/Utils/WanFuOnlineConfig.cs @@ -18,6 +18,20 @@ namespace BWP.B3QingDaoWanFu.Utils ConfigurationUtil.Fill(this); } + private IntListConfigRef _saleoutstoreSaveNotCheckStoreGoodsConsistent = new IntListConfigRef(); + + [LogicName("销售出库保存不受存货仓库设置控制的仓库ID")] + [ConfigurationItemGroup("青岛万福")] + [ConfigurationItemDescription("销售出库保存不是存货仓库设置控制的仓库ID")] + [DomainConfigurationItem] + public IntListConfigRef SaleoutstoreSaveNotCheckStoreGoodsConsistent + { + get { return _saleoutstoreSaveNotCheckStoreGoodsConsistent; } + set { _saleoutstoreSaveNotCheckStoreGoodsConsistent = value; } + } + + + private IntConfigRef _receiptTypeID = new IntConfigRef(0);