From a6d4e3051b337f4cd1a7ef400cf00ff64f0931e3 Mon Sep 17 00:00:00 2001 From: luanhui Date: Sat, 13 Jan 2018 13:14:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=86=9C=E8=A1=8C=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=20=E9=85=8D=E7=BD=AE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- B3QingDaoWanFu.Web/B3QingDaoWanFu.Web.csproj | 10 ++- .../CustomerDeviceSetEdit.cs | 67 +++++++++++++++++++ B3QingDaoWanFu/B3QingDaoWanFu.csproj | 2 + B3QingDaoWanFu/BL/CustomerDeviceSetBL.cs | 33 +++++++++ B3QingDaoWanFu/BO/CustomerDeviceSet.cs | 55 +++++++++++++++ B3QingDaoWanFu/Rpc/GatheringRpc.cs | 18 ++--- .../RpcHelper/RpcHelperUtil.cs | 22 ++++-- .../App_Data/PublishProfiles/WanFu.pubxml | 2 +- .../config/plugins/B3QingDaoWanFu.plugin | 4 ++ 9 files changed, 193 insertions(+), 20 deletions(-) create mode 100644 B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/CustomerDeviceSet_/CustomerDeviceSetEdit.cs create mode 100644 B3QingDaoWanFu/BL/CustomerDeviceSetBL.cs create mode 100644 B3QingDaoWanFu/BO/CustomerDeviceSet.cs diff --git a/B3QingDaoWanFu.Web/B3QingDaoWanFu.Web.csproj b/B3QingDaoWanFu.Web/B3QingDaoWanFu.Web.csproj index efa97ec..4086503 100644 --- a/B3QingDaoWanFu.Web/B3QingDaoWanFu.Web.csproj +++ b/B3QingDaoWanFu.Web/B3QingDaoWanFu.Web.csproj @@ -141,6 +141,9 @@ ASPXCodeBehind + + ASPXCodeBehind + ASPXCodeBehind @@ -157,7 +160,12 @@ - + + + {b47ce3c3-c269-48b8-84a7-32360e5a9e8e} + B3QingDaoWanFu + + diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/CustomerDeviceSet_/CustomerDeviceSetEdit.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/CustomerDeviceSet_/CustomerDeviceSetEdit.cs new file mode 100644 index 0000000..2ca6ce5 --- /dev/null +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/CustomerDeviceSet_/CustomerDeviceSetEdit.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Web.UI; +using System.Web.UI.WebControls; +using BWP.B3Frameworks.Utils; +using BWP.B3QingDaoWanFu.BL; +using BWP.B3QingDaoWanFu.BO; +using BWP.B3Sale.BO; +using BWP.B3Sale.Utils; +using Forks.EnterpriseServices.DataForm; +using Forks.Utils.Collections; +using TSingSoft.WebControls2; + +namespace BWP.Web.Pages.B3QingDaoWanFu.CustomerDeviceSet_ +{ + class CustomerDeviceSetEdit: SingletonDmoEditPage + { + private DFEditGrid _grid; + + protected override void BuildBody(VLayoutPanel vPanel) + { + var hPanel = vPanel.Add(new HLayoutPanel(), new VLayoutOption(HorizontalAlign.Center)); + hPanel.Add(new SimpleLabel("结账客户")); + var chb = hPanel.Add(new ChoiceBox(B3SaleDataSources.结账客户)); + chb.Width = 150; + chb.EnableInputArgument = true; + chb.EnableTopItem = true; + + var bt = hPanel.Add(new TSButton("新增")); + bt.Click += delegate { + if (chb.IsEmpty) + throw new ApplicationException("结账客户"); + if (Dmo.Details.Any(x => x.AccountCustomer_ID == short.Parse(chb.Value))) + return; + _grid.GetFromUI(); + var detail = new CustomerDeviceSet_Detail(); + detail.AccountCustomer_ID = short.Parse(chb.Value); + DmoUtil.RefreshDependency(detail, "AccountCustomer_ID"); + Dmo.Details.Add(detail); + _grid.DataBind(); + }; + var detailEditor = new DFCollectionEditor(() => Dmo.Details); + detailEditor.AllowDeletionFunc = () => CanSave; + detailEditor.CanDeleteFunc = (detail) => CanSave; + detailEditor.IsEditableFunc = (field, detail) => CanSave; + _grid = vPanel.Add(new DFEditGrid(detailEditor) { Width = Unit.Percentage(50) }, new VLayoutOption(HorizontalAlign.Center)); + _grid.Columns.Add(new DFEditGridColumn("AccountCustomer_Name")); + _grid.Columns.EAdd(new DFEditGridColumn("DeviceCode")).InitEditControl += (send, e) => { + e.Control.Width=Unit.Percentage(100); + }; + } + + public override void AppToUI() + { + base.AppToUI(); + _grid.DataBind(); + } + + public override void GetFromUI() + { + base.GetFromUI(); + _grid.GetFromUI(); + } + } +} diff --git a/B3QingDaoWanFu/B3QingDaoWanFu.csproj b/B3QingDaoWanFu/B3QingDaoWanFu.csproj index 02da20f..1ef3550 100644 --- a/B3QingDaoWanFu/B3QingDaoWanFu.csproj +++ b/B3QingDaoWanFu/B3QingDaoWanFu.csproj @@ -131,6 +131,8 @@ Customer_version.cs + + diff --git a/B3QingDaoWanFu/BL/CustomerDeviceSetBL.cs b/B3QingDaoWanFu/BL/CustomerDeviceSetBL.cs new file mode 100644 index 0000000..cee13a7 --- /dev/null +++ b/B3QingDaoWanFu/BL/CustomerDeviceSetBL.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using BWP.B3Frameworks.BL; +using BWP.B3QingDaoWanFu.BO; +using BWP.B3Sale.BO; +using Forks.EnterpriseServices.BusinessInterfaces; + +namespace BWP.B3QingDaoWanFu.BL +{ + + [BusinessInterface(typeof(CustomerDeviceSetBL))] + public interface ICustomerDeviceSetBL : ISingletonDmoBL + { + long GetAccountCustomer_ID(string outcode); + } + + public class CustomerDeviceSetBL:DomainSingletonDmoBL, ICustomerDeviceSetBL + { + public long GetAccountCustomer_ID(string outcode) + { + var dmo = Load(); + var fd = dmo.Details.FirstOrDefault(x => x.DeviceCode == outcode); + if (fd == null) + { + return 0; + } + + return fd.AccountCustomer_ID??0; + } + } +} diff --git a/B3QingDaoWanFu/BO/CustomerDeviceSet.cs b/B3QingDaoWanFu/BO/CustomerDeviceSet.cs new file mode 100644 index 0000000..3514ddc --- /dev/null +++ b/B3QingDaoWanFu/BO/CustomerDeviceSet.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using BWP.B3Frameworks; +using BWP.B3Frameworks.BO; +using BWP.B3Sale.BO; +using BWP.B3Sale.Utils; +using Forks.EnterpriseServices; +using Forks.EnterpriseServices.DataForm; +using Forks.EnterpriseServices.DomainObjects2; + +namespace BWP.B3QingDaoWanFu.BO +{ + [DFClass,Serializable,LogicName("结账客户设备配置")] + public class CustomerDeviceSet:DomainSingletonDmo + { + + readonly CustomerDeviceSet_DetailCollection _details = new CustomerDeviceSet_DetailCollection(); + + [OneToMany(typeof(CustomerDeviceSet_Detail), "ID")] + [Join("ID", "CustomerDeviceSet_ID")] + public CustomerDeviceSet_DetailCollection Details + { + get { return _details; } + } + } + + [DFClass, Serializable, LogicName("结账客户设备配置")] + public class CustomerDeviceSet_Detail : Base + { + + public long CustomerDeviceSet_ID { get; set; } + + [LogicName("结账客户")] + [DFDataKind(B3SaleDataSources.结账客户)] + [DFExtProperty(B3FrameworksConsts.DFExtProperties.DisplayField, "AccountCustomer_Name")] + public long? AccountCustomer_ID { get; set; } + + [LogicName("结账客户")] + [ReferenceTo(typeof(Customer), "Name")] + [Join("AccountCustomer_ID", "ID")] + public string AccountCustomer_Name { get; set; } + + [LogicName("设备号")] + public string DeviceCode { get; set; } + } + + [Serializable] + public class CustomerDeviceSet_DetailCollection : DmoCollection + { + + } + +} diff --git a/B3QingDaoWanFu/Rpc/GatheringRpc.cs b/B3QingDaoWanFu/Rpc/GatheringRpc.cs index ac4188d..84775f8 100644 --- a/B3QingDaoWanFu/Rpc/GatheringRpc.cs +++ b/B3QingDaoWanFu/Rpc/GatheringRpc.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using BWP.B3Frameworks; using BWP.B3Frameworks.Utils; +using BWP.B3QingDaoWanFu.BL; using BWP.B3QingDaoWanFu.Utils; using BWP.B3Sale.BL; using BWP.B3Sale.BO; @@ -26,16 +27,10 @@ namespace BWP.B3QingDaoWanFu.Rpc var bl = BIFactory.Create(context); // bl.InitNewDmo(dmo); dmo.Domain_ID = DomainContext.Current.ID; - var dom = new DQueryDom(new JoinAlias(typeof(Customer))); - dom.Columns.Add(DQSelectColumn.Field("AccountCustomer_ID")); - dom.Columns.Add(DQSelectColumn.Field("AccountCustomer_Name")); - dom.Where.Conditions.Add(DQCondition.EQ("OuterCode", dmo.AccountCustomer_OuterCode));// - //找到该客户对应的结账客户 - var info = dom.EExecuteScalar(context.Session); - if (info == null) - throw new ApplicationException(string.Format("没有配置外部编码{0}的对应结账客户", dmo.AccountCustomer_OuterCode)); - dmo.AccountCustomer_ID = info.Item1; - dmo.AccountCustomer_Name = info.Item2; + var customerId = BIFactory.Create().GetAccountCustomer_ID(dmo.AccountCustomer_OuterCode); + if (customerId == 0) + throw new ApplicationException(string.Format("没有设备号{0}的对应结账客户", dmo.AccountCustomer_OuterCode)); + dmo.AccountCustomer_ID = customerId; SetAccountCustomerInfo(dmo, context.Session); @@ -67,7 +62,6 @@ namespace BWP.B3QingDaoWanFu.Rpc private static void SetAccountCustomerInfo(Gathering dmo, IDmoSessionWithTransaction session) { var dom = new DQueryDom(new JoinAlias(typeof(Customer))); - new Customer().Employee_ID = 1; dom.Columns.Add(DQSelectColumn.Field("Department_ID")); dom.Columns.Add(DQSelectColumn.Field("Employee_ID")); dom.Columns.Add(DQSelectColumn.Field("Department_Name")); @@ -83,7 +77,7 @@ namespace BWP.B3QingDaoWanFu.Rpc } else { - throw new ApplicationException(string.Format("不存在编号为{0}的客户", dmo.AccountCustomer_OuterCode)); + throw new ApplicationException(string.Format("不存在ID为{0}的客户", dmo.AccountCustomer_ID)); } } diff --git a/B3WanFuSaleWebService/RpcHelper/RpcHelperUtil.cs b/B3WanFuSaleWebService/RpcHelper/RpcHelperUtil.cs index dea44ee..407c345 100644 --- a/B3WanFuSaleWebService/RpcHelper/RpcHelperUtil.cs +++ b/B3WanFuSaleWebService/RpcHelper/RpcHelperUtil.cs @@ -15,16 +15,26 @@ namespace RpcHelper { public static string InsertGathering(string data) { //测试用的 -// using (var sr=new StreamReader("D:\\测试报文.txt")) -// { -// data=sr.ReadToEnd(); -// } + if (data == "ceshi") + { + using (var sr = new StreamReader("D:\\测试报文.txt")) + { + data = sr.ReadToEnd(); + } + } var logName = DateTime.Today.Date.ToString("yyyyMMdd") + "Gatheringlog.txt"; var results = new Results(); - var path = System.Web.HttpContext.Current.Request.PhysicalApplicationPath; +// var path = System.Web.HttpContext.Current.Request.PhysicalApplicationPath; + + var path = "D:\\zhifutonglog\\"; + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + string resultStr; - using (var textWriter = new StreamWriter(path + "\\log\\" + logName, true, Encoding.UTF8)) { + using (var textWriter = new StreamWriter(path + logName, true, Encoding.UTF8)) { textWriter.WriteLine("{0} 收款单接口开始接收数据:------------------------------------", DateTime.Now); textWriter.WriteLine(data); Console.WriteLine("{0}:开始接受数据:", DateTime.Now); diff --git a/B3WanFuSaleWebService/WebFolder/App_Data/PublishProfiles/WanFu.pubxml b/B3WanFuSaleWebService/WebFolder/App_Data/PublishProfiles/WanFu.pubxml index a7664f1..da302d1 100644 --- a/B3WanFuSaleWebService/WebFolder/App_Data/PublishProfiles/WanFu.pubxml +++ b/B3WanFuSaleWebService/WebFolder/App_Data/PublishProfiles/WanFu.pubxml @@ -6,7 +6,7 @@ FileSystem - Release + Debug Any CPU True diff --git a/WebFolder/config/plugins/B3QingDaoWanFu.plugin b/WebFolder/config/plugins/B3QingDaoWanFu.plugin index f039039..f2b5e13 100644 --- a/WebFolder/config/plugins/B3QingDaoWanFu.plugin +++ b/WebFolder/config/plugins/B3QingDaoWanFu.plugin @@ -21,9 +21,13 @@ + + + +