using BWP.B3Frameworks.Utils;
|
|
using BWP.B3SubstituteKill.BO;
|
|
using BWP.B3SubstituteKill.Utils;
|
|
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.WebControls2;
|
|
using TSingSoft.WebPluginFramework;
|
|
|
|
namespace BWP.Web.Utils
|
|
{
|
|
public static class B3SubstituteDataProvider
|
|
{
|
|
internal static void Register()
|
|
{
|
|
ChoiceBoxSettings.Register(B3SubstituteKillConsts.DataSources.授权代宰费用, (argu) =>
|
|
{
|
|
return new DomainChoiceBoxQueryHelper<GenerationCostItem>(argu)
|
|
{
|
|
AddOrganizationLimit = true,
|
|
OnlyAvailable = true
|
|
}.GetData();
|
|
});
|
|
|
|
ChoiceBoxSettings.Register(B3SubstituteKillConsts.DataSources.授权代宰费用全部, (argu) =>
|
|
{
|
|
return new DomainChoiceBoxQueryHelper<GenerationCostItem>(argu)
|
|
{
|
|
AddOrganizationLimit = true,
|
|
OnlyAvailable = false
|
|
}.GetData();
|
|
});
|
|
|
|
ChoiceBoxSettings.Register(B3SubstituteKillConsts.DataSources.授权代宰生产线, (argu) =>
|
|
{
|
|
return new DomainChoiceBoxQueryHelper<SubKillProductLine>(argu)
|
|
{
|
|
AddOrganizationLimit = true,
|
|
OnlyAvailable = true
|
|
}.GetData();
|
|
});
|
|
|
|
ChoiceBoxSettings.Register(B3SubstituteKillConsts.DataSources.授权代宰生产线全部, (argu) =>
|
|
{
|
|
return new DomainChoiceBoxQueryHelper<SubKillProductLine>(argu)
|
|
{
|
|
AddOrganizationLimit = true,
|
|
OnlyAvailable = false
|
|
}.GetData();
|
|
});
|
|
|
|
ChoiceBoxSettings.Register(B3SubstituteKillConsts.DataSources.授权代宰回收, (argu) =>
|
|
{
|
|
return new DomainChoiceBoxQueryHelper<SubKillCallBack>(argu)
|
|
{
|
|
AddOrganizationLimit = true,
|
|
OnlyAvailable = true
|
|
}.GetData();
|
|
});
|
|
|
|
ChoiceBoxSettings.Register(B3SubstituteKillConsts.DataSources.授权代宰回收全部, (argu) =>
|
|
{
|
|
return new DomainChoiceBoxQueryHelper<SubKillCallBack>(argu)
|
|
{
|
|
AddOrganizationLimit = true,
|
|
OnlyAvailable = false
|
|
}.GetData();
|
|
});
|
|
|
|
ChoiceBoxSettings.Register(B3SubstituteKillConsts.DataSources.供应商代宰标识, (argu) => { return Get代宰标识(argu, true); });
|
|
ChoiceBoxSettings.Register(B3SubstituteKillConsts.DataSources.供应商代宰标识全部, (argu) => { return Get代宰标识(argu, false); });
|
|
}
|
|
|
|
static IEnumerable<WordPair> Get代宰标识(ChoiceBoxArgument argu, bool available)
|
|
{
|
|
if (string.IsNullOrEmpty(argu.CodeArgument))
|
|
return new List<WordPair>();
|
|
var main = new JoinAlias(typeof(SubKillFlag));
|
|
var detail = new JoinAlias(typeof(SubKillFlag_Detail));
|
|
var query = new DQueryDom(main);
|
|
query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "SubKillFlag_ID"));
|
|
query.Columns.Add(DQSelectColumn.Field("ID", detail));
|
|
query.Columns.Add(DQSelectColumn.Field("Name", detail));
|
|
query.Where.Conditions.Add(DQCondition.EQ("Supplier_ID", long.Parse(argu.CodeArgument)));
|
|
if (available)
|
|
query.Where.Conditions.Add(DQCondition.EQ("Stopped", false));
|
|
if (!string.IsNullOrEmpty(argu.InputArgument))
|
|
query.Where.Conditions.Add(DQCondition.Or(DQCondition.Like(detail, "Name", argu.InputArgument), DQCondition.Like(detail, "Spell", argu.InputArgument)));
|
|
var result = query.EExecuteList<long, string>();
|
|
var l = new List<WordPair>();
|
|
foreach (var item in result)
|
|
l.Add(new WordPair(item.Item2, item.Item1.ToString()));
|
|
return l;
|
|
}
|
|
}
|
|
}
|