diff --git a/BWP.B3_YunKen/BWP.B3_YunKen.csproj b/BWP.B3_YunKen/BWP.B3_YunKen.csproj
index b43aa6b..6f53a9c 100644
--- a/BWP.B3_YunKen/BWP.B3_YunKen.csproj
+++ b/BWP.B3_YunKen/BWP.B3_YunKen.csproj
@@ -68,6 +68,8 @@
+
+
diff --git a/BWP.B3_YunKen/TypeIoc/SaleForecastBeforeSaveTypeIoc.cs b/BWP.B3_YunKen/TypeIoc/SaleForecastBeforeSaveTypeIoc.cs
new file mode 100644
index 0000000..8f843ff
--- /dev/null
+++ b/BWP.B3_YunKen/TypeIoc/SaleForecastBeforeSaveTypeIoc.cs
@@ -0,0 +1,57 @@
+using BWP.B3Frameworks;
+using BWP.B3Sale.BL;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using BWP.B3_YunKen.BO;
+using BWP.B3Frameworks.BO.NamedValueTemplate;
+using BWP.B3Sale.BO;
+using Forks.EnterpriseServices.BusinessInterfaces;
+using Forks.EnterpriseServices.DomainObjects2;
+using Forks.EnterpriseServices.DomainObjects2.DQuery;
+using Forks.Utils;
+using TSingSoft.WebPluginFramework;
+
+namespace BWP.B3_YunKen.TypeIoc
+{
+ [TypeIOC(typeof(SaleForecastBL), typeof(SaleForecastBL.BaseBLIOCs.BeforeSave))]
+ public class SaleForecastBeforeSaveTypeIoc : SaleForecastBL.BaseBLIOCs.BeforeSave
+ {
+
+ public void Invoke(IDmoContext context, SaleForecast dmo)
+ {
+
+ foreach (var detail in dmo.Details)
+ {
+ var list = GetGoods_PackageCount(detail.SaleGoods_ID);
+ if (list.Count <= 0)
+ {
+ string msg = "存货【" + detail.Goods_Name + "】没有在【产品包装物设置】界面设置包装物";
+ throw new Exception(msg);
+ }
+ }
+ }
+
+
+
+ //根据存货查找【包装物设置】中对应的存货设置
+ private List> GetGoods_PackageCount(long? goodID)
+ {
+ var main = new JoinAlias(typeof(Goods_Package));
+
+ var query = new DQueryDom(main);
+
+ query.Columns.Add(DQSelectColumn.Field("Package_ID", main));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Count(), "Count"));
+ query.GroupBy.Expressions.Add(DQExpression.Field(main, "Package_ID"));
+
+ query.Where.Conditions.Add(DQCondition.EQ(main, "Goods_ID", goodID));
+ //query.Where.Conditions.Add(DQCondition.EQ(main, "Stopped", 0));
+
+
+ return query.EExecuteList();
+ }
+
+ }
+}
diff --git a/BWP.B3_YunKen/TypeIoc/SaleOutStoreBeforeSaveTypeIoc.cs b/BWP.B3_YunKen/TypeIoc/SaleOutStoreBeforeSaveTypeIoc.cs
new file mode 100644
index 0000000..d1498cf
--- /dev/null
+++ b/BWP.B3_YunKen/TypeIoc/SaleOutStoreBeforeSaveTypeIoc.cs
@@ -0,0 +1,56 @@
+using BWP.B3_YunKen.BO;
+using BWP.B3Frameworks;
+using BWP.B3Frameworks.BO.NamedValueTemplate;
+using BWP.B3Sale.BL;
+using BWP.B3Sale.BO;
+using Forks.EnterpriseServices.BusinessInterfaces;
+using Forks.EnterpriseServices.DomainObjects2;
+using Forks.EnterpriseServices.DomainObjects2.DQuery;
+using Forks.Utils;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using TSingSoft.WebPluginFramework;
+
+namespace BWP.B3_YunKen.TypeIoc
+{
+ [TypeIOC(typeof(SaleOutStoreBL), typeof(SaleOutStoreBL.BaseBLIOCs.BeforeSave))]
+ public class SaleOutStoreBeforeSaveTypeIoc : SaleOutStoreBL.BaseBLIOCs.BeforeSave
+ {
+ public void Invoke(IDmoContext context, SaleOutStore dmo)
+ {
+
+ foreach (var detail in dmo.Details)
+ {
+ var list=GetGoods_PackageCount(detail.SaleGoods_ID);
+ if (list.Count <= 0)
+ {
+ string msg = "存货【" + detail.Goods_Name + "】没有在【产品包装物设置】界面设置包装物";
+ throw new Exception(msg);
+ }
+ }
+ }
+
+
+
+ //根据存货查找【包装物设置】中对应的存货设置
+ private List> GetGoods_PackageCount(long? goodID)
+ {
+ var main = new JoinAlias(typeof(Goods_Package));
+
+ var query = new DQueryDom(main);
+
+ query.Columns.Add(DQSelectColumn.Field("Package_ID", main));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Count(), "Count"));
+ query.GroupBy.Expressions.Add(DQExpression.Field(main, "Package_ID"));
+
+ query.Where.Conditions.Add(DQCondition.EQ(main, "Goods_ID", goodID));
+ //query.Where.Conditions.Add(DQCondition.EQ(main, "Stopped", 0));
+
+
+ return query.EExecuteList();
+ }
+
+ }
+}