Browse Source

需求单No.141314 新增【羊屠宰单】新增羊屠宰单数据分析。

master
yibo 7 years ago
parent
commit
60553eb427
24 changed files with 1327 additions and 20 deletions
  1. +18
    -0
      B3SheepButcherManage.Web/B3SheepButcherManage.Web.csproj
  2. +251
    -0
      B3SheepButcherManage.Web/Pages/B3SheepButcherManage/Bills/Butcher_/ButcherEdit.cs
  3. +48
    -0
      B3SheepButcherManage.Web/Pages/B3SheepButcherManage/Bills/Butcher_/ButcherList.cs
  4. +65
    -0
      B3SheepButcherManage.Web/Pages/B3SheepButcherManage/Bills/Butcher_/ButcherList.xml
  5. +19
    -0
      B3SheepButcherManage.Web/Pages/B3SheepButcherManage/Bills/Butcher_/ButcherPrint.cs
  6. +219
    -0
      B3SheepButcherManage.Web/Pages/B3SheepButcherManage/Reports/ButcherAnalyse_/ButcherAnalyse.cs
  7. +48
    -0
      B3SheepButcherManage.Web/Pages/B3SheepButcherManage/Reports/ButcherAnalyse_/ButcherAnalyse.xml
  8. +6
    -0
      B3SheepButcherManage/B3SheepButcherManage.csproj
  9. +207
    -0
      B3SheepButcherManage/BL/Bill/ButcherBL/ButcherBL.cs
  10. +133
    -0
      B3SheepButcherManage/BL/Bill/ButcherBL/ButcherBL2.cs
  11. +1
    -1
      B3SheepButcherManage/BL/Bill/ButcherOrderBL/ButcherOrderBL.cs
  12. +1
    -2
      B3SheepButcherManage/BL/Bill/WeightBillBL/WeightBillBL.cs
  13. +56
    -0
      B3SheepButcherManage/BO/Bill/Butcher/Butcher.cs
  14. +104
    -0
      B3SheepButcherManage/BO/Bill/Butcher/Butcher_Detail.cs
  15. +2
    -2
      B3SheepButcherManage/BO/Bill/ButcherOrder/ButcherOrder.cs
  16. +1
    -1
      B3SheepButcherManage/BO/Bill/ButcherOrder/ButcherOrder_Detail.cs
  17. +1
    -0
      B3SheepButcherManage/DmoTypeIDOffsets.cs
  18. +32
    -0
      B3SheepButcherManage/Ioc/B3SheepButcherManageFactoryDBList.cs
  19. +32
    -0
      B3SheepButcherManage/Utils/B3SheepButcherManageConfig.cs
  20. +33
    -12
      WebFolder/config/Plugins/B3SheepButcherManage.Plugin
  21. +2
    -2
      WebFolder/config/billreports/B3SheepButcherManage/ButcherOrderPrint.xml
  22. +34
    -0
      WebFolder/config/billreports/B3SheepButcherManage/ButcherPrint.xml
  23. +1
    -0
      WebFolder/config/ioc/B3SheepButcherManageFactoryDBList.txt
  24. +13
    -0
      WebFolder/config/ioc/B3SheepButcherManageFactoryDBList.xml

+ 18
- 0
B3SheepButcherManage.Web/B3SheepButcherManage.Web.csproj View File

@ -126,6 +126,15 @@
<Compile Include="Pages\B3SheepButcherManage\Bills\ButcherOrder_\SelectWeighBillDialog.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3SheepButcherManage\Bills\Butcher_\ButcherEdit.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3SheepButcherManage\Bills\Butcher_\ButcherList.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3SheepButcherManage\Bills\Butcher_\ButcherPrint.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3SheepButcherManage\Bills\FixedPrice_\FixedPriceEdit.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
@ -144,6 +153,9 @@
<Compile Include="Pages\B3SheepButcherManage\Bills\WeightBill_\WeightBillPrint.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3SheepButcherManage\Reports\ButcherAnalyse_\ButcherAnalyse.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3SheepButcherManage\Reports\WeightBillAnalyse_\WeightBillAbnormalAnalyse.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
@ -180,6 +192,12 @@
<ItemGroup>
<EmbeddedResource Include="Pages\B3SheepButcherManage\Bills\ButcherOrder_\SelectWeighBillDialog.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\B3SheepButcherManage\Bills\Butcher_\ButcherList.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\B3SheepButcherManage\Reports\ButcherAnalyse_\ButcherAnalyse.xml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.


+ 251
- 0
B3SheepButcherManage.Web/Pages/B3SheepButcherManage/Bills/Butcher_/ButcherEdit.cs View File

@ -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);
}
}
}

+ 48
- 0
B3SheepButcherManage.Web/Pages/B3SheepButcherManage/Bills/Butcher_/ButcherList.cs View File

@ -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);
}
}
}
}

+ 65
- 0
B3SheepButcherManage.Web/Pages/B3SheepButcherManage/Bills/Butcher_/ButcherList.xml View File

@ -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>

+ 19
- 0
B3SheepButcherManage.Web/Pages/B3SheepButcherManage/Bills/Butcher_/ButcherPrint.cs View File

@ -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));
}
}
}

+ 219
- 0
B3SheepButcherManage.Web/Pages/B3SheepButcherManage/Reports/ButcherAnalyse_/ButcherAnalyse.cs View File

@ -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;
}
}
}

+ 48
- 0
B3SheepButcherManage.Web/Pages/B3SheepButcherManage/Reports/ButcherAnalyse_/ButcherAnalyse.xml View File

@ -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>

+ 6
- 0
B3SheepButcherManage/B3SheepButcherManage.csproj View File

@ -88,19 +88,25 @@
</ItemGroup>
<ItemGroup>
<Compile Include="BL\BaseInfo\LivestockBL.cs" />
<Compile Include="BL\Bill\ButcherBL\ButcherBL.cs" />
<Compile Include="BL\Bill\ButcherBL\ButcherBL2.cs" />
<Compile Include="BL\Bill\ButcherOrderBL\ButcherOrderBL.cs" />
<Compile Include="BL\Bill\FixedPriceBL\FixedPriceBL.cs" />
<Compile Include="BL\Bill\WeightBillBL\WeightBillBL.cs" />
<Compile Include="BO\BaseInfo\Livestock.cs" />
<Compile Include="BO\Bill\ButcherOrder\ButcherOrder.cs" />
<Compile Include="BO\Bill\ButcherOrder\ButcherOrder_Detail.cs" />
<Compile Include="BO\Bill\Butcher\Butcher.cs" />
<Compile Include="BO\Bill\Butcher\Butcher_Detail.cs" />
<Compile Include="BO\Bill\FixedPrice\FixedPrice.cs" />
<Compile Include="BO\Bill\FixedPrice\FixedPrice_Detail.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill_AbnormalRecording.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill_Record.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill.cs" />
<Compile Include="DmoTypeIDOffsets.cs" />
<Compile Include="Ioc\B3SheepButcherManageFactoryDBList.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils\B3SheepButcherManageConfig.cs" />
<Compile Include="Utils\WeightUtil.cs" />
</ItemGroup>
<ItemGroup />


+ 207
- 0
B3SheepButcherManage/BL/Bill/ButcherBL/ButcherBL.cs View File

@ -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; }
}
}

+ 133
- 0
B3SheepButcherManage/BL/Bill/ButcherBL/ButcherBL2.cs View File

@ -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;
}
}
}
}

+ 1
- 1
B3SheepButcherManage/BL/Bill/ButcherOrderBL/ButcherOrderBL.cs View File

@ -10,7 +10,7 @@ using System.Text;
namespace BWP.B3SheepButcherManage.BL
{
[BusinessInterface(typeof(ButcherOrderBL))]
[LogicName("羊排宰")]
[LogicName("羊排宰")]
public interface IButcherOrderBL : IDepartmentWorkFlowBillBL<ButcherOrder>
{ }


+ 1
- 2
B3SheepButcherManage/BL/Bill/WeightBillBL/WeightBillBL.cs View File

@ -32,9 +32,8 @@ namespace BWP.B3SheepButcherManage.BL
dmo.BuyWeigh1 = dmo.WeighRecords.Sum(x => (x.Weight ?? 0).Value);
dmo.BuyNum = dmo.WeighRecords.Sum(x => (x.Number));
}
//dmo.AlreadyButcherNum = dmo.WeighRecords.Count(x => x.IsButchered);
dmo.AbnormalMoney = dmo.WeighAbnormalRecording.Sum(x => (x.Abnormal_Money ?? 0).Value);
SetAbnormal_Money(dmo);
dmo.AbnormalMoney = dmo.WeighAbnormalRecording.Sum(x => (x.Abnormal_Money ?? 0).Value);
base.beforeSave(dmo);
}


+ 56
- 0
B3SheepButcherManage/BO/Bill/Butcher/Butcher.cs View File

@ -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; }
}
}
}

+ 104
- 0
B3SheepButcherManage/BO/Bill/Butcher/Butcher_Detail.cs View File

@ -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>
{ }
}

+ 2
- 2
B3SheepButcherManage/BO/Bill/ButcherOrder/ButcherOrder.cs View File

@ -13,7 +13,7 @@ using TSingSoft.WebControls2;
namespace BWP.B3SheepButcherManage.BO
{
[DFClass, Serializable]
[LogicName("羊排宰")]
[LogicName("羊排宰")]
[DmoTypeID(B3FrameworksConsts.DmoTypeIDBases.B3SheepButcherManage, B3SheepButcherManageConsts.DmoTypeIDOffsets.ButcherOrder)]
[EditUrl("~/B3SheepButcherManage/Bills/ButcherOrder_/ButcherOrderEdit.aspx")]
public class ButcherOrder : DepartmentWorkFlowBill
@ -24,7 +24,7 @@ namespace BWP.B3SheepButcherManage.BO
public DateTime Date { get { return dt; } set { dt = value; } }
private ButcherOrder_DetailCollection mDetail = new ButcherOrder_DetailCollection();
[OneToMany(typeof(ButcherOrder_Detail), "Sequence")]
[OneToMany(typeof(ButcherOrder_Detail), "Sequence", false)]
[Join("ID", "ButcherOrder_ID")]
public ButcherOrder_DetailCollection Details
{


+ 1
- 1
B3SheepButcherManage/BO/Bill/ButcherOrder/ButcherOrder_Detail.cs View File

@ -11,7 +11,7 @@ using System.Text;
namespace BWP.B3SheepButcherManage.BO
{
[DFClass, Serializable]
[LogicName("羊排宰_明细")]
[LogicName("羊排宰_明细")]
public class ButcherOrder_Detail : Base
{
[DbColumn(Index = IndexType.Normal, AllowNull = false)]


+ 1
- 0
B3SheepButcherManage/DmoTypeIDOffsets.cs View File

@ -13,6 +13,7 @@ namespace BWP.B3SheepButcherManage
public const byte FixedPrice = 2;
public const byte WeightBill = 3;
public const byte ButcherOrder = 4;
public const byte Butcher = 5;
}
public static class DataSources


+ 32
- 0
B3SheepButcherManage/Ioc/B3SheepButcherManageFactoryDBList.cs View File

@ -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; }
}
}

+ 32
- 0
B3SheepButcherManage/Utils/B3SheepButcherManageConfig.cs View File

@ -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; }
}
}
}

+ 33
- 12
WebFolder/config/Plugins/B3SheepButcherManage.Plugin View File

@ -14,7 +14,7 @@
</Assemblies>
<ContentFiles>
<Folder name="config/billreports"/>
<File name="config/ioc/B3SheepButcherManageMenu.txt" overwrite="true"/>
<Folder name="config/ioc" overwrite="false"/>
</ContentFiles>
<DbResources></DbResources>
<Profiles>
@ -30,6 +30,22 @@
<Function index="6" name="锁定"/>
<Function index="7" name="解锁"/>
</FunctionGroup>
<FunctionGroup name="羊定价单" roleSchemas="employee">
<Function index="0" name="访问" />
<Function index="1" name="新建" />
<Function index="2" name="编辑" />
<Function index="3" name="删除" />
<Function index="4" name="审核" />
<Function index="5" name="撤销" />
<Function index="6" name="锁定" />
<Function index="7" name="解锁" />
<Function index="8" name="管理" />
<Function index="9" name="作废" />
<Function index="10" name="完毕"/>
<Function index="11" name="撤销完毕"/>
<Function index="12" name="打印"/>
<Function index="13" name="调价"/>
</FunctionGroup>
<FunctionGroup name="羊过磅单" roleSchemas="employee" features="B3SheepButcherManage.0001">
<Function index="0" name="访问" />
<Function index="1" name="新建" />
@ -47,7 +63,7 @@
<Function index="13" name="数据分析"/>
<Function index="14" name="异常分析"/>
</FunctionGroup>
<!--<FunctionGroup name="结算单" roleSchemas="employee">
<FunctionGroup name="羊排宰单" roleSchemas="employee" features="B3SheepButcherManage.0002">
<Function index="0" name="访问" />
<Function index="1" name="新建" />
<Function index="2" name="编辑" />
@ -60,9 +76,8 @@
<Function index="9" name="作废" />
<Function index="10" name="完毕"/>
<Function index="11" name="撤销完毕"/>
<Function index="12" name="打印"/>
</FunctionGroup>-->
<FunctionGroup name="羊定价单" roleSchemas="employee">
</FunctionGroup>
<FunctionGroup name="羊屠宰单" roleSchemas="employee" features="B3SheepButcherManage.0003">
<Function index="0" name="访问" />
<Function index="1" name="新建" />
<Function index="2" name="编辑" />
@ -75,13 +90,12 @@
<Function index="9" name="作废" />
<Function index="10" name="完毕"/>
<Function index="11" name="撤销完毕"/>
<Function index="12" name="打印"/>
<Function index="13" name="调价"/>
<Function index="12" name="删除明细"/>
<Function index="13" name="打印"/>
<Function index="14" name="添加明细"/>
<Function index="15" name="数据分析"/>
</FunctionGroup>
<!--<FunctionGroup name="报表" roleSchemas="employee">
<Function index="0" name="过磅单分析" />
</FunctionGroup>-->
<FunctionGroup name="羊排宰" roleSchemas="employee">
<FunctionGroup name="羊结算单" roleSchemas="employee" features="B3SheepButcherManage.0004">
<Function index="0" name="访问" />
<Function index="1" name="新建" />
<Function index="2" name="编辑" />
@ -95,16 +109,23 @@
<Function index="10" name="完毕"/>
<Function index="11" name="撤销完毕"/>
</FunctionGroup>
<!--<FunctionGroup name="报表" roleSchemas="employee">
<Function index="0" name="过磅单分析" />
</FunctionGroup>-->
</Security>
<Menus>
<Menu id="0001" name="/B3羊屠宰场管理/基础档案/级别" roles="B3SheepButcherManage.级别.访问" url="B3SheepButcherManage/BaseInfos/Livestock_/LivestockList.aspx"/>
<Menu id="0002" name="/B3羊屠宰场管理/业务单据/羊定价单" roles="B3SheepButcherManage.羊定价单.访问" url="B3SheepButcherManage/Bills/FixedPrice_/FixedPriceList.aspx"/>
<Menu id="0003" features="B3SheepButcherManage.0001" name="/B3羊屠宰场管理/业务单据/羊过磅单" roles="B3SheepButcherManage.羊过磅单.访问" url="B3SheepButcherManage/Bills/WeightBill_/WeightBillList.aspx"/>
<Menu id="0004" name="/B3羊屠宰场管理/业务单据/羊排宰" roles="B3SheepButcherManage.羊排宰.访问" url="B3SheepButcherManage/Bills/ButcherOrder_/ButcherOrderList.aspx"/>
<Menu id="0004" features="B3SheepButcherManage.0002" name="/B3羊屠宰场管理/业务单据/羊排宰单" roles="B3SheepButcherManage.羊排宰单.访问" url="B3SheepButcherManage/Bills/ButcherOrder_/ButcherOrderList.aspx"/>
<Menu id="0005" features="B3SheepButcherManage.0003" name="/B3羊屠宰场管理/业务单据/羊屠宰单" roles="B3SheepButcherManage.羊屠宰单.访问" url="B3SheepButcherManage/Bills/Butcher_/ButcherList.aspx"/>
</Menus>
<Features>
<Feature id="0001" name="羊过磅单"/>
<Feature id="0002" name="羊排宰单"/>
<Feature id="0003" name="羊屠宰单"/>
<Feature id="0004" name="羊结算单"/>
</Features>
</Plugin>


+ 2
- 2
WebFolder/config/billreports/B3SheepButcherManage/ButcherOrderPrint.xml View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<BillReports xmlns="urn:BillReports" version="1.0" displayName="羊排宰" phyName="羊排宰">
<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>
<TextBand fontName="黑体" fontSize="15" align="Center">羊排宰№$Dmo.ID</TextBand>
<DFInfoBand object="$Dmo" cols="4">
<Field name="AccountingUnit_Name" lblWidth="4"/>


+ 34
- 0
WebFolder/config/billreports/B3SheepButcherManage/ButcherPrint.xml View File

@ -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>

+ 1
- 0
WebFolder/config/ioc/B3SheepButcherManageFactoryDBList.txt View File

@ -0,0 +1 @@
羊屠宰场管理数据库配置

+ 13
- 0
WebFolder/config/ioc/B3SheepButcherManageFactoryDBList.xml View File

@ -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>

Loading…
Cancel
Save