Browse Source

订单创建审核更新 部门经办人

master
luanhui 7 years ago
parent
commit
c0bdba7955
3 changed files with 122 additions and 2 deletions
  1. +6
    -2
      B3QingDaoWanFu/B3QingDaoWanFu.csproj
  2. +34
    -0
      B3QingDaoWanFu/BLActions/BLActionUtil.cs
  3. +82
    -0
      B3QingDaoWanFu/BLActions/SaleOrderBLAction.cs

+ 6
- 2
B3QingDaoWanFu/B3QingDaoWanFu.csproj View File

@ -69,11 +69,13 @@
<Reference Include="B3Sale, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3a973053c7ebf11c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\tsref\Debug\B3Sale.dll</HintPath>
<Private>False</Private></Reference>
<Private>False</Private>
</Reference>
<Reference Include="b3saleinterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3a973053c7ebf11c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\tsref\Debug\b3saleinterface.dll</HintPath>
<Private>False</Private></Reference>
<Private>False</Private>
</Reference>
<Reference Include="B3UnitedInfos, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\BwpB3Project\tsref\Debug\B3UnitedInfos.dll</HintPath>
@ -130,7 +132,9 @@
<Compile Include="..\..\..\version\Customer_version.cs">
<Link>Customer_version.cs</Link>
</Compile>
<Compile Include="BLActions\BLActionUtil.cs" />
<Compile Include="BLActions\SaleForecastBLAction.cs" />
<Compile Include="BLActions\SaleOrderBLAction.cs" />
<Compile Include="BL\CustomerDeviceSetBL.cs" />
<Compile Include="BO\CustomerDeviceSet.cs" />
<Compile Include="DataPatchs\StatPaySetBillNeedValue20171123.cs" />


+ 34
- 0
B3QingDaoWanFu/BLActions/BLActionUtil.cs View File

@ -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];
}
}
}
}
}

+ 82
- 0
B3QingDaoWanFu/BLActions/SaleOrderBLAction.cs View File

@ -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<string> Features
{
get { return new List<string>(); }
}
}
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<string> Features
{
get { return new List<string>(); }
}
}
}

Loading…
Cancel
Save