This commit is contained in:
gongxh
2021-05-21 09:51:10 +08:00
4 changed files with 33 additions and 8 deletions

View File

@@ -138,7 +138,7 @@ SELECT m..mocode, md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitNam
FROM mom_order m WITH (NOLOCK) INNER JOIN
mom_orderdetail md WITH (NOLOCK) ON m.MoId = md.MoId INNER JOIN
mom_moallocate ma WITH (NOLOCK) ON md.MoDId = ma.MoDId
INNER JOIN
left JOIN
mom_motype motype WITH (NOLOCK) ON motype.MoTypeId = md.MoTypeId
INNER JOIN
(SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) wqty
@@ -226,7 +226,7 @@ SELECT m..mocode, md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitNam
FROM mom_order m WITH (NOLOCK) INNER JOIN
mom_orderdetail md WITH (NOLOCK) ON m.MoId = md.MoId INNER JOIN
mom_moallocate ma WITH (NOLOCK) ON md.MoDId = ma.MoDId
INNER JOIN
left JOIN
mom_motype motype WITH (NOLOCK) ON motype.MoTypeId = md.MoTypeId
INNER JOIN
(SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) wqty
@@ -368,13 +368,13 @@ SELECT m..mocode, md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitNam
where convert(varchar,b.dDate,112) between convert(varchar,dateadd(day,-day(dateadd(month,-3,getdate()))+1,dateadd(month,-3,getdate())),112)
and convert(varchar,dateadd(day,-day(dateadd(month,-3,getdate())),dateadd(month,1,dateadd(month,-3,getdate()))),112)
group by a.cinvcode
) a2 on a.cInvCode =a2.cInvCode
) a3 on a.cInvCode =a3.cInvCode
full join
(select left(convert(varchar,dateadd(month,-2,getdate()),112),6) as month1 , a.cinvcode, sum(a.iQuantity) as iQuantity from rdrecords11 a WITH (nolock) left join rdrecord11 b WITH (nolock) on a.id=b.id
where convert(varchar,b.dDate,112) between convert(varchar,dateadd(day,-day(dateadd(month,-2,getdate()))+1,dateadd(month,-2,getdate())),112)
and convert(varchar,dateadd(day,-day(dateadd(month,-2,getdate())),dateadd(month,1,dateadd(month,-2,getdate()))),112)
group by a.cinvcode
) a3 on a.cInvCode =a3.cInvCode
) a2 on a.cInvCode =a2.cInvCode
full join
(select left(convert(varchar,dateadd(month,-4,getdate()),112),6) as month1 , a.cinvcode, sum(a.iQuantity) as iQuantity from rdrecords11 a WITH (nolock) left join rdrecord11 b WITH (nolock) on a.id=b.id
where convert(varchar,b.dDate,112) between convert(varchar,dateadd(day,-day(dateadd(month,-4,getdate()))+1,dateadd(month,-4,getdate())),112)
@@ -547,7 +547,8 @@ SELECT m..mocode, md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitNam
{
string sql = $@"
Select cpoid,CONVERT(varchar(100),dpodate, 23) as dpodate,zpurpoheader.cvenabbname,zpurpotail.cinvcode,zpurpotail.cinvname,zpurpotail.cinvstd,zpurpotail.cinvm_unit,zpurpotail.ireceivedqty,
iquantity,prd.rqty,CONVERT(varchar(100), zpurpotail.darrivedate, 23) as darrivedate,cupsocode, CONVERT(varchar(100), d.ddate, 23) as ddate, CONVERT(varchar(100), c.drequirdate, 23) as drequirdate
iquantity,prd.rqty,CONVERT(varchar(100), zpurpotail.darrivedate, 23) as darrivedate,cupsocode, CONVERT(varchar(100), d.ddate, 23) as ddate, CONVERT(varchar(100), c.drequirdate, 23) as drequirdate,
zpurpotail.cbcloser,zpurpoheader.ccloser
From zpurpoheader with(nolock) inner join zpurpotail with(nolock) on zpurpoheader.poid=zpurpotail.poid
left join pu_appbody c with(nolock) on zpurpotail.iAppIds =c.autoid
left join pu_apphead d with(nolock) on d.id =c.id
@@ -598,7 +599,10 @@ SELECT m..mocode, md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitNam
where.Add(" d.dDate between @beginDate2 and @endDate2 ");
}
if (!info1.byFinish)
{
where.Add(" isnull(zpurpotail.cbcloser,'') ='' ");
}
var aa = string.Join(" and ", where.ToArray());
if (!string.IsNullOrEmpty(aa))