This commit is contained in:
gongxh
2021-08-28 09:43:02 +08:00
4 changed files with 27 additions and 9 deletions

View File

@@ -16,5 +16,7 @@ namespace NX.ERP.Model.Request
public string MaterialName { get => _name; set => _name = value; }
public IEnumerable<string> BinCodes { get; set; }
}
}

View File

@@ -51,7 +51,7 @@ namespace NX.ERP.U8.Pmc
GROUP BY cInvCode) cs ON c.cInvCode = cs.cInvCode
LEFT JOIN
(SELECT cinvcode, SUM(iquantity) qty
FROM InvPositionSum WITH (NOLOCK) where cPosCode not in ('00701','00801','09001')
FROM InvPositionSum WITH (NOLOCK) where cPosCode not in ('00701','00801','09001') and cWhCode not in (4,5)
GROUP BY cInvCode) ds ON c.cInvCode = ds.cInvCode
LEFT JOIN
@@ -218,7 +218,7 @@ SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate ,md.Rem
GROUP BY cInvCode) cs ON ma.InvCode = cs.cInvCode
LEFT JOIN
(SELECT cinvcode, SUM(iquantity) qty
FROM InvPositionSum WITH (NOLOCK) where cPosCode not in ('00701','00801','09001')
FROM InvPositionSum WITH (NOLOCK) where cPosCode not in ('00701','00801','09001') and cWhCode not in (4,5)
GROUP BY cInvCode) ds ON ma.InvCode = ds.cInvCode
INNER JOIN
Inventory p WITH (NOLOCK) ON md.InvCode = p.cInvCode INNER JOIN
@@ -254,7 +254,12 @@ SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate ,md.Rem
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
union all
SELECT cupsoids as iAppIds , sum(iquantity) AS qty
FROM OM_MODetails WITH (nolock)
GROUP BY cupsoids
) rds ON ommds.autoid = rds.iAppIds
WHERE ISNULL(OMM.cCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND
ommds.fquantity - ISNULL(rds.qty, 0) > 0) OM
GROUP BY cInvCode) pu_App ON MA.INVCODE = pu_App.CINVCODE LEFT JOIN
@@ -342,7 +347,7 @@ SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate,md.Rema
GROUP BY cInvCode) cs ON ma.InvCode = cs.cInvCode
LEFT JOIN
(SELECT cinvcode, SUM(iquantity) qty
FROM InvPositionSum WITH (NOLOCK) where cPosCode not in ('00701','00801','09001')
FROM InvPositionSum WITH (NOLOCK) where cPosCode not in ('00701','00801','09001') and cWhCode not in (4,5)
GROUP BY cInvCode) ds ON ma.InvCode = ds.cInvCode
INNER JOIN
Inventory p WITH (NOLOCK) ON md.InvCode = p.cInvCode INNER JOIN
@@ -378,7 +383,12 @@ SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate,md.Rema
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
union all
SELECT cupsoids as iAppIds , sum(iquantity) AS qty
FROM OM_MODetails WITH (nolock)
GROUP BY cupsoids
) rds ON ommds.autoid = rds.iAppIds
WHERE ISNULL(OMM.cCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND
ommds.fquantity - ISNULL(rds.qty, 0) > 0) OM
GROUP BY cInvCode) pu_App ON MA.INVCODE = pu_App.CINVCODE LEFT JOIN
@@ -688,7 +698,7 @@ update a set a.dqty=a.dqty+isnull(ds.qty,0),a.cqty=a.cqty+isnull(cs.qty,0) fro
GROUP BY cInvCode) cs ON a.cInvCode = cs.cInvCode
LEFT JOIN
(SELECT cinvcode, SUM(iquantity) qty
FROM InvPositionSum WITH (nolock) where cPosCode not in ('00701','00801','09001')
FROM InvPositionSum WITH (nolock) where cPosCode not in ('00701','00801','09001') and cWhCode not in (4,5)
GROUP BY cInvCode) ds ON a.cInvCode = ds.cInvCode
update a set a.momqty=a.momqty+isnull(MX.MQTY,0)

View File

@@ -54,14 +54,20 @@ from InvPositionSum as a left join Inventory as b on a.cInvCode=b.cInvCode where
if (stock.MaterialCodes != null)
{
where.Add(" cInvCode in @MaterialCodes ");
where.Add(" a.cInvCode in @MaterialCodes ");
}
if (stock.BinCodes != null)
{
where.Add(" cPosCode in @BinCodes ");
}
return this.GetList(string.Join(" and ", where.ToArray()), new
{
MaterialCode = stock.MaterialCode,
MaterialName = $"%{stock.MaterialName}%",
stock.MaterialCodes
stock.MaterialCodes,
stock.BinCodes
}); ;

View File

@@ -7,7 +7,7 @@
<appSettings>
<add key="ApiDbName" value="MES_SUBMIT" />
<add key="server" value="10.0.0.12" />
<add key="AccId" value="u8-2@003" />
<add key="AccId" value="u8-2@001" />
<add key="UserId" value="wx997" />
<add key="Password" value="1" />
<add key="EaiPort" value="80" />