| @ -0,0 +1,251 @@ | |||
| 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 System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Web.UI; | |||
| using System.Web.UI.WebControls; | |||
| using TSingSoft.WebControls2; | |||
| using TSingSoft.WebPluginFramework; | |||
| namespace BWP.Web.Pages.B3SheepButcherManage.Bills.Butcher_ | |||
| { | |||
| class ButcherEdit : DepartmentWorkFlowBillEditPage<Butcher, IButcherBL> | |||
| { | |||
| protected DFEditGrid _detailGrid; | |||
| protected override void BuildBody(Control control) | |||
| { | |||
| base.BuildBody(control); | |||
| AddDetails(control.EAdd(new TitlePanel("单据明细", "单据明细"))); | |||
| } | |||
| protected override void BuildBasePropertiesEditor(TitlePanel titlePanel, PageLayoutSection pageLayoutSection) | |||
| { | |||
| var layoutManager = new LayoutManager("", mDFInfo, mDFContainer); | |||
| var config = new AutoLayoutConfig(); | |||
| layoutManager.Config = config; | |||
| config.Add("AccountingUnit_ID"); | |||
| config.Add("Department_ID"); | |||
| config.Add("Employee_ID"); | |||
| config.Add("Store_ID"); | |||
| config.Add("Date"); | |||
| config.Add("Remark"); | |||
| pageLayoutSection.SetRequired("AccountingUnit_ID"); | |||
| pageLayoutSection.ApplyLayout(layoutManager, config, mPageLayoutManager, mDFInfo); | |||
| titlePanel.Controls.Add(layoutManager.CreateLayout()); | |||
| } | |||
| private void AddDetails(TitlePanel titlePanel) | |||
| { | |||
| var vPanel = titlePanel.EAdd(new VLayoutPanel()); | |||
| AddLinkButtons(vPanel); | |||
| var hPanel = vPanel.Add(new HLayoutPanel(), new VLayoutOption(HorizontalAlign.Left)); | |||
| if (CanSave) | |||
| { | |||
| hPanel.Add(new TSButton("创建明细", delegate | |||
| { | |||
| mDFContainer.GetFromUI(); | |||
| var msg = mBL.CreateDetailFromWeightClient(Dmo); | |||
| AllOrders = Dmo.Details.Where(x => x.PrePhase.HasValue).Select(x => x.PrePhase.Value).OrderBy(x => x).ToList(); | |||
| AppToUI(); | |||
| AspUtil.Alert(this, "创建成功!" + msg); | |||
| })); | |||
| } | |||
| var editor = new DFCollectionEditor<Butcher_Detail>(() => FilterDetails()); | |||
| editor.AllowDeletionFunc = () => false; | |||
| editor.CanDeleteFunc = detail => false; | |||
| editor.IsEditableFunc = (field, detail) => CanSave; | |||
| _detailGrid = new DFEditGrid(editor); | |||
| _detailGrid.DFGridSetEnabled = false; | |||
| _detailGrid.Width = Unit.Percentage(100); | |||
| _detailGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("Sequence")); | |||
| _detailGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("PhaseCode")); | |||
| _detailGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("WeightBill_ID")); | |||
| _detailGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("LiveVarieties_Name")); | |||
| _detailGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("Livestock_Name")); | |||
| // 重量 | |||
| var weight = new DFEditGridColumn<DFTextBox>("Weight"); | |||
| weight.Align = AlignMode.Center; | |||
| weight.SumMode = SumMode.Sum; | |||
| _detailGrid.Columns.Add(weight); | |||
| // 扣重 | |||
| var subtractWeight = new DFEditGridColumn<DFTextBox>("SubtractWeight"); | |||
| subtractWeight.Align = AlignMode.Center; | |||
| subtractWeight.SumMode = SumMode.Sum; | |||
| _detailGrid.Columns.Add(subtractWeight); | |||
| // 结算重 | |||
| var finalWeight = new DFEditGridColumn<DFTextBox>("FinalWeight"); | |||
| finalWeight.Align = AlignMode.Center; | |||
| finalWeight.SumMode = SumMode.Sum; | |||
| _detailGrid.Columns.Add(finalWeight); | |||
| _detailGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("StatPay_ID")); | |||
| _detailGrid.Columns.Add(new DFEditGridColumn<DFTextBox>("Remark")); | |||
| mDFContainer.AddNonDFControl(_detailGrid, "$detailGrid"); | |||
| var section = mPageLayoutManager.AddSection("DetaiColumns", "明细列"); | |||
| titlePanel.SetPageLayoutSetting(mPageLayoutManager, section.Name); | |||
| section.ApplyLayout(_detailGrid, mPageLayoutManager, DFInfo.Get(typeof(Butcher_Detail))); | |||
| vPanel.Add(_detailGrid); | |||
| if (CanSave) | |||
| { | |||
| DeleteButcherDetailByID(vPanel); | |||
| InsertButcherDetailByID(vPanel); | |||
| } | |||
| } | |||
| void AddLinkButtons(VLayoutPanel vPanel) | |||
| { | |||
| if (!IsPostBack) | |||
| AllOrders = GetAllOrders(); | |||
| var hPanel = vPanel.Add(new HLayoutPanel(), new VLayoutOption(HorizontalAlign.Left)); | |||
| hPanel.Add(new SimpleLabel("阶段")); | |||
| var rp = hPanel.Add(new RadioLabelList()); | |||
| rp.RepeatColumns = 50; | |||
| rp.Items.Add(new ListItem("全部", "-1")); | |||
| foreach (var item in AllOrders) | |||
| rp.Items.Add(new ListItem(item.ToString(), item.ToString())); | |||
| rp.SelectedIndexChanged += (sender, e) => | |||
| { | |||
| Order = int.Parse(rp.SelectedValue); | |||
| _detailGrid.DataBind(); | |||
| }; | |||
| } | |||
| private void InsertButcherDetailByID(VLayoutPanel vPanel) | |||
| { | |||
| if (!CheckDefaultRole("添加明细")) | |||
| return; | |||
| var hPanel = new HLayoutPanel(); | |||
| vPanel.Add(hPanel, new VLayoutOption(HorizontalAlign.Left)); | |||
| hPanel.Add(new LiteralControl("顺序号")); | |||
| var startDelNoInput = new TextBox(); | |||
| hPanel.Add(startDelNoInput); | |||
| hPanel.Add(new LiteralControl("下面插入")); | |||
| var endDelNoInput = new TextBox(); | |||
| hPanel.Add(endDelNoInput); | |||
| hPanel.Add(new LiteralControl("条记录")); | |||
| var deleteButton = new TSButton("插入"); | |||
| hPanel.Add(deleteButton); | |||
| deleteButton.Click += delegate | |||
| { | |||
| long sID = long.Parse(startDelNoInput.Text); | |||
| int count = int.Parse(endDelNoInput.Text); | |||
| mBL.InsertDetailBySequence(Dmo, sID, count); | |||
| Dmo = mBL.Load(Dmo.ID); | |||
| AspUtil.Alert(this, "插入成功"); | |||
| _detailGrid.DataBind(); | |||
| }; | |||
| } | |||
| private void DeleteButcherDetailByID(VLayoutPanel vPanel) | |||
| { | |||
| if (!CheckDefaultRole("删除明细")) | |||
| return; | |||
| var hPanel = new HLayoutPanel(); | |||
| vPanel.Add(hPanel, new VLayoutOption(HorizontalAlign.Left)); | |||
| hPanel.Add(new LiteralControl("顺序号:从")); | |||
| var startDelNoInput = new TextBox(); | |||
| hPanel.Add(startDelNoInput); | |||
| hPanel.Add(new LiteralControl("到")); | |||
| var endDelNoInput = new TextBox(); | |||
| hPanel.Add(endDelNoInput); | |||
| var deleteButton = new TSButton("删除"); | |||
| hPanel.Add(deleteButton); | |||
| deleteButton.Click += delegate | |||
| { | |||
| long? sID = long.Parse(startDelNoInput.Text); | |||
| long? eID = long.Parse(endDelNoInput.Text); | |||
| mBL.DeleteDetail(MinDmo.ID, sID, eID); | |||
| Dmo = mBL.Load(Dmo.ID); | |||
| AspUtil.Alert(this, "删除成功"); | |||
| _detailGrid.DataBind(); | |||
| }; | |||
| } | |||
| public override void AppToUI() | |||
| { | |||
| base.AppToUI(); | |||
| _detailGrid.DataBind(); | |||
| } | |||
| public override void GetFromUI() | |||
| { | |||
| base.GetFromUI(); | |||
| _detailGrid.GetFromUI(); | |||
| } | |||
| List<int> GetAllOrders() | |||
| { | |||
| var query = new DQueryDom(new JoinAlias(typeof(Butcher_Detail))); | |||
| query.Columns.Add(DQSelectColumn.Field("PrePhase")); | |||
| query.Distinct = true; | |||
| query.Where.Conditions.Add(DQCondition.And(DQCondition.IsNotNull(DQExpression.Field("PrePhase")), DQCondition.EQ("Butcher_ID", MinDmo.ID))); | |||
| query.OrderBy.Expressions.Add(DQOrderByExpression.Create("PrePhase")); | |||
| return query.EExecuteList<int>(); | |||
| } | |||
| List<int> AllOrders | |||
| { | |||
| get | |||
| { | |||
| if (ViewState["allOrders"] == null) | |||
| return new List<int>(); | |||
| return (List<int>)ViewState["allOrders"]; | |||
| } | |||
| set | |||
| { | |||
| ViewState["allOrders"] = value; | |||
| } | |||
| } | |||
| int Order | |||
| { | |||
| get | |||
| { | |||
| if (ViewState["Order"] == null) | |||
| return AllOrders.FirstOrDefault(); | |||
| return (int)ViewState["Order"]; | |||
| } | |||
| set { ViewState["Order"] = value; } | |||
| } | |||
| private System.Collections.IList FilterDetails() | |||
| { | |||
| var filterDetails = Dmo.Details.ToList<Butcher_Detail>(); | |||
| if (Order != -1) | |||
| { | |||
| if (Order == 0) | |||
| filterDetails = new List<Butcher_Detail>(); | |||
| else | |||
| filterDetails = filterDetails.Where(x => x.PrePhase == Order).ToList(); | |||
| } | |||
| return new DFEditGridPhonyData(filterDetails, Dmo.Details); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,48 @@ | |||
| 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.Butcher_ | |||
| { | |||
| class ButcherList : DomainBillListPage<Butcher, IButcherBL> | |||
| { | |||
| protected override void AddQueryControls(VLayoutPanel vPanel) | |||
| { | |||
| vPanel.Add(CreateDefaultBillQueryControls((panel, config) => | |||
| { | |||
| config.Add("Date"); | |||
| 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"); | |||
| } | |||
| } | |||
| protected override void InitToolBar(HLayoutPanel toolbar) | |||
| { | |||
| base.InitToolBar(toolbar); | |||
| if (CheckDefaultRole("数据分析", false)) | |||
| { | |||
| var button = new TSButton("数据分析") { UseSubmitBehavior = false }; | |||
| button.OnClientClick = "preventEventDefault(event);OpenUrlInTopTab('B3SheepButcherManage/Reports/ButcherAnalyse_/ButcherAnalyse.aspx','数据分析');"; | |||
| toolbar.Add(button); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,65 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | |||
| <Select xmlns="urn:XDQuery"> | |||
| <Columns> | |||
| <Field name="ID"/> | |||
| </Columns> | |||
| <From> | |||
| <DmoClass class="BWP.B3SheepButcherManage.BO.Butcher, 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="Date"/> | |||
| <QBE paramName="MinDate" /> | |||
| </GreaterThanOrEqual> | |||
| <LessThanOrEqual> | |||
| <Field name="Date"/> | |||
| <QBE paramName="MaxDate"/> | |||
| </LessThanOrEqual> | |||
| <EQ> | |||
| <Field name="BillState"/> | |||
| <QBE paramName ="BillState"/> | |||
| </EQ> | |||
| </And> | |||
| </Where> | |||
| </Select> | |||
| @ -0,0 +1,19 @@ | |||
| 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.Butcher_ | |||
| { | |||
| class ButcherPrint : DomainTemplatePrintPage<Butcher, IButcherBL> | |||
| { | |||
| protected override void AddParameters(IDictionary<string, object> dic) | |||
| { | |||
| dic.Add("$ID", Dmo.ID); | |||
| dic.Add("$Details", Dmo.Details); | |||
| dic.Add("$DetailType", typeof(Butcher_Detail)); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,219 @@ | |||
| using BWP.B3Frameworks; | |||
| using BWP.B3Frameworks.BO.MoneyTemplate; | |||
| using BWP.B3Frameworks.BO.NamedValueTemplate; | |||
| using BWP.B3Frameworks.Utils; | |||
| using BWP.B3ProcurementInterface.Utils; | |||
| using BWP.B3SheepButcherManage.BO; | |||
| using BWP.Web.Layout; | |||
| using BWP.Web.Utils; | |||
| using BWP.Web.WebControls; | |||
| using Forks.EnterpriseServices; | |||
| using Forks.EnterpriseServices.DataForm; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||
| using Forks.EnterpriseServices.SqlDoms; | |||
| using Forks.Utils; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Web.UI.HtmlControls; | |||
| using System.Web.UI.WebControls; | |||
| using TSingSoft.WebControls2; | |||
| using TSingSoft.WebPluginFramework; | |||
| namespace BWP.Web.Pages.B3SheepButcherManage.Reports.ButcherAnalyse_ | |||
| { | |||
| class ButcherAnalyse : DFGridReportPage | |||
| { | |||
| protected override string Caption | |||
| { | |||
| get { return "屠宰单分析"; } | |||
| } | |||
| protected override string AccessRoleName | |||
| { | |||
| get { return "B3SheepButcherManage.羊屠宰单.数据分析"; } | |||
| } | |||
| protected override void InitForm(HtmlForm form) | |||
| { | |||
| base.InitForm(form); | |||
| mDFGrid.AllowColGroup = true; | |||
| mDFGrid.AllowRowGroup = _checkbox.Items.FindByText("合并单元格").Selected; | |||
| mDFGrid.AllowSorting = true; | |||
| mDFGrid.HeaderPagerLock = true; | |||
| } | |||
| private readonly DFInfo _mDFInfo = DFInfo.Get(typeof(Butcher_Detail)); | |||
| private readonly DFInfo _butcher = DFInfo.Get(typeof(Butcher)); | |||
| private readonly DFInfo _weigh = DFInfo.Get(typeof(WeightBill)); | |||
| protected override void AddQueryControls(VLayoutPanel vPanel) | |||
| { | |||
| var customPanel = new LayoutManager("Main", _mDFInfo, mQueryContainer); | |||
| customPanel.Add("Butcher_ID", new SimpleLabel("屠宰单号"), QueryCreator.DFTextBox(_mDFInfo.Fields["Butcher_ID"])); | |||
| customPanel.Add("Supplier_ID", new SimpleLabel("供应商"), QueryCreator.DFChoiceBox(_weigh.Fields["Supplier_ID"], B3ProcurementInterfaceDataSources.供应商用于屠宰场)); | |||
| customPanel.Add("AccountingUnit_ID", new SimpleLabel("会计单位"), QueryCreator.DFChoiceBox(_weigh.Fields["AccountingUnit_ID"], B3FrameworksConsts.DataSources.授权会计单位全部)); | |||
| customPanel.Add("Zone_ID", new SimpleLabel("来源区域"), QueryCreator.DFChoiceBox(_weigh.Fields["Zone_ID"], "B3ButcherManage_区域")); | |||
| customPanel.Add("WeightBill_ID", QueryCreator.DFTextBox(_mDFInfo.Fields["WeightBill_ID"])); | |||
| customPanel.Add("Livestock_ID", QueryCreator.DFChoiceBox(_mDFInfo.Fields["Livestock_ID"], BWP.B3SheepButcherManage.B3SheepButcherManageConsts.DataSources.活体级别)); | |||
| DFNamedValueInput<单据状态> billStateInput; | |||
| customPanel.Add("BillState", new SimpleLabel("单据状态"), billStateInput = QueryCreator.一般单据状态(_butcher.Fields["BillState"])); | |||
| billStateInput.Value = 单据状态.已审核; | |||
| customPanel.Add("Date", new SimpleLabel("屠宰日期"), QueryCreator.TimeRange(_butcher.Fields["Date"], mQueryContainer, "MinDate", "MaxDate")); | |||
| var config = customPanel.CreateDefaultConfig(4); | |||
| config["Date"].ColSpan = 2; | |||
| config.Expand = false; | |||
| vPanel.Add(customPanel.CreateLayout()); | |||
| } | |||
| private CheckBoxListWithReverseSelect _checkbox; | |||
| protected override void InitQueryPanel(QueryPanel queryPanel) | |||
| { | |||
| base.InitQueryPanel(queryPanel); | |||
| var panel = queryPanel.CreateTab("显示字段"); | |||
| _checkbox = new CheckBoxListWithReverseSelect { RepeatColumns = 6, RepeatDirection = RepeatDirection.Horizontal }; | |||
| _checkbox.Items.Add(new ListItem("会计单位", "AccountingUnit_Name")); | |||
| _checkbox.Items.Add(new ListItem("屠宰单号", "ID")); | |||
| _checkbox.Items.Add(new ListItem("过磅日期", "WeighTime")); | |||
| _checkbox.Items.Add(new ListItem("屠宰日期", "Date")); | |||
| _checkbox.Items.Add(new ListItem("阶段号", "PhaseCode")); | |||
| _checkbox.Items.Add(new ListItem("来源区域", "Zone_Name")); | |||
| _checkbox.Items.Add(new ListItem("供应商", "Supplier_Name")); | |||
| _checkbox.Items.Add(new ListItem("过磅单号", "WeightBill_ID")); | |||
| _checkbox.Items.Add(new ListItem("收购重量", "WeightBill_BuyWeigh1")); | |||
| _checkbox.Items.Add(new ListItem("出肉率", "出肉率")); | |||
| _checkbox.Items.Add(new ListItem("级别", "Livestock_Name")); | |||
| _checkbox.Items.Add(new ListItem("级别头数", "级别头数")); | |||
| _checkbox.Items.Add(new ListItem("重量", "Weight")); | |||
| _checkbox.Items.Add(new ListItem("扣重", "SubtractWeight")); | |||
| _checkbox.Items.Add(new ListItem("结算重", "FinalWeight")); | |||
| _checkbox.Items.Add(new ListItem("业务员", "Employee_Name")); | |||
| _checkbox.Items.Add(new ListItem("备注", "Remark")); | |||
| _checkbox.Items.Add(new ListItem("合并单元格") { Selected = false }); | |||
| panel.EAdd(_checkbox); | |||
| mQueryControls.Add("显示字段", _checkbox); | |||
| mQueryControls.EnableHoldLastControlNames.Add("显示字段"); | |||
| } | |||
| protected override DQueryDom GetQueryDom() | |||
| { | |||
| mDFGrid.AllowRowGroup = _checkbox.Items.FindByText("合并单元格").Selected; | |||
| var dom = base.GetQueryDom(); | |||
| var detail = dom.From.RootSource.Alias; | |||
| var butcher = new JoinAlias("butcher", typeof(Butcher)); | |||
| dom.From.AddJoin(JoinType.Left, new DQDmoSource(butcher), DQCondition.EQ(detail, "Butcher_ID", butcher, "ID")); | |||
| var weigh = new JoinAlias("weigh", typeof(WeightBill)); | |||
| dom.From.AddJoin(JoinType.Left, new DQDmoSource(weigh), DQCondition.EQ(detail, "WeightBill_ID", weigh, "ID")); | |||
| var butcherTemp = new JoinAlias("tempButcher", typeof(TempButcher)); | |||
| dom.RegisterQueryTable(typeof(TempButcher), new[] { "ID", "WeightBill_ID", "WeightBill_Supplier_ID", "FinalWeight", "WeightBill_BuyWeigh1" }, TempButcher.GetQueryDom()); | |||
| dom.From.AddJoin(JoinType.Left, new DQDmoSource(butcherTemp), DQCondition.And(DQCondition.EQ(butcher, "ID", butcherTemp, "ID"), DQCondition.EQ(weigh, "Supplier_ID", butcherTemp, "WeightBill_Supplier_ID"), DQCondition.EQ(detail, "WeightBill_ID", butcherTemp, "WeightBill_ID"))); | |||
| var 级别头数 = false; | |||
| foreach (ListItem field in _checkbox.Items) | |||
| { | |||
| if (field.Selected) | |||
| { | |||
| switch (field.Text) | |||
| { | |||
| case "会计单位": | |||
| case "过磅日期": | |||
| case "来源区域": | |||
| case "供应商": | |||
| dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(weigh, field.Value), field.Text)); | |||
| dom.GroupBy.Expressions.Add(DQExpression.Field(weigh, field.Value)); | |||
| break; | |||
| case "屠宰单号": | |||
| case "屠宰日期": | |||
| case "业务员": | |||
| dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(butcher, field.Value), field.Text)); | |||
| dom.GroupBy.Expressions.Add(DQExpression.Field(butcher, field.Value)); | |||
| break; | |||
| case "阶段号": | |||
| //dom.OrderBy.Expressions.Add(DQOrderByExpression.Create(butcher, "Date", true)); | |||
| //dom.GroupBy.Expressions.Add(DQExpression.Field(butcher, "Date")); | |||
| //dom.OrderBy.Expressions.Add(DQOrderByExpression.Create(detail, "Sequence")); | |||
| //dom.GroupBy.Expressions.Add(DQExpression.Field(detail, "Sequence")); | |||
| //dom.OrderBy.Expressions.Add(DQOrderByExpression.Create(detail, "PhaseCode")); | |||
| //dom.GroupBy.Expressions.Add(DQExpression.Field(detail, "PhaseCode")); | |||
| var snip = DQExpression.Snippet<int>("CAST(substring([detail].[PhaseCode],1,patindex('%-%',[detail].[PhaseCode])-1) AS int)"); | |||
| dom.Columns.Add(DQSelectColumn.Create(snip, field.Text)); | |||
| dom.GroupBy.Expressions.Add(snip); | |||
| if (dom.OrderBy.Expressions.Count == 0) | |||
| dom.OrderBy.Expressions.Add(DQOrderByExpression.Create(snip, false)); | |||
| break; | |||
| case "过磅单号": | |||
| case "级别": | |||
| case "备注": | |||
| case "收购重量": | |||
| dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(detail, field.Value), field.Text)); | |||
| dom.GroupBy.Expressions.Add(DQExpression.Field(detail, field.Value)); | |||
| break; | |||
| case "重量": | |||
| case "扣重": | |||
| case "结算重": | |||
| dom.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(detail, field.Value)), field.Text)); | |||
| SumColumnNames.Add(field.Text); | |||
| GroupSumColumnNamnes.Add(field.Text); | |||
| break; | |||
| case "级别头数": | |||
| 级别头数 = true; | |||
| dom.Columns.Add(DQSelectColumn.Create(DQExpression.Count(DQExpression.Field(detail, "Livestock_Name")), field.Text)); | |||
| SumColumnNames.Add(field.Text); | |||
| GroupSumColumnNamnes.Add(field.Text); | |||
| break; | |||
| case "出肉率": | |||
| //var crl = 1; | |||
| dom.Columns.Add(DQSelectColumn.Create(DQExpression.Max(DQExpression.Divide(DQExpression.Field(butcherTemp, "FinalWeight"), DQExpression.Field(butcherTemp, "WeightBill_BuyWeigh1"))).ECastType<Money<百分数>>(), "出肉率")); | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| if (级别头数 == false) | |||
| dom.GroupBy.Expressions.Add(DQExpression.Field(detail, "ID")); | |||
| foreach (var c in dom.Columns) | |||
| ColumnNames.Add(c.Name); | |||
| dom.Where.Conditions.Add(DQCondition.EQ(butcher, "Domain_ID", DomainContext.Current.ID)); | |||
| OrganizationUtil.AddOrganizationLimit(dom, typeof(Butcher), butcher); | |||
| return dom; | |||
| } | |||
| } | |||
| internal class TempButcher | |||
| { | |||
| public long? ID { get; set; } | |||
| [LogicName("过磅单号")] | |||
| public long WeightBill_ID { get; set; } | |||
| [LogicName("过磅单供应商")] | |||
| public long? WeightBill_Supplier_ID { get; set; } | |||
| [LogicName("结算重")] | |||
| public Money<decimal>? FinalWeight { get; set; } | |||
| [LogicName("收购重量")] | |||
| public Money<decimal>? WeightBill_BuyWeigh1 { get; set; } | |||
| public static DQueryDom GetQueryDom() | |||
| { | |||
| var main = new JoinAlias(typeof(Butcher)); | |||
| var detail = new JoinAlias(typeof(Butcher_Detail)); | |||
| var query = new DQueryDom(detail); | |||
| query.From.AddJoin(JoinType.Left, new DQDmoSource(main), DQCondition.EQ(main, "ID", detail, "Butcher_ID")); | |||
| query.Columns.Add(DQSelectColumn.Field("ID", main)); | |||
| query.Columns.Add(DQSelectColumn.Field("WeightBill_ID", detail)); | |||
| query.Columns.Add(DQSelectColumn.Field("WeightBill_Supplier_ID", detail)); | |||
| query.Columns.Add(DQSelectColumn.Sum(detail, "FinalWeight")); | |||
| query.Columns.Add(DQSelectColumn.Max(detail, "WeightBill_BuyWeigh1")); | |||
| query.GroupBy.Expressions.Add(DQExpression.Field(main, "ID")); | |||
| query.GroupBy.Expressions.Add(DQExpression.Field(detail, "WeightBill_ID")); | |||
| query.GroupBy.Expressions.Add(DQExpression.Field(detail, "WeightBill_Supplier_ID")); | |||
| return query; | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,48 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | |||
| <Select xmlns="urn:XDQuery"> | |||
| <Columns> | |||
| </Columns> | |||
| <From> | |||
| <DmoClass class="BWP.B3SheepButcherManage.BO.Butcher_Detail, B3SheepButcherManage" alias="detail"/> | |||
| </From> | |||
| <Where> | |||
| <And> | |||
| <EQ> | |||
| <Field name="BillState" alias="butcher"/> | |||
| <QBE paramName="BillState"/> | |||
| </EQ> | |||
| <EQ> | |||
| <Field name="Butcher_ID" alias="detail"/> | |||
| <QBE paramName="Butcher_ID"/> | |||
| </EQ> | |||
| <EQ> | |||
| <Field name="AccountingUnit_ID" alias="weigh"/> | |||
| <QBE paramName="AccountingUnit_ID"/> | |||
| </EQ> | |||
| <EQ> | |||
| <Field name="Supplier_ID" alias="weigh"/> | |||
| <QBE paramName="Supplier_ID"/> | |||
| </EQ> | |||
| <EQ> | |||
| <Field name="WeightBill_ID" alias="detail"/> | |||
| <QBE paramName="WeightBill_ID"/> | |||
| </EQ> | |||
| <EQ> | |||
| <Field name="Livestock_ID" alias="detail"/> | |||
| <QBE paramName="Livestock_ID"/> | |||
| </EQ> | |||
| <EQ> | |||
| <Field name="Zone_ID" alias="weigh"/> | |||
| <QBE paramName="Zone_ID"/> | |||
| </EQ> | |||
| <GreaterThanOrEqual> | |||
| <Field name="Date" alias="butcher"/> | |||
| <QBE paramName="MinDate" /> | |||
| </GreaterThanOrEqual> | |||
| <LessThanOrEqual> | |||
| <Field name="Date" alias="butcher"/> | |||
| <QBE paramName="MaxDate"/> | |||
| </LessThanOrEqual> | |||
| </And> | |||
| </Where> | |||
| </Select> | |||
| @ -0,0 +1,207 @@ | |||
| using BWP.B3Frameworks.BL; | |||
| using BWP.B3SheepButcherManage.BO; | |||
| using BWP.B3SheepButcherManage.Ioc; | |||
| using BWP.B3SheepButcherManage.Utils; | |||
| using Forks.EnterpriseServices; | |||
| using Forks.EnterpriseServices.BusinessInterfaces; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||
| using Forks.EnterpriseServices.Ioc; | |||
| using Forks.EnterpriseServices.SqlDoms; | |||
| using Forks.Utils.Data; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using TSingSoft.WebPluginFramework; | |||
| namespace BWP.B3SheepButcherManage.BL | |||
| { | |||
| [BusinessInterface(typeof(ButcherBL))] | |||
| [LogicName("羊屠宰单")] | |||
| public interface IButcherBL : IDepartmentWorkFlowBillBL<Butcher> | |||
| { | |||
| string CreateDetailFromWeightClient(Butcher dmo); | |||
| [Log(Disabled = true)] | |||
| void InsertDetailBySequence(Butcher dmo, long insertIndexId, int count); | |||
| [Log(Disabled = true)] | |||
| void DeleteDetail(long butcherID, long? startID, long? endID); | |||
| } | |||
| public partial class ButcherBL : DepartmentWorkFlowBillBL<Butcher>, IButcherBL | |||
| { | |||
| protected override void beforeSave(Butcher dmo) | |||
| { | |||
| var config = new B3SheepButcherManageConfig(); | |||
| foreach (var detail in dmo.Details) | |||
| { | |||
| if (config.SubtractWeight.Value != 0 && (detail.SubtractWeight ?? 0) == 0) | |||
| detail.SubtractWeight = config.SubtractWeight.Value; | |||
| detail.FinalWeight = (detail.Weight ?? 0) - (detail.SubtractWeight ?? 0); | |||
| } | |||
| base.beforeSave(dmo); | |||
| } | |||
| string GetConnectionStr(long accountingUnitID) | |||
| { | |||
| string connectionString = ""; | |||
| var config = IocFactory.Create<B3SheepButcherManageFactoryDBList>("B3SheepButcherManageFactoryDBList"); | |||
| if (config != null && config.Connections.Count != 0) // 有定义 | |||
| { | |||
| var items = config.Connections.Cast<FactoryDBConnection>().ToList(); | |||
| var f = items.FirstOrDefault(x => x.AccountingUnit_ID == accountingUnitID && x.Key == "屠宰单"); | |||
| if (f != null) | |||
| { | |||
| return f.Value; | |||
| } | |||
| } | |||
| return connectionString; | |||
| } | |||
| public void DeleteDetail(long butcherID, long? startID, long? endID) | |||
| { | |||
| if (startID == null || endID == null) | |||
| throw new Exception("请指定要删除的屠宰单明细ID范围"); | |||
| if (startID > endID) | |||
| throw new Exception("开始ID不能比结束ID大"); | |||
| //判断删除的明细后面有无已经录入了重量的明细 | |||
| var dom = new DQueryDom(new JoinAlias(typeof(Butcher_Detail))); | |||
| dom.Where.Conditions.Add(DQCondition.EQ("Butcher_ID", butcherID)); | |||
| dom.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("Sequence", startID)); | |||
| dom.Where.Conditions.Add(DQCondition.LessThanOrEqual("Sequence", endID)); | |||
| dom.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field("Weight"))); | |||
| dom.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field("PhaseCode"))); | |||
| dom.Range = SelectRange.Top(1); | |||
| dom.Columns.Add(DQSelectColumn.Field("ID")); | |||
| if (Session.ExecuteScalar(dom) != null) | |||
| throw new Exception("你要删除的屠宰单明细后已经有重量录入"); | |||
| //删除屠宰单明细 | |||
| var delDom = new DQDeleteDom(typeof(Butcher_Detail)); | |||
| delDom.Where.Conditions.Add(DQCondition.EQ("Butcher_ID", butcherID)); | |||
| delDom.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("Sequence", startID)); | |||
| delDom.Where.Conditions.Add(DQCondition.LessThanOrEqual("Sequence", endID)); | |||
| Session.ExecuteNonQuery(delDom); | |||
| ReUpdateSequenceAndPhaseCode(butcherID); | |||
| } | |||
| void ReUpdateSequenceAndPhaseCode(long butcherID) | |||
| { | |||
| var query = new DmoQuery(typeof(Butcher_Detail)); | |||
| query.Where.Conditions.Add(DQCondition.EQ("Butcher_ID", butcherID)); | |||
| query.OrderBy.Expressions.Add(DQOrderByExpression.Create("Sequence", false)); | |||
| var list = Session.ExecuteList(query); | |||
| int phasePartI = 1; | |||
| int phasePartII = 0; | |||
| long? lastWeighID = null; | |||
| int i = 1; | |||
| foreach (Butcher_Detail detail in list) | |||
| { | |||
| var dom = new DQUpdateDom(typeof(Butcher_Detail)); | |||
| dom.Where.Conditions.Add(DQCondition.EQ("ID", detail.ID)); | |||
| dom.Columns.Add(new DQUpdateColumn("Sequence", i++)); | |||
| if (lastWeighID == null) | |||
| { | |||
| lastWeighID = detail.WeightBill_ID; | |||
| phasePartII = 1; | |||
| } | |||
| else if (lastWeighID == detail.WeightBill_ID) | |||
| phasePartII++; | |||
| else | |||
| { | |||
| lastWeighID = detail.WeightBill_ID; | |||
| phasePartI++; | |||
| phasePartII = 1; | |||
| } | |||
| string phaseCode = string.Format("{0}-{1}", phasePartI, phasePartII); | |||
| dom.Columns.Add(new DQUpdateColumn("PhaseCode", phaseCode)); | |||
| dom.Columns.Add(new DQUpdateColumn("PrePhase", phasePartI)); | |||
| Session.ExecuteNonQuery(dom); | |||
| } | |||
| } | |||
| public void InsertDetailBySequence(Butcher dmo, long insertIndexId, int count) | |||
| { | |||
| if (insertIndexId == 0) | |||
| { | |||
| throw new Exception("不能在第0行插入"); | |||
| } | |||
| var preDetail = dmo.Details.FirstOrDefault(x => x.Sequence == insertIndexId); | |||
| if (preDetail == null) | |||
| { | |||
| throw new Exception("顺序号填写错误"); | |||
| } | |||
| int currentSequence = (preDetail.Sequence ?? 0) + 1; | |||
| int phasePartI = Convert.ToInt32(preDetail.PhaseCode.Split('-')[0]); | |||
| int phasePartII = Convert.ToInt32(preDetail.PhaseCode.Split('-')[1]); | |||
| for (int i = 0; i < count; i++) | |||
| { | |||
| var detail = new Butcher_Detail(); | |||
| detail.StatPay_ID = preDetail.StatPay_ID; | |||
| detail.WeightBill_ID = preDetail.WeightBill_ID; | |||
| detail.Livestock_ID = preDetail.Livestock_ID; | |||
| detail.Livestock_Name = preDetail.Livestock_Name; | |||
| detail.Sequence = currentSequence; | |||
| phasePartII++; | |||
| detail.PhaseCode = string.Format("{0}-{1}", phasePartI, phasePartII); | |||
| detail.PrePhase = phasePartI; | |||
| dmo.Details.Add(detail); | |||
| currentSequence++; | |||
| } | |||
| //修改本条信息之后的顺序号和阶段号 | |||
| foreach (Butcher_Detail butcherDetail in dmo.Details.OrderBy(x => x.Sequence).Where(x => x.Sequence > preDetail.Sequence && x.ID > 0)) | |||
| { | |||
| phasePartII++; | |||
| butcherDetail.Sequence = currentSequence; | |||
| if (butcherDetail.PrePhase == phasePartI) | |||
| { | |||
| butcherDetail.PhaseCode = string.Format("{0}-{1}", phasePartI, phasePartII); | |||
| } | |||
| currentSequence++; | |||
| } | |||
| Update(dmo); | |||
| } | |||
| } | |||
| class tempWeightTable | |||
| { | |||
| [LogicName("ID")] | |||
| public long ID { get; set; } | |||
| [LogicName("日期")] | |||
| public DateTime DateTime { get; set; } | |||
| [LogicName("级别号")] | |||
| public long? Livestock_ID { get; set; } | |||
| [LogicName("级别")] | |||
| public string Livestock_Name { get; set; } | |||
| [LogicName("重量")] | |||
| public decimal? Weight { get; set; } | |||
| [LogicName("备注")] | |||
| public string Remark { get; set; } | |||
| [LogicName("扣重")] | |||
| public decimal? SubWeight { get; set; } | |||
| [LogicName("顺序号")] | |||
| public long Sequence { get; set; } | |||
| [LogicName("阶段号")] | |||
| public string PhaseCode { get; set; } | |||
| } | |||
| } | |||
| @ -0,0 +1,133 @@ | |||
| using BWP.B3Frameworks; | |||
| using BWP.B3Frameworks.BO.NamedValueTemplate; | |||
| using BWP.B3SheepButcherManage.BO; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||
| using Forks.EnterpriseServices.SqlDoms; | |||
| using Forks.Utils.Data; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace BWP.B3SheepButcherManage.BL | |||
| { | |||
| partial class ButcherBL | |||
| { | |||
| public string CreateDetailFromWeightClient(Butcher dmo) | |||
| { | |||
| string connectionString = GetConnectionStr(dmo.AccountingUnit_ID ?? 0); | |||
| if (string.IsNullOrEmpty(connectionString)) | |||
| { | |||
| throw new ApplicationException("未设置 屠宰单 数据库连接字符串!"); | |||
| } | |||
| var orderData = TempContainer.GetDate(dmo.Date); | |||
| if (!orderData.Any()) | |||
| throw new Exception("没有排宰数据"); | |||
| dmo.Details.Clear(); | |||
| return GetDataByOrder(orderData, connectionString, dmo); | |||
| } | |||
| string GetDataByOrder(List<TempContainer> orderData, string connectionString, Butcher dmo) | |||
| { | |||
| var msg = new StringBuilder(); | |||
| var sql = "select [Index],[Livestock_ID],[Livestock_Name],[Weight],[Time] from [dbo].[B3ClientService_GradeAndWeight_Detail] where [Order]= {0} and [Date] ='" + dmo.Date + "' Order by [Index]"; | |||
| using (var sqlUtil = new SqlUtil(connectionString)) | |||
| { | |||
| foreach (var item in orderData) | |||
| { | |||
| var idx = 0; | |||
| var s = string.Format(sql, item.Order); | |||
| using (var reader = sqlUtil.ExecuteReader(s)) | |||
| { | |||
| while (reader.Read()) | |||
| { | |||
| var detail = new Butcher_Detail(); | |||
| idx++; | |||
| if (!(reader["Index"] is DBNull)) | |||
| { | |||
| detail.Sequence = Convert.ToInt32(reader["Index"]); // 顺序号 | |||
| } | |||
| detail.PrePhase = item.Order; | |||
| detail.WeightBill_ID = item.WeightBill_ID; | |||
| detail.LiveVarieties_ID = item.LiveVarieties_ID; | |||
| detail.LiveVarieties_Name = item.LiveVarieties_Name; | |||
| detail.PhaseCode = string.Format("{0}-{1}", detail.PrePhase, idx); | |||
| if (!(reader["Livestock_ID"] is DBNull)) | |||
| { | |||
| detail.Livestock_ID = Convert.ToInt64(reader["Livestock_ID"]); // 级别 | |||
| } | |||
| if (!(reader["Livestock_Name"] is DBNull)) | |||
| { | |||
| detail.Livestock_Name = reader["Livestock_Name"].ToString(); // 级别 | |||
| } | |||
| if (!(reader["Weight"] is DBNull)) | |||
| { | |||
| detail.Weight = Convert.ToDecimal(reader["Weight"]); // 重量 | |||
| } | |||
| if (!(reader["Time"] is DBNull)) | |||
| { | |||
| detail.Time = Convert.ToDateTime(reader["Time"]); // 时间 | |||
| } | |||
| dmo.Details.Add(detail); | |||
| } | |||
| if (item.Number != idx) | |||
| msg.Append(string.Format("顺序号{0}排宰{1}头 读入{2}头", item.Order, item.Number, idx)); | |||
| } | |||
| } | |||
| } | |||
| return msg.ToString(); | |||
| } | |||
| class TempContainer | |||
| { | |||
| public int Order { get; set; } | |||
| public int Number { get; set; } | |||
| public long WeightBill_ID { get; set; } | |||
| public long? LiveVarieties_ID { get; set; } | |||
| public string LiveVarieties_Name { get; set; } | |||
| public static List<TempContainer> GetDate(DateTime date) | |||
| { | |||
| var order = new JoinAlias(typeof(ButcherOrder)); | |||
| var orderDetail = new JoinAlias(typeof(ButcherOrder_Detail)); | |||
| var weightDetail = new JoinAlias(typeof(WeightBill_Record)); | |||
| var query = new DQueryDom(order); | |||
| query.From.AddJoin(JoinType.Left, new DQDmoSource(orderDetail), DQCondition.EQ(order, "ID", orderDetail, "ButcherOrder_ID")); | |||
| query.From.AddJoin(JoinType.Left, new DQDmoSource(weightDetail), DQCondition.EQ(orderDetail, "WeightBill_ID", weightDetail, "WeightBill_ID")); | |||
| query.Columns.Add(DQSelectColumn.Field("Sequence", orderDetail)); | |||
| query.Columns.Add(DQSelectColumn.Field("Number", orderDetail)); | |||
| query.Columns.Add(DQSelectColumn.Field("WeightBill_ID", orderDetail)); | |||
| query.Columns.Add(DQSelectColumn.Field("LiveVarieties_ID", weightDetail)); | |||
| query.Columns.Add(DQSelectColumn.Field("LiveVarieties_Name", weightDetail)); | |||
| query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ(order, "Date", date), DQCondition.InEQ("BillState", 单据状态.已作废), DQCondition.EQ("Domain_ID", DomainContext.Current.ID))); | |||
| query.OrderBy.Expressions.Add(DQOrderByExpression.Create(orderDetail, "Sequence")); | |||
| var list = new List<TempContainer>(); | |||
| using (var session = Dmo.NewSession()) | |||
| { | |||
| using (var reader = session.ExecuteReader(query)) | |||
| { | |||
| while (reader.Read()) | |||
| { | |||
| var entity = new TempContainer(); | |||
| entity.Order = (int)reader[0]; | |||
| entity.Number = (int?)reader[1] ?? 0; | |||
| entity.WeightBill_ID = (long)reader[2]; | |||
| entity.LiveVarieties_ID = (long?)reader[3]; | |||
| entity.LiveVarieties_Name = (string)reader[4]; | |||
| list.Add(entity); | |||
| } | |||
| } | |||
| } | |||
| return list; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,56 @@ | |||
| using BWP.B3Frameworks; | |||
| using BWP.B3Frameworks.Attributes; | |||
| using BWP.B3Frameworks.BO; | |||
| using Forks.EnterpriseServices; | |||
| using Forks.EnterpriseServices.DataDictionary; | |||
| using Forks.EnterpriseServices.DataForm; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using TSingSoft.WebPluginFramework; | |||
| namespace BWP.B3SheepButcherManage.BO | |||
| { | |||
| [Serializable, DFClass, LogicName("羊屠宰单")] | |||
| [DmoTypeID(B3FrameworksConsts.DmoTypeIDBases.B3SheepButcherManage, B3SheepButcherManageConsts.DmoTypeIDOffsets.Butcher)] | |||
| [EditUrl("~/B3SheepButcherManage/Bills/Butcher_/ButcherEdit.aspx")] | |||
| public class Butcher : DepartmentWorkFlowBill | |||
| { | |||
| private DateTime _date = BLContext.Today; | |||
| [LogicName("屠宰日期")] | |||
| [DbColumn(Index = IndexType.Normal)] | |||
| public DateTime Date | |||
| { | |||
| get { return _date; } | |||
| set { _date = value; } | |||
| } | |||
| [DFDataKind(B3FrameworksConsts.DataSources.授权仓库)] | |||
| [DFExtProperty(B3FrameworksConsts.DFExtProperties.DisplayField, "Store_Name")] | |||
| [DFExtProperty(B3FrameworksConsts.DFExtProperties.QueryDataKind, B3FrameworksConsts.DataSources.授权仓库全部)] | |||
| [DFPrompt("仓库")] | |||
| public long? Store_ID { get; set; } | |||
| [LogicName("仓库")] | |||
| [ReferenceTo(typeof(Store), "Name")] | |||
| [Join("Store_ID", "ID")] | |||
| public string Store_Name { get; set; } | |||
| [Join("AccountingUnit_ID", "ID")] | |||
| [LogicName("会计单位编号")] | |||
| [ReferenceTo(typeof(AccountingUnit), "Code")] | |||
| public string AccountingUnit_Code { get; set; } | |||
| private readonly Butcher_DetailCollection _details = new Butcher_DetailCollection(); | |||
| [OneToMany(typeof(Butcher_Detail), "Sequence", false)] | |||
| [Join("ID", "Butcher_ID")] | |||
| public Butcher_DetailCollection Details | |||
| { | |||
| get { return _details; } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,104 @@ | |||
| using BWP.B3Frameworks.BO; | |||
| using BWP.B3ProduceUnitedInfos.BO; | |||
| using Forks.EnterpriseServices; | |||
| using Forks.EnterpriseServices.DataDictionary; | |||
| using Forks.EnterpriseServices.DataForm; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using Forks.Utils; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using TSingSoft.WebPluginFramework; | |||
| namespace BWP.B3SheepButcherManage.BO | |||
| { | |||
| [Serializable, DFClass, LogicName("屠宰单明细")] | |||
| public class Butcher_Detail : Base | |||
| { | |||
| [DbColumn(Index = IndexType.Normal, AllowNull = false)] | |||
| public long Butcher_ID { get; set; } | |||
| [LogicName("结算单")] | |||
| public long? StatPay_ID { get; set; } | |||
| [LogicName("顺序号")] | |||
| public int? Sequence { get; set; } | |||
| /// <summary> | |||
| /// PhaseCode 1-1 1-2 | |||
| /// </summary> | |||
| /// <value></value> | |||
| [LogicName("阶段号")] | |||
| public string PhaseCode { get; set; } | |||
| [LogicName("阶段")] | |||
| public int? PrePhase { get; set; } | |||
| [LogicName("过磅单号")] | |||
| [DbColumn(Index = IndexType.Normal)] | |||
| public long WeightBill_ID { get; set; } | |||
| [LogicName("级别")] | |||
| public long? Livestock_ID { get; set; } | |||
| [LogicName("活体品种")] | |||
| public long? LiveVarieties_ID { get; set; } | |||
| /// <summary> | |||
| /// Weight | |||
| /// </summary> | |||
| /// <value></value> | |||
| [LogicName("重量")] | |||
| public Money<decimal>? Weight { get; set; } | |||
| [LogicName("扣重")] | |||
| public Money<decimal>? SubtractWeight { get; set; } | |||
| [LogicName("结算重")] | |||
| public Money<decimal>? FinalWeight { get; set; } | |||
| /// <summary> | |||
| /// Time | |||
| /// </summary> | |||
| /// <value></value> | |||
| [LogicName("时间")] | |||
| public DateTime? Time { get; set; } | |||
| /// <summary> | |||
| /// Remark | |||
| /// </summary> | |||
| /// <value></value> | |||
| [LogicName("备注")] | |||
| public string Remark { get; set; } | |||
| [LogicName("活体品种")] | |||
| [ReferenceTo(typeof(LiveVarieties), "Name")] | |||
| [Join("LiveVarieties_ID", "ID")] | |||
| public string LiveVarieties_Name { get; set; } | |||
| [LogicName("级别")] | |||
| [ReferenceTo(typeof(Livestock), "Name")] | |||
| [Join("Livestock_ID", "ID")] | |||
| public string Livestock_Name { get; set; } | |||
| [LogicName("收购重量")] | |||
| [ReferenceTo(typeof(WeightBill), "BuyWeigh1")] | |||
| [Join("WeightBill_ID", "ID")] | |||
| public Money<decimal>? WeightBill_BuyWeigh1 { get; set; } | |||
| [LogicName("过磅单供应商")] | |||
| [ReferenceTo(typeof(WeightBill), "Supplier_ID")] | |||
| [Join("WeightBill_ID", "ID")] | |||
| public long? WeightBill_Supplier_ID { get; set; } | |||
| [LogicName("过磅单供应商")] | |||
| [ReferenceTo(typeof(WeightBill), "Supplier_Name")] | |||
| [Join("WeightBill_ID", "ID")] | |||
| public string WeightBill_Supplier_Name { get; set; } | |||
| } | |||
| [Serializable] | |||
| public class Butcher_DetailCollection : DmoCollection<Butcher_Detail> | |||
| { } | |||
| } | |||
| @ -0,0 +1,32 @@ | |||
| using System; | |||
| using System.Collections; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace BWP.B3SheepButcherManage.Ioc | |||
| { | |||
| public class B3SheepButcherManageFactoryDBList | |||
| { | |||
| private ArrayList mConnections = new ArrayList(); | |||
| public ArrayList Connections | |||
| { | |||
| get | |||
| { | |||
| return mConnections; | |||
| } | |||
| set | |||
| { | |||
| mConnections = value; | |||
| } | |||
| } | |||
| } | |||
| public class FactoryDBConnection | |||
| { | |||
| public long AccountingUnit_ID { get; set; } | |||
| public string Key { get; set; } | |||
| public string Value { get; set; } | |||
| } | |||
| } | |||
| @ -0,0 +1,32 @@ | |||
| using BWP.B3Frameworks.Attributes; | |||
| using Forks.EnterpriseServices; | |||
| using Forks.Utils.Configuration; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using TSingSoft.WebPluginFramework; | |||
| namespace BWP.B3SheepButcherManage.Utils | |||
| { | |||
| [ConfigurationEnabled] | |||
| public class B3SheepButcherManageConfig | |||
| { | |||
| public B3SheepButcherManageConfig() | |||
| { | |||
| ConfigurationUtil.Fill(this); | |||
| } | |||
| private DecimalConfigRef _subtractWeight = new DecimalConfigRef(0); | |||
| [DomainConfigurationItem] | |||
| [LogicName("屠宰扣重值")] | |||
| [ConfigurationItemGroup("羊屠宰场管理")] | |||
| [ConfigurationItemDescription("默认0")] | |||
| public DecimalConfigRef SubtractWeight | |||
| { | |||
| get { return _subtractWeight; } | |||
| set { _subtractWeight = value; } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,34 @@ | |||
| <?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="Employee_Name" lblWidth="4"/> | |||
| <Field name="Store_Name" lblWidth="4"/> | |||
| <Field name="Date" lblWidth="4"/> | |||
| <Field name="Remark" lblWidth="4"/> | |||
| </DFInfoBand> | |||
| <HtmlBand> | |||
| <![CDATA[<h2>屠宰明细</h2>]]> | |||
| </HtmlBand> | |||
| <DFListBand collection="$Details" itemType="$DetailType" enablePaging="true" > | |||
| <Field name="Sequence"/> | |||
| <Field name="PhaseCode"/> | |||
| <Field name="WeightBill_ID" /> | |||
| <Field name="LiveVarieties_Name" /> | |||
| <Field name="Livestock_Name"/> | |||
| <Field name="Weight"/> | |||
| <Field name="SubtractWeight"/> | |||
| <Field name="FinalWeight"/> | |||
| <Field name="StatPay_ID"/> | |||
| <Field name="Remark"/> | |||
| </DFListBand> | |||
| </Bands> | |||
| </BillReport> | |||
| </Report> | |||
| </BillReports> | |||
| @ -0,0 +1 @@ | |||
| 羊屠宰场管理数据库配置 | |||
| @ -0,0 +1,13 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | |||
| <B3SheepButcherManageFactoryDBList xmlns:ns1="clr-namespace:System.Collections;assembly=mscorlib" xmlns="clr-namespace:BWP.B3SheepButcherManage.Ioc;assembly=B3SheepButcherManage"> | |||
| <B3SheepButcherManageFactoryDBList.Connections> | |||
| <ns1:ArrayList> | |||
| <FactoryDBConnection AccountingUnit_ID="110" Key="屠宰单" Value="Server=.;Database=B3ButcherWeightClient;Integrated Security=true;uid=sa;pwd=bwp2011!@#" /> | |||
| <FactoryDBConnection AccountingUnit_ID="2" Key="屠宰单" Value="Server=.;Database=B3ButcherWeightClient;Integrated Security=true;uid=sa;pwd=bwp2011!@#" /> | |||
| </ns1:ArrayList> | |||
| </B3SheepButcherManageFactoryDBList.Connections> | |||
| </B3SheepButcherManageFactoryDBList> | |||