diff --git a/B3QingDaoWanFu.Web/B3QingDaoWanFu.Web.csproj b/B3QingDaoWanFu.Web/B3QingDaoWanFu.Web.csproj index f02ea28..b0a1089 100644 --- a/B3QingDaoWanFu.Web/B3QingDaoWanFu.Web.csproj +++ b/B3QingDaoWanFu.Web/B3QingDaoWanFu.Web.csproj @@ -41,6 +41,14 @@ D:\BwpB3Project\tsref\Debug\B3ButcherManage.Web.dll False + + False + ..\..\..\tsref\Debug\B3ExportBase.dll + + + False + ..\..\..\tsref\Debug\B3ExportBase.Web.dll + False D:\BwpB3Project\tsref\Debug\B3Frameworks.dll @@ -69,10 +77,12 @@ False ..\..\..\tsref\Debug\B3Sale.dll + False False ..\..\..\tsref\Debug\B3Sale.Web.dll + False False @@ -141,9 +151,24 @@ ASPXCodeBehind + + ASPXCodeBehind + + + ASPXCodeBehind + + + ASPXCodeBehind + + + ASPXCodeBehind + ASPXCodeBehind + + ASPXCodeBehind + ASPXCodeBehind @@ -153,6 +178,9 @@ ASPXCodeBehind + + ASPXCodeBehind + ASPXCodeBehind @@ -170,6 +198,9 @@ ASPXCodeBehind + + ASPXCodeBehind + ASPXCodeBehind @@ -184,6 +215,7 @@ {b47ce3c3-c269-48b8-84a7-32360e5a9e8e} B3QingDaoWanFu + False @@ -197,6 +229,15 @@ + + + + + + + + + diff --git a/B3QingDaoWanFu.Web/ExportBaseInfoList.cs b/B3QingDaoWanFu.Web/ExportBaseInfoList.cs new file mode 100644 index 0000000..a3daf78 --- /dev/null +++ b/B3QingDaoWanFu.Web/ExportBaseInfoList.cs @@ -0,0 +1,252 @@ +using BWP.B3ExportBase; +using BWP.B3ExportBase.BL; +using BWP.B3Frameworks; +using BWP.B3Frameworks.Utils; +using BWP.Web.Layout; +using BWP.Web.Utils; +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.Security; +using System.Text; +using System.Web.UI; +using System.Web.UI.WebControls; +using TSingSoft.WebControls2; +using TSingSoft.WebPluginFramework; +using Forks.Utils.Collections; + +namespace BWP.Web +{ + public abstract class ExportBaseInfoList : ListPageBase, IExportUIBase + where TBL : IExportBaseBL + { + protected override bool EnableExcelExport + { + get + { + return false; + } + } + + protected readonly static DFInfo mDFInfo = DFInfo.Get(typeof(TDmo)); + + public virtual Control CreateUI() + { + return null; + } + + protected TBL BL = BIFactory.Create(); + private ChoiceBox _chb; + + + private short? _billTypeID; + protected short BillTypeID + { + get + { + if (_billTypeID == null) + { + _billTypeID = DmoTypeIDAttribute.GetID(typeof(TDmo)); + } + return _billTypeID.Value; + } + } + + private short? _methodID; + + public short MethodID + { + get + { + if (_methodID == null) + _methodID = BL.GetMethodID(); + return _methodID.Value; + } + } + + public abstract string Url { get; } + + protected virtual string AccessRoleName + { + get { return ""; } + } + + protected override void InitForm(System.Web.UI.HtmlControls.HtmlForm form) + { + + var hPanel = new HLayoutPanel(); + hPanel.Add(new SimpleLabel("导出方法")); + form.Controls.Add(hPanel); + _chb = hPanel.Add(new ChoiceBox(B3ExportBaseConsts.DataSources.导出方法)); + _chb.Width = 150; + _chb.AutoPostBack = true; + _chb.EnableInputArgument = true; + _chb.SelectedValueChanged += delegate + { + var ui = B3ExportBaseUtil.GetExportUI(short.Parse(_chb.Value)); + if (ui == null) + return; + if (!string.IsNullOrEmpty(ui.Url)) + { + AspUtil.Redirect(ui.Url); + } + else + { + AspUtil.Redirect("~/B3ExportBase/ExportPage.aspx?methodID=" + _chb.Value); + } + }; + if (BLContext.User.IsInRole("B3ExportBase.接口管理.配置")) + { + var button = new TSButton("配置") { UseSubmitBehavior = false }; + button.OnClientClick = string.Format("preventEventDefault(event);OpenUrlInTopTab('B3ExportBase/ExportConfigEdit.aspx?methodID={0}','{1}配置');", MethodID, Caption); + hPanel.Add(button); + } + base.InitForm(form); + } + + static readonly bool IsWithCode = TypeUtil.IsWithCodeBaseInfo(typeof(TDmo)); + protected Control CreateDefaultBaseInfoQueryControls(Action beforeCreateLayout = null) + { + var layoutManager = new LayoutManager("", mDFInfo, mQueryContainer); + var config = new AutoLayoutConfig() { Cols = 8, DefaultLabelWidth = 4 }; + config.Add("ID"); + config.Add("Name"); + if (IsWithCode) + { + config.Add("Code"); + } + config.Add("Stopped"); + config.Add("IsLocked"); + config.Add("Remark"); + layoutManager.Config = config; + if (beforeCreateLayout != null) + { + beforeCreateLayout(layoutManager, config); + } + + var section = mPageLayoutManager.AddSection(B3FrameworksConsts.PageLayouts.QueryConditions, B3FrameworksConsts.PageLayouts.QueryConditions_DisplayName); + section.ApplyLayout(layoutManager, config, mPageLayoutManager, mDFInfo); + return layoutManager.CreateLayout(); + } + + protected override void AddGrid(Control parent) + { + var hbox = new HLayoutPanel(); + hbox.CssClass += " LeftPaddingWrapper"; + parent.Controls.Add(hbox); + AddExportControl(hbox); + base.AddGrid(parent); + } + + protected virtual void AddExportControl(HLayoutPanel hbox) + { + var btnExport = hbox.Add(new TSButton("导出")); + btnExport.Click += (sender, obj) => Export(); + hbox.Add(new LiteralControl(" ")); + } + + protected virtual void BeforeUnExport(List ids) + { + } + + private void Export() + { + var idList = mBrowseGrid.GetSelectedItems().Select(item => (long)item["ID"]).ToList(); + var message = DoExport(idList); + AspUtil.Alert(this, message); + mBrowseGrid.DataBind(); + } + + protected abstract string DoExport(List idList); + + protected override void InitBrowseGrid(DFBrowseGrid grid) + { + base.InitBrowseGrid(grid); + var section = mPageLayoutManager.AddSection(B3FrameworksConsts.PageLayouts.QueryResult, B3FrameworksConsts.PageLayouts.QueryResult_DisplayName); + section.ApplyLayout(grid, mPageLayoutManager, mDFInfo); + grid.MultiSelectionEnabled = true; + } + + protected override DQueryDom GetQueryDom() + { + var query = base.GetQueryDom(); + OrganizationUtil.AddOrganizationLimit(query, typeof(TDmo)); + if (query.OrderBy.Expressions.Count == 0) + { + query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true)); + } + return query; + } + + + protected override void OnLoad(EventArgs e) + { + if (!IsPostBack && MethodID > 0) + { + _chb.Value = MethodID.ToString(); + _chb.DisplayValue = Caption; + } + base.OnLoad(e); + } + + protected override bool NotWaitingUserInput() + { + return true; + } + + protected override void OnInit(EventArgs e) + { + if (!string.IsNullOrEmpty(AccessRoleName) && !User.IsInRole(AccessRoleName)) + { + throw new SecurityException("您无权访问此页面"); + } + + base.OnInit(e); + } + + protected override void CreateDFBrowseGridColumns(DFBrowseGrid grid) + { + if (string.IsNullOrEmpty(EditUrl)) + { + AddDFBrowseGridColumn(grid, "ID"); + } + else + { + grid.Columns.EAdd(new DFBrowseGridCustomExtColumn((row, cell, dataSourceIndex) => + { + var id = row["ID"]; + var linkButton = new LinkButton(); + linkButton.OnClientClick = string.Format("OpenUrlInTopTab('{0}?ID={1}');return false;", EditUrl, id); + linkButton.Text = string.Format("No.{0}", id); + cell.Controls.Add(linkButton); + cell.Align = "center"; + })).HeaderText = "单号"; + } + + if (IsWithCode) + AddDFBrowseGridColumn(grid, "Code"); + AddDFBrowseGridColumn(grid, "Name"); + AddDFBrowseGridColumn(grid, "Stopped"); + AddDFBrowseGridColumn(grid, "IsLocked"); + AddDFBrowseGridColumn(grid, "Remark"); + } + + protected virtual string EditUrl + { + get + { + return ""; + } + } + + protected virtual string LogicName + { + get { return mDFInfo.LogicName; } + } + //conString = InnerBLUtil.GetDmoPropertyByID(context.Session, typeof(ExtSystem), "Address", extSystemID); + } +} diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Bills/CostRecord_/CostRecordEdit.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Bills/CostRecord_/CostRecordEdit.cs new file mode 100644 index 0000000..41204c6 --- /dev/null +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Bills/CostRecord_/CostRecordEdit.cs @@ -0,0 +1,128 @@ +using BWP.B3ButcherManage.BO; +using BWP.B3ButcherManage.Utils; +using BWP.B3Frameworks.BO.NamedValueTemplate; +using BWP.B3Frameworks.Utils; +using BWP.B3QingDaoWanFu.BL; +using BWP.B3QingDaoWanFu.BO; +using BWP.Web.Layout; +using BWP.Web.WebControls; +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.WebControls; +using TSingSoft.WebControls2; +using TSingSoft.WebPluginFramework; + +namespace BWP.Web.Pages.B3QingDaoWanFu.Bills.CostRecord_ +{ + class CostRecordEdit : DomainBillEditPage + { + DFEditGrid _detailGrid; + + 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("Date"); + config.Add("PurchaseType_ID"); + layoutManager.Config = config; + pageLayoutSection.ApplyLayout(layoutManager, config, mPageLayoutManager, mDFInfo); + titlePanel.Controls.Add(layoutManager.CreateLayout()); + } + + protected override void BuildBody(System.Web.UI.Control parent) + { + base.BuildBody(parent); + AddDetail(parent.EAdd(new TitlePanel("单据明细", "单据明细"))); + } + + private void AddDetail(TitlePanel titlePanel) + { + if (CanSave) + titlePanel.EAdd(new TSButton("载入", LoadDetail)); + var editor = new DFCollectionEditor(() => 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.Add(new DFEditGridColumn("WeightBill_ID")); + _detailGrid.Columns.Add(new DFEditGridColumn("Supplier_Name")); + _detailGrid.Columns.Add(new DFEditGridColumn("Employee_Name")); + _detailGrid.Columns.Add(new DFEditGridColumn("Car_Name")); + _detailGrid.Columns.Add(new DFEditGridColumn("BuyNum")); + _detailGrid.Columns.Add(new DFEditGridColumn("Mileage")); + _detailGrid.Columns.Add(new DFEditGridColumn("TransferFee")); + _detailGrid.Columns.Add(new DFEditGridColumn("JingJiFee")); + + var section = mPageLayoutManager.AddSection("DetaiColumns", "明细列"); + titlePanel.SetPageLayoutSetting(mPageLayoutManager, section.Name); + + section.ApplyLayout(_detailGrid, mPageLayoutManager, DFInfo.Get(typeof(CostRecord_Detail))); + } + + private void LoadDetail(object sender, EventArgs e) + { + GetFromUI(); + if (Dmo.PurchaseType_ID == null) + throw new Exception("请选择收购类型"); + Dmo.Details.Clear(); + var query = new DQueryDom(new JoinAlias("_weighBill", typeof(WeighBill))); + query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("PurchaseType_ID", Dmo.PurchaseType_ID), DQCondition.EQ(DQExpression.Snippet("CAST([_weighBill].[WeighTime] AS DATE)"), DQExpression.Value(Dmo.Date)), DQCondition.GreaterThanOrEqual("BillState", 单据状态.已审核))); + query.Columns.Add(DQSelectColumn.Field("ID")); + query.Columns.Add(DQSelectColumn.Field("Supplier_Name")); + query.Columns.Add(DQSelectColumn.Field("Employee_Name")); + query.Columns.Add(DQSelectColumn.Field("Car_Name")); + query.Columns.Add(DQSelectColumn.Field("BuyNum")); + query.OrderBy.Expressions.Add(DQOrderByExpression.Create("WeighTime")); + using (var session = Forks.EnterpriseServices.DomainObjects2.Dmo.NewSession()) + { + using (var reader = session.ExecuteReader(query)) + { + while (reader.Read()) + { + var detail = new CostRecord_Detail() + { + WeightBill_ID = (long)reader[0], + Supplier_Name = (string)reader[1], + Employee_Name = (string)reader[2], + Car_Name = (string)reader[3], + BuyNum = (int?)reader[4] + }; + Dmo.Details.Add(detail); + } + } + } + _detailGrid.DataBind(); + } + + public override void AppToUI() + { + base.AppToUI(); + _detailGrid.DataBind(); + } + + public override void GetFromUI() + { + base.GetFromUI(); + _detailGrid.GetFromUI(); + } + + protected override void InitNewDmo(CostRecord dmo) + { + base.InitNewDmo(dmo); + var profile = DomainUserProfileUtil.Load(); + if (profile.AccountingUnit_ID.HasValue) + { + dmo.AccountingUnit_ID = profile.AccountingUnit_ID; + dmo.AccountingUnit_Name = profile.AccountingUnit_Name; + } + } + } +} diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Bills/CostRecord_/CostRecordList.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Bills/CostRecord_/CostRecordList.cs new file mode 100644 index 0000000..51bd134 --- /dev/null +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Bills/CostRecord_/CostRecordList.cs @@ -0,0 +1,35 @@ +using BWP.B3QingDaoWanFu.BL; +using BWP.B3QingDaoWanFu.BO; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using TSingSoft.WebControls2; + +namespace BWP.Web.Pages.B3QingDaoWanFu.Bills.CostRecord_ +{ + class CostRecordList : DomainBillListPage + { + protected override void AddQueryControls(VLayoutPanel vPanel) + { + vPanel.Add(CreateDefaultBillQueryControls((panel, config) => + { + config.Add("Date"); + config.Add("AccountingUnit_ID"); + config.Add("PurchaseType_ID"); + config.Remvoe("Remark"); + })); + } + + protected override void AddDFBrowseGridColumn(DFBrowseGrid grid, string field) + { + base.AddDFBrowseGridColumn(grid, field); + if (field == "BillState") + { + AddDFBrowseGridColumn(grid, "AccountingUnit_Name"); + AddDFBrowseGridColumn(grid, "Date"); + AddDFBrowseGridColumn(grid, "PurchaseType_Name"); + } + } + } +} diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Bills/CostRecord_/CostRecordList.xml b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Bills/CostRecord_/CostRecordList.xml new file mode 100644 index 0000000..0445910 --- /dev/null +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Bills/CostRecord_/CostRecordList.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Bills/CostRecord_/CostRecordPrint.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Bills/CostRecord_/CostRecordPrint.cs new file mode 100644 index 0000000..89ef49f --- /dev/null +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Bills/CostRecord_/CostRecordPrint.cs @@ -0,0 +1,19 @@ +using BWP.B3QingDaoWanFu.BL; +using BWP.B3QingDaoWanFu.BO; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BWP.Web.Pages.B3QingDaoWanFu.Bills.CostRecord_ +{ + class CostRecordPrint : DomainTemplatePrintPage + { + protected override void AddParameters(IDictionary dic) + { + dic.Add("$ID", Dmo.ID); + dic.Add("$Details", Dmo.Details); + dic.Add("$DetailType", typeof(CostRecord_Detail)); + } + } +} diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/ExportUI/GoodsExportToMES.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/ExportUI/GoodsExportToMES.cs new file mode 100644 index 0000000..9a99750 --- /dev/null +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/ExportUI/GoodsExportToMES.cs @@ -0,0 +1,134 @@ +using BWP.B3ExportBase; +using BWP.B3ExportBase.Utils; +using BWP.B3Frameworks; +using BWP.B3Frameworks.Utils; +using BWP.B3QingDaoWanFu.BL; +using BWP.B3UnitedInfos; +using BWP.B3UnitedInfos.BO; +using BWP.Web.Layout; +using BWP.Web.Pages.B3ExportBase; +using BWP.Web.Utils; +using Forks.EnterpriseServices.BusinessInterfaces; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using Forks.EnterpriseServices.SqlDoms; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Web.UI; +using TSingSoft.WebControls2; +using TSingSoft.WebPluginFramework; + +namespace BWP.Web.Pages.B3QingDaoWanFu.ExportUI +{ + // [LogicName("存货导MES")] + class GoodsExportToMES : ExportBaseInfoList + { + private ChoiceBox _dfcUrl; + protected override void AddExportControl(HLayoutPanel hbox) + { + hbox.Add(new SimpleLabel("外部系统")); + _dfcUrl = hbox.Add(new ChoiceBox()); + _dfcUrl.DataKind = B3ExportBaseConsts.DataSources.外部系统; + _dfcUrl.EnableInputArgument = true; + _dfcUrl.SmartOrderEnabled = false; + _dfcUrl.EnableTopItem = true; + _dfcUrl.Width = 130; + base.AddExportControl(hbox); + } + + protected override string DoExport(List idList) + { + if (idList.Count == 0) + { + throw new ApplicationException("请选择档案!"); + } + if (_dfcUrl.IsEmpty) + { + throw new ApplicationException("请选择外部系统!"); + } + BL.Export(idList, long.Parse(_dfcUrl.Value)); + return BIFactory.GetLastMessage(); + } + + public override string Url + { + get { return "~/B3QingDaoWanFu/ExportUI/GoodsExportToMES.aspx"; } + } + + protected override string Caption + { + get { return "存货导MES存货"; } + } + + protected override string EditUrl + { + get + { + return "B3UnitedInfos/BaseInfos/Goods_/GoodsEdit.aspx"; + } + } + + protected override DQueryDom GetQueryDom() + { + var query = base.GetQueryDom(); + + var goodsProperty = query.EJoin(); + + var catalog = query.EJoin("GoodsPropertyCatalog_ID", JoinType.Left, goodsProperty); + + query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(goodsProperty, "Name"), "存货属性")); + query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(catalog, "Name"), "存货属性分类")); + + TreeUtil.AddTreeCondition(query, mQueryContainer, "存货属性分类", catalog); + + DomainUtil.AddDomainPermissionLimit(query, typeof(GoodsProperty), goodsProperty); + + return query; + } + + protected override void AddQueryControls(VLayoutPanel vPanel) + { + vPanel.Add(CreateDefaultBaseInfoQueryControls((layoutManager, config) => + { + layoutManager.Add("存货属性分类", new SimpleLabel("属性分类"), QueryCreator.DFChoiceBox(mDFInfo.Fields["ID"], B3UnitedInfosConsts.DataSources.存货属性分类)); + config.AddAfter("GoodsProperty_ID", "ID"); + config.AddBefore("存货属性分类", "GoodsProperty_ID"); + config.Add("ProductLine_ID"); + config.Add("Brand"); + config.Add("Origin"); + })); + } + + protected override void AddDFBrowseGridColumn(DFBrowseGrid grid, string field) + { + base.AddDFBrowseGridColumn(grid, field); + + if (field == "Name") + { + AddDFBrowseGridColumn(grid, "Brand"); + AddDFBrowseGridColumn(grid, "Origin"); + AddDFBrowseGridColumn(grid, "存货属性"); + AddDFBrowseGridColumn(grid, "存货属性分类"); + AddDFBrowseGridColumn(grid, "ProductLine_Name"); + AddDFBrowseGridColumn(grid, "MainUnit"); + AddDFBrowseGridColumn(grid, "SecondUnit"); + AddDFBrowseGridColumn(grid, "Spec"); + } + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + if (!IsPostBack) + { + var tuple = ExportConfigUtil.LoadDefaultExtSystems(MethodID); + if (tuple != null) + { + _dfcUrl.Value = tuple.Item1.ToString(); + _dfcUrl.DisplayValue = tuple.Item2; + } + } + } + } +} diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/ExportUI/GoodsExportToMES.xml b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/ExportUI/GoodsExportToMES.xml new file mode 100644 index 0000000..fb4d4bc --- /dev/null +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/ExportUI/GoodsExportToMES.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/SaleOutStoreEdit_Ext.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/SaleOutStoreEdit_Ext.cs index 0151e75..c1f8a5e 100644 --- a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/SaleOutStoreEdit_Ext.cs +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/SaleOutStoreEdit_Ext.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using BWP.Web.Layout; using BWP.Web.Pages.B3Sale.Bills.SaleOutStore_; using TSingSoft.WebControls2; @@ -9,6 +10,11 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Overlays { class SaleOutStoreEdit_Ext: SaleOutStoreEdit { + protected override void AddEmpInfo(AutoLayoutConfig config) + { + config.Add("BalanceMoney"); + } + protected override void AddCustomerDetailColumns(DFEditGrid detailGrid) { detailGrid.Columns.Add(new DFEditGridColumn("FactoryPrice")); diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/StatPayEdit_Ext.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/StatPayEdit_Ext.cs index 9616f01..e1eea3c 100644 --- a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/StatPayEdit_Ext.cs +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/StatPayEdit_Ext.cs @@ -1,9 +1,15 @@ -using BWP.Web.Pages.B3ButcherManage.Bills.StatPay_; +using BWP.B3ButcherManage.BO; +using BWP.Web.Pages.B3ButcherManage.Bills.StatPay_; +using BWP.Web.WebControls; +using Forks.EnterpriseServices.DataForm; +using Forks.EnterpriseServices.DomainObjects2.DQuery; using System; using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; +using System.Web.UI.WebControls; +using TSingSoft.WebControls2; +using TSingSoft.WebPluginFramework; namespace BWP.Web.Pages.B3QingDaoWanFu.Overlays { @@ -15,5 +21,45 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Overlays if (tag != null) tag.Key = "WeightSumRate2"; } + + DFEditGrid _farmerGrid; + protected override void AddFarmerDetail(System.Web.UI.Control control) + { + var panel = control.EAdd(new TitlePanel("养殖户信息", "养殖户信息")); + var editor = new DFCollectionEditor(() => Dmo.FarmerDetails); + editor.AllowDeletionFunc = () => false; + + editor.CanDeleteFunc = detail => false; + editor.IsEditableFunc = (field, detail) => { + return CanSave && field.Name == "ExtMoney"; + }; + + _farmerGrid = panel.EAdd(new DFEditGrid(editor) { Width = Unit.Percentage(100), ShowLineNo = true }); + _farmerGrid.Columns.Add(new DFEditGridColumn("Farmer_Name")); + _farmerGrid.Columns.Add(new DFEditGridColumn("Farmer_IDCard")); + _farmerGrid.Columns.Add(new DFEditGridColumn("Farmer_BankAccount")); + _farmerGrid.Columns.Add(new DFEditGridColumn("Farmer_Address")); + _farmerGrid.Columns.Add(new DFEditGridColumn("Farmer_Tel")); + _farmerGrid.Columns.Add(new DFEditGridColumn("Number")); + _farmerGrid.Columns.Add(new DFEditGridColumn("ExeWeight")); + _farmerGrid.Columns.Add(new DFEditGridColumn("ExtMoney")); + + var section4 = mPageLayoutManager.AddSection("detailColumns4", "养殖户信息"); + section4.ApplyLayout(_farmerGrid, mPageLayoutManager, DFInfo.Get(typeof(Weigh_FarmerDetail))); + panel.SetPageLayoutSetting(mPageLayoutManager, section4.Name); + } + + public override void GetFromUI() + { + base.GetFromUI(); + _farmerGrid.GetFromUI(); + } + + public override void AppToUI() + { + base.AppToUI(); + mDFContainer.MakeReadonly("ShackMoney"); + _farmerGrid.DataBind(); + } } } diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/StatPayList_Ext.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/StatPayList_Ext.cs new file mode 100644 index 0000000..3280c84 --- /dev/null +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/StatPayList_Ext.cs @@ -0,0 +1,20 @@ +using BWP.Web.Pages.B3ButcherManage.Bills.StatPay_; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using TSingSoft.WebControls2; + +namespace BWP.Web.Pages.B3QingDaoWanFu.Overlays +{ + class StatPayList_Ext : StatPayList + { + protected override void InitToolBar(TSingSoft.WebControls2.HLayoutPanel toolbar) + { + base.InitToolBar(toolbar); + var button = new TSButton("养殖户分析") { UseSubmitBehavior = false }; + button.OnClientClick = "preventEventDefault(event);OpenUrlInTopTab('B3QingDaoWanFu/Reports/StatPayAnalyse.aspx','养殖户分析');"; + toolbar.Add(button); + } + } +} diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs index 1270c82..29833e5 100644 --- a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs @@ -25,6 +25,7 @@ using BWP.B3Frameworks; using System.Web.UI; using TSingSoft.WebPluginFramework.Controls; using TSingSoft.WebPluginFramework.Exports; +using BWP.B3QingDaoWanFu.BO; namespace BWP.Web.Pages.B3QingDaoWanFu.Reports { @@ -62,7 +63,7 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports var 皮肉重量 = (Money<金额>?)(objToDecimal(肉重量) + objToDecimal(皮重)); row["皮肉重量"] = 皮肉重量; sum皮肉重量 += (皮肉重量 ?? 0); - + var 到厂毛重 = objToDecimal(row["到厂毛重"]); row["皮肉比"] = Math.Round((double)(皮肉重量 / 到厂毛重 * 100), 2); } @@ -74,12 +75,13 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports table.SumRow["皮肉重量"] = sum皮肉重量; } catch { } - SetCommonDivSumTable(table, "毛重单价", "应付金额", "到厂毛重"); - SetCommonDivSumTable(table, "实付单价", "实付金额", "到厂毛重"); + SetCommonDivSumTable(table, "核算单价", "核算金额", "到厂毛重"); + SetCommonDivSumTable(table, "付款单价", "付款金额", "到厂毛重"); SetCommonDivSumTable(table, "单头盈亏", "盈亏", "收购头数"); SetCommonDivSumTable(table, "均重", "到厂毛重", "收购头数"); - SetCommonDivSumTable(table, "损耗比", "损耗", "原发毛重",true); + SetCommonDivSumTable(table, "损耗比", "损耗", "原发毛重", true); SetCommonDivSumTable(table, "皮肉比", "皮肉重量", "到厂毛重", true); + SetCommonDivSumTable(table, "成本单价", "成本金额", "到厂毛重"); Set占比(table); @@ -93,7 +95,36 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports table.SumRow["死亡头数"] = n; } -// Set占比(table,); + //if (_checkbox.Items.FindByText("人工费").Selected) + //{ + // Money<金额> n = 0m; + // foreach (DFDataRow row in table.Rows) + // { + // n += Convert.ToDecimal(row["人工费"] ?? 0); + // } + // table.SumRow["人工费"] = n; + //} + + //if (_checkbox.Items.FindByText("运费").Selected) + //{ + // Money<金额> n = 0; + // foreach (DFDataRow row in table.Rows) + // { + // n += Convert.ToDecimal(row["运费"] ?? 0); + // } + // table.SumRow["运费"] = n; + //} + //if (_checkbox.Items.FindByText("里程").Selected) + //{ + // decimal n = 0; + // foreach (DFDataRow row in table.Rows) + // { + // n += Convert.ToDecimal(row["里程"] ?? 0); + // } + // table.SumRow["里程"] = n; + //} + + // Set占比(table,); } private void Set占比(DFDataTable table) @@ -115,21 +146,21 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports var 烫褪总重量 = 烫褪一级重量 + 烫褪二级重量 + 烫褪三级重量 + 烫褪四级重量 + 烫褪五级重量; - table.SumRow["剥皮|一级|占比"] =Math.Round(剥皮一级重量 / 剥皮总重量*100,2); - table.SumRow["剥皮|二级|占比"] =Math.Round(剥皮二级重量 / 剥皮总重量*100,2); - table.SumRow["剥皮|三级|占比"] =Math.Round(剥皮三级重量 / 剥皮总重量*100,2); - table.SumRow["剥皮|四级|占比"] =Math.Round(剥皮四级重量 / 剥皮总重量*100,2); - table.SumRow["剥皮|五级|占比"] =Math.Round(剥皮五级重量 / 剥皮总重量*100,2); + table.SumRow["剥皮|一级|占比"] = Math.Round(剥皮一级重量 / 剥皮总重量 * 100, 2); + table.SumRow["剥皮|二级|占比"] = Math.Round(剥皮二级重量 / 剥皮总重量 * 100, 2); + table.SumRow["剥皮|三级|占比"] = Math.Round(剥皮三级重量 / 剥皮总重量 * 100, 2); + table.SumRow["剥皮|四级|占比"] = Math.Round(剥皮四级重量 / 剥皮总重量 * 100, 2); + table.SumRow["剥皮|五级|占比"] = Math.Round(剥皮五级重量 / 剥皮总重量 * 100, 2); - table.SumRow["烫褪|一级|占比"] =Math.Round(烫褪一级重量 / 烫褪总重量*100,2); - table.SumRow["烫褪|二级|占比"] =Math.Round(烫褪二级重量 / 烫褪总重量*100,2); - table.SumRow["烫褪|三级|占比"] =Math.Round(烫褪三级重量 / 烫褪总重量*100,2); - table.SumRow["烫褪|四级|占比"] =Math.Round(烫褪四级重量 / 烫褪总重量*100,2); - table.SumRow["烫褪|五级|占比"] =Math.Round(烫褪五级重量 / 烫褪总重量*100, 2); + table.SumRow["烫褪|一级|占比"] = Math.Round(烫褪一级重量 / 烫褪总重量 * 100, 2); + table.SumRow["烫褪|二级|占比"] = Math.Round(烫褪二级重量 / 烫褪总重量 * 100, 2); + table.SumRow["烫褪|三级|占比"] = Math.Round(烫褪三级重量 / 烫褪总重量 * 100, 2); + table.SumRow["烫褪|四级|占比"] = Math.Round(烫褪四级重量 / 烫褪总重量 * 100, 2); + table.SumRow["烫褪|五级|占比"] = Math.Round(烫褪五级重量 / 烫褪总重量 * 100, 2); var 一二级重量 = 剥皮一级重量 + 剥皮二级重量 + 烫褪一级重量 + 烫褪二级重量; var 总重量 = 剥皮总重量 + 烫褪总重量; - table.SumRow["一二级比"] =Math.Round(一二级重量 / 总重量 * 100, 2); + table.SumRow["一二级比"] = Math.Round(一二级重量 / 总重量 * 100, 2); } @@ -211,7 +242,9 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports _checkbox.Items.Add(new ListItem("过磅单号", "Weigh_ID")); _checkbox.Items.Add(new ListItem("结算单号", "ID")); _checkbox.Items.Add(new ListItem("业务员", "Employee_Name")); - + _checkbox.Items.Add(new ListItem("里程", "Mileage")); + _checkbox.Items.Add(new ListItem("运费", "TransferFee")); + _checkbox.Items.Add(new ListItem("人工费", "JingJiFee")); _checkbox.Items.Add(new ListItem("收购头数", "RealNumber")); _checkbox.Items.Add(new ListItem("死亡头数", "DeathNumber")); @@ -237,10 +270,12 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports _checkbox.Items.Add(new ListItem("宰后扣款", "宰后扣款")); _checkbox.Items.Add(new ListItem("死猪扣款", "DeadPigRewardMoney")); - _checkbox.Items.Add(new ListItem("实付金额", "ActualMoney")); - _checkbox.Items.Add(new ListItem("应付金额", "Money")); - _checkbox.Items.Add(new ListItem("实付单价", "ActualPrice")); - _checkbox.Items.Add(new ListItem("毛重单价", "RawPrice")); + _checkbox.Items.Add(new ListItem("付款金额", "ActualMoney")); + _checkbox.Items.Add(new ListItem("核算金额", "Money")); + _checkbox.Items.Add(new ListItem("成本金额", "CostMoney")); + _checkbox.Items.Add(new ListItem("付款单价", "ActualPrice")); + _checkbox.Items.Add(new ListItem("核算单价", "RawPrice")); + _checkbox.Items.Add(new ListItem("成本单价", "CostPrice")); _checkbox.Items.Add(new ListItem("盈亏", "盈亏")); _checkbox.Items.Add(new ListItem("单头盈亏", "单头盈亏")); @@ -280,8 +315,8 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports { return new QuerySettings(SelectRange.All, mDFGrid.SortField, mDFGrid.SortDirection); }; - - queryPanel.ButtonsPanel.EAdd(new TSButton("导出到Excel", (sender, args) => exporter.Export(excelExporter))); + + queryPanel.ButtonsPanel.EAdd(new TSButton("导出到Excel", (sender, args) => exporter.Export(excelExporter))); queryPanel.ButtonsPanel.EAdd(exporter); } @@ -323,6 +358,10 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports tempUnionDom.Register(query); var unionAlias = new JoinAlias("tempUnionDom", typeof(tempUnionDom)); query.From.AddJoin(JoinType.Left, new DQDmoSource(unionAlias), DQCondition.EQ(bill, "ID", unionAlias, "StatPay_ID")); + var costRecord = new JoinAlias(typeof(CostRecordTemp)); + CostRecordTemp.Register(query); + query.From.AddJoin(JoinType.Left, new DQDmoSource(costRecord), DQCondition.And(DQCondition.EQ(unionAlias, "UnionType", 1), DQCondition.EQ(bill, "Weigh_ID", costRecord, "WeightBill_ID"))); + query.GroupBy.Expressions.Add(DQExpression.Field(bill, "Date")); @@ -330,8 +369,8 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports var 收购重量 = DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ(unionAlias, "UnionType", 1), DQExpression.Field(unionAlias, "RealWeight"))); var 损耗 = DQExpression.Subtract(榜前重量, 收购重量); var 皮肉重量 = DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ(unionAlias, "UnionType", 2), DQExpression.Field(unionAlias, "TotalWeight"))); - var 盈亏 = DQExpression.Subtract(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ(unionAlias, "UnionType", 1), DQExpression.Field(unionAlias, "Money"))), DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ(unionAlias, "UnionType", 1), DQExpression.Field(unionAlias, "ActualMoney")))); - + var 盈亏 = DQExpression.Subtract(DQExpression.Subtract(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ(unionAlias, "UnionType", 1), DQExpression.Field(unionAlias, "Money"))), DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ(unionAlias, "UnionType", 1), DQExpression.Field(unionAlias, "ActualMoney")))), DQExpression.Sum(DQExpression.Add(DQExpression.IfNull(DQExpression.Field(costRecord, "TransferFee"), DQExpression.Value(0)), DQExpression.IfNull(DQExpression.Field(costRecord, "JingJiFee"), DQExpression.Value(0))))); + var costMoney = DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ(unionAlias, "UnionType", 1), DQExpression.Add(DQExpression.Add(DQExpression.IfNull(DQExpression.Field(costRecord, "TransferFee"), DQExpression.Value(0)), DQExpression.IfNull(DQExpression.Field(costRecord, "JingJiFee"), DQExpression.Value(0))), DQExpression.IfNull(DQExpression.Field(unionAlias, "ActualMoney"), DQExpression.Value(0))))); var sumColumn = new List(); foreach (ListItem field in _checkbox.Items) @@ -359,7 +398,12 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(field.Value), field.Text)); query.GroupBy.Expressions.Add(DQExpression.Field(field.Value)); break; - + case "里程": + case "运费": + case "人工费": + query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(costRecord, field.Value)), field.Text)); + sumColumn.Add(field.Text); + break; case "均重": query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ(unionAlias, "UnionType", 1), DQExpression.Field(unionAlias, "RealWeight"))).ESafeDivide(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ(unionAlias, "UnionType", 1), DQExpression.Field(unionAlias, "RealNumber")))).ECastType>(), "均重")); break; @@ -367,16 +411,28 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports case "收购头数": case "原发毛重": case "到厂毛重": - case "实付金额": - case "应付金额": - case "毛重单价": - case "实付单价": + case "付款金额": + case "核算金额": + case "核算单价": + case "付款单价": case "宰前扣款": case "死猪扣款": query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ(unionAlias, "UnionType", 1), DQExpression.Field(unionAlias, field.Value))), field.Text)); sumColumn.Add(field.Text); break; + case "成本金额": + query.Columns.Add(DQSelectColumn.Create(costMoney.ECastType?>(), field.Text)); + + sumColumn.Add(field.Text); + break; + + case "成本单价": + query.Columns.Add(DQSelectColumn.Create(DQExpression.Divide(costMoney, DQExpression.NullIfZero(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ(unionAlias, "UnionType", 1), DQExpression.Field(unionAlias, "RealWeight"))))).ECastType?>(), field.Text)); + + sumColumn.Add(field.Text); + break; + case "盈亏": query.Columns.Add(DQSelectColumn.Create(盈亏, "盈亏")); @@ -992,9 +1048,35 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports query.Columns.Add(DQSelectColumn.Field("Weigh_ID")); query.Columns.Add(DQSelectColumn.Sum("Num")); query.GroupBy.Expressions.Add(DQExpression.Field("Weigh_ID")); - query.Where.Conditions.Add(DQCondition.EQ(setting, "AbnormalItem_Name","死亡")); + query.Where.Conditions.Add(DQCondition.EQ(setting, "AbnormalItem_Name", "死亡")); return query; } } + + class CostRecordTemp + { + public long WeightBill_ID { get; set; } + + public Money<金额>? JingJiFee { get; set; } + + public Money<金额>? TransferFee { get; set; } + public decimal? Mileage { get; set; } + + public static void Register(DQueryDom root) + { + var main = new JoinAlias(typeof(CostRecord)); + var detail = new JoinAlias(typeof(CostRecord_Detail)); + var query = new DQueryDom(main); + query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "CostRecord_ID")); + query.Columns.Add(DQSelectColumn.Field("WeightBill_ID", detail)); + query.Columns.Add(DQSelectColumn.Sum(detail, "JingJiFee")); + query.Columns.Add(DQSelectColumn.Sum(detail, "TransferFee")); + query.Columns.Add(DQSelectColumn.Sum(detail, "Mileage")); + query.GroupBy.Expressions.Add(DQExpression.Field(detail, "WeightBill_ID")); + query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("BillState", 单据状态.已审核), DQCondition.EQ("Domain_ID", DomainContext.Current.ID))); + + root.RegisterQueryTable(typeof(CostRecordTemp), new string[] { "WeightBill_ID", "JingJiFee", "TransferFee", "Mileage" }, query); + } + } } } diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/PayInfoExport.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/PayInfoExport.cs index 885c39d..ba31fcf 100644 --- a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/PayInfoExport.cs +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/PayInfoExport.cs @@ -3,7 +3,9 @@ using BWP.B3ButcherManage.BO; using BWP.B3Frameworks; using BWP.Web.Layout; using BWP.Web.Utils; +using Forks.EnterpriseServices.DomainObjects2; using Forks.EnterpriseServices.DomainObjects2.DQuery; +using Forks.EnterpriseServices.SqlDoms; using System; using System.Collections.Generic; using System.Linq; @@ -24,19 +26,39 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports get { return "付款清单导出"; } } + protected override void InitQueryPanel(WebControls.QueryPanel queryPanel) + { + base.InitQueryPanel(queryPanel); + queryPanel.ConditonPanel.EAdd(CreateExportTypePanel()); + } + + DFBoolComboBox payTarget; + private HLayoutPanel CreateExportTypePanel() + { + var panel = new HLayoutPanel(); + panel.Add(new SimpleLabel("付款对象")); + payTarget = panel.Add(new DFBoolComboBox() { TrueDisplayValue = "供应商", FalseDisplayValue = "养殖户" }); + return panel; + } + + DFChoiceBox purchaseType; protected override void AddQueryControls(VLayoutPanel vPanel) { var layout = new LayoutManager("Main", mDFInfo, mQueryContainer); layout.Add("AccountingUnit_ID", new SimpleLabel("会计单位"), QueryCreator.DFChoiceBox(mDFInfo.Fields["AccountingUnit_ID"], B3FrameworksConsts.DataSources.授权会计单位全部)); layout.Add("Supplier_ID", new SimpleLabel("供应商"), QueryCreator.DFChoiceBox(mDFInfo.Fields["Supplier_ID"], B3ButcherManageConsts.DataSources.供应商)); + layout.Add("PurchaseType_ID", new SimpleLabel("收购类型"), purchaseType = QueryCreator.DFChoiceBox(mDFInfo.Fields["Supplier_ID"], B3ButcherManageConsts.DataSources.收购类型)); + layout["PurchaseType_ID"].NotAutoAddToContainer = true; layout.Add("Date", new SimpleLabel("付款日期"), QueryCreator.DateRange(mDFInfo.Fields["Date"], mQueryContainer, "MinDate", "MaxDate", DateTime.Today, null)); layout["Date"].NotAutoAddToContainer = true; - var config = new AutoLayoutConfig { Cols = 2 }; + var config = new AutoLayoutConfig { Cols = 4 }; config.Add("Date"); config.Add("ID"); config.Add("AccountingUnit_ID"); config.Add("Supplier_ID"); + config.Add("PurchaseType_ID"); + config.Add("BillState"); layout.Config = config; vPanel.Add(layout.CreateLayout()); @@ -49,11 +71,33 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports var t = string.Format(SubTitle, GetMinDate()); var query = base.GetQueryDom(); query.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet("ROW_NUMBER() OVER(order by [_bill].[ID])"), t + "序号")); - query.Columns.Add(DQSelectColumn.Field("Supplier_BankAccount", t + "卡号")); - query.Columns.Add(DQSelectColumn.Field("Supplier_Name", t + "姓名")); - query.Columns.Add(DQSelectColumn.Field("Money", t + "金额")); - SumColumnNames.Add("Money"); + if (!payTarget.Value.Value) + { + var root = query.From.RootSource.Alias; + var detail = new JoinAlias(typeof(Pay_Detail)); + var rel = new JoinAlias(typeof(Pay_Advance_Relate)); + var adv = new JoinAlias(typeof(AdvancePay_Detail)); + query.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.EQ(root, "ID", detail, "Pay_ID")); + query.From.AddJoin(JoinType.Left, new DQDmoSource(rel), DQCondition.EQ(detail, "ID", rel, "Pay_Detail_ID")); + query.From.AddJoin(JoinType.Left, new DQDmoSource(adv), DQCondition.EQ(rel, "AdvancePay_Detail_ID", adv, "ID")); + query.Columns.Add(DQSelectColumn.Field("ID", root, t + "付款单号")); + query.Columns.Add(DQSelectColumn.Field("Farmer_Bank", adv, t + "开户银行")); + query.Columns.Add(DQSelectColumn.Field("Farmer_BankAccount", adv, t + "卡号")); + query.Columns.Add(DQSelectColumn.Field("Farmer_Name", adv, t + "姓名")); + query.Columns.Add(DQSelectColumn.Field("Money", adv, t + "金额")); + SumColumnNames.Add("Money"); + query.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field(adv, "ID"))); + } + else + { + query.Columns.Add(DQSelectColumn.Field("Supplier_BankAccount", t + "卡号")); + query.Columns.Add(DQSelectColumn.Field("Supplier_Name", t + "姓名")); + query.Columns.Add(DQSelectColumn.Field("Money", t + "金额")); + SumColumnNames.Add("Money"); + } query.Columns.Add(DQSelectColumn.Field("Remark", t + "备注")); + if (!purchaseType.IsEmpty) + DetailTemp.AddPurchaseTypeCondition(query, long.Parse(purchaseType.Value)); foreach (var c in query.Columns) ColumnNames.Add(c.Name); return query; @@ -76,4 +120,21 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports } } } + + class DetailTemp + { + public long Pay_ID { get; set; } + + public static void AddPurchaseTypeCondition(DQueryDom root, long purchaseTypeID) + { + var query = new DQueryDom(new JoinAlias(typeof(Pay_Detail))); + query.Where.Conditions.Add(DQCondition.EQ("StatPay_PurchaseType_ID", purchaseTypeID)); + query.Columns.Add(DQSelectColumn.Field("Pay_ID")); + query.GroupBy.Expressions.Add(DQExpression.Field("Pay_ID")); + + root.RegisterQueryTable(typeof(DetailTemp), new string[] { "Pay_ID" }, query); + var detail = new JoinAlias(typeof(DetailTemp)); + root.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(root.From.RootSource.Alias, "ID", detail, "Pay_ID")); + } + } } diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/PayInfoExport.xml b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/PayInfoExport.xml index 1262b74..8659d33 100644 --- a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/PayInfoExport.xml +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/PayInfoExport.xml @@ -28,6 +28,10 @@ + + + + \ No newline at end of file diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/StatPayAnalyse.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/StatPayAnalyse.cs new file mode 100644 index 0000000..927b39c --- /dev/null +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/StatPayAnalyse.cs @@ -0,0 +1,162 @@ +using BWP.B3ButcherManage; +using BWP.B3ButcherManage.BO; +using BWP.B3Frameworks; +using BWP.B3Frameworks.BO.MoneyTemplate; +using BWP.Web.Layout; +using BWP.Web.Utils; +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 TSingSoft.WebControls2; +using TSingSoft.WebPluginFramework; + +namespace BWP.Web.Pages.B3QingDaoWanFu.Reports +{ + class StatPayAnalyse : DFGridReportPage + { + protected override string AccessRoleName + { + get { return "B3QingDaoWanFu.报表.结算单分析"; } + } + + protected override string Caption + { + get { return "结算单分析"; } + } + + protected override string QueryOptionsTabName + { + get + { + return "显示字段"; + } + } + + protected override void InitForm(System.Web.UI.HtmlControls.HtmlForm form) + { + base.InitForm(form); + mDFGrid.AllowRowGroup = true; + } + + public override Forks.EnterpriseServices.DataForm.PagedDFDataTable GetPagedDFDataTable(TSingSoft.WebControls2.DFGrids.QuerySettings settings) + { + var result = base.GetPagedDFDataTable(settings); + var billSum = GetBillSum(); + if (billSum != null) + { + if (ColumnNames.Contains("实付金额")) + result.Data.SumRow["实付金额"] = billSum.Item1; + if (ColumnNames.Contains("收购头数")) + result.Data.SumRow["收购头数"] = billSum.Item2; + if (ColumnNames.Contains("收购重量")) + result.Data.SumRow["收购重量"] = billSum.Item3; + } + return result; + } + + Tuple?, int?, Money?> GetBillSum() + { + var query = base.GetQueryDom(); + var n = new DQueryDom(new JoinAlias(typeof(StatPay))); + n.Where.Conditions.Add(DQCondition.And(query.Where.Conditions)); + n.Columns.Add(DQSelectColumn.Sum("ActualMoney")); + n.Columns.Add(DQSelectColumn.Sum("RealNumber")); + n.Columns.Add(DQSelectColumn.Sum("RealWeight")); + return n.EExecuteScalar?, int?, Money?>(); + } + + public override Forks.EnterpriseServices.DataForm.DFDataTable GetDFDataTable(TSingSoft.WebControls2.DFGrids.QuerySettings settings) + { + var result = base.GetDFDataTable(settings); + var billSum = GetBillSum(); + if (billSum != null) + { + if (ColumnNames.Contains("实付金额")) + result.SumRow["实付金额"] = billSum.Item1; + if (ColumnNames.Contains("收购头数")) + result.SumRow["收购头数"] = billSum.Item2; + if (ColumnNames.Contains("收购重量")) + result.SumRow["收购重量"] = billSum.Item3; + } + return result; + } + + protected override void InitQueryPanel(WebControls.QueryPanel queryPanel) + { + base.InitQueryPanel(queryPanel); + queryPanel.ConditonPanel.EAdd(CreateDatePanel()); + } + + private HLayoutPanel CreateDatePanel() + { + var panel = new HLayoutPanel(); + panel.Add(new SimpleLabel("核算日期")); + panel.Add(QueryCreator.DateRange(mDFInfo.Fields["Date"], mQueryContainer, "MinDate", "MaxDate", DateTime.Today, null)); + return panel; + } + + protected override void AddQueryControls(VLayoutPanel vPanel) + { + var layout = new LayoutManager("Main", mDFInfo, mQueryContainer); + + var config = new AutoLayoutConfig { Cols = 4 }; + config.Add("ID"); + config.Add("BillState"); + config.Add("Supplier_ID"); + config.Add("Employee_ID"); + config.Add("PurchaseType_ID"); + config.Add("Weigh_ID"); + config.Add("WeighTime"); + + layout.Config = config; + vPanel.Add(layout.CreateLayout()); + } + + ReportDisplayOptionHelper mDisplayHelper = new ReportDisplayOptionHelper(); + protected override void AddQueryOptions(VLayoutPanel vPanel)//显示字段 + { + mDisplayHelper.AddOptionItem("过磅日期", () => DQExpression.Snippet("CAST([_weight].[WeighTime] AS DATE)").ECastType(), false); + mDisplayHelper.AddOptionItem("过磅单号", "_bill", "Weigh_ID", false); + mDisplayHelper.AddOptionItem("结算日期", "_bill", "Date", false); + mDisplayHelper.AddOptionItem("结算单号", "_bill", "ID", false); + mDisplayHelper.AddOptionItem("供应商", "_bill", "Supplier_Name", false); + mDisplayHelper.AddOptionItem("收购头数", "_bill", "RealNumber", false); + mDisplayHelper.AddOptionItem("收购重量", "_bill", "RealWeight", false); + mDisplayHelper.AddOptionItem("实付金额", "_bill", "ActualMoney", false); + + mDisplayHelper.AddOptionItem("养殖户", "_detail", "Farmer_Name", false); + mDisplayHelper.AddOptionItem("身份证号", "_detail", "Farmer_IDCard", false); + mDisplayHelper.AddOptionItem("地址", "_detail", "Farmer_Address", false); + mDisplayHelper.AddOptionItem("电话", "_detail", "Farmer_Tel", false); + mDisplayHelper.AddOptionItem("棚前头数", "_detail", "Number", false, true); + mDisplayHelper.AddOptionItem("棚前重量", "_detail", "ExeWeight", false, true); + mDisplayHelper.AddOptionItem("棚前金额", "_detail", "ExtMoney", false, true); + AddQueryOption("选项", mDisplayHelper.GetAllDisplayNames(), mDisplayHelper.GetDefaultSelelectedDisplayNames()); + + base.AddQueryOptions(vPanel); + } + + + protected override DQueryDom GetQueryDom() + { + var query = base.GetQueryDom(); + var root = query.From.RootSource.Alias; + var weight = new JoinAlias("_weight", typeof(WeighBill)); + var detail = new JoinAlias("_detail", typeof(Weigh_FarmerDetail)); + query.From.AddJoin(JoinType.Left, new DQDmoSource(weight), DQCondition.EQ(root, "Weigh_ID", weight, "ID")); + query.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.EQ(root, "Weigh_ID", detail, "Weigh_ID")); + mDisplayHelper.AddAlias("_bill", root); + mDisplayHelper.AddAlias("_weight", weight); + mDisplayHelper.AddAlias("_detail", detail); + + mDisplayHelper.AddSelectColumns(query, (name) => OptionIsSelected("选项", name), SumColumnNames, ColumnNames); + query.Where.Conditions.Add(DQCondition.EQ(root, "Domain_ID", DomainContext.Current.ID)); + return query; + } + } +} diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/StatPayAnalyse.xml b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/StatPayAnalyse.xml new file mode 100644 index 0000000..cafd100 --- /dev/null +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/StatPayAnalyse.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Tools/CarLoadingBySendLinePage.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Tools/CarLoadingBySendLinePage.cs index 1824618..dc422f9 100644 --- a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Tools/CarLoadingBySendLinePage.cs +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Tools/CarLoadingBySendLinePage.cs @@ -270,13 +270,28 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Tools dom.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field("SecondNumber")), "辅数量")); dom.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.GreaterThan(DQExpression.Field(areadyLoadBill, "SaleOutStore_ID"), DQExpression.Snippet("0")), DQExpression.Field("AllUnitNum"), DQExpression.NULL)), "已派车数量")); dom.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet?>("null"), "本次派车数量")); - dom.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet("null"), "业务员ID")); - dom.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet("''"), "业务员")); - dom.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet("null"), "送货人员ID")); - dom.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet("''"), "送货人员")); - dom.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet("null"), "车辆ID")); - dom.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet("''"), "车辆")); + +// dom.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet("null"), "业务员ID")); +// dom.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet("''"), "业务员")); + + dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(sendLine, "Employee_ID"), "业务员ID")); + dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(sendLine, "Employee_Name"), "业务员")); + dom.GroupBy.Expressions.Add(DQExpression.Field(sendLine, "Employee_ID")); + dom.GroupBy.Expressions.Add(DQExpression.Field(sendLine, "Employee_Name")); + + dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(sendLine, "Employee_ID"), "送货人员ID")); + dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(sendLine, "Employee_Name"), "送货人员")); + +// dom.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet("null"), "送货人员ID")); +// dom.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet("''"), "送货人员")); + + dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(sendLine,"Car_ID"), "车辆ID")); + dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(sendLine, "Car_Name"), "车辆")); + dom.GroupBy.Expressions.Add(DQExpression.Field(sendLine, "Car_ID")); + dom.GroupBy.Expressions.Add(DQExpression.Field(sendLine, "Car_Name")); + // dom.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet("null"), "车辆ID")); + // dom.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet("''"), "车辆")); dom.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet("''"), "Remark")); dom.Where.Conditions.Add(DQCondition.EQ("BillState", 单据状态.未审核)); dom.Where.Conditions.Add(DQCondition.EQ("TakeGoods_Type", 配送方式.公司配送)); diff --git a/B3QingDaoWanFu.Web/Pages/TypeIOCs/CarLoadingTypeIOC.cs b/B3QingDaoWanFu.Web/Pages/TypeIOCs/CarLoadingTypeIOC.cs index be99900..e0294f4 100644 --- a/B3QingDaoWanFu.Web/Pages/TypeIOCs/CarLoadingTypeIOC.cs +++ b/B3QingDaoWanFu.Web/Pages/TypeIOCs/CarLoadingTypeIOC.cs @@ -6,14 +6,20 @@ using System.Text; using System.Web.UI; using System.Web.UI.HtmlControls; using BWP.B3Frameworks; +using BWP.B3Frameworks.BO.MoneyTemplate; using BWP.B3Sale.BO; using BWP.Web.Pages.B3Sale; using BWP.Web.Pages.B3Sale.Bills.CarLoading_; using Forks.Drawing; +using Forks.EnterpriseServices; using Forks.EnterpriseServices.DataForm; using Forks.Utils; using TSingSoft.WebControls2.BillReports; using TSingSoft.WebPluginFramework; +using Forks.EnterpriseServices.BusinessInterfaces; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using Forks.EnterpriseServices.DomainObjects2; +using Forks.EnterpriseServices.SqlDoms; namespace BWP.Web.Pages.TypeIOCs { @@ -27,13 +33,180 @@ namespace BWP.Web.Pages.TypeIOCs AddParameterss(dic, dmo); } + [DFClass] + public class CarLoadingGoodsSumDetailData + { + public string Goods_Name { get; set; } + public string Goods_Code { get; set; } + public string Goods_Spec { get; set; } + public Money? Number { get; set; } + public string Goods_MainUnit { get; set; } + public Money? SecondNumber { get; set; } + public string Goods_SecondUnit { get; set; } + public string Customer_Name { get; set; } + } + + + + static DQueryDom GetSaleOutStoreSumDetails(List billIds) + { + var outStore = new JoinAlias(typeof(SaleOutStore)); + var detail = new JoinAlias(typeof(SaleOutStore_Detail)); + var query = new DQueryDom(detail); + query.From.AddJoin(JoinType.Left, new DQDmoSource(outStore), DQCondition.EQ(detail, "SaleOutStore_ID", outStore, "ID")); + query.Columns.Add(DQSelectColumn.Field("Goods_Name")); + query.Columns.Add(DQSelectColumn.Field("Goods_Code")); + query.Columns.Add(DQSelectColumn.Field("Goods_Spec")); + query.Columns.Add(DQSelectColumn.Sum(detail,"Number")); + query.Columns.Add(DQSelectColumn.Field("Goods_MainUnit")); + query.Columns.Add(DQSelectColumn.Sum(detail, "SecondNumber")); + query.Columns.Add(DQSelectColumn.Field("Goods_SecondUnit")); + query.Columns.Add(DQSelectColumn.Field("Customer_Name",outStore)); + query.GroupBy.Expressions.Add(DQExpression.Field("Goods_Name")); + query.GroupBy.Expressions.Add(DQExpression.Field("Goods_Code")); + query.GroupBy.Expressions.Add(DQExpression.Field("Goods_Spec")); + query.GroupBy.Expressions.Add(DQExpression.Field("Goods_MainUnit")); + query.GroupBy.Expressions.Add(DQExpression.Field("Goods_SecondUnit")); + query.GroupBy.Expressions.Add(DQExpression.Field(outStore,"Customer_Name")); + query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("SaleOutStore_ID"), billIds.Select(item => DQExpression.Value(item)).ToArray())); + return query; + } + //定制打印格式【装车单】 protected void AddParameterss(IDictionary dic, CarLoading Dmo) { - + var list = new List(); + if (Dmo.BillDetails.Count > 0) { + var billInfo = Dmo.BillDetails.Where(x=>x.BillTypeID == DmoTypeIDAttribute.GetID(typeof(SaleOutStore))).Select(detail => detail.BillID).ToList(); + var query = GetSaleOutStoreSumDetails(billInfo); + + using (var context = new TransactionContext()) { + using (var reader = context.Session.ExecuteReader(query)) { + while (reader.Read()) { + var data = new CarLoadingGoodsSumDetailData(); + data.Goods_Name = (string)reader[0]; + data.Goods_Code = (string)reader[1]; + data.Goods_Spec = (string)reader[2]; + data.Number = (Money?)reader[3]; + data.Goods_MainUnit = (string)reader[4]; + data.SecondNumber = (Money?)reader[5]; + data.Goods_SecondUnit = (string)reader[6]; + data.Customer_Name = (string)reader[7]; + list.Add(data); + } + } + } + } + dic.Add("$DetailInfo3Type", typeof(CarLoadingGoodsSumDetailData)); + dic.Add("$DetailInfo3", list); PageSize = 100; dic.Add("$DetailInfo2", new Func(() => GetPrintStyle(Dmo))); + dic.Add("$万福装车单明细", new Func(() => Get万福装车单明细(Dmo))); + + } + + private string Get万福装车单明细(CarLoading dmo) + { + var sb=new StringBuilder(); + sb.AppendLine(""); + sb.AppendLine("客户存货名称规格件数主单位计划数量数量发货标记复称数量备注"); + + var list = GetWanFuCarLoadingList(dmo); + foreach (IGrouping grouping in list.GroupBy(x=>x.Customer_Name)) + { + AppendByGrouping(sb,grouping); + } + + AppendSumRow(sb,list); + + sb.AppendLine(""); + + return sb.ToString(); + + } + + private void AppendSumRow(StringBuilder sb, List list) + { + var sumOrderSecondNumber = (Money<二位小数>?)list.Sum(x => (x.OrderSecondNumber ?? 0).Value); + var sumOrderUnitNum = (Money<二位小数>?)list.Sum(x => (x.OrderUnitNum ?? 0).Value); + var sumUnitNum = (Money<二位小数>?)list.Sum(x => (x.UnitNum ?? 0).Value); + sb.AppendLine("合计" + sumOrderSecondNumber + "" + sumOrderUnitNum + "" + sumUnitNum + ""); + } + + private void AppendByGrouping(StringBuilder sb, IGrouping grouping) + { + var isfirst = true; + var count = grouping.Count(); + foreach (TempClassForCarLoadingWanFu wanFu in grouping.OrderBy(x=>x.SaleOutStore_Detail_ID)) + { + if (isfirst) + { + isfirst = false; + sb.AppendLine(""+ wanFu.Customer_Name+ ""+wanFu.Goods_Name+""+wanFu.Goods_Spec+""+wanFu.OrderSecondNumber+""+wanFu.Goods_MainUnit+""+wanFu.OrderUnitNum+""+wanFu.UnitNum+""+wanFu.Remark+""); + } + else + { + sb.AppendLine("" + wanFu.Goods_Name + "" + wanFu.Goods_Spec + "" + wanFu.OrderSecondNumber + "" + wanFu.Goods_MainUnit + "" + wanFu.OrderUnitNum + "" + wanFu.UnitNum + "" + wanFu.Remark + ""); + } + } + } + private List GetWanFuCarLoadingList(CarLoading dmo) + { + + var bill=new JoinAlias(typeof(CarLoading)); + var detail=new JoinAlias(typeof(CarLoading_BillDetail)); + var outstore= new JoinAlias(typeof(SaleOutStore)); + var outstoreDetail= new JoinAlias(typeof(SaleOutStore_Detail)); + var orderDetail= new JoinAlias(typeof(Order_Detail)); + + var query=new DQueryDom(bill); + query.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.EQ(bill, "ID",detail, "CarLoading_ID")); + query.From.AddJoin(JoinType.Left, new DQDmoSource(outstore), DQCondition.EQ(detail, "BillID", outstore, "ID")); + query.From.AddJoin(JoinType.Left, new DQDmoSource(outstoreDetail), DQCondition.EQ(outstoreDetail, "SaleOutStore_ID", detail, "BillID")); + query.From.AddJoin(JoinType.Left, new DQDmoSource(orderDetail), DQCondition.EQ(outstoreDetail, "Order_DetailID", orderDetail, "ID")); + + query.Columns.Add(DQSelectColumn.Field("Customer_Name", outstore)); + query.Columns.Add(DQSelectColumn.Field("Goods_Name", outstoreDetail)); + query.Columns.Add(DQSelectColumn.Field("Goods_Spec", outstoreDetail)); + query.Columns.Add(DQSelectColumn.Field("SecondNumber", orderDetail, "OrderSecondNumber")); + query.Columns.Add(DQSelectColumn.Field("Goods_MainUnit", outstoreDetail)); + query.Columns.Add(DQSelectColumn.Field("UnitNum", orderDetail, "OrderUnitNum")); + query.Columns.Add(DQSelectColumn.Field("UnitNum", outstoreDetail, "UnitNum")); + query.Columns.Add(DQSelectColumn.Field("Remark", detail)); + query.Columns.Add(DQSelectColumn.Field("ID", outstoreDetail, "SaleOutStore_Detail_ID")); + + query.Where.Conditions.Add(DQCondition.EQ(bill,"ID", dmo.ID)); + + if (StoreIDs != null && StoreIDs.Count > 0) + { + query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(outstore, "Store_ID"), StoreIDs.Select(x => DQExpression.Value(x)).ToArray())); + } + + + + var list = new List(); + using (var session=Dmo.NewSession()) + { + using (var reader= session.ExecuteReader(query)) + { + while (reader.Read()) + { + var model=new TempClassForCarLoadingWanFu(); + model.Customer_Name = (string) reader[0]; + model.Goods_Name= (string)reader[1]; + model.Goods_Spec = (string)reader[2]; + model.OrderSecondNumber = (Money?)reader[3]; + model.Goods_MainUnit = (string)reader[4]; + model.OrderUnitNum = (Money?)reader[5]; + model.UnitNum = (Money?)reader[6]; + model.Remark = (string)reader[7]; + model.SaleOutStore_Detail_ID = (long?)reader[8]; + list.Add(model); + } + } + } + return list; } @@ -103,7 +276,7 @@ namespace BWP.Web.Pages.TypeIOCs table.Rows.Add(row); if (first) { - row.EAdd("center", group.Count() + 1, 1, (string)dataRow["Customer_Name"]); + row.EAdd("center", group.Count() , 1, (string)dataRow["Customer_Name"]); first = false; } @@ -114,7 +287,7 @@ namespace BWP.Web.Pages.TypeIOCs main = (main ?? 0) + (mainNum ?? 0); sec = (sec ?? 0) + (secNum ?? 0); } - table.EAddRow("center", 1, 1, "小计", "", sec.ToString(), "", main.ToString(),main.ToString(), "", "", ""); + //table.EAddRow("center", 1, 1, "小计", "", sec.ToString(), "", main.ToString(),main.ToString(), "", "", ""); } } @@ -213,4 +386,36 @@ namespace BWP.Web.Pages.TypeIOCs public static int rowCount; } + + [DFClass,Serializable] + class TempClassForCarLoadingWanFu + { + public long? SaleOutStore_Detail_ID { get; set; } + + [LogicName("客户")] + public string Customer_Name { get; set; } + + [LogicName("存货")] + public string Goods_Name { get; set; } + + [LogicName("规格")] + public string Goods_Spec { get; set; } + + [LogicName("件数")] + public Money? OrderSecondNumber { get; set; } + + [LogicName("主单位")] + public string Goods_MainUnit { get; set; } + + [LogicName("计划数量")] + public Money? OrderUnitNum { get; set; } + + [LogicName("数量")] + public Money? UnitNum { get; set; } + + + [LogicName("备注")] + public string Remark { get; set; } + + } } diff --git a/B3QingDaoWanFu.Web/PluginClass.cs b/B3QingDaoWanFu.Web/PluginClass.cs index 234bb72..edb2af1 100644 --- a/B3QingDaoWanFu.Web/PluginClass.cs +++ b/B3QingDaoWanFu.Web/PluginClass.cs @@ -20,10 +20,13 @@ namespace BWP.B3QingDaoWanFu WpfPageFactory.RegisterPageOverlay(typeof(StatPayEdit).FullName, typeof(StatPayEdit_Ext).FullName); WpfPageFactory.RegisterPageOverlay(typeof(StatPayAnalyse).FullName, typeof(StatPayAnalyse_Ext).FullName); WpfPageFactory.RegisterPageOverlay(typeof(SaleOutStoreEdit).FullName, typeof(SaleOutStoreEdit_Ext).FullName); + WpfPageFactory.RegisterPageOverlay(typeof(StatPayList).FullName, typeof(StatPayList_Ext).FullName); GlobalFlags.On(B3ButcherManageConsts.GlobalFlags.StatPayAddRewardWithButcherUseWeight); GlobalFlags.On(B3SaleConsts.Flags.MarketingActivityEnableAdjustPrice); GlobalFlags.On(B3SaleConsts.Flags.SendOutStoreNoAvailableStorage); GlobalFlags.On(B3SaleConsts.Flags.CustAcceptAnalyseHasFactoryPrice); + GlobalFlags.On(B3ButcherManageConsts.GlobalFlags.预付款单不关联过磅单); + GlobalFlags.On(B3SaleConsts.Flags.SaleOutStoreEnableScan); } } } diff --git a/B3QingDaoWanFu/B3QingDaoWanFu.csproj b/B3QingDaoWanFu/B3QingDaoWanFu.csproj index 754481d..dbf7ac2 100644 --- a/B3QingDaoWanFu/B3QingDaoWanFu.csproj +++ b/B3QingDaoWanFu/B3QingDaoWanFu.csproj @@ -41,6 +41,10 @@ D:\BwpB3Project\tsref\Debug\B3ButcherManage.Web.dll False + + False + ..\..\..\tsref\Debug\B3ExportBase.dll + False D:\BwpB3Project\tsref\Debug\B3Frameworks.dll @@ -69,10 +73,12 @@ False ..\..\..\tsref\Debug\B3Sale.dll + False False ..\..\..\tsref\Debug\b3saleinterface.dll + False False @@ -84,11 +90,19 @@ D:\BwpB3Project\tsref\Debug\Forks.EnterpriseServices.dll False + + False + ..\..\..\tsref\Debug\Forks.JsonRpc.Client.dll + False D:\BwpB3Project\tsref\Debug\Forks.Utils.dll False + + False + ..\..\..\tsref\Debug\Newtonsoft.Json.dll + False @@ -130,16 +144,27 @@ Customer_version.cs + + + + + + + + + + + diff --git a/B3QingDaoWanFu/BL/Bill/CostRecordBL/CostRecordBL.cs b/B3QingDaoWanFu/BL/Bill/CostRecordBL/CostRecordBL.cs new file mode 100644 index 0000000..aa6b8ba --- /dev/null +++ b/B3QingDaoWanFu/BL/Bill/CostRecordBL/CostRecordBL.cs @@ -0,0 +1,20 @@ +using BWP.B3Frameworks.BL; +using BWP.B3QingDaoWanFu.BO; +using Forks.EnterpriseServices; +using Forks.EnterpriseServices.BusinessInterfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BWP.B3QingDaoWanFu.BL +{ + [BusinessInterface(typeof(CostRecordBL))] + [LogicName("费用录入")] + public interface ICostRecordBL : IDomainBillBL + { } + + public class CostRecordBL : DomainBillBL, ICostRecordBL + { + } +} diff --git a/B3QingDaoWanFu/BL/ExportBL/GoodsExportBL.cs b/B3QingDaoWanFu/BL/ExportBL/GoodsExportBL.cs new file mode 100644 index 0000000..792a79f --- /dev/null +++ b/B3QingDaoWanFu/BL/ExportBL/GoodsExportBL.cs @@ -0,0 +1,135 @@ +using BWP.B3ExportBase; +using BWP.B3ExportBase.BL; +using BWP.B3Frameworks; +using BWP.B3UnitedInfos.BO; +using Forks.EnterpriseServices; +using Forks.EnterpriseServices.BusinessInterfaces; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using TSingSoft.WebPluginFramework.BIPlugins.BLEvents; +using TSingSoft.WebPluginFramework; +using BWP.B3Frameworks.Utils; +using BWP.B3ExportBase.BO; +using Forks.JsonRpc.Client; +using Newtonsoft.Json; + +namespace BWP.B3QingDaoWanFu.BL +{ + [BusinessInterface(typeof(GoodsExportBL))] + public interface IGoodsExportBL : IExportBaseBL + { + void Export(List dmoIDs, long extSystemID); + + void UpdateOrInsert(Goods goods); + + void Stop(string code); + + void Start(string code); + + void Delete(string code); + } + + [LogicName("存货导MES存货")] + [ExportID(B3FrameworksConsts.DmoTypeIDBases.B3QingDaoWanFu, B3QingDaoWanFuConsts.DmoTypeIDOffsets.GoodsExport)] + public class GoodsExportBL : ExportBaseBL, IGoodsExportBL + { + const string MethodPath = "/MainSystem/B3ClientService/Rpcs/InterfaceRpc/GoodsRpc/"; + protected override void BeforeExport(List dmoIDs) + { + Dmos = new List(); + + var scriptHelper = new PythonScriptHelper(string.Empty, Config.Script, this); + + MinDmoProperties = new List(); + MinDetailProperties = new List(); + LoadFullDom = true; + //在脚本里设置是否载入整张单据 或者部分字段 + scriptHelper.Before(); + if (LoadFullDom) + { + var list = new List(); + var query = new DmoQuery(typeof(Goods)); + query.Where.Conditions.EFieldInList("ID", dmoIDs); + + foreach (Goods bill in Session.ExecuteList(query)) + { + if (list.IndexOf(bill.ID) == -1) + { + list.Add(bill.ID); + Dmos.Add(bill); + } + } + return; + } + LoadMinDmo(Dmos, dmoIDs); + } + + private string _serverUrl; + + protected string ServerUrl + { + get { return _serverUrl; } + set { _serverUrl = value; } + } + + public void Export(List dmoIDs, long extSystemID) + { + if (dmoIDs.Count == 0) + throw new Exception("没有要导出的内容"); + ExtSystemID = extSystemID; + _serverUrl = InnerBLUtil.GetDmoPropertyByID(Session, typeof(ExtSystem), "Address", extSystemID); + if (string.IsNullOrEmpty(_serverUrl)) + throw new Exception("外部系统地址不能为空"); + BeforeExport(dmoIDs); + DoExport(dmoIDs); + } + + private void DoExport(List dmoIDs) + { + var scriptHelper = new PythonScriptHelper(string.Empty, Config.Script, this); + var dmos = Dmos.OrderBy(x => x.ID).ToList(); + scriptHelper.AddLocalVar("dmos", dmos); + scriptHelper.Execute(); + InitRpc(); + var json = JsonConvert.SerializeObject(dmos); + RpcFacade.Call(MethodPath + "BatchImport", json); + BIFactory.MsgBuilder.Append("导出成功!"); + } + + public void UpdateOrInsert(Goods goods) + { + RpcFacade.Call(MethodPath + "UpdateOrInsert", JsonConvert.SerializeObject(goods)); + } + + public void Stop(string code) + { + RpcFacade.Call(MethodPath + "Stop", code); + } + + public void Start(string code) + { + RpcFacade.Call(MethodPath + "Start", code); + } + + public void Delete(string code) + { + RpcFacade.Call(MethodPath + "Delete", code); + } + + void InitRpc() + { + try + { + RpcFacade.Init(_serverUrl, "B3QingFu"); + } + catch (Exception ex) + { + if (ex.Message != "Can only start once") + throw; + } + } + } +} diff --git a/B3QingDaoWanFu/BLActions/BLActionUtil.cs b/B3QingDaoWanFu/BLActions/BLActionUtil.cs new file mode 100644 index 0000000..fae9ae8 --- /dev/null +++ b/B3QingDaoWanFu/BLActions/BLActionUtil.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using BWP.B3Frameworks.Utils; +using BWP.B3Sale.BO; +using Forks.EnterpriseServices.DomainObjects2; +using Forks.EnterpriseServices.DomainObjects2.DQuery; + +namespace BWP.B3QingDaoWanFu.BLActions +{ + class BLActionUtil + { + public static void GetDepEmpByCustomer(IDmoSession session,long customerId,out long? depid,out long? empid) + { + depid = null; + empid = null; + var query = new DQueryDom(new JoinAlias(typeof(Customer))); + query.Columns.Add(DQSelectColumn.Field("Department_ID")); + query.Columns.Add(DQSelectColumn.Field("Employee_ID")); + query.Where.Conditions.Add(DQCondition.EQ("ID",customerId)); + + using (var reader=session.ExecuteReader(query)) + { + if (reader.Read()) + { + depid = (long?) reader[0]; + empid = (long?) reader[1]; + } + } + + } + } +} diff --git a/B3QingDaoWanFu/BLActions/SaleOrderBLAction.cs b/B3QingDaoWanFu/BLActions/SaleOrderBLAction.cs new file mode 100644 index 0000000..ae3084d --- /dev/null +++ b/B3QingDaoWanFu/BLActions/SaleOrderBLAction.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using BWP.B3Sale.BO; +using Forks.EnterpriseServices.BusinessInterfaces; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using TSingSoft.WebPluginFramework; +using TSingSoft.WebPluginFramework.BIPlugins.BLEvents; + +namespace BWP.B3QingDaoWanFu.BLActions +{ + class SaleOrderCreateUpdateDepEmpBLAction: IBLMethodAction + { + public void Execute(IDmoContext context, object dmo, object parameter) + { + var order = dmo as Order; + long? depid; + long? empid; + BLActionUtil.GetDepEmpByCustomer(context.Session,order.Customer_ID??0, out depid,out empid); + if (depid != null) + { + order.Department_ID = depid; + } + if (empid != null) + { + order.Employee_ID = empid; + } + } + + public string Name + { + get { return "B3QingDaoWanFu.销售订单创建根据客户档案更新部门经办人"; } + } + public string Description + { + get { return "销售订单创建根据客户档案更新部门经办人"; } + } + public IList Features + { + get { return new List(); } + } + } + + class SaleOrderCheckUpdateDepEmpBLAction : IBLMethodAction + { + public void Execute(IDmoContext context, object dmo, object parameter) + { + var order = dmo as Order; + long? depid; + long? empid; + BLActionUtil.GetDepEmpByCustomer(context.Session, order.Customer_ID ?? 0, out depid, out empid); + if (depid.HasValue || empid.HasValue) + { + var updateDom = new DQUpdateDom(typeof(Order)); + if (depid.HasValue) + { + updateDom.Columns.Add(new DQUpdateColumn("Department_ID", depid)); + } + if (empid.HasValue) + { + updateDom.Columns.Add(new DQUpdateColumn("Employee_ID", empid)); + } + updateDom.Where.Conditions.Add(DQCondition.EQ("ID",order.ID)); + context.Session.ExecuteNonQuery(updateDom); + } + } + + public string Name + { + get { return "B3QingDaoWanFu.销售订单审核根据客户档案更新部门经办人"; } + } + public string Description + { + get { return "销售订单审核根据客户档案更新部门经办人"; } + } + public IList Features + { + get { return new List(); } + } + } +} diff --git a/B3QingDaoWanFu/BLActions/SaleOutStoreBLActions.cs b/B3QingDaoWanFu/BLActions/SaleOutStoreBLActions.cs new file mode 100644 index 0000000..419a523 --- /dev/null +++ b/B3QingDaoWanFu/BLActions/SaleOutStoreBLActions.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using BWP.B3Sale.BL; +using BWP.B3Sale.BO; +using Forks.EnterpriseServices.BusinessInterfaces; +using TSingSoft.WebPluginFramework.BIPlugins.BLEvents; + +namespace BWP.B3QingDaoWanFu.BLActions +{ + //class SaleOutStoreCheckNullifyBLActions : IBLMethodAction + //{ + + // public void Execute(IDmoContext context, object dmo, object parameter) + // { + // var bl = BIFactory.Create(context.Session); + // var outstore = dmo as SaleOutStore; + // if (outstore.Details.Count == 0) + // { + // bl.UnCheck(outstore); + // bl.Nullify(outstore); + // } + // } + + // public string Name + // { + // get { return "B3QingDaoWanFu.销售出库审核作废没有明细的单据"; } + // } + // public string Description + // { + // get { return "销售出库审核作废没有明细的单据"; } + // } + // public IList Features + // { + // get { return new List(); } + // } + //} +} diff --git a/B3QingDaoWanFu/BO/Bill/CostRecord/CostRecord.cs b/B3QingDaoWanFu/BO/Bill/CostRecord/CostRecord.cs new file mode 100644 index 0000000..7d5e66a --- /dev/null +++ b/B3QingDaoWanFu/BO/Bill/CostRecord/CostRecord.cs @@ -0,0 +1,56 @@ +using BWP.B3ButcherManage.BO; +using BWP.B3Frameworks; +using BWP.B3Frameworks.BO; +using Forks.EnterpriseServices; +using Forks.EnterpriseServices.DataForm; +using Forks.EnterpriseServices.DomainObjects2; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using TSingSoft.WebControls2; + +namespace BWP.B3QingDaoWanFu.BO +{ + [DFClass, Serializable, LogicName("费用录入")] + public class CostRecord : DomainBill, IAccountingUnitBill + { + [LogicName("会计单位")] + [DFNotEmpty] + [DFExtProperty("WebControlType", DFEditControl.ChoiceBox)] + [DFDataKind(B3FrameworksConsts.DataSources.授权会计单位)] + [DFExtProperty(B3FrameworksConsts.DFExtProperties.QueryDataKind, B3FrameworksConsts.DataSources.授权会计单位全部)] + [DFExtProperty("DisplayField", "AccountingUnit_Name")] + public long? AccountingUnit_ID { get; set; } + + DateTime date = DateTime.Today.AddDays(-1); + [LogicName("过磅日期")] + public DateTime Date { get { return date; } set { date = value; } } + + [LogicName("收购类型")] + [DFNotEmpty] + [DFExtProperty("WebControlType", DFEditControl.ChoiceBox)] + [DFDataKind(B3ButcherManage.B3ButcherManageConsts.DataSources.收购类型)] + [DFExtProperty(B3FrameworksConsts.DFExtProperties.QueryDataKind, B3ButcherManage.B3ButcherManageConsts.DataSources.收购类型)] + [DFExtProperty("DisplayField", "PurchaseType_Name")] + public long? PurchaseType_ID { get; set; } + + private CostRecord_DetailCollection _details = new CostRecord_DetailCollection(); + [OneToMany(typeof(CostRecord_Detail), "ID")] + [Join("ID", "CostRecord_ID")] + public CostRecord_DetailCollection Details + { + get { return _details; } + } + + [ReferenceTo(typeof(AccountingUnit), "Name")] + [LogicName("会计单位")] + [Join("AccountingUnit_ID", "ID")] + public string AccountingUnit_Name { get; set; } + + [ReferenceTo(typeof(PurchaseType), "Name")] + [LogicName("收购类型")] + [Join("PurchaseType_ID", "ID")] + public string PurchaseType_Name { get; set; } + } +} diff --git a/B3QingDaoWanFu/BO/Bill/CostRecord/CostRecord_Detail.cs b/B3QingDaoWanFu/BO/Bill/CostRecord/CostRecord_Detail.cs new file mode 100644 index 0000000..4bc8cd7 --- /dev/null +++ b/B3QingDaoWanFu/BO/Bill/CostRecord/CostRecord_Detail.cs @@ -0,0 +1,56 @@ +using BWP.B3ButcherManage.BO; +using BWP.B3Frameworks.BO; +using BWP.B3Frameworks.BO.MoneyTemplate; +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.B3QingDaoWanFu.BO +{ + [Serializable, DFClass, LogicName("费用录入_明细")] + public class CostRecord_Detail : Base + { + public long CostRecord_ID { get; set; } + + [LogicName("过磅单号")] + public long WeightBill_ID { get; set; } + + [LogicName("里程")] + public decimal? Mileage { get; set; } + + [LogicName("人工费")] + public Money<金额>? JingJiFee { get; set; } + + [LogicName("运费")] + public Money<金额>? TransferFee { get; set; } + + [LogicName("供应商")] + [ReferenceTo(typeof(WeighBill), "Supplier_Name")] + [Join("WeightBill_ID", "ID")] + public string Supplier_Name { get; set; } + + [LogicName("车辆")] + [ReferenceTo(typeof(WeighBill), "Car_Name")] + [Join("WeightBill_ID", "ID")] + public string Car_Name { get; set; } + + [LogicName("经纪人")] + [ReferenceTo(typeof(WeighBill), "Employee_Name")] + [Join("WeightBill_ID", "ID")] + public string Employee_Name { get; set; } + + [LogicName("头数")] + [ReferenceTo(typeof(WeighBill), "BuyNum")] + [Join("WeightBill_ID", "ID")] + public int? BuyNum { get; set; } + } + + [Serializable] + public class CostRecord_DetailCollection : DmoCollection + { } +} diff --git a/B3QingDaoWanFu/BO/SaleOutStoreBarCodeToMESLog.cs b/B3QingDaoWanFu/BO/SaleOutStoreBarCodeToMESLog.cs new file mode 100644 index 0000000..4b52673 --- /dev/null +++ b/B3QingDaoWanFu/BO/SaleOutStoreBarCodeToMESLog.cs @@ -0,0 +1,17 @@ +using Forks.EnterpriseServices.DomainObjects2; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using TSingSoft.WebPluginFramework; + +namespace BWP.B3QingDaoWanFu.BO +{ + + [BOClass] + [KeyField("SaleOutStore_ID", KeyGenType.assigned)] + public class SaleOutStoreBarCodeToMESLog + { + public long SaleOutStore_ID { get; set; } + } +} diff --git a/B3QingDaoWanFu/Rpc/GatheringRpc.cs b/B3QingDaoWanFu/Rpc/GatheringRpc.cs index 84775f8..04e72cc 100644 --- a/B3QingDaoWanFu/Rpc/GatheringRpc.cs +++ b/B3QingDaoWanFu/Rpc/GatheringRpc.cs @@ -22,14 +22,15 @@ namespace BWP.B3QingDaoWanFu.Rpc [Rpc] public static long Insert(Gathering dmo) { + var outerCode = dmo.AccountCustomer_OuterCode.Trim(); using (var context = new TransactionContext()) { var bl = BIFactory.Create(context); // bl.InitNewDmo(dmo); dmo.Domain_ID = DomainContext.Current.ID; - var customerId = BIFactory.Create().GetAccountCustomer_ID(dmo.AccountCustomer_OuterCode); + var customerId = BIFactory.Create().GetAccountCustomer_ID(outerCode); if (customerId == 0) - throw new ApplicationException(string.Format("没有设备号{0}的对应结账客户", dmo.AccountCustomer_OuterCode)); + throw new ApplicationException(string.Format("没有设备号{0}的对应结账客户", outerCode)); dmo.AccountCustomer_ID = customerId; SetAccountCustomerInfo(dmo, context.Session); diff --git a/B3QingDaoWanFu/Tasks/SyncSaleOutStoreInfoToMES.cs b/B3QingDaoWanFu/Tasks/SyncSaleOutStoreInfoToMES.cs new file mode 100644 index 0000000..563e404 --- /dev/null +++ b/B3QingDaoWanFu/Tasks/SyncSaleOutStoreInfoToMES.cs @@ -0,0 +1,170 @@ +using BWP.B3ProcurementInterface.Utils; +using BWP.B3QingDaoWanFu.BO; +using BWP.B3Sale.BO; +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.Threading; +using TSingSoft.WebPluginFramework.TimerTasks; +using TSingSoft.WebPluginFramework; +using Forks.JsonRpc.Client; +using Newtonsoft.Json; +using BWP.B3Frameworks.BO.NamedValueTemplate; +using BWP.B3ButcherManage.Utils; + +namespace BWP.B3QingDaoWanFu.Tasks +{ + public class SyncSaleOutStoreInfoToMES : ITimerTask + { + volatile static object _lockObj = new object(); + public void Execute() + { + if (!Monitor.TryEnter(_lockObj)) + { + throw new SameTaskNotFinishException(this); + } + try + { + DoExecute(); + } + finally + { + Monitor.Exit(_lockObj); + } + } + + private void DoExecute() + { + if (!ClientServerFacedRpcFacadeUtil.InitRpcFacade()) + return; + var main = new JoinAlias(typeof(SaleOutStore)); + var relate = new JoinAlias(typeof(SaleOutStoreBarCodeToMESLog)); + var detail = new JoinAlias(typeof(SaleOutStore_Detail)); + var weight = new JoinAlias(typeof(WeightingInfor)); + var scan = new JoinAlias(typeof(WeightingInfo_ScanDetail)); + var temp = new JoinAlias(typeof(Temp)); + var query = new DQueryDom(main); + query.From.AddJoin(JoinType.Left, new DQDmoSource(relate), DQCondition.EQ(main, "ID", relate, "SaleOutStore_ID")); + query.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "SaleOutStore_ID")); + query.From.AddJoin(JoinType.Left, new DQDmoSource(weight), DQCondition.And(DQCondition.EQ(detail, "ID", weight, "DetailID"), DQCondition.EQ(weight, "BillType", DmoTypeIDAttribute.GetID(typeof(SaleOutStore))))); + query.From.AddJoin(JoinType.Left, new DQDmoSource(scan), DQCondition.And(DQCondition.EQ(detail, "ID", scan, "Detail_ID"), DQCondition.EQ(weight, "ID", scan, "WeightingInfo_ID"))); + query.RegisterQueryTable(typeof(Temp), new string[] { "GroupID", "Weight" }, Temp.GetQueryDom()); + query.From.AddJoin(JoinType.Left, new DQDmoSource(temp), DQCondition.EQ(detail, "ID", temp, "GroupID")); + + query.Columns.Add(DQSelectColumn.Field("ID", main)); + query.Columns.Add(DQSelectColumn.Field("BarCode", scan)); + query.Columns.Add(DQSelectColumn.Field("NetWeight", weight)); + query.Columns.Add(DQSelectColumn.Field("ID", detail)); + query.Columns.Add(DQSelectColumn.Field("LoadTime", main)); + query.Columns.Add(DQSelectColumn.Field("Goods_Code", detail)); + query.Columns.Add(DQSelectColumn.Field("Weight", temp)); + + + query.Where.Conditions.Add(DQCondition.And(DQCondition.GreaterThanOrEqual("BillState", 单据状态.已审核), DQCondition.IsNull(DQExpression.Field(relate, "SaleOutStore_ID")), DQCondition.IsNotNull(DQExpression.Field(scan, "ID")))); + query.OrderBy.Expressions.Add(DQOrderByExpression.Create(main, "ID")); + query.OrderBy.Expressions.Add(DQOrderByExpression.Create(weight, "NetWeight", true)); + using (var session = Dmo.NewSession()) + { + var list = new List(); + var ids = new List(); + var discont = new Dictionary(); + using (var reader = session.ExecuteReader(query)) + { + while (reader.Read()) + { + var id = (long)reader[0]; + if (!ids.Contains(id)) + ids.Add(id); + var entity = new CarcassSaleOutStoreObj(); + entity.BarCode = (string)reader[1]; + var wv = ((Money?)reader[2]).EToDecimal(); + entity.GroupID = (long)reader[3]; + if (wv < 0) + { + var first = list.FirstOrDefault(x => x.GroupID == entity.GroupID && x.BarCode == entity.BarCode); + if (first != null) + list.Remove(first); + continue; + } + entity.Time = (DateTime?)reader[4]; + entity.SaleGoods_Code = (string)reader[5]; + entity.Weight = (decimal?)reader[6]; + list.Add(entity); + } + } + if (ids.Count == 0) + return; + if (list.Any()) + { + foreach (var g in list.GroupBy(x => x.GroupID)) + { + var first = true; + foreach (var item in g) + { + if (first) + first = false; + else + item.Weight = 0; + } + } + + var slist = TraceBackInfoUtil.SplitList(list, 1000); + foreach (var items in slist) + { + var par = JsonConvert.SerializeObject(items); + var json = RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/CarcassSaleOutStoreRpc/UploadCarcassInfo", par); + } + } + + foreach (var item in ids) + session.Insert(new SaleOutStoreBarCodeToMESLog { SaleOutStore_ID = item }); + + session.Commit(); + } + } + + public string Name + { + get { return "上传审核的销售出库扫码信息到MES"; } + } + + class Temp + { + public long GroupID { get; set; } + public decimal? Weight { get; set; } + + public static DQueryDom GetQueryDom() + { + var main = new JoinAlias(typeof(SaleOutStore)); + var relate = new JoinAlias(typeof(SaleOutStoreBarCodeToMESLog)); + var detail = new JoinAlias(typeof(SaleOutStore_Detail)); + var weight = new JoinAlias(typeof(WeightingInfor)); + var query = new DQueryDom(main); + query.From.AddJoin(JoinType.Left, new DQDmoSource(relate), DQCondition.EQ(main, "ID", relate, "SaleOutStore_ID")); + query.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "SaleOutStore_ID")); + query.From.AddJoin(JoinType.Left, new DQDmoSource(weight), DQCondition.And(DQCondition.EQ(detail, "ID", weight, "DetailID"), DQCondition.EQ(weight, "BillType", DmoTypeIDAttribute.GetID(typeof(SaleOutStore))))); + + query.Columns.Add(DQSelectColumn.Field("ID", detail)); + query.Columns.Add(DQSelectColumn.Sum(weight, "NetWeight")); + query.GroupBy.Expressions.Add(DQExpression.Field(detail, "ID")); + + query.Where.Conditions.Add(DQCondition.And(DQCondition.GreaterThanOrEqual("BillState", 单据状态.已审核), DQCondition.IsNull(DQExpression.Field(relate, "SaleOutStore_ID")), DQCondition.IsNotNull(DQExpression.Field(weight, "ID")))); + return query; + } + } + } + + class CarcassSaleOutStoreObj + { + public string BarCode { get; set; } + public decimal? Weight { get; set; } + public DateTime? Time { get; set; } + public long? GroupID { get; set; } + public string SaleGoods_Code { get; set; } + } +} diff --git a/B3QingDaoWanFu/TypeIOCs/GoodsBLTypeIOC.cs b/B3QingDaoWanFu/TypeIOCs/GoodsBLTypeIOC.cs new file mode 100644 index 0000000..9a370b8 --- /dev/null +++ b/B3QingDaoWanFu/TypeIOCs/GoodsBLTypeIOC.cs @@ -0,0 +1,65 @@ +using BWP.B3Frameworks; +using BWP.B3ProcurementInterface.Utils; +using BWP.B3QingDaoWanFu.BL; +using BWP.B3UnitedInfos.BL; +using BWP.B3UnitedInfos.BO; +using Forks.EnterpriseServices.BusinessInterfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BWP.B3QingDaoWanFu.TypeIOCs +{ + [TypeIOC(typeof(GoodsBL), typeof(GoodsBL.BaseBLIOCs.AfterSave))] + public class GoodsAfterSave : GoodsBL.BaseBLIOCs.AfterSave + { + public void Invoke(IDmoContext context, Goods dmo) + { + if (ClientServerFacedRpcFacadeUtil.InitRpcFacade()) + { + var bl = BIFactory.Create(context); + bl.UpdateOrInsert(dmo); + } + } + } + + [TypeIOC(typeof(GoodsBL), typeof(GoodsBL.BaseInfoBLIOCs.AfterStart))] + public class GoodsAfterStart : GoodsBL.BaseInfoBLIOCs.AfterStart + { + public void Invoke(IDmoContext context, Goods dmo) + { + if (ClientServerFacedRpcFacadeUtil.InitRpcFacade()) + { + var bl = BIFactory.Create(context); + bl.Start(dmo.Code); + } + } + } + + [TypeIOC(typeof(GoodsBL), typeof(GoodsBL.BaseInfoBLIOCs.AfterStop))] + public class GoodsAfterStop : GoodsBL.BaseInfoBLIOCs.AfterStop + { + public void Invoke(IDmoContext context, Goods dmo) + { + if (ClientServerFacedRpcFacadeUtil.InitRpcFacade()) + { + var bl = BIFactory.Create(context); + bl.Stop(dmo.Code); + } + } + } + + [TypeIOC(typeof(GoodsBL), typeof(GoodsBL.BaseBLIOCs.AfterDelete))] + public class GoodsAfterDelete : GoodsBL.BaseBLIOCs.AfterDelete + { + public void Invoke(IDmoContext context, Goods dmo) + { + if (ClientServerFacedRpcFacadeUtil.InitRpcFacade()) + { + var bl = BIFactory.Create(context); + bl.Delete(dmo.Code); + } + } + } +} diff --git a/B3QingDaoWanFu/TypeIOCs/SaleOutStoreBLTypeIoc.cs b/B3QingDaoWanFu/TypeIOCs/SaleOutStoreBLTypeIoc.cs index b902bcc..9f9823f 100644 --- a/B3QingDaoWanFu/TypeIOCs/SaleOutStoreBLTypeIoc.cs +++ b/B3QingDaoWanFu/TypeIOCs/SaleOutStoreBLTypeIoc.cs @@ -12,13 +12,17 @@ using Forks.EnterpriseServices.DomainObjects2.DQuery; using Forks.EnterpriseServices.SqlDoms; using Forks.Utils; using TSingSoft.WebPluginFramework; +using BWP.B3ButcherManage.BO; +using BWP.B3QingDaoWanFu.Utils; +using Newtonsoft.Json; +using System.Net; +using System.IO; +using TSingSoft.WebPluginFramework.QueueTasks; namespace BWP.B3QingDaoWanFu.TypeIOCs { - - [TypeIOC(typeof(SaleOutStoreBL), typeof(SaleOutStoreBL.BaseBLIOCs.BeforeSave))] - public class SaleOutStoreBLTypeIoc:SaleOutStoreBL.BaseBLIOCs.BeforeSave + public class SaleOutStoreBLTypeIoc : SaleOutStoreBL.BaseBLIOCs.BeforeSave { public void Invoke(IDmoContext context, SaleOutStore dmo) { @@ -26,33 +30,180 @@ namespace BWP.B3QingDaoWanFu.TypeIOCs { detail.FactoryPrice = GetFactoryPrice(context, dmo, detail.SaleGoods_ID); } + + CheckStoreGoodsConsistent(context, dmo); + } + + void CheckStoreGoodsConsistent(IDmoContext context, SaleOutStore dmo) + { + var notchntrolstoreids = new WanFuOnlineConfig().SaleoutstoreSaveNotCheckStoreGoodsConsistent.Value.ToList(); + if (notchntrolstoreids.Count == 0) + { + return; + } + if (notchntrolstoreids.Contains(Convert.ToInt32((dmo.Store_ID ?? 0)))) + { + return; + } + + var query = new DmoQuery(typeof(SaleGoods_Accounting_Store)); + query.Where.Conditions.Add(DQCondition.EQ("AccountingUnit_ID", dmo.AccountingUnit_ID)); + query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("SaleGoods_ID"), dmo.Details.Select(x => DQExpression.Value(x.SaleGoods_ID)).ToArray())); + var list = context.Session.ExecuteList(query).Cast().ToList(); + foreach (SaleGoods_Accounting_Store storeset in list) + { + if (storeset.Store_ID != dmo.Store_ID) + { + throw new Exception(storeset.SaleGoods_Name + "配置的仓库:" + storeset.Store_Name + " 与单据上的仓库不一致,不允许保存"); + } + } } private Money? GetFactoryPrice(IDmoContext context, SaleOutStore dmo, long detailSaleGoodsId) { - var detail=new JoinAlias(typeof(DynamicPrice_Detail)); - var query=new DQueryDom(detail); + var detail = new JoinAlias(typeof(DynamicPrice_Detail)); + var query = new DQueryDom(detail); query.Where.Conditions.Add(DQCondition.EQ("SaleGoods_ID", detailSaleGoodsId)); - query.Where.Conditions.Add(DQCondition.InSubQuery(DQExpression.Field("DynamicPrice_ID"),GetSubQueryDom(dmo))); + query.Where.Conditions.Add(DQCondition.InSubQuery(DQExpression.Field("DynamicPrice_ID"), GetSubQueryDom(dmo))); query.Columns.Add(DQSelectColumn.Field("Price")); return query.EExecuteScalar?>(context.Session); } - private DQueryDom GetSubQueryDom( SaleOutStore dmo) + private DQueryDom GetSubQueryDom(SaleOutStore dmo) { - var bill=new JoinAlias("bill",typeof(DynamicPrice)); - var detail=new JoinAlias("detail",typeof(DynamicPrice_AccountingUnitDetail)); - var query=new DQueryDom(bill); - query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail),DQCondition.EQ(bill,"ID",detail, "DynamicPrice_ID") ); + var bill = new JoinAlias("bill", typeof(DynamicPrice)); + var detail = new JoinAlias("detail", typeof(DynamicPrice_AccountingUnitDetail)); + var query = new DQueryDom(bill); + query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(bill, "ID", detail, "DynamicPrice_ID")); query.AddBillStateCondition(bill); - query.Where.Conditions.Add(DQCondition.EQ(detail, "AccountingUnit_ID",dmo.AccountingUnit_ID)); + query.Where.Conditions.Add(DQCondition.EQ(detail, "AccountingUnit_ID", dmo.AccountingUnit_ID)); query.Where.Conditions.Add(DQCondition.LessThanOrEqual(bill, "StartPriceDate", dmo.LoadTime)); - query.OrderBy.Expressions.Add(DQOrderByExpression.Create(bill,"ID",true)); - query.Columns.Add(DQSelectColumn.Field("ID",bill)); - query.Range=SelectRange.Top(1); + query.OrderBy.Expressions.Add(DQOrderByExpression.Create(bill, "ID", true)); + query.Columns.Add(DQSelectColumn.Field("ID", bill)); + query.Range = SelectRange.Top(1); return query; } } + + [TypeIOC(typeof(SaleOutStoreBL), typeof(SaleOutStoreBL.BillBLIOCs.AfterCheck))] + public class SaleOutStoreCheckBLTypeIoc : SaleOutStoreBL.BillBLIOCs.AfterCheck + { + public void Invoke(IDmoContext context, SaleOutStore dmo) + { + var task = new SaleInfoTractBackTask(dmo.ID); + task.AddTaskUser_ID = BLContext.User.ID; + task.DomainUser_ID = DomainContext.Current.DomainUser.ID; + QueueTaskService.Add(task); + } + } + + [Serializable] + class SaleInfoTractBackTask : QueueTaskBase + { + public long BillID { get; set; } + public long DomainUser_ID { get; set; } + + public SaleInfoTractBackTask(long id) + { + BillID = id; + } + + public override bool PersistTask + { + get + { + return true; + } + } + + protected override bool SingleTaskInQueue + { + get + { + return true; + } + } + + public override void Execute(QueueTaskContext context) + { + using (var scope = new SpecialDomainUserBLScope(DomainUser_ID)) + { + var config = new B3ButcherManageOnlineConfiguration(); + if (string.IsNullOrEmpty(config.TraceBackServerUrl)) + return; + var url = config.TraceBackServerUrl + "InsertSaleOutStore"; + using (var session = Dmo.NewSession()) + { + var infos = GetTraceBackInfos(session, BillID); + var list = TraceBackInfoUtil.SplitList(infos, 1000); + foreach (var letList in list) + { + var arr = JsonConvert.SerializeObject(letList); + TraceBackInfoUtil.Insert(url, arr); + } + } + } + } + + List GetTraceBackInfos(IDmoSession session, long id) + { + var detail = new JoinAlias(typeof(SaleOutStore_Detail)); + var bill = new JoinAlias(typeof(SaleOutStore)); + var weight = new JoinAlias(typeof(WeightingInfor)); + var scan = new JoinAlias(typeof(WeightingInfo_ScanDetail)); + var query = new DQueryDom(detail); + query.From.AddJoin(JoinType.Left, new DQDmoSource(bill), DQCondition.EQ(detail, "SaleOutStore_ID", bill, "ID")); + query.From.AddJoin(JoinType.Left, new DQDmoSource(weight), DQCondition.And(DQCondition.EQ(detail, "ID", weight, "DetailID"), DQCondition.EQ(weight, "BillType", DmoTypeIDAttribute.GetID(typeof(SaleOutStore))))); + query.From.AddJoin(JoinType.Left, new DQDmoSource(scan), DQCondition.And(DQCondition.EQ(detail, "ID", scan, "Detail_ID"), DQCondition.EQ(weight, "ID", scan, "WeightingInfo_ID"))); + query.Columns.Add(DQSelectColumn.Field("Customer_Name", bill)); + query.Columns.Add(DQSelectColumn.Field("Car_Name", bill)); + query.Columns.Add(DQSelectColumn.Field("LoadTime", bill)); + query.Columns.Add(DQSelectColumn.Field("BarCode", scan)); + query.Columns.Add(DQSelectColumn.Field("NetWeight", weight)); + + query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ(detail, "SaleOutStore_ID", id), DQCondition.IsNotNull(DQExpression.Field(scan, "ID")))); + query.OrderBy.Expressions.Add(DQOrderByExpression.Create(weight, "NetWeight", true)); + var list = new List(); + using (var reader = session.ExecuteReader(query)) + { + while (reader.Read()) + { + var entity = new TractBillSaleInfo(); + entity.Code = (string)reader[3]; + var wv = (Money)reader[4]; + if (wv < 0) + { + var first = list.FirstOrDefault(x => x.Code == entity.Code); + if (first != null) + list.Remove(first); + continue; + } + entity.SendCustomer = (string)reader[0]; + entity.CarNo = (string)reader[1]; + entity.SendDate = ((DateTime)reader[2]).ToString("yyyyMMdd"); + list.Add(entity); + } + } + return list; + } + + public override string Name + { + get { return string.Format("抽取销售出库单No.{0}到追溯信息到服务器", BillID); } + } + } + + class TractBillSaleInfo + { + //[LogicName("条码")] + public string Code { get; set; } + + public string SendCustomer { get; set; } + + public string CarNo { get; set; } + + public string SendDate { get; set; } + } } diff --git a/B3QingDaoWanFu/TypeIOCs/StatPayBLTypeIoc.cs b/B3QingDaoWanFu/TypeIOCs/StatPayBLTypeIoc.cs index 2185bec..988fd06 100644 --- a/B3QingDaoWanFu/TypeIOCs/StatPayBLTypeIoc.cs +++ b/B3QingDaoWanFu/TypeIOCs/StatPayBLTypeIoc.cs @@ -10,31 +10,88 @@ using BWP.B3Frameworks; using Forks.EnterpriseServices.BusinessInterfaces; using Forks.Utils; using TSingSoft.WebPluginFramework; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using Forks.EnterpriseServices.DomainObjects2; +using BWP.B3QingDaoWanFu.BO; +using Forks.EnterpriseServices.SqlDoms; +using BWP.B3Frameworks.BO.NamedValueTemplate; +using BWP.B3Frameworks.BO.MoneyTemplate; namespace BWP.B3QingDaoWanFu.TypeIOCs { - [TypeIOC(typeof(StatPayBL), typeof(StatPayBL.BaseBLIOCs.BeforeSave))] - public class StatPayBeforeSaveTypeIoc : StatPayBL.BaseBLIOCs.BeforeSave + //[TypeIOC(typeof(StatPayBL), typeof(StatPayBL.BaseBLIOCs.AfterSave))] + //public class StatPayBeforeSaveTypeIoc : StatPayBL.BaseBLIOCs.AfterSave + //{ + // public void Invoke(IDmoContext context, StatPay dmo) + // { + + // } + //} + [TypeIOC(typeof(StatPayBL), typeof(StatPayBL.BaseBLIOCs.AfterInsert))] + public class StatPayAfterInsertBLTypeIoc : StatPayBL.BaseBLIOCs.AfterInsert { public void Invoke(IDmoContext context, StatPay dmo) { - var 死猪奖罚设置ID = 36; - dmo.DeadPigRewardMoney = dmo.OtherRewardDetails.Where(x=>x.Sanction_ID== 死猪奖罚设置ID).Sum(x => (x.Money ?? 0).Value); - var butcherdetail = dmo.Details.FirstOrDefault(x => x.HogGrade_ID.HasValue); - if (butcherdetail != null) + if (dmo.Weigh_ID == null) + return; + var details = GetFarmerDetail(context.Session, dmo.Weigh_ID.Value); + var total = details.Sum(x => x.Item2 ?? 0); + foreach (var detail in details) { - dmo.HogGrade_ID = butcherdetail.HogGrade_ID; + var arr = new List>(); + if (total != 0) + { + var v = dmo.RealWeight * detail.Item2 / total; + if (v.HasValue) + { + v = decimal.Round(v.Value, 2); + arr.Add(new Tuple("ExeWeight", v)); + } + } + if (detail.Item3 != null) + { + arr.Add(new Tuple("ExtMoney", detail.Item3)); + } + if (arr.Any()) + UpdateProperty(detail.Item1, context.Session, arr.ToArray()); } } + + List> GetFarmerDetail(IDmoSession session, long weightID) + { + var query = new DQueryDom(new JoinAlias(typeof(Weigh_FarmerDetail))); + query.Where.Conditions.Add(DQCondition.EQ("Weigh_ID", weightID)); + query.Columns.Add(DQSelectColumn.Field("ID")); + query.Columns.Add(DQSelectColumn.Field("Number")); + query.Columns.Add(DQSelectColumn.Field("Money")); + return query.EExecuteList(session); + } + + void UpdateProperty(long id, IDmoSession session, params Tuple[] par) + { + var update = new DQUpdateDom(typeof(Weigh_FarmerDetail)); + update.Where.Conditions.Add(DQCondition.EQ("ID", id)); + foreach (var item in par) + update.Columns.Add(new DQUpdateColumn(item.Item1, item.Item2)); + session.ExecuteNonQuery(update); + } } + [TypeIOC(typeof(StatPayBL), typeof(StatPayBL.BaseBLIOCs.AfterSave))] public class StatPayAfterSaveBLTypeIoc : StatPayBL.BaseBLIOCs.AfterSave { public void Invoke(IDmoContext context, StatPay dmo) { + var 死猪奖罚设置ID = 36; + dmo.DeadPigRewardMoney = dmo.OtherRewardDetails.Where(x => x.Sanction_ID == 死猪奖罚设置ID).Sum(x => (x.Money ?? 0).Value); + var butcherdetail = dmo.Details.FirstOrDefault(x => x.HogGrade_ID.HasValue); + if (butcherdetail != null) + { + dmo.HogGrade_ID = butcherdetail.HogGrade_ID; + } //自定义单价 if (dmo.UpdateActualPrice) { @@ -43,7 +100,9 @@ namespace BWP.B3QingDaoWanFu.TypeIOCs if (dmo.PurchaseType_Name == "业务") { - dmo.ActualMoney = (dmo.ShackMoney.EToDecimal() ?? 0) + (dmo.JingJianFee.EToDecimal() ?? 0) - (dmo.DiscontMoney.EToDecimal() ?? 0); + if (dmo.FarmerDetails.Any()) + dmo.ShackMoney = dmo.FarmerDetails.Sum(x => x.ExtMoney ?? 0); + dmo.ActualMoney = (dmo.ShackMoney.EToDecimal() ?? 0); Money? we = null; if (dmo.ShackWeight != 0) we = dmo.ShackWeight; diff --git a/B3QingDaoWanFu/Utils/B3QingDaoWanFuConsts.cs b/B3QingDaoWanFu/Utils/B3QingDaoWanFuConsts.cs new file mode 100644 index 0000000..c637e07 --- /dev/null +++ b/B3QingDaoWanFu/Utils/B3QingDaoWanFuConsts.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BWP.B3QingDaoWanFu +{ + public class B3QingDaoWanFuConsts + { + internal static class DmoTypeIDOffsets + { + public const byte GoodsExport = 1; + } + } +} diff --git a/B3QingDaoWanFu/Utils/WanFuOnlineConfig.cs b/B3QingDaoWanFu/Utils/WanFuOnlineConfig.cs index b59b4e6..d487c20 100644 --- a/B3QingDaoWanFu/Utils/WanFuOnlineConfig.cs +++ b/B3QingDaoWanFu/Utils/WanFuOnlineConfig.cs @@ -18,6 +18,20 @@ namespace BWP.B3QingDaoWanFu.Utils ConfigurationUtil.Fill(this); } + private IntListConfigRef _saleoutstoreSaveNotCheckStoreGoodsConsistent = new IntListConfigRef(); + + [LogicName("销售出库保存不受存货仓库设置控制的仓库ID")] + [ConfigurationItemGroup("青岛万福")] + [ConfigurationItemDescription("销售出库保存不是存货仓库设置控制的仓库ID")] + [DomainConfigurationItem] + public IntListConfigRef SaleoutstoreSaveNotCheckStoreGoodsConsistent + { + get { return _saleoutstoreSaveNotCheckStoreGoodsConsistent; } + set { _saleoutstoreSaveNotCheckStoreGoodsConsistent = value; } + } + + + private IntConfigRef _receiptTypeID = new IntConfigRef(0); diff --git a/B3WanFuSaleWebService/RpcHelper/RpcHelperUtil.cs b/B3WanFuSaleWebService/RpcHelper/RpcHelperUtil.cs index 407c345..7d6a0d8 100644 --- a/B3WanFuSaleWebService/RpcHelper/RpcHelperUtil.cs +++ b/B3WanFuSaleWebService/RpcHelper/RpcHelperUtil.cs @@ -60,7 +60,7 @@ namespace RpcHelper { results.SendResult.Add(r); var gathering = new RpcObject("/MainSystem/B3Sale/BO/Gathering"); - SetString(gathering, "AccountCustomer_OuterCode", bill.Head.CustomerCode);// 客户的外部编码 + SetString(gathering, "AccountCustomer_OuterCode", bill.Head.CustomerCode.Trim());// 客户的外部编码 SetDateTime(gathering, "GatheringTime", bill.Head.Time); SetDecimal(gathering, "GatheringMoney", bill.Head.Money); diff --git a/WebFolder/config/billreports/B3QingDaoWanFu/CostRecordPrint.xml b/WebFolder/config/billreports/B3QingDaoWanFu/CostRecordPrint.xml new file mode 100644 index 0000000..d9c5a28 --- /dev/null +++ b/WebFolder/config/billreports/B3QingDaoWanFu/CostRecordPrint.xml @@ -0,0 +1,25 @@ + + + + + + 费用录入№$Dmo.ID + + + + + + + 单据明细]]> + + + + + + + + + + + + diff --git a/WebFolder/config/plugins/B3QingDaoWanFu.plugin b/WebFolder/config/plugins/B3QingDaoWanFu.plugin index 6728bf2..8cf7c61 100644 --- a/WebFolder/config/plugins/B3QingDaoWanFu.plugin +++ b/WebFolder/config/plugins/B3QingDaoWanFu.plugin @@ -11,7 +11,7 @@ - + @@ -22,7 +22,8 @@ - + + @@ -30,6 +31,21 @@ + + + + + + + + + + + + + + + @@ -37,7 +53,9 @@ - + + +