| @ -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); | |||||
| // | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -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"); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -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> | |||||
| @ -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)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -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(); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -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 = " " }); | |||||
| 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; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -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> | |||||
| @ -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); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -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); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -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; } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -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> | |||||
| { } | |||||
| } | |||||
| @ -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; } | |||||
| } | |||||
| } | |||||
| @ -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?>(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -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> | |||||