|
|
|
@ -12,13 +12,12 @@ using Forks.EnterpriseServices.DomainObjects2.DQuery; |
|
|
|
using Forks.EnterpriseServices.SqlDoms; |
|
|
|
using Forks.Utils; |
|
|
|
using TSingSoft.WebPluginFramework; |
|
|
|
using BWP.B3ButcherManage.BO; |
|
|
|
|
|
|
|
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) |
|
|
|
{ |
|
|
|
@ -30,29 +29,57 @@ namespace BWP.B3QingDaoWanFu.TypeIOCs |
|
|
|
|
|
|
|
private Money<decimal>? 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<Money<decimal>?>(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 config = new B3ButcherManageOnlineConfiguration(); |
|
|
|
if (string.IsNullOrEmpty(config.TraceBackServerUrl)) |
|
|
|
return; |
|
|
|
var detail = new JoinAlias(typeof(SaleOutStore_Detail)); |
|
|
|
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(weight), DQCondition.And(DQCondition.EQ(detail, "ID", weight, "DetailID"), DQCondition.EQ("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("BarCode", scan)); |
|
|
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ(detail, "SaleOutStore_ID", dmo.ID), DQCondition.IsNotNull(DQExpression.Field(scan, "ID")))); |
|
|
|
|
|
|
|
var list = query.EExecuteList<string>(context.Session); |
|
|
|
if (!list.Any()) |
|
|
|
return; |
|
|
|
|
|
|
|
var letList = list.Select(x => new TraceBackInfo { Code = x, SendCustomer = dmo.Customer_Name, CarNo = dmo.Car_Name, SendDate = dmo.LoadTime.Value.ToString("yyyyMMdd") }); |
|
|
|
TraceBackInfoUtil.Insert(config.TraceBackServerUrl, letList.ToList()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |