diff --git a/B3ButcherManageToSale/TypeIOCs/ForecastButcherInfo.cs b/B3ButcherManageToSale/TypeIOCs/ForecastButcherInfo.cs index e5f5726..fe1f72c 100644 --- a/B3ButcherManageToSale/TypeIOCs/ForecastButcherInfo.cs +++ b/B3ButcherManageToSale/TypeIOCs/ForecastButcherInfo.cs @@ -75,5 +75,17 @@ namespace BWP.B3ButcherManageToSale.TypeIOCs query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Stopped", false), DQCondition.EQ("Domain_ID", DomainContext.Current.ID))); return query.EExecuteList>(session); } + + public Money? GetGoodsSaleOutStoreNumber(IDmoContext context, long storeID, DateTime date, long goodsID) + { + var main = new JoinAlias("_main", typeof(SaleOutStore)); + var detail = new JoinAlias(typeof(SaleOutStore_Detail)); + var query = new DQueryDom(main); + query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "SaleOutStore_ID")); + query.Columns.Add(DQSelectColumn.Sum(detail, "UnitNum")); + query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ(DQExpression.Snippet("cast(_main.LoadTime as date)"), DQExpression.Value(date)), DQCondition.EQ("BillState", 单据状态.未审核), DQCondition.IsNotNull(DQExpression.Field(detail, "UnitNum")))); + query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ(detail, "SaleGoods_ID", goodsID), DQCondition.EQ("Store_ID", storeID))); + return query.EExecuteScalar?>(context.Session); + } } }