From c0bdba795583dec0f2ab92e8d356bc935f3567ac Mon Sep 17 00:00:00 2001
From: luanhui <1029149336@@qq.com>
Date: Tue, 27 Mar 2018 11:34:32 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=88=9B=E5=BB=BA=E5=AE=A1?=
=?UTF-8?q?=E6=A0=B8=E6=9B=B4=E6=96=B0=20=E9=83=A8=E9=97=A8=E7=BB=8F?=
=?UTF-8?q?=E5=8A=9E=E4=BA=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
B3QingDaoWanFu/B3QingDaoWanFu.csproj | 8 +-
B3QingDaoWanFu/BLActions/BLActionUtil.cs | 34 ++++++++
B3QingDaoWanFu/BLActions/SaleOrderBLAction.cs | 82 +++++++++++++++++++
3 files changed, 122 insertions(+), 2 deletions(-)
create mode 100644 B3QingDaoWanFu/BLActions/BLActionUtil.cs
create mode 100644 B3QingDaoWanFu/BLActions/SaleOrderBLAction.cs
diff --git a/B3QingDaoWanFu/B3QingDaoWanFu.csproj b/B3QingDaoWanFu/B3QingDaoWanFu.csproj
index c39bf0e..8b8118a 100644
--- a/B3QingDaoWanFu/B3QingDaoWanFu.csproj
+++ b/B3QingDaoWanFu/B3QingDaoWanFu.csproj
@@ -69,11 +69,13 @@
False
..\..\..\tsref\Debug\B3Sale.dll
- False
+ False
+
False
..\..\..\tsref\Debug\b3saleinterface.dll
- False
+ False
+
False
D:\BwpB3Project\tsref\Debug\B3UnitedInfos.dll
@@ -130,7 +132,9 @@
Customer_version.cs
+
+
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(); }
+ }
+ }
+}