using BWP.B3_YunKen.BO;
|
|
using BWP.B3Frameworks.Utils;
|
|
using BWP.B3Sale.BO;
|
|
using Forks.EnterpriseServices.BusinessInterfaces;
|
|
using Forks.EnterpriseServices.DomainObjects2;
|
|
using Forks.EnterpriseServices.DomainObjects2.DQuery;
|
|
using Forks.EnterpriseServices.SqlDoms;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using TSingSoft.WebPluginFramework;
|
|
using TSingSoft.WebPluginFramework.BIPlugins.BLEvents;
|
|
|
|
namespace BWP.B3_YunKen.BLActions
|
|
{
|
|
public class SaleOutStoreBLIsSetWrappageActions : IBLMethodAction
|
|
{
|
|
//A:根据存货查找【包装物设置】中对应的存货设置
|
|
//B:若存货没有在【包装物设置】界面设置包装物,则无法保存。
|
|
public string Description
|
|
{
|
|
get { return "销售出库设置包装物"; }
|
|
}
|
|
|
|
public void Execute(IDmoContext context, object dmo, object parameter)
|
|
{
|
|
var bill = dmo as SaleOutStore;
|
|
if (bill == null)
|
|
return;
|
|
foreach (var detail in bill.Details)
|
|
{
|
|
var list = GetGoods_PackageCount(detail.SaleGoods_ID, bill.AccountingUnit_ID);
|
|
if (list.Count <= 0)
|
|
{
|
|
string msg = "存货【" + detail.Goods_Name + "】没有在【产品包装物设置】界面设置包装物";
|
|
throw new Exception(msg);
|
|
}
|
|
}
|
|
}
|
|
|
|
//根据存货查找【包装物设置】中对应的存货设置
|
|
private List<long?> GetGoods_PackageCount(long? goodID, long? accID)
|
|
{
|
|
var gpackage = new JoinAlias(typeof(Goods_Package));
|
|
var package = new JoinAlias(typeof(Wrappage));
|
|
|
|
var query = new DQueryDom(gpackage);
|
|
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(package), DQCondition.EQ(package, "ID", gpackage, "Package_ID"));
|
|
|
|
query.Columns.Add(DQSelectColumn.Field("Package_ID", gpackage));
|
|
//query.Columns.Add(DQSelectColumn.Create(DQExpression.Count(), "Count"));
|
|
query.GroupBy.Expressions.Add(DQExpression.Field(gpackage, "Package_ID"));
|
|
|
|
query.Where.Conditions.Add(DQCondition.EQ(gpackage, "Goods_ID", goodID));
|
|
query.Where.Conditions.Add(DQCondition.EQ(package, "AccountingUnit_ID", accID));
|
|
|
|
|
|
return query.EExecuteList<long?>();
|
|
}
|
|
|
|
|
|
public IList<string> Features
|
|
{
|
|
get { return new List<string>(); }
|
|
}
|
|
|
|
public string Name
|
|
{
|
|
get { return "B3_YunKen.销售出库设置包装物"; }
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|