| @ -0,0 +1,51 @@ | |||
| using BWP.B3ProduceUnitedInfos.NamedValueTemplate; | |||
| using BWP.B3SheepButcherManage; | |||
| using BWP.B3SheepButcherManage.BL; | |||
| using BWP.B3SheepButcherManage.BO; | |||
| using BWP.Web.CustomPageLayout; | |||
| using BWP.Web.Layout; | |||
| using BWP.Web.Utils; | |||
| using BWP.Web.WebControls; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using TSingSoft.WebControls2; | |||
| namespace BWP.Web.Pages.B3SheepButcherManage.BaseInfos.Livestock_ | |||
| { | |||
| class LivestockEdit : BaseInfoEditPage<Livestock, ILivestockBL> | |||
| { | |||
| protected override void BuildBasePropertiesEditor(TitlePanel titlePanel, PageLayoutSection pageLayoutSection) | |||
| { | |||
| var layoutManager = new LayoutManager("", mDFInfo, mDFContainer); | |||
| layoutManager.Add("GoodsProperty_ID", InputCreator.DFChoiceBox(B3SheepButcherManageConsts.DataSources.可屠宰存货属性, "GoodsProperty_Name")); | |||
| var config = new AutoLayoutConfig(); | |||
| layoutManager.Config = config; | |||
| config.Add("GoodsProperty_ID"); | |||
| config.Add("Name"); | |||
| config.Add("Code"); | |||
| config.Add("LiveVarieties_ID"); | |||
| config.Add("PrintShortName"); | |||
| config.Add("Spec"); | |||
| config.Add("Feature"); | |||
| config.Add("Origin"); | |||
| config.Add("Brand"); | |||
| config.Add("TaxRate"); | |||
| config.Add("MainUnit"); | |||
| config.Add("SecondUnit"); | |||
| config.Add("Remark"); | |||
| pageLayoutSection.SetRequired("GoodsProperty_ID", "Name", "Code"); | |||
| pageLayoutSection.ApplyLayout(layoutManager, config, mPageLayoutManager, mDFInfo); | |||
| titlePanel.Controls.Add(layoutManager.CreateLayout()); | |||
| layoutManager.EnsureInputControlCreated<DFChoiceBox>("LiveVarieties_ID").CodeArgument = 生物资产属性.羊.Value.ToString(); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,57 @@ | |||
| using BWP.B3Frameworks.Utils; | |||
| using BWP.B3ProduceUnitedInfos.NamedValueTemplate; | |||
| using BWP.B3SheepButcherManage; | |||
| using BWP.B3SheepButcherManage.BL; | |||
| using BWP.B3SheepButcherManage.BO; | |||
| using BWP.B3UnitedInfos.BO; | |||
| using BWP.Web.Layout; | |||
| using BWP.Web.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; | |||
| namespace BWP.Web.Pages.B3SheepButcherManage.BaseInfos.Livestock_ | |||
| { | |||
| class LivestockList : BaseInfoListPage<Livestock, ILivestockBL> | |||
| { | |||
| protected override DQueryDom GetQueryDom() | |||
| { | |||
| var dom = base.GetQueryDom(); | |||
| var prop = new JoinAlias(typeof(GoodsProperty)); | |||
| dom.From.AddJoin(JoinType.Inner, new DQDmoSource(prop), DQCondition.EQ(prop, "ID", dom.From.RootSource.Alias, "GoodsProperty_ID")); | |||
| dom.Where.Conditions.Add(DQCondition.EQ(prop, "IsButchery", true)); | |||
| dom.Where.Conditions.Add(DQCondition.EQ("LiveVarieties_Nature", 生物资产属性.羊)); | |||
| DomainUtil.AddDomainPermissionLimit(dom, typeof(GoodsProperty), prop); | |||
| return dom; | |||
| } | |||
| protected override void AddQueryControls(VLayoutPanel vPanel) | |||
| { | |||
| LayoutManager manage = null; | |||
| vPanel.Add(CreateDefaultBaseInfoQueryControls((layoutManager, config) => | |||
| { | |||
| layoutManager.Add("GoodsProperty_ID", QueryCreator.DFChoiceBox(mDFInfo.Fields["GoodsProperty_ID"], B3SheepButcherManageConsts.DataSources.可屠宰存货属性)); | |||
| config.AddAfter("GoodsProperty_ID", "ID"); | |||
| config.Add("LiveVarieties_ID"); | |||
| manage = layoutManager; | |||
| })); | |||
| manage.EnsureInputControlCreated<DFChoiceBox>("LiveVarieties_ID").CodeArgument = 生物资产属性.羊.Value.ToString(); | |||
| } | |||
| protected override void AddDFBrowseGridColumn(DFBrowseGrid grid, string field) | |||
| { | |||
| base.AddDFBrowseGridColumn(grid, field); | |||
| if (field == "Name") | |||
| { | |||
| AddDFBrowseGridColumn(grid, "LiveVarieties_Name"); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,55 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | |||
| <Select xmlns="urn:XDQuery"> | |||
| <Columns> | |||
| <Field name="ID"/> | |||
| </Columns> | |||
| <From> | |||
| <DmoClass class="BWP.B3SheepButcherManage.BO.Livestock, B3SheepButcherManage"/> | |||
| </From> | |||
| <Where> | |||
| <And> | |||
| <EQ> | |||
| <Field name="ID"/> | |||
| <QBE paramName="ID"/> | |||
| </EQ> | |||
| <EQ> | |||
| <Field name="GoodsProperty_ID"/> | |||
| <QBE paramName="GoodsProperty_ID"/> | |||
| </EQ> | |||
| <EQ> | |||
| <Field name="LiveVarieties_ID"/> | |||
| <QBE paramName="LiveVarieties_ID"/> | |||
| </EQ> | |||
| <Or> | |||
| <Contains> | |||
| <Field name="Name"/> | |||
| <QBE paramName="Name"/> | |||
| </Contains> | |||
| <Contains> | |||
| <Field name="Spell"/> | |||
| <QBE paramName="Name"/> | |||
| </Contains> | |||
| </Or> | |||
| <Contains> | |||
| <Field name="Code"/> | |||
| <QBE paramName="Code"/> | |||
| </Contains> | |||
| <Contains> | |||
| <Field name="Brand"/> | |||
| <QBE paramName="Brand"/> | |||
| </Contains> | |||
| <EQ> | |||
| <Field name="Stopped"/> | |||
| <QBE paramName="Stopped"/> | |||
| </EQ> | |||
| <EQ> | |||
| <Field name="IsLocked"/> | |||
| <QBE paramName="IsLocked"/> | |||
| </EQ> | |||
| <Contains> | |||
| <Field name="Remark"/> | |||
| <QBE paramName="Remark"/> | |||
| </Contains> | |||
| </And> | |||
| </Where> | |||
| </Select> | |||
| @ -0,0 +1,243 @@ | |||
| using BWP.B3Frameworks; | |||
| using BWP.B3Frameworks.BO.NamedValueTemplate; | |||
| using BWP.B3SheepButcherManage.BL; | |||
| using BWP.B3SheepButcherManage.BO; | |||
| using BWP.Web.CustomPageLayout; | |||
| using BWP.Web.Layout; | |||
| using BWP.Web.WebControls; | |||
| using Forks.EnterpriseServices.BusinessInterfaces; | |||
| 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.WebControls; | |||
| using TSingSoft.WebControls2; | |||
| using TSingSoft.WebPluginFramework.Controls; | |||
| using TSingSoft.WebPluginFramework.Exports; | |||
| using Forks.Utils.Collections; | |||
| using BWP.B3ProduceUnitedInfos.NamedValueTemplate; | |||
| namespace BWP.Web.Pages.B3SheepButcherManage.Bills.FixedPrice_ | |||
| { | |||
| class FixedPriceEdit : DepartmentWorkFlowBillEditPage<FixedPrice, IFixedPriceBL> | |||
| { | |||
| DFEditGrid _detailGrid; | |||
| protected override void BuildBasePropertiesEditor(TitlePanel titlePanel, PageLayoutSection pageLayoutSection) | |||
| { | |||
| var layoutManager = new LayoutManager("", mDFInfo, mDFContainer); | |||
| var config = new AutoLayoutConfig(); | |||
| config.Add("AccountingUnit_ID"); | |||
| config.Add("Department_ID"); | |||
| config.Add("Employee_ID"); | |||
| config.Add("ExeTime"); | |||
| pageLayoutSection.ApplyLayout(layoutManager, config, mPageLayoutManager, mDFInfo); | |||
| layoutManager.Config = config; | |||
| titlePanel.Controls.Add(layoutManager.CreateLayout()); | |||
| } | |||
| protected override void BuildBody(System.Web.UI.Control parent) | |||
| { | |||
| base.BuildBody(parent); | |||
| AddDetail(parent.EAdd(new TitlePanel("单据明细", "单据明细"))); | |||
| } | |||
| private void AddDetail(TitlePanel titlePanel) | |||
| { | |||
| var vPanel = titlePanel.EAdd(new VLayoutPanel()); | |||
| var hPanel = new HLayoutPanel(); | |||
| vPanel.Add(hPanel, new VLayoutOption(HorizontalAlign.Left)); | |||
| if (CanSave) | |||
| { | |||
| var btnAdd = new TSButton("新增"); | |||
| btnAdd.Click += (sender, e) => | |||
| { | |||
| _detailGrid.GetFromUI(); | |||
| var detail = new FixedPrice_Detail(); | |||
| Dmo.Details.Add(detail); | |||
| _detailGrid.DataBind(); | |||
| }; | |||
| hPanel.Add(btnAdd); | |||
| var exportOutBtn = new TSButton("导出定价单"); | |||
| hPanel.Add(exportOutBtn); | |||
| var exporter = new Exporter(); | |||
| hPanel.Add(exporter); | |||
| exportOutBtn.Click += delegate | |||
| { | |||
| var dom = QueryDetail(); | |||
| var file = new DQueryExcelExporter(LogicName + "No." + Dmo.ID + ".xls", new LoadArguments(dom)); | |||
| exporter.Export(file); | |||
| }; | |||
| var exportPriceBtn = new TSButton("导入定价单"); | |||
| hPanel.Add(exportPriceBtn); | |||
| hPanel.Add(new SimpleLabel("定价单ID")); | |||
| var txtbillID = hPanel.Add(new DFTextBox()); | |||
| exportPriceBtn.Click += (sender, e) => | |||
| { | |||
| _detailGrid.GetFromUI(); | |||
| if (txtbillID.IsEmpty) | |||
| throw new Exception("请输入定价单单号"); | |||
| var list = GetDetailDataList(long.Parse(txtbillID.Text)); | |||
| foreach (var item in list) | |||
| { | |||
| var priceDetail = new FixedPrice_Detail(); | |||
| priceDetail.ValuationArea_ID = item.ValuationArea_ID; | |||
| priceDetail.ValuationArea_Name = item.ValuationArea_Name; | |||
| priceDetail.LiveVarieties_ID = item.LiveVarieties_ID; | |||
| priceDetail.LiveVarieties_Name = item.LiveVarieties_Name; | |||
| priceDetail.Livestock_ID = item.Livestock_ID; | |||
| priceDetail.Livestock_Name = item.Livestock_Name; | |||
| priceDetail.OriginalPrice = item.Price; | |||
| priceDetail.Remark = item.Remark; | |||
| Dmo.Details.Add(priceDetail); | |||
| } | |||
| _detailGrid.DataBind(); | |||
| }; | |||
| if (CheckDefaultRole("调价")) | |||
| { | |||
| var txtPrice = new DFTextBox(); | |||
| hPanel.Add(new SimpleLabel("调价")); | |||
| hPanel.Add(txtPrice); | |||
| var btnPrice = new TSButton("调价"); | |||
| btnPrice.Click += delegate | |||
| { | |||
| if (string.IsNullOrWhiteSpace(txtPrice.Text)) | |||
| { | |||
| return; | |||
| } | |||
| _detailGrid.GetFromUI(); | |||
| foreach (FixedPrice_Detail detail in Dmo.Details) | |||
| { | |||
| detail.Price = detail.Price + decimal.Parse(txtPrice.Text); | |||
| } | |||
| _detailGrid.DataBind(); | |||
| }; | |||
| hPanel.Add(btnPrice); | |||
| } | |||
| } | |||
| if (MinDmo.BillState == 单据状态.已审核) | |||
| { | |||
| hPanel.Add(new TSButton("更新未审核账单单价", delegate | |||
| { | |||
| mBL.RsetPrice(Dmo); | |||
| AspUtil.Alert(this, "操作成功!"); | |||
| })); | |||
| } | |||
| var editor = new DFCollectionEditor<FixedPrice_Detail>(() => Dmo.Details); | |||
| editor.AllowDeletionFunc = () => CanSave; | |||
| editor.CanDeleteFunc = detail => true; | |||
| editor.IsEditableFunc = (field, detail) => CanSave; | |||
| _detailGrid = new DFEditGrid(editor); | |||
| _detailGrid.DFGridSetEnabled = false; | |||
| _detailGrid.Width = Unit.Percentage(100); | |||
| _detailGrid.Columns.Add(new DFEditGridColumn("ValuationArea_ID")); | |||
| _detailGrid.Columns.EAdd(new DFEditGridColumn<DFChoiceBox>("LiveVarieties_ID")).InitEditControl += (sender, e) => | |||
| { | |||
| e.Control.CodeArgument = 生物资产属性.羊.Value.ToString(); | |||
| }; | |||
| _detailGrid.Columns.Add(new DFEditGridColumn("Livestock_ID")); | |||
| _detailGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("OriginalPrice")); | |||
| _detailGrid.Columns.Add(new DFEditGridColumn("Price")); | |||
| _detailGrid.Columns.Add(new DFEditGridColumn("Remark")); | |||
| mDFContainer.AddNonDFControl(_detailGrid, "$detailGrid"); | |||
| var dic = new Dictionary<string, Unit>(); | |||
| dic.Add("定价地区", Unit.Percentage(20)); | |||
| dic.Add("品种", Unit.Percentage(20)); | |||
| dic.Add("级别", Unit.Percentage(20)); | |||
| dic.Add("原单价", Unit.Percentage(15)); | |||
| dic.Add("单价", Unit.Percentage(15)); | |||
| dic.Add("备注", Unit.Percentage(10)); | |||
| _detailGrid.PreferWidthGridSet = dic; | |||
| var section = mPageLayoutManager.AddSection("DetaiColumns", "明细列"); | |||
| titlePanel.SetPageLayoutSetting(mPageLayoutManager, section.Name); | |||
| section.ApplyLayout(_detailGrid, mPageLayoutManager, DFInfo.Get(typeof(FixedPrice_Detail))); | |||
| vPanel.Add(_detailGrid); | |||
| } | |||
| DQueryDom QueryDetail() | |||
| { | |||
| var dom = new DQueryDom(new JoinAlias(typeof(FixedPrice_Detail))); | |||
| dom.Columns.Add(DQSelectColumn.Field("ID")); | |||
| dom.Columns.Add(DQSelectColumn.Field("ValuationArea_Name")); | |||
| dom.Columns.Add(DQSelectColumn.Field("LiveVarieties_Name")); | |||
| dom.Columns.Add(DQSelectColumn.Field("Livestock_Name")); | |||
| dom.Columns.Add(DQSelectColumn.Field("Price")); | |||
| dom.Columns.Add(DQSelectColumn.Field("OriginalPrice")); | |||
| dom.Columns.Add(DQSelectColumn.Field("Remark")); | |||
| dom.Where.Conditions.Add(DQCondition.EQ("FixedPrice_ID", Dmo.ID)); | |||
| return dom; | |||
| } | |||
| public override void AppToUI() | |||
| { | |||
| base.AppToUI(); | |||
| _detailGrid.DataBind(); | |||
| } | |||
| public override void GetFromUI() | |||
| { | |||
| base.GetFromUI(); | |||
| _detailGrid.GetFromUI(); | |||
| } | |||
| List<FixedPrice_Detail> GetDetailDataList(long? ID) | |||
| { | |||
| var alias = new JoinAlias(typeof(FixedPrice)); | |||
| var detail = new JoinAlias(typeof(FixedPrice_Detail)); | |||
| var dom = new DQueryDom(alias); | |||
| dom.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.And(DQCondition.EQ(alias, "ID", detail, "FixedPrice_ID"))); | |||
| dom.Columns.Add(DQSelectColumn.Field("ValuationArea_ID", detail)); | |||
| dom.Columns.Add(DQSelectColumn.Field("LiveVarieties_ID", detail)); | |||
| dom.Columns.Add(DQSelectColumn.Field("Livestock_ID", detail)); | |||
| dom.Columns.Add(DQSelectColumn.Field("OriginalPrice", detail)); | |||
| dom.Columns.Add(DQSelectColumn.Field("Price", detail)); | |||
| dom.Columns.Add(DQSelectColumn.Field("Remark", detail)); | |||
| dom.Columns.Add(DQSelectColumn.Field("ValuationArea_Name", detail)); | |||
| dom.Columns.Add(DQSelectColumn.Field("LiveVarieties_Name", detail)); | |||
| dom.Columns.Add(DQSelectColumn.Field("Livestock_Name", detail)); | |||
| dom.Where.Conditions.Add(DQCondition.EQ(alias, "Domain_ID", DomainContext.Current.ID)); | |||
| dom.Where.Conditions.Add(DQCondition.EQ(alias, "BillState", 单据状态.已审核)); | |||
| dom.Where.Conditions.Add(DQCondition.EQ(alias, "ID", ID)); | |||
| var list = new List<FixedPrice_Detail>(); | |||
| using (var context = new TransactionContext()) | |||
| { | |||
| using (var reader = context.Session.ExecuteReader(dom)) | |||
| { | |||
| while (reader.Read()) | |||
| { | |||
| var priceDetail = new FixedPrice_Detail(); | |||
| priceDetail.ValuationArea_ID = (long?)reader[0]; | |||
| priceDetail.LiveVarieties_ID = (long?)reader[1]; | |||
| priceDetail.Livestock_ID = (long?)reader[2]; | |||
| priceDetail.OriginalPrice = (decimal?)reader[3]; | |||
| priceDetail.Price = (decimal?)reader[4]; | |||
| priceDetail.Remark = (string)reader[5]; | |||
| priceDetail.ValuationArea_Name = (string)reader[6]; | |||
| priceDetail.LiveVarieties_Name = (string)reader[7]; | |||
| priceDetail.Livestock_Name = (string)reader[8]; | |||
| list.Add(priceDetail); | |||
| } | |||
| } | |||
| } | |||
| return list; | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,37 @@ | |||
| using BWP.B3SheepButcherManage.BL; | |||
| using BWP.B3SheepButcherManage.BO; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using TSingSoft.WebControls2; | |||
| namespace BWP.Web.Pages.B3SheepButcherManage.Bills.FixedPrice_ | |||
| { | |||
| class FixedPriceList : DomainBillListPage<FixedPrice, IFixedPriceBL> | |||
| { | |||
| protected override void AddQueryControls(VLayoutPanel vPanel) | |||
| { | |||
| vPanel.Add(CreateDefaultBillQueryControls((panel, config) => | |||
| { | |||
| config.Add("ExeTime"); | |||
| config.Add("AccountingUnit_ID"); | |||
| config.Add("Department_ID"); | |||
| config.Add("Employee_ID"); | |||
| })); | |||
| } | |||
| protected override void AddDFBrowseGridColumn(DFBrowseGrid grid, string field) | |||
| { | |||
| base.AddDFBrowseGridColumn(grid, field); | |||
| if (field == "BillState") | |||
| { | |||
| AddDFBrowseGridColumn(grid, "AccountingUnit_Name"); | |||
| AddDFBrowseGridColumn(grid, "Department_Name"); | |||
| AddDFBrowseGridColumn(grid, "Employee_Name"); | |||
| AddDFBrowseGridColumn(grid, "CheckUser_Name"); | |||
| AddDFBrowseGridColumn(grid, "Remark"); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,69 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | |||
| <Select xmlns="urn:XDQuery"> | |||
| <Columns> | |||
| <Field name="ID"/> | |||
| </Columns> | |||
| <From> | |||
| <DmoClass class="BWP.B3SheepButcherManage.BO.FixedPrice, B3SheepButcherManage"/> | |||
| </From> | |||
| <Where> | |||
| <And> | |||
| <EQ> | |||
| <Field name="ID"/> | |||
| <QBE paramName="ID"/> | |||
| </EQ> | |||
| <EQ> | |||
| <Field name="AccountingUnit_ID"/> | |||
| <QBE paramName="AccountingUnit_ID"/> | |||
| </EQ> | |||
| <EQ> | |||
| <Field name="Department_ID"/> | |||
| <QBE paramName="Department_ID"/> | |||
| </EQ> | |||
| <EQ> | |||
| <Field name="Employee_ID"/> | |||
| <QBE paramName="Employee_ID"/> | |||
| </EQ> | |||
| <EQ> | |||
| <Field name="IsLocked"/> | |||
| <QBE paramName="IsLocked"/> | |||
| </EQ> | |||
| <Contains> | |||
| <Field name="Remark"/> | |||
| <QBE paramName="Remark"/> | |||
| </Contains> | |||
| <Contains> | |||
| <Field name="CreateUser_Name"/> | |||
| <QBE paramName="CreateUser_Name"/> | |||
| </Contains> | |||
| <Contains> | |||
| <Field name="CheckUser_Name"/> | |||
| <QBE paramName="CheckUser_Name"/> | |||
| </Contains> | |||
| <GreaterThanOrEqual> | |||
| <Field name="CreateTime"/> | |||
| <QBE paramName="MinCreateTime" /> | |||
| </GreaterThanOrEqual> | |||
| <LessThanOrEqual> | |||
| <Field name="CreateTime"/> | |||
| <QBE paramName="MaxCreateTime"/> | |||
| </LessThanOrEqual> | |||
| <GreaterThanOrEqual> | |||
| <Field name="ExeTime"/> | |||
| <QBE paramName="MinExeTime" /> | |||
| </GreaterThanOrEqual> | |||
| <LessThanOrEqual> | |||
| <Field name="ExeTime"/> | |||
| <QBE paramName="MaxExeTime"/> | |||
| </LessThanOrEqual> | |||
| <EQ> | |||
| <Field name="BillState"/> | |||
| <QBE paramName ="BillState"/> | |||
| </EQ> | |||
| </And> | |||
| </Where> | |||
| </Select> | |||
| @ -0,0 +1,21 @@ | |||
| using BWP.B3SheepButcherManage.BL; | |||
| using BWP.B3SheepButcherManage.BO; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace BWP.Web.Pages.B3SheepButcherManage.Bills.FixedPrice_ | |||
| { | |||
| class FixedPricePrint : DomainTemplatePrintPage<FixedPrice, IFixedPriceBL> | |||
| { | |||
| protected override void AddParameters(IDictionary<string, object> dic) | |||
| { | |||
| dic.Add("$ID", Dmo.ID); | |||
| dic.Add("$Details", Dmo.Details); | |||
| dic.Add("$DetailType", typeof(FixedPrice_Detail)); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,50 @@ | |||
| using BWP.B3Frameworks.Utils; | |||
| using BWP.B3SheepButcherManage; | |||
| using BWP.B3SheepButcherManage.BO; | |||
| using BWP.B3UnitedInfos.BO; | |||
| 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 B3SheepButcherManageChoiceBoxProvider | |||
| { | |||
| public static void Register() | |||
| { | |||
| ChoiceBoxSettings.Register(B3SheepButcherManageConsts.DataSources.可屠宰存货属性, (argu) => | |||
| new ChoiceBoxQueryHelper<GoodsProperty>(argu, true) | |||
| { | |||
| BeforeQuery = query => | |||
| { | |||
| query.Where.Conditions.Add(DQCondition.EQ("IsButchery", true)); | |||
| DomainUtil.AddDomainPermissionLimit(query); | |||
| } | |||
| }.GetData()); | |||
| ChoiceBoxSettings.Register(B3SheepButcherManageConsts.DataSources.活体级别, argu => | |||
| { | |||
| var goods = new JoinAlias(typeof(Livestock)); | |||
| var goodsProperty = new JoinAlias(typeof(GoodsProperty)); | |||
| var dom = new DQueryDom(goods); | |||
| dom.From.AddJoin(JoinType.Left, new DQDmoSource(goodsProperty), DQCondition.EQ(goods, "GoodsProperty_ID", goodsProperty, "ID")); | |||
| dom.Columns.Add(DQSelectColumn.Field("Name", goods)); | |||
| dom.Columns.Add(DQSelectColumn.Field("ID", goods)); | |||
| dom.Where.Conditions.Add(DQCondition.EQ(goodsProperty, "IsButchery", true)); | |||
| dom.Where.Conditions.Add(DQCondition.EQ("Stopped", false)); | |||
| DomainUtil.AddDomainPermissionLimit(dom, typeof(GoodsProperty), goodsProperty); | |||
| if (!string.IsNullOrEmpty(argu.InputArgument)) | |||
| { | |||
| dom.Where.Conditions.Add(DQCondition.Or(DQCondition.Like("Name", argu.InputArgument), DQCondition.Like("Spell", argu.InputArgument), DQCondition.Like("Code", argu.InputArgument))); | |||
| } | |||
| return dom.EExecuteList<string, long>().Select(x => new WordPair(x.Item1.ToString(), x.Item2.ToString())); | |||
| }); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,32 @@ | |||
| using BWP.B3Frameworks.BL; | |||
| using BWP.B3SheepButcherManage.BO; | |||
| using Forks.EnterpriseServices; | |||
| using Forks.EnterpriseServices.BusinessInterfaces; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace BWP.B3SheepButcherManage.BL | |||
| { | |||
| [BusinessInterface(typeof(LivestockBL))] | |||
| [LogicName("级别")] | |||
| public interface ILivestockBL : IBaseInfoBL<Livestock> | |||
| { | |||
| } | |||
| public class LivestockBL : BaseInfoBL<Livestock>, ILivestockBL | |||
| { | |||
| protected override void beforeSave(Livestock dmo) | |||
| { | |||
| if (dmo.GoodsProperty_ID == null) | |||
| { | |||
| throw new Exception("必须设置畜类属性(存货属性)"); | |||
| } | |||
| base.beforeSave(dmo); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,54 @@ | |||
| using BWP.B3Frameworks.BL; | |||
| using BWP.B3Frameworks.BO.NamedValueTemplate; | |||
| using BWP.B3SheepButcherManage.BO; | |||
| using Forks.EnterpriseServices; | |||
| using Forks.EnterpriseServices.BusinessInterfaces; | |||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace BWP.B3SheepButcherManage.BL | |||
| { | |||
| [LogicName("羊定价单")] | |||
| [BusinessInterface(typeof(FixedPriceBL))] | |||
| public interface IFixedPriceBL : IDepartmentWorkFlowBillBL<FixedPrice> | |||
| { | |||
| void RsetPrice(FixedPrice dmo); | |||
| } | |||
| public class FixedPriceBL : DepartmentWorkFlowBillBL<FixedPrice>, IFixedPriceBL | |||
| { | |||
| public void RsetPrice(FixedPrice dmo) | |||
| { | |||
| //var dom = new DmoQuery(typeof(StatPay)); | |||
| //dom.Where.Conditions.Add(DQCondition.EQ("BillState", 单据状态.未审核)); | |||
| //dom.Where.Conditions.Add(DQCondition.EQ("FixedPrice_ID", dmo.ID)); | |||
| //var statPayList = Session.ExecuteList(dom); | |||
| //var statPayBL = BIFactory.Create<IStatPayBL>(Session); | |||
| //foreach (StatPay statPay in statPayList) | |||
| //{ | |||
| // var needUpdate = false; | |||
| // foreach (var butcherDetail in statPay.Details) | |||
| // { | |||
| // var pay = statPay; | |||
| // var detail = butcherDetail; | |||
| // var priceDetail = dmo.Details.FirstOrDefault( | |||
| // x => x.ValuationArea_ID == pay.ValuationArea_ID && | |||
| // x.Livestock_ID == detail.Livestock_ID && | |||
| // x.HogGrade_ID == detail.HogGrade_ID); | |||
| // if (priceDetail != null) | |||
| // { | |||
| // detail.Price = priceDetail.Price; | |||
| // needUpdate = true; | |||
| // } | |||
| // } | |||
| // if (needUpdate) | |||
| // { | |||
| // statPayBL.Update(statPay); | |||
| // } | |||
| //} | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,25 @@ | |||
| using BWP.B3Frameworks; | |||
| using BWP.B3ProduceUnitedInfos; | |||
| using BWP.B3ProduceUnitedInfos.BO; | |||
| using BWP.B3ProduceUnitedInfos.NamedValueTemplate; | |||
| using Forks.EnterpriseServices; | |||
| using Forks.EnterpriseServices.DataForm; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using Forks.Utils; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace BWP.B3SheepButcherManage.BO | |||
| { | |||
| [DFClass, Serializable] | |||
| [LogicName("级别")] | |||
| [MapToTable("B3UnitedInfos_Goods")] | |||
| [DmoTypeID(B3FrameworksConsts.DmoTypeIDBases.B3SheepButcherManage, B3SheepButcherManageConsts.DmoTypeIDOffsets.Livestock)] | |||
| [DFCPrompt("畜类属性", Property = "GoodsProperty_ID")] | |||
| [DFCPrompt("畜类属性", Property = "GoodsProperty_Name")] | |||
| public class Livestock : B3ProduceUnitedInfos.BO.GoodsExt | |||
| { | |||
| } | |||
| } | |||
| @ -0,0 +1,32 @@ | |||
| using BWP.B3Frameworks; | |||
| using BWP.B3Frameworks.Attributes; | |||
| using BWP.B3Frameworks.BO; | |||
| using Forks.EnterpriseServices; | |||
| using Forks.EnterpriseServices.DataForm; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace BWP.B3SheepButcherManage.BO | |||
| { | |||
| [LogicName("羊定价单")] | |||
| [Serializable, DFClass] | |||
| [DmoTypeID(B3FrameworksConsts.DmoTypeIDBases.B3SheepButcherManage, B3SheepButcherManageConsts.DmoTypeIDOffsets.FixedPrice)] | |||
| [EditUrl("~/B3SheepButcherManage/Bills/FixedPrice_/FixedPriceEdit.aspx")] | |||
| public class FixedPrice : DepartmentWorkFlowBill | |||
| { | |||
| [LogicName("执行时间")] | |||
| public DateTime? ExeTime { get; set; } | |||
| private FixedPrice_DetailCollection _detail = new FixedPrice_DetailCollection(); | |||
| [OneToMany(typeof(FixedPrice_Detail), "ID")] | |||
| [Join("ID", "FixedPrice_ID")] | |||
| public FixedPrice_DetailCollection Details | |||
| { | |||
| get { return this._detail; } | |||
| set { this._detail = value; } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,75 @@ | |||
| using BWP.B3CowButcherManage; | |||
| using BWP.B3CowButcherManage.BO; | |||
| using BWP.B3Frameworks; | |||
| using BWP.B3Frameworks.BO; | |||
| using BWP.B3ProduceUnitedInfos; | |||
| using BWP.B3ProduceUnitedInfos.BO; | |||
| using Forks.EnterpriseServices; | |||
| using Forks.EnterpriseServices.DataForm; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using TSingSoft.WebControls2; | |||
| namespace BWP.B3SheepButcherManage.BO | |||
| { | |||
| [DFClass, Serializable] | |||
| [LogicName("羊定价单_明细")] | |||
| public class FixedPrice_Detail : Base | |||
| { | |||
| public long FixedPrice_ID { get; set; } | |||
| [LogicName("定价地区")] | |||
| [DFExtProperty("WebControlType", DFEditControl.ChoiceBox)] | |||
| [DFDataKind(B3CowButcherManageConsts.DataSources.计价区域全部)] | |||
| [DFExtProperty(B3FrameworksConsts.DFExtProperties.DisplayField, "ValuationArea_Name")] | |||
| [DFExtProperty(B3FrameworksConsts.DFExtProperties.QueryDataKind, B3CowButcherManageConsts.DataSources.计价区域全部)] | |||
| public long? ValuationArea_ID { get; set; } | |||
| [LogicName("定价地区")] | |||
| [ReferenceTo(typeof(ValuationArea), "Name")] | |||
| [Join("ValuationArea_ID", "ID")] | |||
| public string ValuationArea_Name { get; set; } | |||
| [LogicName("品种")] | |||
| [DFExtProperty("WebControlType", DFEditControl.ChoiceBox)] | |||
| [DFDataKind(B3ProduceUnitedInfosDataSources.活体品种)] | |||
| [DFExtProperty(B3FrameworksConsts.DFExtProperties.DisplayField, "LiveVarieties_Name")] | |||
| [DFExtProperty(B3FrameworksConsts.DFExtProperties.QueryDataKind, B3ProduceUnitedInfosDataSources.活体品种)] | |||
| public long? LiveVarieties_ID { get; set; } | |||
| [LogicName("品种")] | |||
| [ReferenceTo(typeof(LiveVarieties), "Name")] | |||
| [Join("LiveVarieties_ID", "ID")] | |||
| public string LiveVarieties_Name { get; set; } | |||
| [LogicName("级别")] | |||
| [DFExtProperty("WebControlType", DFEditControl.ChoiceBox)] | |||
| [DFDataKind(B3SheepButcherManageConsts.DataSources.活体级别)] | |||
| [DFExtProperty(B3FrameworksConsts.DFExtProperties.DisplayField, "Livestock_Name")] | |||
| [DFExtProperty(B3FrameworksConsts.DFExtProperties.QueryDataKind, B3SheepButcherManageConsts.DataSources.活体级别)] | |||
| public long? Livestock_ID { get; set; } | |||
| [LogicName("级别")] | |||
| [ReferenceTo(typeof(Livestock), "Name")] | |||
| [Join("Livestock_ID", "ID")] | |||
| public string Livestock_Name { get; set; } | |||
| [LogicName("单价")] | |||
| public decimal? Price { get; set; } | |||
| [LogicName("原单价")] | |||
| public decimal? OriginalPrice { get; set; } | |||
| [LogicName("备注")] | |||
| public string Remark { get; set; } | |||
| } | |||
| [Serializable] | |||
| public class FixedPrice_DetailCollection : DmoCollection<FixedPrice_Detail> | |||
| { } | |||
| } | |||
| @ -0,0 +1,29 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | |||
| <BillReports xmlns="urn:BillReports" version="1.0" displayName="羊定价单" phyName="羊定价单"> | |||
| <Report phyName="标准格式"> | |||
| <BillReport xmlns="urn:BillReport" version="1" displayName="标准格式" > | |||
| <Bands> | |||
| <TextBand fontName="黑体" fontSize="15" align="Center">羊定价单№$Dmo.ID</TextBand> | |||
| <DFInfoBand object="$Dmo" cols="4"> | |||
| <Field name="AccountingUnit_Name" lblWidth="4"/> | |||
| <Field name="Department_Name" lblWidth="4"/> | |||
| <Field name="ExeTime" lblWidth="4"/> | |||
| <Field name="Employee_Name" lblWidth="4"/> | |||
| <Field name="Remark" lblWidth="4"/> | |||
| </DFInfoBand> | |||
| <HtmlBand> | |||
| <![CDATA[<h2>定价明细</h2>]]> | |||
| </HtmlBand> | |||
| <DFListBand collection="$Details" itemType="$DetailType" enablePaging="true" > | |||
| <Field name="ValuationArea_Name"/> | |||
| <Field name="LiveVarieties_Name"/> | |||
| <Field name="Livestock_Name" /> | |||
| <Field name="OriginalPrice" /> | |||
| <Field name="Price"/> | |||
| <Field name="Remark" /> | |||
| </DFListBand> | |||
| </Bands> | |||
| </BillReport> | |||
| </Report> | |||
| </BillReports> | |||