Browse Source

需求单No.138385 新增【代宰过磅】

master
yibo 8 years ago
parent
commit
21d8f906ad
18 changed files with 1234 additions and 0 deletions
  1. +23
    -0
      B3SubstituteKill.Web/B3SubstituteKill.Web.csproj
  2. +348
    -0
      B3SubstituteKill.Web/Pages/B3SubstituteKill/Bills/SubKillWeightBill_/SubKillWeightBillEdit.cs
  3. +39
    -0
      B3SubstituteKill.Web/Pages/B3SubstituteKill/Bills/SubKillWeightBill_/SubKillWeightBillList.cs
  4. +72
    -0
      B3SubstituteKill.Web/Pages/B3SubstituteKill/Bills/SubKillWeightBill_/SubKillWeightBillList.xml
  5. +19
    -0
      B3SubstituteKill.Web/Pages/B3SubstituteKill/Bills/SubKillWeightBill_/SubKillWeightBillPrint.cs
  6. +31
    -0
      B3SubstituteKill.Web/Pages/B3SubstituteKill/Bills/SubKillWeightBill_/WeightUtil.cs
  7. +317
    -0
      B3SubstituteKill.Web/Pages/B3SubstituteKill/Dialogs/WeightRecordDialog.cs
  8. +17
    -0
      B3SubstituteKill.Web/Pages/B3SubstituteKill/Dialogs/WeightRecordDialog.xml
  9. +10
    -0
      B3SubstituteKill/B3SubstituteKill.csproj
  10. +36
    -0
      B3SubstituteKill/BL/Bills/SubKillWeightBill/SubKillWeightBillBL.cs
  11. +27
    -0
      B3SubstituteKill/BL/Bills/SubKillWeightBill/WeightingInfoBL.cs
  12. +84
    -0
      B3SubstituteKill/BO/Bills/SubKillWeightBill/SubKillWeightBill.cs
  13. +62
    -0
      B3SubstituteKill/BO/Bills/SubKillWeightBill/SubKillWeightBill_Detail.cs
  14. +44
    -0
      B3SubstituteKill/BO/Bills/SubKillWeightBill/WeightingInfo.cs
  15. +48
    -0
      B3SubstituteKill/Rpcs/SupplierRpc.cs
  16. +2
    -0
      B3SubstituteKill/Utils/B3SubstituteKillConsts.cs
  17. +16
    -0
      WebFolder/config/Plugins/B3SubstituteKill.plugin
  18. +39
    -0
      WebFolder/config/billreports/B3SubstituteKill/SubKillWeightBillPrint.xml

+ 23
- 0
B3SubstituteKill.Web/B3SubstituteKill.Web.csproj View File

@ -45,6 +45,10 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\BwpB3Project\tsref\Debug\B3ProcurementInterface.dll</HintPath> <HintPath>..\..\..\..\..\..\BwpB3Project\tsref\Debug\B3ProcurementInterface.dll</HintPath>
</Reference> </Reference>
<Reference Include="B3ProduceUnitedInfos, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3a973053c7ebf11c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\tsref\Debug\B3ProduceUnitedInfos.dll</HintPath>
</Reference>
<Reference Include="B3System, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL"> <Reference Include="B3System, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\BwpB3Project\tsref\Debug\B3System.dll</HintPath> <HintPath>..\..\..\..\..\..\BwpB3Project\tsref\Debug\B3System.dll</HintPath>
@ -124,6 +128,19 @@
<Compile Include="Pages\B3SubstituteKill\Bills\SubKillPriceBill_\SubKillPriceBillPrint.cs"> <Compile Include="Pages\B3SubstituteKill\Bills\SubKillPriceBill_\SubKillPriceBillPrint.cs">
<SubType>ASPXCodeBehind</SubType> <SubType>ASPXCodeBehind</SubType>
</Compile> </Compile>
<Compile Include="Pages\B3SubstituteKill\Bills\SubKillWeightBill_\SubKillWeightBillEdit.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3SubstituteKill\Bills\SubKillWeightBill_\SubKillWeightBillList.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3SubstituteKill\Bills\SubKillWeightBill_\SubKillWeightBillPrint.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3SubstituteKill\Bills\SubKillWeightBill_\WeightUtil.cs" />
<Compile Include="Pages\B3SubstituteKill\Dialogs\WeightRecordDialog.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="PluginClass.cs" /> <Compile Include="PluginClass.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils\B3SubstituteDataProvider.cs" /> <Compile Include="Utils\B3SubstituteDataProvider.cs" />
@ -152,6 +169,12 @@
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Pages\B3SubstituteKill\Bills\SubKillPriceBill_\SubKillPriceBillList.xml" /> <EmbeddedResource Include="Pages\B3SubstituteKill\Bills\SubKillPriceBill_\SubKillPriceBillList.xml" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\B3SubstituteKill\Bills\SubKillWeightBill_\SubKillWeightBillList.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\B3SubstituteKill\Dialogs\WeightRecordDialog.xml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.


+ 348
- 0
B3SubstituteKill.Web/Pages/B3SubstituteKill/Bills/SubKillWeightBill_/SubKillWeightBillEdit.cs View File

@ -0,0 +1,348 @@
using BWP.B3ProduceUnitedInfos;
using BWP.B3SubstituteKill.BL;
using BWP.B3SubstituteKill.BO;
using BWP.Web.Layout;
using BWP.Web.Pages.B3SubstituteKill.Dialogs;
using BWP.Web.Utils;
using BWP.Web.WebControls;
using Forks.EnterpriseServices.BusinessInterfaces;
using Forks.EnterpriseServices.DataForm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using TSingSoft.WebControls2;
using Forks.Utils.Collections;
using BWP.B3SubstituteKill.Utils;
namespace BWP.Web.Pages.B3SubstituteKill.Bills.SubKillWeightBill_
{
class SubKillWeightBillEdit : DepartmentWorkFlowBillEditPage<SubKillWeightBill, ISubKillWeightBillBL>
{
protected override void BuildBasePropertiesEditor(TitlePanel titlePanel, CustomPageLayout.PageLayoutSection pageLayoutSection)
{
var layoutManager = new LayoutManager("", mDFInfo, mDFContainer);
var config = new AutoLayoutConfig();
config.Add("AccountingUnit_ID");
config.Add("Department_ID");
config.Add("Employee_ID");
config.Add("Date");
config.Add("Supplier_ID");
config.Add("Supplier_Tel");
config.Add("Supplier_Card_ID");
config.Add("Supplier_Address");
config.Add("Number");
config.Add("Weight");
config.Add("PriceBill_ID");
config.Add("Remark");
layoutManager.Config = config;
pageLayoutSection.ApplyLayout(layoutManager, config, mPageLayoutManager, mDFInfo);
titlePanel.Controls.Add(layoutManager.CreateLayout());
if (layoutManager.Contains("Supplier_ID"))
{
var supplierInput = layoutManager["Supplier_ID"].InputControl as DFChoiceBox;
if (supplierInput != null)
{
var script = @"
var txtValue =parseInt(__DFContainer.getValue('Supplier_ID'));
simpleRestCall('/MainSystem/B3SubstituteKill/Rpcs/SupplierRpc/GetSupplierAndPriceBillID',[txtValue,__DFContainer.getControl('Date').value],
function(result){
if(typeof(result.Address)!='undefined')
{
__DFContainer.setValue('Supplier_Address',result.Address);
}
else
{
__DFContainer.setValue('Supplier_Address','');
}
if(typeof(result.Tel)!='undefined')
{
__DFContainer.setValue('Supplier_Tel',result.Tel);
}
else
{
__DFContainer.setValue('Supplier_Tel','');
}
if(typeof(result.Supplier_Card_ID)!='undefined')
{
__DFContainer.setValue('Supplier_Card_ID',result.Card_ID);
}
else
{
__DFContainer.setValue('Supplier_Card_ID','');
}
if(typeof(result.SupplierApply_ID)!='undefined')
{
__DFContainer.setValue('PriceBill_ID',result.SupplierApply_ID);
}
else
{
__DFContainer.setValue('PriceBill_ID','');
}
},{ });";
supplierInput.OnClientSelected = script;
}
}
}
protected override void BuildBody(System.Web.UI.Control parent)
{
base.BuildBody(parent);
AddDetail(parent.EAdd(new TitlePanel("过磅明细", "过磅明细")));
}
DFEditGrid _detailGrid;
private void AddDetail(TitlePanel titlePanel)
{
var hPanel = titlePanel.EAdd(new HLayoutPanel());
if (CanSave)
{
var addBtn = new TSButton() { Text = "新增" };
addBtn.Click += (sender, e) =>
{
_detailGrid.GetFromUI();
Dmo.Details.Add(new SubKillWeightBill_Detail());
_detailGrid.DataBind();
};
hPanel.Add(addBtn);
var input1 = hPanel.Add(new DFWebSocketInput(8181));
input1.Attributes["skipchangecheck"] = "skipchangecheck";
input1.Width = 100;
input1.Height = 35;
input1.Font.Bold = true;
input1.Font.Size = 16;
//input1.Text = "15";
mDFContainer.AddNonDFControl(input1, "$WebSocketInput");
TSButton readMaoBtn = hPanel.Add(new TSButton()
{
Text = "读入毛重"
});
readMaoBtn.OnClientClick = "var behindSelect=__DFContainer.getControl('$Details').behind.selectedRow().dfContainer; if(behindSelect==undefined){alert('请先选择称重明细');return false;} var id=behindSelect.getValue('ID');if(id==0){alert('请先保存单据');return false;} $('#GridRowIndex').val(__DFContainer.getControl('$Details').behind.mSelectedRowIndex);";
readMaoBtn.Click += delegate
{
GetFromUI();
var index = int.Parse(Request.Form["GridRowIndex"]) - 1;
var detail = Dmo.Details[index];
if (detail.Weight == null)
{
detail.Weight = 0;
}
decimal inputWeight;
if (decimal.TryParse(input1.Text, out inputWeight))
{
detail.MaoWeight = (detail.MaoWeight ?? 0) + inputWeight;
detail.Weight += inputWeight;
}
// AspUtil.Redirect(AspUtil.UpdateUrlParam(Request.RawUrl, "detailID", detail.ID.ToString()));
WeightUtil.InsertRecord(Dmo, detail, decimal.Round(decimal.Parse(input1.Text), 2), "电子称", "毛重");
_detailGrid.DataBind();
};
TSButton readPiBtn = hPanel.Add(new TSButton()
{
Text = "读入皮重"
});
readPiBtn.OnClientClick = "var behindSelect=__DFContainer.getControl('$Details').behind.selectedRow().dfContainer; if(behindSelect==undefined){alert('请先选择称重明细');return false;} var id=behindSelect.getValue('ID');if(id==0){alert('请先保存单据');return false;} $('#GridRowIndex').val(__DFContainer.getControl('$Details').behind.mSelectedRowIndex);";
readPiBtn.Click += delegate
{
GetFromUI();
var index = int.Parse(Request.Form["GridRowIndex"]) - 1;
var detail = Dmo.Details[index];
if (detail.Weight == null)
{
detail.Weight = 0;
}
decimal inputWeight;
if (decimal.TryParse(input1.Text, out inputWeight))
{
detail.PiWeight = (detail.PiWeight ?? 0) + inputWeight;
detail.Weight -= inputWeight;
}
WeightUtil.InsertRecord(Dmo, detail, decimal.Round(decimal.Parse(input1.Text), 2), "电子称", "皮重");
_detailGrid.DataBind();
};
}
var weight = hPanel.Add(new DialogButton { Text = "称重记录" });
weight.Click += queryWInforBtn_Click;
weight.Url = AspUtil.AddParamToUrl(AspUtil.AddParamToUrl(AspUtil.AddParamToUrl("~/B3SubstituteKill/Dialogs/WeightRecordDialog.aspx", "BillType", "'+4034+'"), "DetailID", "'+__DFContainer.getControl('$Details').behind.selectedRow().dfContainer.getValue('ID')+'"), "BillID", "'+" + MinDmo.ID + "+'");
weight.Url = AspUtil.AddParamToUrl(weight.Url, "BillState", MinDmo.BillState.Value.ToString());
var editor = new DFCollectionEditor<SubKillWeightBill_Detail>(() => Dmo.Details);
editor.AllowDeletionFunc = () => CanSave;
editor.CanDeleteFunc = detail => CanSave;
editor.IsEditableFunc = (field, detail) => CanSave;
_detailGrid = titlePanel.EAdd(new DFEditGrid(editor) { Width = Unit.Percentage(100) });
_detailGrid.Columns.EAdd(new DFEditGridColumn<DFChoiceBox>("LiveVarieties_ID")).InitEditControl += (sender, e) =>
{
e.Control.DataKind = B3ProduceUnitedInfos.B3ProduceUnitedInfosDataSources.;
e.Control.EnableInputArgument = true;
e.Control.EnableTopItem = true;
e.Control.DFDisplayField = "LiveVarieties_Name";
e.Control.Width = Unit.Pixel(150);
};
_detailGrid.Columns.EAdd(new DFEditGridColumn<DFTextBox>("Number")).InitEditControl += (sender, e) =>
{
e.Control.Style["width"] = "120px";
};
_detailGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("MaoWeight"));
_detailGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("PiWeight"));
_detailGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("Weight"));
_detailGrid.Columns.EAdd(new DFEditGridColumn<DFChoiceBox>("LiveColonyHouse_ID")).InitEditControl += (sender, e) =>
{
e.Control.DataKind = B3ProduceUnitedInfosDataSources.;
e.Control.EnableInputArgument = true;
e.Control.EnableTopItem = true;
e.Control.OnBeforeDrop = "this.codeArgument=2";
e.Control.DFDisplayField = "LiveColonyHouse_Name";
e.Control.Width = Unit.Pixel(150);
};
_detailGrid.Columns.EAdd(new DFEditGridColumn<DFChoiceBox>("SubKillProductLine_ID")).InitEditControl += (sender, e) =>
{
e.Control.DataKind = B3SubstituteKillConsts.DataSources.线;
e.Control.EnableInputArgument = true;
e.Control.EnableTopItem = true;
e.Control.DFDisplayField = "SubKillProductLine_Name";
e.Control.Width = Unit.Pixel(150);
};
_detailGrid.Columns.Add(new DFEditGridColumn("Remark"));
_detailGrid.ValueColumns.Add("ID");
var section = mPageLayoutManager.AddSection("Detail", "过磅明细");
titlePanel.SetPageLayoutSetting(mPageLayoutManager, section.Name);
section.ApplyLayout(_detailGrid, mPageLayoutManager, DFInfo.Get(typeof(SubKillWeightBill_Detail)));
mDFContainer.AddNonDFControl(_detailGrid, "$Details");
}
private void queryWInforBtn_Click(object sender, EventArgs e)
{
_detailGrid.GetFromUI();
var vInfor = DialogUtil.GetCachedObj(this) as SumWInfor;
var detail = Dmo.Details.First(x => x.ID == vInfor.DetailID);
detail.Weight = vInfor.Weight;
detail.MaoWeight = vInfor.MaoWeight;
detail.PiWeight = vInfor.PiWeight;
_detailGrid.DataBind();
GetFromUI();
DmoSave2(detail.ID);
}
private void DmoSave2(long detailID = 0)
{
GetFromUI();
if (IsNew)
{
mBL.Insert(Dmo);
}
else
{
mBL.Update(Dmo);
}
var blMessage = BIFactory.GetLastMessage();
var url = Request.RawUrl;
if (IsNew)
{
url = AspUtil.RemoveUrlParam(url, "ReferToID");
url = AspUtil.AddParamToUrl(url, "ID", Dmo.ID.ToString());
}
var message = "保存成功!";
if (!string.IsNullOrEmpty(blMessage))
{
message += "\r\n" + blMessage;
}
url = AspUtil.RemoveUrlParam(url, "detailID");
if (detailID == 0)
AspUtil.RedirectAndAlert(this, url, message);
else
AspUtil.Redirect(AspUtil.UpdateUrlParam(Request.RawUrl, "detailID", detailID.ToString()));
}
public override void AppToUI()
{
base.AppToUI();
_detailGrid.DataBind();
}
public override void GetFromUI()
{
base.GetFromUI();
_detailGrid.GetFromUI();
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
Page.ClientScript.RegisterHiddenField("LastAction", Page.Request.Form["LastAction"]);
Page.ClientScript.RegisterHiddenField("GridRowIndex", "");
if (!IsPostBack)
{
var detailID = Request.QueryString["detailID"];
if (!string.IsNullOrEmpty(detailID))
{
int index = 0;
foreach (var detail in Dmo.Details)
{
if (detail.ID.ToString() == detailID)
{
break;
}
index++;
}
if (index >= 0)
{
_detailGrid.CurrentPageIndex = index / _detailGrid.PageSize;
var selectedrow = (index - _detailGrid.CurrentPageIndex * _detailGrid.PageSize).ToString();
Page.ClientScript.RegisterStartupScript(GetType(), "FocusToRow", @"
$(function(){
if (browserContext && browserContext.Browser == ""IE"") {
__DFContainer.getControl(""$Details"").rows({row}).scrollIntoView();
}else {
__DFContainer.getControl(""$Details"").rows[{row}].scrollIntoView();
}
});".Replace("{row}", selectedrow.ToString()), true);
_detailGrid.DataBind();
}
}
}
//不知道做什么用,如果不安装销售系统则报错 ,所以隐藏掉
// var fc = @"<script>
//simpleRestCall('/MainSystem/B3Sale/Rpcs/WeightInfoRpc/QueryAssignInfor',
//[" + MinDmo.ID + @"],
//function(result){
// if(result!=''){
//window.goodsname=result;
// }
//},{});</script>";
// Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "d", fc);
//
}
}
}

+ 39
- 0
B3SubstituteKill.Web/Pages/B3SubstituteKill/Bills/SubKillWeightBill_/SubKillWeightBillList.cs View File

@ -0,0 +1,39 @@
using BWP.B3SubstituteKill.BL;
using BWP.B3SubstituteKill.BO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebControls2;
namespace BWP.Web.Pages.B3SubstituteKill.Bills.SubKillWeightBill_
{
class SubKillWeightBillList : DomainBillListPage<SubKillWeightBill, ISubKillWeightBillBL>
{
protected override void AddQueryControls(VLayoutPanel vPanel)
{
vPanel.Add(CreateDefaultBillQueryControls((panel, config) =>
{
config.Add("AccountingUnit_ID");
config.Add("Department_ID");
config.Add("Employee_ID");
config.Add("Date");
config.Add("Supplier_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, "Date");
AddDFBrowseGridColumn(grid, "Supplier_Name");
}
}
}
}

+ 72
- 0
B3SubstituteKill.Web/Pages/B3SubstituteKill/Bills/SubKillWeightBill_/SubKillWeightBillList.xml View File

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8" ?>
<Select xmlns="urn:XDQuery">
<Columns>
<Field name="ID"/>
</Columns>
<From>
<DmoClass class="BWP.B3SubstituteKill.BO.SubKillWeightBill, B3SubstituteKill"/>
</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="Supplier_ID"/>
<QBE paramName="Supplier_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
B3SubstituteKill.Web/Pages/B3SubstituteKill/Bills/SubKillWeightBill_/SubKillWeightBillPrint.cs View File

@ -0,0 +1,19 @@
using BWP.B3SubstituteKill.BL;
using BWP.B3SubstituteKill.BO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.Web.Pages.B3SubstituteKill.Bills.SubKillWeightBill_
{
class SubKillWeightBillPrint : DomainTemplatePrintPage<SubKillWeightBill, ISubKillWeightBillBL>
{
protected override void AddParameters(IDictionary<string, object> dic)
{
dic.Add("$ID", Dmo.ID);
dic.Add("$Details", Dmo.Details);
dic.Add("$DetailType", typeof(SubKillWeightBill_Detail));
}
}
}

+ 31
- 0
B3SubstituteKill.Web/Pages/B3SubstituteKill/Bills/SubKillWeightBill_/WeightUtil.cs View File

@ -0,0 +1,31 @@
using BWP.B3SubstituteKill.BL;
using BWP.B3SubstituteKill.BO;
using Forks.EnterpriseServices.BusinessInterfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.Web.Pages.B3SubstituteKill.Bills.SubKillWeightBill_
{
static class WeightUtil
{
public static void InsertRecord(SubKillWeightBill dmo, SubKillWeightBill_Detail detail, decimal weight, string type, string weightType)
{
using (var context = new TransactionContext())
{
var weightingInfor = new WeightingInfo();
weightingInfor.WeightTime = DateTime.Now;
weightingInfor.DetailID = detail.ID;
weightingInfor.Weight = weight;
weightingInfor.BillType = 4032 + 2;
weightingInfor.BillID = detail.SubKillWeightBill_ID;
weightingInfor.WeightType = weightType;
context.Session.Insert(weightingInfor);
var bl = BIFactory.Create<ISubKillWeightBillBL>(context);
bl.Update(dmo);
context.Commit();
}
}
}
}

+ 317
- 0
B3SubstituteKill.Web/Pages/B3SubstituteKill/Dialogs/WeightRecordDialog.cs View File

@ -0,0 +1,317 @@
using BWP.B3SubstituteKill.BL;
using BWP.B3SubstituteKill.BO;
using BWP.B3Frameworks.Utils;
using BWP.Web.Utils;
using Forks.EnterpriseServices.BusinessInterfaces;
using Forks.EnterpriseServices.DataForm;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using TSingSoft.WebControls2;
using TSingSoft.WebPluginFramework.Controls;
using Forks.Utils.Collections;
namespace BWP.Web.Pages.B3SubstituteKill.Dialogs
{
public class WeightRecordDialog : AppBasePage
{
protected QueryContainer mQueryContainer;
protected DFInfo mDFInfo = DFInfo.Get(typeof(WeightingInfo));
private DFBrowseGrid mGrid;
private short BillType
{
get
{
short billType = 0;
//if (!string.IsNullOrEmpty(Request["BillType"]))
//{
billType = short.Parse(Request["BillType"]);
// }
return billType;
}
}
// 删除且更新 按钮 是否可用
private bool CanDelUpdate
{
get
{
if (!string.IsNullOrEmpty(Request["CanDelUpdate"]))
{
if ("true".Equals(Request["CanDelUpdate"]))
{
return true;
}
}
return false;
}
}
private long BillID
{
get
{
long detailID = 0;
if (!string.IsNullOrEmpty(Request["BillID"]))
{
detailID = long.Parse(Request["BillID"]);
}
return detailID;
}
}
private long DetailID
{
get
{
long detailID = 0;
if (!string.IsNullOrEmpty(Request["DetailID"]))
{
detailID = long.Parse(Request["DetailID"]);
}
return detailID;
}
}
private bool CanDelete
{
get
{
if (!string.IsNullOrEmpty(Request["CanDelete"]))
{
if ("true".Equals(Request["CanDelete"]))
{
return true;
}
}
return false;
}
}
private bool CanUpdate
{
get
{
if (!string.IsNullOrEmpty(Request["CanUpdate"]))
{
if ("true".Equals(Request["CanUpdate"]))
{
return true;
}
}
return false;
}
}
void deleteBtn_Click(object sender, EventArgs e)
{
if (!mGrid.GetSelectedItems().Any())
{
AspUtil.Alert(this, "请先选择要删除的记录!");
return;
}
// 删除选择的记录
DelAction();
AspUtil.Reload(this);
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
var style = @"<style>
.tsButton{
margin: 1px 20px;
height: 50px;
width:120px;
color: #FFFFFF;
background: #42a3da;
border: 0;
cursor: pointer;
font-size:20px;
}
</style>
";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "headDiv", style);
}
private void DelAction()
{
// 删除选择的记录
using (var context = new TransactionContext())
{
var bl = BIFactory.Create<IWeightingInfoBL>(context);
foreach (DFDataRow row in mGrid.GetSelectedItems())
{
var id = (long)row["ID"];
var weightingInfor = bl.Load(id);
bl.Delete(weightingInfor);
}
context.Commit();
}
}
// 取得 毛重合计,扣重合计
void updateBtn_Click(object sender, EventArgs e)
{
UpdateAction();
}
private void UpdateAction()
{
SumWInfor sumW = new SumWInfor();
using (var context = new TransactionContext())
{
DQueryDom dom = new DQueryDom(new JoinAlias(typeof(WeightingInfo)));
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Multiply(DQExpression.Field("Weight"), DQExpression.LogicCase(DQCondition.EQ("WeightType", "毛重"), DQExpression.Value(1), DQExpression.Value(0)))), "毛重"));
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Multiply(DQExpression.Field("Weight"), DQExpression.LogicCase(DQCondition.EQ("WeightType", "皮重"), DQExpression.Value(1), DQExpression.Value(0)))), "皮重"));
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Multiply(DQExpression.Field("Weight"), DQExpression.LogicCase(DQCondition.EQ("WeightType", "毛重"), DQExpression.Value(1), DQExpression.Value(-1)))), "Weight"));
dom.Where.Conditions.Add(DQCondition.EQ("BillType", BillType));
dom.Where.Conditions.Add(DQCondition.EQ("DetailID", DetailID));
sumW.DetailID = DetailID;
using (IDQDataReader reader = context.Session.ExecuteReader(dom))
{
while (reader.Read())
{
if (reader[0] != null)
sumW.MaoWeight = Convert.ToDecimal(reader[0]);
if (reader[1] != null)
sumW.PiWeight = Convert.ToDecimal(reader[1]);
if (reader[2] != null)
sumW.Weight = Convert.ToDecimal(reader[2]);
}
}
context.Commit();
}
DialogUtil.SetCachedObj(this, sumW);
AspUtil.Close(this);
}
// 是否显示 删除且更新 按钮
private bool DisplayDelUpdateBtn
{
get
{
bool canDis = true;
if (!string.IsNullOrEmpty(Request["DisplayDUBtn"]))
{
if (Request["DisplayDUBtn"].Equals("false"))
{
canDis = false;
}
}
return canDis;
}
}
bool Checked
{
get { return !string.IsNullOrEmpty(Request.QueryString["BillState"]) && int.Parse(Request.QueryString["BillState"]) >= 20; }
}
protected override void InitForm(System.Web.UI.HtmlControls.HtmlForm form)
{
mQueryContainer = QueryContainer.FromResource(this.GetType().FullName + ".xml", this.GetType().Assembly);
form.Controls.Add(new PageTitle("过磅单记录表"));
VLayoutPanel vLayoutPanel = new VLayoutPanel();
form.Controls.Add(vLayoutPanel);
AddGrid(vLayoutPanel);
if (Checked)
return;
TSButton deleteBtn = new TSButton("删 除");
deleteBtn.OnClientClick = "return confirm('确定要删除所选的错误记录吗?');";
deleteBtn.Click += deleteBtn_Click;
HLayoutPanel hLayoutPanel = new HLayoutPanel();
hLayoutPanel.Add(deleteBtn);
hLayoutPanel.Add(new Literal { Text = "&nbsp;&nbsp;" });
TSButton updateBtn = new TSButton("更 新");
updateBtn.Click += updateBtn_Click;
hLayoutPanel.Add(updateBtn);
vLayoutPanel.Add(hLayoutPanel, new VLayoutOption(HorizontalAlign.Center));
}
private void BindGrid(bool IsDisAllRecord)
{
mGrid.Query = mQueryContainer.Build();
mGrid.Query.Columns.Add(DQSelectColumn.Create(DQExpression.LogicCase(DQCondition.EQ("WeightType", "毛重"), DQExpression.Field("Weight")), "毛重"));
mGrid.Query.Columns.Add(DQSelectColumn.Create(DQExpression.LogicCase(DQCondition.EQ("WeightType", "皮重"), DQExpression.Field("Weight")), "皮重"));
mGrid.Query.Where.Conditions.Add(DQCondition.EQ("BillType", BillType));
if (IsDisAllRecord)
{
mGrid.Query.Where.Conditions.Add(DQCondition.EQ("BillID", BillID));
}
else
{
mGrid.Query.Where.Conditions.Add(DQCondition.EQ("DetailID", DetailID));
}
mGrid.Query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", false));
mGrid.CurrentPageIndex = 0;
mGrid.DataBind();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!IsPostBack)
{
BindGrid(false);
}
}
private void AddGrid(VLayoutPanel vPanel)
{
mGrid = new DFBrowseGrid(new DFDataTableEditor());
mGrid.Width = Unit.Percentage(80);
mGrid.MultiSelectionEnabled = true;
mGrid.Columns.Add(new DFBrowseGridColumn("ID"));
// mGrid.Columns.Add(new DFBrowseGridColumn("Goods_Name"));
mGrid.Columns.Add(new DFBrowseGridColumn("WeightTime"));
mGrid.Columns.Add(new DFBrowseGridColumn("毛重"));
mGrid.Columns.Add(new DFBrowseGridColumn("皮重"));
//mGrid.Columns.EAdd(new DFBrowseGridColumn("Weight")).SumMode = SumMode.Sum;
vPanel.Add(mGrid);
}
}
[Serializable]
public class SumWInfor
{
public Money<decimal> MaoWeight { get; set; }
public Money<decimal> PiWeight { get; set; }
public Money<decimal> Weight
{
get;
set;
}
public long DetailID
{
get;
set;
}
}
}

+ 17
- 0
B3SubstituteKill.Web/Pages/B3SubstituteKill/Dialogs/WeightRecordDialog.xml View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<Select xmlns="urn:XDQuery">
<Columns>
<Field name="ID"/>
</Columns>
<From>
<DmoClass class="BWP.B3SubstituteKill.BO.WeightingInfo, B3SubstituteKill"/>
</From>
<Where>
<And>
<EQ>
<Field name="ID"/>
<QBE paramName="ID"/>
</EQ>
</And>
</Where>
</Select>

+ 10
- 0
B3SubstituteKill/B3SubstituteKill.csproj View File

@ -45,6 +45,10 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\BwpB3Project\tsref\Debug\B3ProcurementInterface.dll</HintPath> <HintPath>..\..\..\..\..\..\BwpB3Project\tsref\Debug\B3ProcurementInterface.dll</HintPath>
</Reference> </Reference>
<Reference Include="B3ProduceUnitedInfos, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3a973053c7ebf11c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\tsref\Debug\B3ProduceUnitedInfos.dll</HintPath>
</Reference>
<Reference Include="Forks.EnterpriseServices, Version=3.1.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL"> <Reference Include="Forks.EnterpriseServices, Version=3.1.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\BwpB3Project\tsref\Debug\Forks.EnterpriseServices.dll</HintPath> <HintPath>..\..\..\..\..\..\BwpB3Project\tsref\Debug\Forks.EnterpriseServices.dll</HintPath>
@ -79,6 +83,8 @@
<Compile Include="BL\BaseInfos\SubKillFlag\SubKillFlagBL.cs" /> <Compile Include="BL\BaseInfos\SubKillFlag\SubKillFlagBL.cs" />
<Compile Include="BL\BaseInfos\SubKillCallBack\SubKillCallBackBL.cs" /> <Compile Include="BL\BaseInfos\SubKillCallBack\SubKillCallBackBL.cs" />
<Compile Include="BL\Bills\SubKillPriceBill\SubKillPriceBillBL.cs" /> <Compile Include="BL\Bills\SubKillPriceBill\SubKillPriceBillBL.cs" />
<Compile Include="BL\Bills\SubKillWeightBill\WeightingInfoBL.cs" />
<Compile Include="BL\Bills\SubKillWeightBill\SubKillWeightBillBL.cs" />
<Compile Include="BO\BaseInfos\GenerationCostItem\GenerationCostItem.cs" /> <Compile Include="BO\BaseInfos\GenerationCostItem\GenerationCostItem.cs" />
<Compile Include="BO\BaseInfos\SubKillProductLine\SubKillProductLine.cs" /> <Compile Include="BO\BaseInfos\SubKillProductLine\SubKillProductLine.cs" />
<Compile Include="BO\BaseInfos\SubKillFlag\SubKillFlag.cs" /> <Compile Include="BO\BaseInfos\SubKillFlag\SubKillFlag.cs" />
@ -87,7 +93,11 @@
<Compile Include="BO\Bills\SubKillPriceBill\SubKillPriceBill_CallBackDetail.cs" /> <Compile Include="BO\Bills\SubKillPriceBill\SubKillPriceBill_CallBackDetail.cs" />
<Compile Include="BO\Bills\SubKillPriceBill\SubKillPriceBill_CostItemDetail.cs" /> <Compile Include="BO\Bills\SubKillPriceBill\SubKillPriceBill_CostItemDetail.cs" />
<Compile Include="BO\Bills\SubKillPriceBill\SubKillPriceBill_SupplierDetail.cs" /> <Compile Include="BO\Bills\SubKillPriceBill\SubKillPriceBill_SupplierDetail.cs" />
<Compile Include="BO\Bills\SubKillWeightBill\SubKillWeightBill.cs" />
<Compile Include="BO\Bills\SubKillWeightBill\SubKillWeightBill_Detail.cs" />
<Compile Include="BO\Bills\SubKillWeightBill\WeightingInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Rpcs\SupplierRpc.cs" />
<Compile Include="Utils\B3SubstituteKillConsts.cs" /> <Compile Include="Utils\B3SubstituteKillConsts.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup />


+ 36
- 0
B3SubstituteKill/BL/Bills/SubKillWeightBill/SubKillWeightBillBL.cs View File

@ -0,0 +1,36 @@
using BWP.B3Frameworks.BL;
using BWP.B3SubstituteKill.BO;
using BWP.B3SubstituteKill.Rpcs;
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.BusinessInterfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebPluginFramework;
namespace BWP.B3SubstituteKill.BL
{
[BusinessInterface(typeof(SubKillWeightBillBL))]
[LogicName("代宰过磅")]
public interface ISubKillWeightBillBL : IDepartmentWorkFlowBillBL<SubKillWeightBill>
{ }
public class SubKillWeightBillBL : DepartmentWorkFlowBillBL<SubKillWeightBill>, ISubKillWeightBillBL
{
protected override void beforeSave(SubKillWeightBill dmo)
{
foreach (var detail in dmo.Details)
{
if (detail.MaoWeight.HasValue || detail.PiWeight.HasValue)
detail.Weight = (detail.MaoWeight ?? 0) - (detail.PiWeight ?? 0);
}
dmo.PriceBill_ID = null;
if (dmo.Date.HasValue && dmo.Supplier_ID.HasValue)
dmo.PriceBill_ID = SupplierRpc.GetPriceBillID(dmo.Supplier_ID.Value, dmo.Date.Value);
dmo.Number = dmo.Details.Sum(x => x.Number ?? 0);
dmo.Weight = dmo.Details.Sum(x => x.Weight.EToDecimal() ?? 0);
base.beforeSave(dmo);
}
}
}

+ 27
- 0
B3SubstituteKill/BL/Bills/SubKillWeightBill/WeightingInfoBL.cs View File

@ -0,0 +1,27 @@
using BWP.B3Frameworks.BL;
using BWP.B3SubstituteKill.BO;
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.BusinessInterfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebPluginFramework;
namespace BWP.B3SubstituteKill.BL
{
[BusinessInterface(typeof(WeightingInfoBL))]
[LogicName("称重记录")]
public interface IWeightingInfoBL : IBaseBL<WeightingInfo>
{
}
public class WeightingInfoBL : BaseBL<WeightingInfo>, IWeightingInfoBL
{
protected override void beforeSave(WeightingInfo dmo)
{
dmo.WeightTime = BLContext.Now;
base.beforeSave(dmo);
}
}
}

+ 84
- 0
B3SubstituteKill/BO/Bills/SubKillWeightBill/SubKillWeightBill.cs View File

@ -0,0 +1,84 @@
using BWP.B3Frameworks;
using BWP.B3Frameworks.Attributes;
using BWP.B3Frameworks.BO;
using BWP.B3ProcurementInterface.BO;
using BWP.B3ProcurementInterface.Utils;
using BWP.B3SubstituteKill.Utils;
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.DataForm;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebControls2;
namespace BWP.B3SubstituteKill.BO
{
[DFClass, Serializable]
[LogicName("代宰过磅")]
[DmoTypeID(B3FrameworksConsts.DmoTypeIDBases.B3SubstituteKill, B3SubstituteKillConsts.DmoTypeIDOffsets.SubKillWeightBill)]
[EditUrl("~/B3SubstituteKill/Bills/SubKillWeightBill_/SubKillWeightBillEdit.aspx")]
public class SubKillWeightBill : DepartmentWorkFlowBill
{
private DateTime? date=DateTime.Now;
[LogicName("过磅时间")]
[DFExtProperty("WebControlType", DFEditControl.DateTimeInput)]
[DFNotEmpty]
public DateTime? Date
{
get { return date; }
set { date = value; }
}
[DFDataKind(B3ProcurementInterfaceDataSources.供应商用于屠宰场)]
[DFExtProperty(B3FrameworksConsts.DFExtProperties.DisplayField, "Supplier_Name")]
[DFExtProperty(B3FrameworksConsts.DFExtProperties.QueryDataKind, B3ProcurementInterfaceDataSources.供应商用于屠宰场全部)]
[DFExtProperty("WebControlType", DFEditControl.ChoiceBox)]
[DFPrompt("供应商")]
[DFNotEmpty]
public long? Supplier_ID { get; set; }
[ReferenceTo(typeof(Supplier), "Name")]
[Join("Supplier_ID", "ID")]
[DFPrompt("供应商")]
public string Supplier_Name { get; set; }
[ReferenceTo(typeof(Supplier), "Tel")]
[Join("Supplier_ID", "ID")]
[DFPrompt("联系方式")]
public string Supplier_Tel { get; set; }
[ReferenceTo(typeof(Supplier), "Card_ID")]
[Join("Supplier_ID", "ID")]
[DFPrompt("身份证号")]
public string Supplier_Card_ID { get; set; }
[ReferenceTo(typeof(Supplier), "Address")]
[Join("Supplier_ID", "ID")]
[DFPrompt("地址")]
public string Supplier_Address { get; set; }
[LogicName("代宰头数")]
[DFExtProperty("WebControlType", DFEditControl.StaticText)]
public int Number { get; set; }
[LogicName("代宰重量")]
[DFExtProperty("WebControlType", DFEditControl.StaticText)]
public Money<decimal> Weight { get; set; }
[LogicName("价格单号")]
[DFExtProperty("WebControlType", DFEditControl.StaticText)]
public long? PriceBill_ID { get; set; }
private SubKillWeightBill_DetailCollection _mDetails = new SubKillWeightBill_DetailCollection();
[OneToMany(typeof(SubKillWeightBill_Detail), "ID")]
[Join("ID", "SubKillWeightBill_ID")]
public SubKillWeightBill_DetailCollection Details
{
get { return _mDetails; }
set { _mDetails = value; }
}
}
}

+ 62
- 0
B3SubstituteKill/BO/Bills/SubKillWeightBill/SubKillWeightBill_Detail.cs View File

@ -0,0 +1,62 @@
using BWP.B3Frameworks.BO;
using BWP.B3ProduceUnitedInfos.BO;
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.DataForm;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.B3SubstituteKill.BO
{
[DFClass, Serializable, LogicName("代宰过磅_明细")]
public class SubKillWeightBill_Detail : Base
{
public long SubKillWeightBill_ID { get; set; }
[LogicName("生猪品种")]
public long? LiveVarieties_ID { get; set; }
[LogicName("头数")]
public int? Number { get; set; }
[LogicName("毛重")]
public Money<decimal>? MaoWeight { get; set; }
[LogicName("皮重")]
public Money<decimal>? PiWeight { get; set; }
[LogicName("重量")]
public Money<decimal>? Weight { get; set; }
[LogicName("圈舍")]
public long? LiveColonyHouse_ID { get; set; }
[LogicName("生产线")]
public long? SubKillProductLine_ID { get; set; }
[LogicName("备注")]
public string Remark { get; set; }
[LogicName("生猪品种")]
[ReferenceTo(typeof(LiveVarieties), "Name")]
[Join("LiveVarieties_ID", "ID")]
public string LiveVarieties_Name { get; set; }
[LogicName("圈舍")]
[ReferenceTo(typeof(LiveColonyHouse), "Name")]
[Join("LiveColonyHouse_ID", "ID")]
public string LiveColonyHouse_Name { get; set; }
[LogicName("生产线")]
[ReferenceTo(typeof(SubKillProductLine), "Name")]
[Join("SubKillProductLine_ID", "ID")]
public string SubKillProductLine_Name { get; set; }
}
[Serializable]
public class SubKillWeightBill_DetailCollection : DmoCollection<SubKillWeightBill_Detail>
{ }
}

+ 44
- 0
B3SubstituteKill/BO/Bills/SubKillWeightBill/WeightingInfo.cs View File

@ -0,0 +1,44 @@
using BWP.B3Frameworks;
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.DataForm;
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BWP.B3Frameworks.BO;
using Forks.Utils;
using BWP.B3SubstituteKill.Utils;
namespace BWP.B3SubstituteKill.BO
{
[LogicName("称重记录")]
[Serializable]
[DFClass]
[DmoTypeID(B3FrameworksConsts.DmoTypeIDBases.B3SubstituteKill, B3SubstituteKillConsts.DmoTypeIDOffsets.WeightingInfo)]
[DBIndex("WeightingInfo_BillTypeAndID", "BillID", true, 0)]
[DBIndex("WeightingInfo_BillTypeAndID", "BillType", true, 1)]
[DBIndex("WeightingInfo_BillTypeAndDetailID", "DetailID", true, 0)]
[DBIndex("WeightingInfo_BillTypeAndDetailID", "BillType", true, 1)]
public class WeightingInfo : Base
{
[LogicName("称重时间")]
public DateTime? WeightTime { get; set; }
[LogicName("称重")]
public Money<decimal>? Weight { get; set; }
[LogicName("单据ID")]
public long? BillID { get; set; }
[LogicName("单据类型")]
public short BillType { get; set; }
[LogicName("明细ID")]
public long DetailID { get; set; }
[LogicName("重量类型类型")]
// 毛重、皮重
public string WeightType { get; set; }
}
}

+ 48
- 0
B3SubstituteKill/Rpcs/SupplierRpc.cs View File

@ -0,0 +1,48 @@
using BWP.B3Frameworks.BO.NamedValueTemplate;
using BWP.B3Frameworks.Utils;
using BWP.B3ProcurementInterface.BO;
using BWP.B3SubstituteKill.BO;
using BWP.Web.Utils;
using Forks.EnterpriseServices.BusinessInterfaces;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.JsonRpc;
using Forks.EnterpriseServices.SqlDoms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebPluginFramework;
namespace BWP.B3SubstituteKill.Rpcs
{
[Rpc]
public static class SupplierRpc
{
[Rpc]
public static Supplier GetSupplierAndPriceBillID(long? supplierId, DateTime? date)
{
var supplier = new Supplier();
var res = WebBLUtil.GetSingleDmo<Supplier>("ID", supplierId, "Tel", "Card_ID", "Address");
if (res != null)
{
supplier = res;
if (date.HasValue)
supplier.SupplierApply_ID = GetPriceBillID(supplierId.Value, date.Value);
}
return supplier;
}
public static long? GetPriceBillID(long supplierID, DateTime date)
{
var main = new JoinAlias(typeof(SubKillPriceBill));
var detail = new JoinAlias(typeof(SubKillPriceBill_SupplierDetail));
var query = new DQueryDom(main);
query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "SubKillPriceBill_ID"));
query.Columns.Add(DQSelectColumn.Max("ID"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.GreaterThanOrEqual("BillState", .), DQCondition.EQ(detail, "Supplier_ID", supplierID), DQCondition.LessThanOrEqual("Date", date)));
return query.EExecuteScalar<long?>();
}
}
}

+ 2
- 0
B3SubstituteKill/Utils/B3SubstituteKillConsts.cs View File

@ -21,6 +21,8 @@ namespace BWP.B3SubstituteKill.Utils
public static class DmoTypeIDOffsets public static class DmoTypeIDOffsets
{ {
public const byte SubKillPriceBill = 1; public const byte SubKillPriceBill = 1;
public const byte SubKillWeightBill = 2;
public const byte WeightingInfo = 3;
} }
} }
} }

+ 16
- 0
WebFolder/config/Plugins/B3SubstituteKill.plugin View File

@ -4,6 +4,7 @@
<Requires> <Requires>
<Plugin name="B3Frameworks" version="$appVersion" /> <Plugin name="B3Frameworks" version="$appVersion" />
<Plugin name="B3ProcurementInterface" version="$appVersion" /> <Plugin name="B3ProcurementInterface" version="$appVersion" />
<Plugin name="B3ProduceUnitedInfos" version="$appVersion" />
</Requires> </Requires>
<Assemblies> <Assemblies>
<File name="B3SubstituteKill.dll" type="bo bl" /> <File name="B3SubstituteKill.dll" type="bo bl" />
@ -73,6 +74,20 @@
<Function index="10" name="完毕"/> <Function index="10" name="完毕"/>
<Function index="11" name="撤销完毕"/> <Function index="11" name="撤销完毕"/>
</FunctionGroup> </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="撤销完毕"/>
</FunctionGroup>
</Security> </Security>
<Menus> <Menus>
<Menu id="0001" name="/B3代宰模块/基础信息/代宰费用" roles="B3SubstituteKill.代宰费用.访问" url="B3SubstituteKill/BaseInfos/GenerationCostItem_/GenerationCostItemList.aspx"/> <Menu id="0001" name="/B3代宰模块/基础信息/代宰费用" roles="B3SubstituteKill.代宰费用.访问" url="B3SubstituteKill/BaseInfos/GenerationCostItem_/GenerationCostItemList.aspx"/>
@ -80,6 +95,7 @@
<Menu id="0003" name="/B3代宰模块/基础信息/代宰标识" roles="B3SubstituteKill.代宰标识.访问" url="B3SubstituteKill/BaseInfos/SubKillFlag_/SubKillFlagList.aspx"/> <Menu id="0003" name="/B3代宰模块/基础信息/代宰标识" roles="B3SubstituteKill.代宰标识.访问" url="B3SubstituteKill/BaseInfos/SubKillFlag_/SubKillFlagList.aspx"/>
<Menu id="0004" name="/B3代宰模块/基础信息/代宰生产线" roles="B3SubstituteKill.代宰生产线.访问" url="B3SubstituteKill/BaseInfos/SubKillProductLine_/SubKillProductLineList.aspx"/> <Menu id="0004" name="/B3代宰模块/基础信息/代宰生产线" roles="B3SubstituteKill.代宰生产线.访问" url="B3SubstituteKill/BaseInfos/SubKillProductLine_/SubKillProductLineList.aspx"/>
<Menu id="0005" name="/B3代宰模块/业务单据/代宰价格单" roles="B3SubstituteKill.代宰价格单.访问" url="B3SubstituteKill/Bills/SubKillPriceBill_/SubKillPriceBillList.aspx"/> <Menu id="0005" name="/B3代宰模块/业务单据/代宰价格单" roles="B3SubstituteKill.代宰价格单.访问" url="B3SubstituteKill/Bills/SubKillPriceBill_/SubKillPriceBillList.aspx"/>
<Menu id="0006" name="/B3代宰模块/业务单据/代宰过磅" roles="B3SubstituteKill.代宰过磅.访问" url="B3SubstituteKill/Bills/SubKillWeightBill_/SubKillWeightBillList.aspx"/>
</Menus> </Menus>
<Features> <Features>


+ 39
- 0
WebFolder/config/billreports/B3SubstituteKill/SubKillWeightBillPrint.xml View File

@ -0,0 +1,39 @@
<?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="Date" lblWidth="4"/>
<Field name="Supplier_Name" lblWidth="4"/>
<Field name="Supplier_Tel" lblWidth="4"/>
<Field name="Supplier_Card_ID" lblWidth="4"/>
<Field name="Supplier_Address" lblWidth="4"/>
<Field name="Number" lblWidth="4"/>
<Field name="Weight" lblWidth="4"/>
<Field name="PriceBill_ID" lblWidth="4"/>
<Field name="Remark" lblWidth="4"/>
</DFInfoBand>
<HtmlBand>
<![CDATA[<h2>过磅明细</h2>]]>
</HtmlBand>
<DFListBand collection="$Details" itemType="$DetailType" enablePaging="true" rowsPerPage="20" >
<LineNo header="序号"/>
<Field name="LiveVarieties_Name"/>
<Field name="Number"/>
<Field name="MaoWeight"/>
<Field name="PiWeight"/>
<Field name="Weight"/>
<Field name="LiveColonyHouse_Name"/>
<Field name="SubKillProductLine_Name"/>
<Field name="Remark"/>
</DFListBand>
</Bands>
</BillReport>
</Report>
</BillReports>

Loading…
Cancel
Save