where+=$@" and od.{nameof(RB_Goods_OrderDetail.Id)} in({ids}) ";
}
if(!string.IsNullOrEmpty(dmodel.StartTime))
{
where+=$@" and o.{nameof(RB_Goods_Order.CreateDate)} >='{dmodel.StartTime}'";
}
if(!string.IsNullOrEmpty(dmodel.EndTime))
{
where+=$@" and o.{nameof(RB_Goods_Order.CreateDate)} <='{dmodel.EndTime} 23:59:59'";
}
if(!string.IsNullOrEmpty(dmodel.OrderNo))
{
where+=$@" and o.{nameof(RB_Goods_Order.OrderNo)} like '%{dmodel.OrderNo}%'";
}
if(!string.IsNullOrEmpty(dmodel.GoodsName))
{
where+=$@" and od.{nameof(RB_Goods_OrderDetail.GoodsName)} like '%{dmodel.GoodsName}%'";
}
if(!string.IsNullOrEmpty(dmodel.ProductCode))
{
where+=$@" and od.{nameof(RB_Goods_OrderDetail.ProductCode)} like '%{dmodel.ProductCode}%'";
}
where+=$" and od.Id not in (SELECT OrderDetailId from rb_goods_expressrelevance where 1=1 {childreWhere})";
where+=@$" AND od.Id NOT IN (SELECT OrderGoodsId FROM {Config.PropertyDB}.rb_warehouseout_goods AS g LEFT JOIN {Config.PropertyDB}.rb_warehouseout_apply AS ap ON g.applyId = ap.id WHERE ap.ApplyStatus in (1,2) {outWhere} )";
stringsql=$@"SELECT od.*,o.OrderNo FROM rb_goods_orderdetail od
INNER JOIN rb_goods_order o on o.OrderId=od.OrderId
builder.Append($" select * from {TableName} as a LEFT JOIN {TableNameApply} as b on a.ApplyId=b.ID where a.Status=0 and b.`Status`=0 and b.ApplyStatus in(1,2) ");
if(query!=null)
{
if(query.ID>0)
{
builder.Append($" AND a.{nameof(RB_WarehouseOut_Goods_Extend.ID)}={query.ID}");
}
if(query.ApplyId>0)
{
builder.Append($" AND a.{nameof(RB_WarehouseOut_Goods_Extend.ApplyId)}={query.ApplyId}");
}
if(query.TenantId>0)
{
builder.Append($" AND a.{nameof(RB_WarehouseOut_Goods_Extend.TenantId)}={query.TenantId}");
builder.Append($" AND b.{nameof(RB_WarehouseOut_Apply.TenantId)}={query.TenantId}");
}
if(query.MallBaseId>0)
{
builder.Append($" AND a.{nameof(RB_WarehouseOut_Goods_Extend.MallBaseId)}={query.MallBaseId}");
builder.Append($" AND b.{nameof(RB_WarehouseOut_Apply.MallBaseId)}={query.MallBaseId}");
}
if(!string.IsNullOrWhiteSpace(query.GoodsName))
{
builder.Append($" AND a.{nameof(RB_WarehouseOut_Goods_Extend.GoodsName)} like '%{query.GoodsName}%'");
}
if(query.SupplierId>0)
{
builder.Append($" AND a.{nameof(RB_WarehouseOut_Goods_Extend.SupplierId)}={query.SupplierId}");