导入工具

This commit is contained in:
杰 朱
2021-05-26 08:50:35 +08:00
parent f953c9576e
commit 1ccaebd4c9
9 changed files with 62 additions and 55 deletions

View File

@@ -74,7 +74,7 @@ namespace NX.ERP.U8.Finance
if (!string.IsNullOrEmpty(aa))
{
sql += "where " + aa;
sql += " where " + aa;
}
using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection)

View File

@@ -143,7 +143,7 @@ SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate ,CONVER
ELSE '其它'
END AS std,dtyl.dtty, ma.Qty qty1, ma.IssQty issqty,(ma.Qty-ma.IssQty) as wll,mdsss.mdqty,shwl.shwl,sdwl.sdwl
,mas.wqty wqty, ISNULL(cs.qty, 0) cqty, ISNULL(misss.issqty, 0) issqtyxc,ISNULL(ds.qty, 0) dqty,isnull(prd.Rqty, 0) rqty,
ISNULL(OMM.RQTY1, 0) AS rqty1, ISNULL(pu_App.RQTY3, 0) AS rqty3,ISNULL(momq.momqty, 0) AS momqty, ISNULL(MX.MQTY, 0) MQTY, 0-(mas.wqty - isnull(ds.qty, 0) - ISNULL(prd.Rqty, 0)
ISNULL(OMM.RQTY1, 0) AS rqty1, ISNULL(pu_App.RQTY3, 0) AS rqty3,ISNULL(MX.MQTY, 0) momqty, 0-(mas.wqty - isnull(ds.qty, 0) - ISNULL(prd.Rqty, 0)
- ISNULL(omm.RQTY1, 0) - ISNULL(MX.MQTY, 0)- ISNULL(pu_App.RQTY3, 0)) AS q, motype.description,
CASE WHEN md.Status = 2 THEN '锁定' WHEN md.Status = 4 THEN '关闭' WHEN md.Status = 3 THEN '审核' ELSE '新建' END AS st, md.Status
FROM mom_order m WITH (NOLOCK) INNER JOIN
@@ -184,11 +184,11 @@ SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate ,CONVER
GROUP BY ma.InvCode) shwl ON ma.InvCode = shwl.InvCode LEFT JOIN
(SELECT mom.MoCode, ma.invcode,SUM(isnull(ma.qty, 0)) dtty
(SELECT mom.MoCode, ma.invcode,round(SUM(isnull(ma.qty, 0))/md.Qty,3) dtty
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 ) dtyl ON ma.InvCode = dtyl.InvCode and dtyl.MoCode=m.MoCode LEFT JOIN
GROUP BY ma.InvCode,mom.MoCode,md.Qty ) dtyl ON ma.InvCode = dtyl.InvCode and dtyl.MoCode=m.MoCode LEFT JOIN
(SELECT ma.invcode, SUM( isnull(issqty, 0)) issqty
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
@@ -261,7 +261,7 @@ SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate ,CONVER
ELSE '其它'
END AS std,dtyl.dtty, ma.Qty qty1, ma.IssQty issqty,(ma.Qty-ma.IssQty) as wll,mdsss.mdqty,shwl.shwl,sdwl.sdwl
,mas.wqty wqty, ISNULL(cs.qty, 0) cqty, ISNULL(misss.issqty, 0) issqtyxc,ISNULL(ds.qty, 0) dqty,isnull(prd.Rqty, 0) rqty,
ISNULL(OMM.RQTY1, 0) AS rqty1, ISNULL(pu_App.RQTY3, 0) AS rqty3,ISNULL(momq.momqty, 0) AS momqty, ISNULL(MX.MQTY, 0) MQTY, 0-(mas.wqty - isnull(ds.qty, 0) - ISNULL(prd.Rqty, 0)
ISNULL(OMM.RQTY1, 0) AS rqty1, ISNULL(pu_App.RQTY3, 0) AS rqty3,ISNULL(MX.MQTY, 0) momqty, 0-(mas.wqty - isnull(ds.qty, 0) - ISNULL(prd.Rqty, 0)
- ISNULL(omm.RQTY1, 0) - ISNULL(MX.MQTY, 0)- ISNULL(pu_App.RQTY3, 0)) AS q, motype.description,
CASE WHEN md.Status = 2 THEN '锁定' WHEN md.Status = 4 THEN '关闭' WHEN md.Status = 3 THEN '审核' ELSE '新建' END AS st, md.Status
FROM mom_order m WITH (NOLOCK) INNER JOIN
@@ -303,11 +303,11 @@ SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate ,CONVER
GROUP BY ma.InvCode) shwl ON ma.InvCode = shwl.InvCode LEFT JOIN
(SELECT mom.MoCode, ma.invcode,SUM(isnull(ma.qty, 0)) dtty
(SELECT mom.MoCode, ma.invcode,round(SUM(isnull(ma.qty, 0))/md.Qty,3) dtty
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 ) dtyl ON ma.InvCode = dtyl.InvCode and dtyl.MoCode=m.MoCode LEFT JOIN
GROUP BY ma.InvCode,mom.MoCode,md.Qty ) dtyl ON ma.InvCode = dtyl.InvCode and dtyl.MoCode=m.MoCode LEFT JOIN
(SELECT ma.invcode, SUM( isnull(issqty, 0)) issqty
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN

View File

@@ -203,7 +203,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,
@@ -250,8 +250,8 @@ namespace NX.ERP.U8.Purchase
pu_appbody ommds WITH (nolock) ON omm.id = ommds.id LEFT JOIN
(SELECT iAppIds, sum(iquantity) AS qty
FROM PO_Podetails WITH (nolock)
GROUP BY iAppIds) rds ON ommds.autoid = rds.iAppIds
WHERE ISNULL(OMM.cCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND
GROUP BY iAppIds) rds ON isnull(ommds.autoid,'') = isnull(rds.iAppIds,'')
WHERE ISNULL(OMM.cCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND ISNULL(rds.qty, 0)=0 and ommds.iReceivedQTY=0 and
ommds.fquantity - ISNULL(rds.qty, 0) > 0) OM
GROUP BY cInvCode
) as tbl1
@@ -282,8 +282,8 @@ namespace NX.ERP.U8.Purchase
pu_appbody ommds WITH (nolock) ON omm.id = ommds.id LEFT JOIN
(SELECT iAppIds, sum(iquantity) AS qty
FROM PO_Podetails WITH (nolock)
GROUP BY iAppIds) rds ON ommds.autoid = rds.iAppIds
WHERE ISNULL(OMM.cCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND DATEDIFF(day,ddate ,GETDATE()) >=3 and
GROUP BY iAppIds) rds ON isnull(ommds.autoid,'') = isnull(rds.iAppIds,'')
WHERE ISNULL(OMM.cCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND ISNULL(rds.qty, 0)=0 and ommds.iReceivedQTY=0 and DATEDIFF(day,ddate ,GETDATE()) >=3 and
ommds.fquantity - ISNULL(rds.qty, 0) > 0) OM
GROUP BY cInvCode
) as tbl1
@@ -385,6 +385,7 @@ namespace NX.ERP.U8.Purchase
";
@@ -404,11 +405,11 @@ namespace NX.ERP.U8.Purchase
pu_appbody ommds WITH (nolock) ON omm.id = ommds.id LEFT JOIN
(SELECT iAppIds, sum(iquantity) AS qty
FROM PO_Podetails WITH (nolock)
GROUP BY iAppIds) rds ON ommds.autoid = rds.iAppIds
GROUP BY iAppIds) rds ON isnull(ommds.autoid,'') = isnull(rds.iAppIds,'')
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, PO_Podetails b where a.poid=b.poid)
as c where c.rownumber=1) f on ommds.cInvCode =f.cInvCode
WHERE ISNULL(OMM.cCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND
WHERE ISNULL(OMM.cCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND ISNULL(rds.qty, 0)=0 and ommds.iReceivedQTY=0 AND
ommds.fquantity - ISNULL(rds.qty, 0) > 0 ) puu
";