修订,离职交接配置
This commit is contained in:
@@ -168,7 +168,7 @@ SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate ,md.Rem
|
||||
mom_moallocate ma WITH (NOLOCK) ON md.MoDId = ma.MoDId
|
||||
left JOIN
|
||||
mom_motype motype WITH (NOLOCK) ON motype.MoTypeId = md.MoTypeId
|
||||
INNER JOIN
|
||||
left JOIN
|
||||
(SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) wqty
|
||||
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
||||
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId
|
||||
@@ -199,12 +199,14 @@ SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate ,md.Rem
|
||||
WHERE md.Status = 3
|
||||
GROUP BY ma.InvCode) shwl ON ma.InvCode = shwl.InvCode LEFT JOIN
|
||||
|
||||
|
||||
(SELECT mom.MoCode, ma.invcode,round(SUM(isnull(ma.qty, 0))/md.Qty,3) dtty
|
||||
(select a.MoCode ,a.InvCode ,a.MoDId ,(a.dtty/b.Qty) as dtty from (
|
||||
SELECT mom.MoCode, ma.invcode,round(SUM(isnull(ma.qty, 0)),3) dtty, md.MoDId
|
||||
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
||||
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId left join
|
||||
mom_order mom WITH (NOLOCK) on md.MoId=mom.MoId
|
||||
GROUP BY ma.InvCode,mom.MoCode,md.Qty ) dtyl ON ma.InvCode = dtyl.InvCode and dtyl.MoCode=m.MoCode LEFT JOIN
|
||||
mom_order mom WITH (NOLOCK) on md.MoId=mom.MoId
|
||||
|
||||
GROUP BY ma.InvCode,mom.MoCode, md.MoDId ) a left join mom_orderdetail b WITH (NOLOCK) ON a.MoDId = b.MoDId ) dtyl ON ma.InvCode = dtyl.InvCode and dtyl.MoCode=m.MoCode and md.MoDId= dtyl.MoDId
|
||||
LEFT JOIN
|
||||
|
||||
(SELECT ma.invcode, SUM( isnull(issqty, 0)) issqty
|
||||
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
||||
@@ -288,7 +290,7 @@ SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate,md.Rema
|
||||
mom_moallocate ma WITH (NOLOCK) ON md.MoDId = ma.MoDId
|
||||
left JOIN
|
||||
mom_motype motype WITH (NOLOCK) ON motype.MoTypeId = md.MoTypeId
|
||||
INNER JOIN
|
||||
left JOIN
|
||||
(SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) wqty
|
||||
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
||||
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId
|
||||
@@ -321,11 +323,14 @@ SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate,md.Rema
|
||||
GROUP BY ma.InvCode) shwl ON ma.InvCode = shwl.InvCode LEFT JOIN
|
||||
|
||||
|
||||
(SELECT mom.MoCode, ma.invcode,round(SUM(isnull(ma.qty, 0))/md.Qty,3) dtty
|
||||
(select a.MoCode ,a.InvCode ,a.MoDId ,(a.dtty/b.Qty) as dtty from (
|
||||
SELECT mom.MoCode, ma.invcode,round(SUM(isnull(ma.qty, 0)),3) dtty, md.MoDId
|
||||
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
||||
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId left join
|
||||
mom_order mom WITH (NOLOCK) on md.MoId=mom.MoId
|
||||
GROUP BY ma.InvCode,mom.MoCode,md.Qty ) dtyl ON ma.InvCode = dtyl.InvCode and dtyl.MoCode=m.MoCode LEFT JOIN
|
||||
mom_order mom WITH (NOLOCK) on md.MoId=mom.MoId
|
||||
|
||||
GROUP BY ma.InvCode,mom.MoCode, md.MoDId ) a left join mom_orderdetail b WITH (NOLOCK) ON a.MoDId = b.MoDId ) dtyl ON ma.InvCode = dtyl.InvCode and dtyl.MoCode=m.MoCode and md.MoDId= dtyl.MoDId
|
||||
LEFT JOIN
|
||||
|
||||
(SELECT ma.invcode, SUM( isnull(issqty, 0)) issqty
|
||||
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
||||
|
||||
@@ -211,7 +211,7 @@ namespace NX.ERP.U8.Purchase
|
||||
public IEnumerable<object> Purchasesum(NX.ERP.Model.Request.PurchasesumRequest info)
|
||||
{
|
||||
string sql = $@"
|
||||
DECLARE @RdRecord table(
|
||||
DECLARE @RdRecord table(
|
||||
cPsn_Num nvarchar(30),
|
||||
cpersonname nvarchar(30),
|
||||
puappnumall int,
|
||||
@@ -273,7 +273,11 @@ namespace NX.ERP.U8.Purchase
|
||||
as tbl on tbl1.cinvcode=tbl.cInvCode
|
||||
) q group by cPsn_Num
|
||||
|
||||
update a set a.puappnumall=b.puappnumall From @RdRecord a left join @RdRecord2 b on a.cpersonname =b.cpersonname
|
||||
update a set a.cpersonname=b.receive From @RdRecord2 a left join CGBB2021_0001_E001 b WITH (NOLOCK) on a.cpersonname =b.quit
|
||||
where b.quit is not null
|
||||
|
||||
update a set a.puappnumall=b.puappnumall From @RdRecord a left join
|
||||
(select cpersonname,sum(puappnumall) as puappnumall from @RdRecord2 group by cpersonname ) b on a.cpersonname =b.cpersonname
|
||||
|
||||
update a set a.puappnumall= a.puappnumall +b.puappnumall From @RdRecord a left join (
|
||||
select '其他' as cpersonname ,sum(puappnumall) as puappnumall from @RdRecord2 where cpersonname not in (select cpersonname From @RdRecord) )b on a.cpersonname =b.cpersonname
|
||||
@@ -305,7 +309,11 @@ namespace NX.ERP.U8.Purchase
|
||||
as tbl on tbl1.cinvcode=tbl.cInvCode
|
||||
) q group by cPsn_Num
|
||||
|
||||
update a set a.puappnum03=b.puappnumall From @RdRecord a left join @RdRecord3 b on a.cpersonname =b.cpersonname
|
||||
update a set a.cpersonname=b.receive From @RdRecord3 a left join CGBB2021_0001_E001 b WITH (NOLOCK) on a.cpersonname =b.quit
|
||||
where b.quit is not null
|
||||
|
||||
update a set a.puappnum03=b.puappnumall From @RdRecord a left join
|
||||
(select cpersonname,sum(puappnumall) as puappnumall from @RdRecord3 group by cpersonname) b on a.cpersonname =b.cpersonname
|
||||
|
||||
update a set a.puappnum03= a.puappnum03 +b.puappnumall From @RdRecord a left join (
|
||||
select '其他' as cpersonname ,sum(puappnumall) as puappnumall from @RdRecord3 where cpersonname not in (select cpersonname From @RdRecord) )b on a.cpersonname =b.cpersonname
|
||||
@@ -342,8 +350,12 @@ namespace NX.ERP.U8.Purchase
|
||||
as tbl on tbl1.cinvcode=tbl.cInvCode )
|
||||
q group by cPsn_Num
|
||||
|
||||
update a set a.cpersonname=b.receive From @RdRecord4 a left join CGBB2021_0001_E001 b WITH (NOLOCK) on a.cpersonname =b.quit
|
||||
where b.quit is not null
|
||||
|
||||
update a set a.mommouth02=b.puappnumall From @RdRecord a left join @RdRecord4 b on a.cpersonname =b.cpersonname
|
||||
update a set a.mommouth02=b.puappnumall From @RdRecord a left join
|
||||
(select cpersonname,sum(puappnumall) as puappnumall from @RdRecord4 group by cpersonname
|
||||
) b on a.cpersonname =b.cpersonname
|
||||
|
||||
update a set a.mommouth02= a.mommouth02 +b.mommouth02 From @RdRecord a left join (
|
||||
select '其他' as cpersonname ,sum(puappnumall) as mommouth02 from @RdRecord4 where cpersonname not in (select cpersonname From @RdRecord) )b on a.cpersonname =b.cpersonname
|
||||
@@ -379,21 +391,28 @@ namespace NX.ERP.U8.Purchase
|
||||
as tbl on tbl1.cinvcode=tbl.cInvCode )
|
||||
q group by cPsn_Num
|
||||
|
||||
|
||||
update a set a.cpersonname=b.receive From @RdRecord5 a left join CGBB2021_0001_E001 b WITH (NOLOCK) on a.cpersonname =b.quit
|
||||
where b.quit is not null
|
||||
|
||||
|
||||
update a set a.mommouth04=b.puappnumall From @RdRecord a left join @RdRecord5 b on a.cpersonname =b.cpersonname
|
||||
update a set a.mommouth04=b.puappnumall From @RdRecord a left join (
|
||||
select cpersonname,sum(puappnumall) as puappnumall from @RdRecord5 group by cpersonname) b on a.cpersonname =b.cpersonname
|
||||
|
||||
update a set a.mommouth04= a.mommouth04 +b.mommouth04 From @RdRecord a left join (
|
||||
select '其他' as cpersonname ,sum(puappnumall) as mommouth04 from @RdRecord5 where cpersonname not in (select cpersonname From @RdRecord) )b on a.cpersonname =b.cpersonname
|
||||
where a.cpersonname='其他'
|
||||
|
||||
|
||||
delete from @RdRecord where cpersonname in (select quit from CGBB2021_0001_E001)
|
||||
|
||||
|
||||
select *from @RdRecord
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
";
|
||||
|
||||
|
||||
@@ -407,8 +426,24 @@ namespace NX.ERP.U8.Purchase
|
||||
public IEnumerable<object> Purchasesumpuapp(NX.ERP.Model.Request.PurchasesumRequest info)
|
||||
{
|
||||
string sql = $@"
|
||||
select *from (
|
||||
SELECT omm.ccode, CONVERT(varchar(100), omm.ddate, 23) as dDatel, omm.ddate ,ommds.cInvCode,ommds.cinvname, ommds.cinvstd,ommds.fquantity - ISNULL(rds.qty, 0) as RQTY,isnull(f.cMaker,'其他') as cMaker
|
||||
IF EXISTS (SELECT NAME FROM tempdb..SYSOBJECTS WHERE NAME ='tablepuapp20210625' AND Xtype='U') DROP Table tempdb..tablepuapp20210625
|
||||
create table tempdb..tablepuapp20210625 (
|
||||
ccode nvarchar(200),
|
||||
dDatel nvarchar(200),
|
||||
ddate datetime,
|
||||
cInvCode nvarchar(200),
|
||||
cinvname nvarchar(500),
|
||||
cinvstd nvarchar(500),
|
||||
RQTY decimal(28, 6),
|
||||
cMaker nvarchar(200)
|
||||
)
|
||||
CREATE INDEX IX_test ON tempdb..tablepuapp20210625 (cinvcode)
|
||||
|
||||
|
||||
insert into tempdb..tablepuapp20210625
|
||||
|
||||
select *from (
|
||||
SELECT omm.ccode, CONVERT(varchar(100), omm.ddate, 23) as dDatel, omm.ddate ,ommds.cInvCode,ommds.cinvname, ommds.cinvstd,ommds.fquantity - ISNULL(rds.qty, 0) as RQTY,isnull(isnull(k.receive ,f.cMaker),'其他') as cMaker
|
||||
FROM pu_AppHead omm WITH (nolock) INNER JOIN
|
||||
pu_appbody ommds WITH (nolock) ON omm.id = ommds.id LEFT JOIN
|
||||
(SELECT iAppIds, sum(iquantity) AS qty
|
||||
@@ -417,8 +452,15 @@ namespace NX.ERP.U8.Purchase
|
||||
left join
|
||||
(select cInvCode,cMaker from ( select cInvCode,ROW_NUMBER() over( partition by b.cInvCode order by a.poid desc) as rownumber ,a.cMaker from PO_Pomain a WITH (nolock), PO_Podetails b WITH (nolock) where a.poid=b.poid)
|
||||
as c where c.rownumber=1) f on ommds.cInvCode =f.cInvCode
|
||||
left join CGBB2021_0001_E001 k WITH (NOLOCK) on f.cMaker =k.quit
|
||||
WHERE ISNULL(OMM.cCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND ISNULL(omm.cverifier, N'') <> N'' AND ISNULL(rds.qty, 0)=0 and ommds.iReceivedQTY=0 AND
|
||||
ommds.fquantity - ISNULL(rds.qty, 0) > 0 ) puu
|
||||
ommds.fquantity - ISNULL(rds.qty, 0) > 0 ) puapp
|
||||
|
||||
update tempdb..tablepuapp20210625 set cmaker='其他' where cMaker not in ( select cPsn_Name from hr_v_HR31_show WITH (NOLOCK) where cDepCode ='52' and rEmployState ='在职')
|
||||
and cMaker not in (select quit from CGBB2021_0001_E001 WITH (NOLOCK))
|
||||
|
||||
|
||||
select *From tempdb..tablepuapp20210625 puu
|
||||
";
|
||||
|
||||
List<string> where = new List<string>();
|
||||
@@ -453,8 +495,9 @@ namespace NX.ERP.U8.Purchase
|
||||
public IEnumerable<object> Purchasesummom(NX.ERP.Model.Request.PurchasesumRequest info)
|
||||
{
|
||||
string sql = $@"
|
||||
DECLARE @RdRecord table(
|
||||
CINVCODE nvarchar(200),
|
||||
IF EXISTS (SELECT NAME FROM tempdb..SYSOBJECTS WHERE NAME ='tablemom20210625' AND Xtype='U') DROP Table tempdb..tablemom20210625
|
||||
create table tempdb..tablemom20210625 (
|
||||
CINVCODE nvarchar(200),
|
||||
RQTY int,
|
||||
iqty int,
|
||||
iQuantity int,
|
||||
@@ -462,10 +505,12 @@ namespace NX.ERP.U8.Purchase
|
||||
cpersonname nvarchar(200),
|
||||
cInvName nvarchar(200),
|
||||
cInvStd nvarchar(500)
|
||||
)
|
||||
insert into @RdRecord
|
||||
)
|
||||
|
||||
|
||||
insert into tempdb..tablemom20210625
|
||||
select *from (
|
||||
select a.*,isnull(f.cMaker,'其他') as cpersonname ,inv.cInvName,inv.cInvStd from (
|
||||
select a.*,isnull(isnull(k.receive ,f.cMaker),'其他') as cpersonname ,inv.cInvName,inv.cInvStd from (
|
||||
select a.InvCode as CINVCODE ,1 as RQTY , iqty,cur.iQuantity, (cur.iQuantity-iqty) as bull From (
|
||||
SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) iqty
|
||||
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
|
||||
@@ -480,12 +525,14 @@ namespace NX.ERP.U8.Purchase
|
||||
) a left join
|
||||
(select cInvCode,cMaker from ( select cInvCode,ROW_NUMBER() over( partition by b.cInvCode order by a.poid desc) as rownumber ,a.cMaker from PO_Pomain a WITH (NOLOCK), PO_Podetails b WITH (NOLOCK) where a.poid=b.poid)
|
||||
as c where c.rownumber=1) f on a.CINVCODE=f.cInvCode
|
||||
left join CGBB2021_0001_E001 k WITH (NOLOCK) on f.cMaker =k.quit
|
||||
left join Inventory inv WITH (NOLOCK) on a.CINVCODE=inv.cInvCode )pumo
|
||||
|
||||
update @RdRecord set cpersonname ='其他' where cpersonname not in ( select cPsn_Name from hr_v_HR31_show where cDepCode ='52' and rEmployState ='在职')
|
||||
update tempdb..tablemom20210625 set cpersonname ='其他' where cpersonname not in ( select cPsn_Name from hr_v_HR31_show WITH (NOLOCK) where cDepCode ='52' and rEmployState ='在职')
|
||||
and cpersonname not in (select quit from CGBB2021_0001_E001 WITH (NOLOCK))
|
||||
|
||||
|
||||
select *From @RdRecord
|
||||
select *From tempdb..tablemom20210625
|
||||
";
|
||||
|
||||
List<string> where = new List<string>();
|
||||
|
||||
@@ -50,6 +50,18 @@
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
<div>
|
||||
<Row :gutter="16">
|
||||
<Col span="15">
|
||||
<label></label>
|
||||
|
||||
</Col>
|
||||
<Col span="4">
|
||||
<label>默认不勾选查应领大于已领量,勾选则已领>0</label>
|
||||
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
|
||||
<Table
|
||||
style="margin-top: 20px"
|
||||
|
||||
Reference in New Issue
Block a user