stringwhere=$" 1=1 and o.{nameof(RB_Goods_Order.Status)}=0 and o.OrderStatus=2";
stringwhere="";
if(dmodel.IsOut==0)
{
where=$" 1=1 and o.{nameof(RB_Goods_Order.Status)}=0 and o.OrderStatus =2";
}
else
{
where=$" 1=1 and o.{nameof(RB_Goods_Order.Status)}=0 and o.OrderStatus in(2,3,4,5,6)";
}
stringchildreWhere="";
stringchildreWhere="";
stringoutWhere="";
stringoutWhere="";
if(dmodel.TenantId>0)
if(dmodel.TenantId>0)
...
@@ -519,8 +538,16 @@ where {where} order by o.CreateDate desc";
...
@@ -519,8 +538,16 @@ where {where} order by o.CreateDate desc";
where+=$@" and od.{nameof(RB_Goods_OrderDetail.ProductCode)} like '%{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})";
if(dmodel.IsOut==0)
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} )";
{
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} )";
}
elseif(dmodel.IsOut==1)
{
where+=$" and( od.Id in (SELECT OrderDetailId from rb_goods_expressrelevance where 1=1 {childreWhere})";
where+=@$" or od.Id 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
stringsql=$@"SELECT od.*,o.OrderNo FROM rb_goods_orderdetail od
INNER JOIN rb_goods_order o on o.OrderId=od.OrderId
INNER JOIN rb_goods_order o on o.OrderId=od.OrderId
where {where} order by o.CreateDate desc";
where {where} order by o.CreateDate desc";
...
@@ -578,7 +605,8 @@ where {where} order by o.CreateDate desc";
...
@@ -578,7 +605,8 @@ where {where} order by o.CreateDate desc";
{
{
where+=$@" and o.{nameof(RB_Goods_Order.OrderNo)} ='{dmodel.OrderNo}'";
where+=$@" and o.{nameof(RB_Goods_Order.OrderNo)} ='{dmodel.OrderNo}'";
}
}
if(dmodel.UserId>0){
if(dmodel.UserId>0)
{
where+=$@" and o.{nameof(RB_Goods_Order.UserId)} ={dmodel.UserId}";
where+=$@" and o.{nameof(RB_Goods_Order.UserId)} ={dmodel.UserId}";