using BWP.B3_YunKen.BO;
|
|
using BWP.B3Frameworks.BO;
|
|
using BWP.B3Frameworks.Utils;
|
|
using BWP.B3Sale.BO;
|
|
using BWP.B3UnitedInfos.BO;
|
|
using BWP.Web.Utils;
|
|
using Forks.EnterpriseServices.DataForm;
|
|
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 System.Web.UI;
|
|
using System.Web.UI.HtmlControls;
|
|
using System.Web.UI.WebControls;
|
|
using TSingSoft.WebControls2;
|
|
using TSingSoft.WebPluginFramework;
|
|
using TSingSoft.WebPluginFramework.Controls;
|
|
using TSingSoft.WebPluginFramework.Security;
|
|
using Forks.Utils.Collections;
|
|
using BWP.B3Sale.Utils;
|
|
using BWP.B3Frameworks;
|
|
using BWP.B3UnitedInfos;
|
|
using BWP.B3Frameworks.BO.NamedValueTemplate;
|
|
using Forks.EnterpriseServices.BusinessInterfaces;
|
|
using BWP.B3Sale.BL;
|
|
|
|
|
|
namespace BWP.Web.Pages.B3YunKen.Bill
|
|
{
|
|
public class GoodsPackageSet : AppBasePage
|
|
{
|
|
readonly DFInfo _dfInfo = DFInfo.Get(typeof(Goods_Package));
|
|
private DFChoiceBox _accountingUnitDfc;
|
|
private DFChoiceBox _goodsDfc;
|
|
private DFBrowseGrid _grid;
|
|
private DFBrowseGrid _gridNew;
|
|
|
|
protected override void InitForm(HtmlForm form)
|
|
{
|
|
CheckRole();
|
|
form.Controls.Add(new PageTitle("产品包装物设置"));
|
|
var vPanel = new VLayoutPanel();
|
|
AddChild(form, vPanel);
|
|
CreateQueryControl(vPanel);
|
|
CreateGrid(vPanel);
|
|
|
|
}
|
|
|
|
void CheckRole()
|
|
{
|
|
if (!BLContext.User.IsInRole("B3_YunKen.产品包装物设置.访问"))
|
|
throw new AppSecurityException("您没有权限访问此页面");
|
|
}
|
|
|
|
|
|
|
|
private void CreateQueryControl(VLayoutPanel vPanel)
|
|
{
|
|
var tablePanel = new TableLayoutPanel(6, 2);
|
|
vPanel.Add(tablePanel);
|
|
|
|
int row = 0;
|
|
tablePanel.Add(0, 1, row, row + 1, new SimpleLabel("会计单位", 4));
|
|
_accountingUnitDfc = tablePanel.Add(1, 2, row, ++row, QueryCreator.DFChoiceBox(_dfInfo.Fields["Package_AccountingUnit_ID"], B3FrameworksConsts.DataSources.授权会计单位), new TableLayoutOption(Unit.Pixel(180)));
|
|
|
|
row = 0;
|
|
tablePanel.Add(2, 3, row, row + 1, new SimpleLabel("产品", 4));
|
|
_goodsDfc = tablePanel.Add(3, 4, row, ++row, QueryCreator.DFChoiceBox(_dfInfo.Fields["Goods_ID"], B3UnitedInfosConsts.DataSources.存货), new TableLayoutOption(Unit.Pixel(180)));
|
|
}
|
|
|
|
private void CreateGrid(VLayoutPanel vPanel)
|
|
{
|
|
var hPanel = vPanel.Add(new HLayoutPanel(), new VLayoutOption(HorizontalAlign.Center));
|
|
hPanel.Add(new LiteralControl("<h2>产品明细</h2>"));
|
|
hPanel.Add(new TSButton("已配产品", delegate { GridDataBind(true); }));
|
|
hPanel.Add(new LiteralControl(" "));
|
|
hPanel.Add(new TSButton("未配产品", delegate { GridDataBind(); }));
|
|
|
|
hPanel.Add(new TSButton("保存价格", delegate { SavePrice(); }));
|
|
|
|
_grid = vPanel.Add(new DFBrowseGrid(new DFDataTableEditor()), new VLayoutOption(HorizontalAlign.Center));
|
|
_grid.Width = Unit.Percentage(50);
|
|
_grid.Add(new DFBrowseGridAutoColumn("Goods_ID"));
|
|
_grid.DFGridSetEnabled = false;
|
|
_grid.OnDetailDataBound = (row, obj, index) =>
|
|
{
|
|
var dataRow = obj as DFDataRow;
|
|
if (dataRow == null)
|
|
{
|
|
return;
|
|
}
|
|
var goodsID = dataRow["Goods_ID"];
|
|
var url = AspUtil.UpdateUrlParam("GoodsPackageDetailSet.aspx", "goodsID", goodsID.ToString());
|
|
if (!string.IsNullOrEmpty(_accountingUnitDfc.Value))
|
|
{
|
|
url = AspUtil.UpdateUrlParam(url, "accID", _accountingUnitDfc.Value);
|
|
}
|
|
row.Cells[0].InnerHtml = "<a target='_blank' href='' onclick=\"var returnValue = " + string.Format("ShowDialog('{0}'); ", url) + @"return false;"">" + row.Cells[0].InnerHtml + "</a>";
|
|
};
|
|
|
|
_gridNew = vPanel.Add(new DFBrowseGrid(new DFDataTableEditor()), new VLayoutOption(HorizontalAlign.Center));
|
|
_gridNew.Width = Unit.Percentage(50);
|
|
_gridNew.Add(new DFBrowseGridAutoColumn("Goods_ID"));
|
|
_gridNew.DFGridSetEnabled = false;
|
|
_gridNew.OnDetailDataBound = (row, obj, index) =>
|
|
{
|
|
var dataRow = obj as DFDataRow;
|
|
if (dataRow == null)
|
|
{
|
|
return;
|
|
}
|
|
var goodsID = dataRow["Goods_ID"];
|
|
var url = AspUtil.UpdateUrlParam("GoodsPackageDetailSet.aspx", "goodsID", goodsID.ToString());
|
|
if (!string.IsNullOrEmpty(_accountingUnitDfc.Value))
|
|
{
|
|
url = AspUtil.UpdateUrlParam(url, "accID", _accountingUnitDfc.Value);
|
|
}
|
|
row.Cells[0].InnerHtml = "<a target='_blank' href='' onclick=\"var returnValue = " + string.Format("ShowDialog('{0}'); ", url) + @"return false;"">" + row.Cells[0].InnerHtml + "</a>";
|
|
};
|
|
|
|
_gridNew.Columns.EAdd(new DFGridCustomExtColumn(delegate(object obj, HtmlTableCell cell, int rowIndex)
|
|
{
|
|
DFDataRow dr = obj as DFDataRow;
|
|
if (dr != null)
|
|
{
|
|
|
|
string accName = (string)dr["会计单位"] ?? "";
|
|
var smallPackNum = int.Parse((dr["内包装物数量"] == null ? "0" : dr["内包装物数量"].ToString()));
|
|
decimal priceSum = 0;
|
|
foreach (var tuple in WrappageKindList)
|
|
{
|
|
if (!string.IsNullOrEmpty(tuple.Item2))
|
|
{
|
|
string name = (string)dr[tuple.Item2] ?? "";
|
|
var price = GetWrappageUnitPrice(accName, name) ?? 0;
|
|
if (price == 0)
|
|
{
|
|
price = GetWrappagePrice(accName, name) ?? 0;
|
|
}
|
|
|
|
if (name.Contains("内包装"))
|
|
{
|
|
price =price * smallPackNum;
|
|
priceSum += price;
|
|
}
|
|
else
|
|
{
|
|
priceSum += price;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
var lb = new Label();
|
|
lb.Text = priceSum.ToString();
|
|
cell.Controls.Add(lb);
|
|
}
|
|
})).HeaderText = "价格";
|
|
|
|
|
|
}
|
|
|
|
|
|
protected override void OnPreRender(EventArgs e)
|
|
{
|
|
base.OnPreRender(e);
|
|
DialogUtil.RegisterDialogReturnInput(Page);
|
|
}
|
|
|
|
private List<Tuple<long, string>> WrappageKindList
|
|
{
|
|
get
|
|
{
|
|
if (ViewState["WrappageKindList"] == null)
|
|
ViewState["WrappageKindList"] = new List<Tuple<long, string>>();
|
|
return (List<Tuple<long, string>>)ViewState["WrappageKindList"];
|
|
}
|
|
set { ViewState["WrappageKindList"] = value; }
|
|
}
|
|
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
base.OnLoad(e);
|
|
if (!IsPostBack)
|
|
{
|
|
var dom = new DQueryDom(new JoinAlias(typeof(WrappageKind)));
|
|
dom.Where.Conditions.Add(DQCondition.EQ("Depth", 1));
|
|
dom.Columns.Add(DQSelectColumn.Field("ID"));
|
|
dom.Columns.Add(DQSelectColumn.Field("Name"));
|
|
WrappageKindList = dom.EExecuteList<long, string>();
|
|
GridDataBind();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void SavePrice(bool configured = false)
|
|
{
|
|
|
|
var dom=GetDQueryDom(true);
|
|
|
|
List<SavePriceTemp> savePriceList = new List<SavePriceTemp>();
|
|
using (var context = new TransactionContext())
|
|
{
|
|
using (var reader = context.Session.ExecuteReader(dom))
|
|
{
|
|
while (reader.Read())
|
|
{
|
|
var d = new SavePriceTemp();
|
|
d.Goods_ID = (long)reader[0];
|
|
d.AccountingUnit_Name = (string)reader[3];
|
|
d.WrappageKindID1 = (string)reader[4];
|
|
d.WrappageKindID2 = (string)reader[5];
|
|
d.WrappageKindID3 = (string)reader[6];
|
|
d.WrappageKindID4 = (string)reader[7];
|
|
d.SmallPackNum = reader[8] == null ? 0 : Convert.ToInt32(reader[8]);
|
|
d.AccountingUnit_ID = (long)reader[9];
|
|
savePriceList.Add(d);
|
|
}
|
|
}
|
|
}
|
|
|
|
List<Goods_PackagePrice> Goods_PackagePriceList = new List<Goods_PackagePrice>();
|
|
#region
|
|
foreach (var savePrice in savePriceList)
|
|
{
|
|
decimal priceSum = 0;
|
|
decimal price1 = 0, price2 = 0, price3 = 0, price4 = 0;
|
|
if (!string.IsNullOrEmpty(savePrice.WrappageKindID1))
|
|
{
|
|
price1 = GetWrappageUnitPrice(savePrice.AccountingUnit_Name, savePrice.WrappageKindID1) ?? 0;
|
|
if (price1 == 0)
|
|
{
|
|
price1 = GetWrappagePrice(savePrice.AccountingUnit_Name, savePrice.WrappageKindID1) ?? 0;
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(savePrice.WrappageKindID2))
|
|
{
|
|
price2 = GetWrappageUnitPrice(savePrice.AccountingUnit_Name, savePrice.WrappageKindID2) ?? 0;
|
|
if (price2 == 0)
|
|
{
|
|
price2 = GetWrappagePrice(savePrice.AccountingUnit_Name, savePrice.WrappageKindID2) ?? 0;
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(savePrice.WrappageKindID3))
|
|
{
|
|
price3 = GetWrappageUnitPrice(savePrice.AccountingUnit_Name, savePrice.WrappageKindID3) ?? 0;
|
|
if (price3 == 0)
|
|
{
|
|
price3 = GetWrappagePrice(savePrice.AccountingUnit_Name, savePrice.WrappageKindID3) ?? 0;
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(savePrice.WrappageKindID4))
|
|
{
|
|
price4 = GetWrappageUnitPrice(savePrice.AccountingUnit_Name, savePrice.WrappageKindID4) ?? 0;
|
|
if (price4 == 0)
|
|
{
|
|
price4 = GetWrappagePrice(savePrice.AccountingUnit_Name, savePrice.WrappageKindID4) ?? 0;
|
|
}
|
|
|
|
price4 = price4 * savePrice.SmallPackNum;
|
|
}
|
|
|
|
priceSum = price1 + price2 + price3 +price4;
|
|
|
|
Goods_PackagePrice gp = new Goods_PackagePrice { Goods_ID = savePrice.Goods_ID, Price = priceSum, AccountingUnit_ID = savePrice.AccountingUnit_ID, User_ID = DomainContext.Current.DomainUser.User_ID };
|
|
|
|
Goods_PackagePriceList.Add(gp);
|
|
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
using (var context = new TransactionContext())
|
|
{
|
|
string sql = "delete from B3_YunKen_Goods_PackagePrice where User_ID=" + DomainContext.Current.DomainUser.User_ID;
|
|
context.Session.ExecuteSqlNonQuery(sql);
|
|
context.Session.Commit();
|
|
}
|
|
|
|
using (var context = new TransactionContext())
|
|
{
|
|
var session = context.Session;
|
|
|
|
foreach (var gp in Goods_PackagePriceList)
|
|
{
|
|
session.Insert(gp);
|
|
}
|
|
session.Commit();
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
class SavePriceTemp
|
|
{
|
|
public long Goods_ID { get; set; }
|
|
|
|
public string AccountingUnit_Name { get; set; }
|
|
|
|
public string WrappageKindID1 { get; set; }
|
|
public string WrappageKindID2 { get; set; }
|
|
public string WrappageKindID3 { get; set; }
|
|
public string WrappageKindID4 { get; set; }
|
|
|
|
public int SmallPackNum { get; set; }
|
|
//public string SmallPackNum { get; set; }
|
|
|
|
public long AccountingUnit_ID { get; set; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GridDataBind(bool configured = false)
|
|
{
|
|
if (configured)
|
|
{
|
|
_gridNew.Query = GetDQueryDom(configured);
|
|
_gridNew.CurrentPageIndex = 0;
|
|
_gridNew.DataBind();
|
|
_gridNew.Visible = true;
|
|
_grid.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
_grid.Query = GetDQueryDom(configured);
|
|
_grid.CurrentPageIndex = 0;
|
|
_grid.DataBind();
|
|
_gridNew.Visible = false;
|
|
_grid.Visible = true;
|
|
}
|
|
}
|
|
|
|
public void DoGridDataBind()
|
|
{
|
|
_grid.DataBind();
|
|
_gridNew.DataBind();
|
|
}
|
|
|
|
private DQueryDom GetDQueryDom(bool configured = false)
|
|
{
|
|
var goods = new JoinAlias(typeof(Goods));
|
|
var temp = new JoinAlias(typeof(TempPackage));
|
|
var temp2 = new JoinAlias(typeof(TempPackage2));
|
|
var dom = new DQueryDom(goods);
|
|
OrganizationUtil.RegisterOrganizationQueryTable(dom);
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(goods, "ID"), "Goods_ID"));
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(goods, "Name"), "产品"));
|
|
if (configured)
|
|
{
|
|
var strings = new string[] { "Goods_ID", "AccountingUnit_ID", "AccountingUnit_Name", "Count" }.ToList();
|
|
for (var index = 0; index < WrappageKindList.Count; index++)
|
|
{
|
|
if (index + 1 > MaxCol)
|
|
break;
|
|
strings.Add("ID" + (index + 1));
|
|
}
|
|
strings.Add("SmallPackNum");
|
|
dom.RegisterQueryTable(typeof(TempPackage2), strings, GetTempDom2());
|
|
dom.From.AddJoin(JoinType.Right, new DQDmoSource(temp2), DQCondition.EQ(temp2, "Goods_ID", goods, "ID"));
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(temp2, "Count"), "已配数量"));
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(temp2, "AccountingUnit_Name"), "会计单位"));
|
|
|
|
int i = 1;
|
|
foreach (var tuple in WrappageKindList)
|
|
{
|
|
if (i > MaxCol)
|
|
break;
|
|
var package = new JoinAlias("p" + i, typeof(Wrappage));
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(package), DQCondition.EQ(package, "ID", temp2, "ID" + i));
|
|
dom.Columns.Add(
|
|
DQSelectColumn.Create(DQExpression.Field(package, "Name"), tuple.Item2));
|
|
i++;
|
|
}
|
|
dom.OrderBy.Expressions.Add(DQOrderByExpression.Create(goods, "Name"));
|
|
dom.OrderBy.Expressions.Add(DQOrderByExpression.Create(temp2, "AccountingUnit_Name"));
|
|
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(temp2, "SmallPackNum"), "内包装物数量"));
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(temp2, "AccountingUnit_ID"), "会计单位ID"));
|
|
}
|
|
else
|
|
{
|
|
dom.RegisterQueryTable(typeof(TempPackage), new[] { "Goods_ID" }, GetTempDom());
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(temp), DQCondition.EQ(temp, "Goods_ID", goods, "ID"));
|
|
dom.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field(temp, "Goods_ID")));
|
|
}
|
|
if (!string.IsNullOrEmpty(_goodsDfc.Value))
|
|
{
|
|
dom.Where.Conditions.Add(DQCondition.EQ("ID", _goodsDfc.Value));
|
|
}
|
|
|
|
dom.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field(goods, "ID")));
|
|
//不显示停用存货
|
|
dom.Where.Conditions.Add(DQCondition.InEQ(DQExpression.Field(goods, "Stopped"), DQExpression.Value(1)));
|
|
return dom;
|
|
}
|
|
|
|
private DQueryDom GetTempDom()
|
|
{
|
|
var gpackage = new JoinAlias(typeof(Goods_Package));
|
|
var dom = new DQueryDom(gpackage);
|
|
dom.Columns.Add(DQSelectColumn.Field("Goods_ID"));
|
|
if (!string.IsNullOrEmpty(_accountingUnitDfc.Value))
|
|
{
|
|
dom.Where.Conditions.Add(DQCondition.EQ("Package_AccountingUnit_ID", _accountingUnitDfc.Value));
|
|
}
|
|
//AuthorizeUtil.AddOrganizationAuthorising(dom, "Package_AccountingUnit_Organization_ID");
|
|
//OrganizationUtil.AddOrganizationLimit(dom, typeof(Goods_Package), gpackage);
|
|
return dom;
|
|
}
|
|
|
|
private const int MaxCol = 10;
|
|
|
|
private DQueryDom GetTempDom2()
|
|
{
|
|
var WrappageKind = new JoinAlias(typeof(WrappageKind));
|
|
var gpackage = new JoinAlias(typeof(Goods_Package));
|
|
var package = new JoinAlias(typeof(Wrappage));
|
|
var acc = new JoinAlias("acc", typeof(AccountingUnit));
|
|
var dom = new DQueryDom(gpackage);
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(package), DQCondition.EQ(package, "ID", gpackage, "Package_ID"));
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(WrappageKind), DQCondition.EQ(package, "WrappageKind_ID", WrappageKind, "ID"));
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(acc), DQCondition.EQ(package, "AccountingUnit_ID", acc, "ID"));
|
|
|
|
dom.Columns.Add(DQSelectColumn.Field("Goods_ID"));
|
|
dom.Columns.Add(DQSelectColumn.Field("ID", acc));
|
|
dom.Columns.Add(DQSelectColumn.Field("Name", acc));
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Count(), "Count"));
|
|
dom.GroupBy.Expressions.Add(DQExpression.Field("Goods_ID"));
|
|
dom.GroupBy.Expressions.Add(DQExpression.Field(acc, "ID"));
|
|
dom.GroupBy.Expressions.Add(DQExpression.Field(acc, "Name"));
|
|
int i = 1;
|
|
foreach (var tuple in WrappageKindList)
|
|
{
|
|
if (i > MaxCol)
|
|
break;
|
|
dom.Columns.Add(
|
|
DQSelectColumn.Create(
|
|
DQExpression.Max(DQExpression.LogicCase(DQCondition.EQ(WrappageKind, "TreeDeep1ID", tuple.Item1), DQExpression.Field(package, "ID"))), tuple.Item2));
|
|
i++;
|
|
}
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.InEQ(WrappageKind, "TreeDeep1ID", 5), DQExpression.Value(0), DQExpression.Field(gpackage, "SmallPackNum"))), "SmallPackNum"));
|
|
|
|
if (!string.IsNullOrEmpty(_accountingUnitDfc.Value))
|
|
{
|
|
dom.Where.Conditions.Add(DQCondition.EQ(acc, "ID", _accountingUnitDfc.Value));
|
|
}
|
|
//AuthorizeUtil.AddOrganizationAuthorising(dom, new KeyValuePair<string, string>("acc", "Organization_ID"));
|
|
OrganizationUtil.AddOrganizationLimit(dom, typeof(AccountingUnit), acc);
|
|
return dom;
|
|
}
|
|
|
|
class TempPackage
|
|
{
|
|
public long Goods_ID { get; set; }
|
|
}
|
|
|
|
class TempPackage2
|
|
{
|
|
public string SmallPackNum { get; set; }
|
|
|
|
public long Goods_ID { get; set; }
|
|
public long AccountingUnit_ID { get; set; }
|
|
public string AccountingUnit_Name { get; set; }
|
|
public long Count { get; set; }
|
|
public long ID1 { get; set; }
|
|
public long ID2 { get; set; }
|
|
public long ID3 { get; set; }
|
|
public long ID4 { get; set; }
|
|
public long ID5 { get; set; }
|
|
public long ID6 { get; set; }
|
|
public long ID7 { get; set; }
|
|
public long ID8 { get; set; }
|
|
public long ID9 { get; set; }
|
|
public long ID10 { get; set; }
|
|
}
|
|
|
|
|
|
|
|
//根据会计单位和包装物名称 得到 包装物单价
|
|
private decimal? GetWrappageUnitPrice(string accName, string wrappageName)
|
|
{
|
|
JoinAlias main = new JoinAlias(typeof(WrappageUnitPrice));
|
|
JoinAlias detail = new JoinAlias(typeof(WrappageUnitPrice_Detail));
|
|
DQueryDom dom = new DQueryDom(main);
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "WrappageUnitPrice_ID"));
|
|
//dom.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(detail, "OldPrice")), "OldPrice"));
|
|
dom.Columns.Add(DQSelectColumn.Field("NewPrice", detail));
|
|
|
|
dom.Where.Conditions.Add(DQCondition.EQ(main, "BillState", 单据状态.已审核));
|
|
dom.Where.Conditions.Add(DQCondition.EQ(main, "AccountingUnit_Name", accName));
|
|
dom.Where.Conditions.Add(DQCondition.EQ(detail, "Wrappage_Name", wrappageName));
|
|
dom.Where.Conditions.Add(DQCondition.EQ("Domain_ID", DomainContext.Current.ID));
|
|
|
|
var price = (decimal?)dom.EExecuteScalar();
|
|
|
|
return price;
|
|
}
|
|
|
|
//根据会计单位和包装物名称 得到 包装物单价
|
|
private decimal? GetWrappagePrice(string accName, string wrappageName)
|
|
{
|
|
JoinAlias main = new JoinAlias(typeof(Wrappage));
|
|
DQueryDom dom = new DQueryDom(main);
|
|
|
|
dom.Columns.Add(DQSelectColumn.Field("Price", main));
|
|
|
|
dom.Where.Conditions.Add(DQCondition.EQ(main, "Stopped", 0));
|
|
dom.Where.Conditions.Add(DQCondition.EQ(main, "AccountingUnit_Name", accName));
|
|
dom.Where.Conditions.Add(DQCondition.EQ(main, "Name", wrappageName));
|
|
dom.Where.Conditions.Add(DQCondition.EQ("Domain_ID", DomainContext.Current.ID));
|
|
|
|
var price = (decimal?)dom.EExecuteScalar();
|
|
|
|
|
|
return price;
|
|
}
|
|
|
|
|
|
}
|
|
}
|