新增:
1.客户价格管理 2.销售订单表单插件取值
This commit is contained in:
74
Gatedge.K3.Pilot.PlugIn/Services/DBService/BDCustPriceDAL.cs
Normal file
74
Gatedge.K3.Pilot.PlugIn/Services/DBService/BDCustPriceDAL.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using Kingdee.BOS;
|
||||
using Kingdee.BOS.Orm.DataEntity;
|
||||
using Kingdee.BOS.ServiceHelper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Gatedge.K3.Pilot.PlugIn.Services.DBService
|
||||
{
|
||||
public class BDCustPriceDAL : BaseDAL
|
||||
{
|
||||
public BDCustPriceDAL(Context context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取物料的协议价、大客户底价
|
||||
/// </summary>
|
||||
/// <param name="materialId"></param>
|
||||
/// <param name="custId"></param>
|
||||
/// <param name="dateTime"></param>
|
||||
/// <returns></returns>
|
||||
public DynamicObjectCollection GetMaterialPrice(int materialId, int custId, string dateTime)
|
||||
{
|
||||
var sql = $@"/*dialect*/
|
||||
declare @FMaterialID int,@custId int,@dateTime datetime
|
||||
SET @custId = {custId}
|
||||
SET @FMaterialID = {materialId}
|
||||
SET @dateTime = '{dateTime}'
|
||||
SELECT t0.FMATERIALID,t0.FNUMBER,t0.FUSEORGID
|
||||
,t0_l.FNAME,t0_l.FSPECIFICATION,ISNULL(t1.F_AGREEPRICE,0) AS F_AGREEPRICE,ISNULL(t2.F_BIGCUSTSETTLEPRICE,0) AS F_BIGCUSTSETTLEPRICE
|
||||
FROM T_BD_MATERIAL t0
|
||||
INNER JOIN T_BD_MATERIAL_L t0_l on t0_l.FMATERIALID = t0.FMATERIALID AND t0_l.FLOCALEID = 2052
|
||||
OUTER APPLY (
|
||||
SELECT TOP 1 t1e.F_AGREEPRICE
|
||||
FROM T_BD_CustPrice t1
|
||||
INNER JOIN T_BD_CustPriceEntry t1e on t1.FID = t1e.FID
|
||||
INNER JOIN T_BD_CustPriceCustEntry t1ce on t1.FID = t1ce.FID
|
||||
AND t1ce.FCUSTID = @custId
|
||||
WHERE t1.FLIMITCUSTOMER = '2'
|
||||
AND t1.FDOCUMENTSTATUS = 'C'
|
||||
AND t1.FFORBIDSTATUS = 'A'
|
||||
AND t1e.FROWAUDITSTATUS = 'A'
|
||||
AND t1e.FFORBIDSTATUS = 'A'
|
||||
AND @dateTime BETWEEN t1e.FEFFECTIVEDATE AND t1e.FEXPRIYDATE
|
||||
AND t1.FUSEORGID = t0.FUSEORGID
|
||||
AND t1e.FMATERIALID = t0.FMATERIALID
|
||||
ORDER BY t1e.FMATERIALID
|
||||
) t1
|
||||
OUTER APPLY (
|
||||
SELECT TOP 1 t2e.F_BIGCUSTSETTLEPRICE
|
||||
FROM T_BD_CustPrice t2
|
||||
INNER JOIN T_BD_CustPriceEntry t2e on t2.FID = t2e.FID
|
||||
WHERE t2.FLIMITCUSTOMER = '1'
|
||||
AND t2.FDOCUMENTSTATUS = 'C'
|
||||
AND t2.FFORBIDSTATUS = 'A'
|
||||
AND t2e.FROWAUDITSTATUS = 'A'
|
||||
AND t2e.FFORBIDSTATUS = 'A'
|
||||
AND @dateTime BETWEEN t2e.FEFFECTIVEDATE AND t2e.FEXPRIYDATE
|
||||
AND t2.FUSEORGID = t0.FUSEORGID
|
||||
AND CHARINDEX(t2e.F_MATERIALMODELGROUP,t0_l.FSPECIFICATION) = 1
|
||||
ORDER BY t2e.FMATERIALID
|
||||
) t2
|
||||
WHERE 1 = 1
|
||||
AND t0.FMATERIALID = @FMaterialID
|
||||
";
|
||||
|
||||
|
||||
return DBServiceHelper.ExecuteDynamicObject(this.Context, sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Gatedge.K3.Pilot.PlugIn/Services/DBService/BaseDAL.cs
Normal file
18
Gatedge.K3.Pilot.PlugIn/Services/DBService/BaseDAL.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Kingdee.BOS;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Gatedge.K3.Pilot.PlugIn.Services.DBService
|
||||
{
|
||||
public class BaseDAL
|
||||
{
|
||||
public Context Context { get; private set; }
|
||||
public BaseDAL(Context context)
|
||||
{
|
||||
this.Context = context;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user