This commit is contained in:
gongxh
2021-05-18 15:22:13 +08:00
4 changed files with 111 additions and 0 deletions

View File

@@ -66,10 +66,12 @@
<Compile Include="Request\Inventorybu.cs" /> <Compile Include="Request\Inventorybu.cs" />
<Compile Include="Request\Inventoryall.cs" /> <Compile Include="Request\Inventoryall.cs" />
<Compile Include="Request\MaterialAppProvide.cs" /> <Compile Include="Request\MaterialAppProvide.cs" />
<Compile Include="Request\PoOrderRequest.cs" />
<Compile Include="Request\SnOrderRequest.cs" /> <Compile Include="Request\SnOrderRequest.cs" />
<Compile Include="Request\SaleOrderRequest.cs" /> <Compile Include="Request\SaleOrderRequest.cs" />
<Compile Include="Response\MOM\Bom.cs" /> <Compile Include="Response\MOM\Bom.cs" />
<Compile Include="Response\Pmc\PmcInventoryallRes.cs" /> <Compile Include="Response\Pmc\PmcInventoryallRes.cs" />
<Compile Include="Response\Pmc\PmcInventorymomRes.cs" />
<Compile Include="Response\Store\MaterialApp.cs" /> <Compile Include="Response\Store\MaterialApp.cs" />
<Compile Include="Response\Store\Stock.cs" /> <Compile Include="Response\Store\Stock.cs" />
<Compile Include="TimestampConverter.cs" /> <Compile Include="TimestampConverter.cs" />

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NX.ERP.Model.Request
{
public class PoOrderRequest
{
public IEnumerable<string> PoCodes { get; set; }
public IEnumerable<string> AppCodes { get; set; }
public string InvStd { get; set; }
public IEnumerable<string> InvCodes { get; set; }
public DateTime? BeginDate { get; set; }
public DateTime? EndDate { get; set; }
public DateTime? BeginDate2 { get; set; }
public DateTime? EndDate2 { get; set; }
}
}

View File

@@ -439,6 +439,77 @@ SELECT m..mocode, md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitNam
} }
} }
public IEnumerable<object> InventoryPo(NX.ERP.Model.Request.PoOrderRequest info1)
{
string sql = $@"
Select cpoid,dpodate,zpurpoheader.cvenabbname,zpurpotail.cinvcode,zpurpotail.cinvname,zpurpotail.cinvstd,zpurpotail.cinvm_unit,zpurpotail.ireceivedqty,
iquantity,prd.rqty,zpurpotail.darrivedate,cupsocode,d.ddate,c.drequirdate
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
LEFT JOIN
(SELECT cinvcode, SUM(rqty) AS rqty
FROM (SELECT PDS.cInvCode, PDS.iQuantity - ISNULL(rds.qty, 0) AS Rqty
FROM PO_Pomain PM WITH (NOLOCK) INNER JOIN
PO_Podetails PDS WITH (NOLOCK) ON PM.POID = PDS.POID LEFT JOIN
(SELECT IPOSID, SUM(IQUANTITY) AS QTY
FROM rdrecords01 rds WITH (NOLOCK) INNER JOIN
RdRecord01 rd WITH (nolock) ON rds.ID = rd.ID
WHERE CBUSTYPE = '普通采购'
GROUP BY IPOSID) RDS ON PDS.ID = RDS.iPOsID
WHERE ISNULL(PM.CCLOSER, N'') = N'' AND ISNULL(PDS.CBCLOSER, N'') = N'' AND
pds.iQuantity - ISNULL(rds.qty, 0) > 0) x
GROUP BY cInvCode) prd ON zpurpotail.cinvcode = prd.CINVCODE
";
List<string> where = new List<string>();
if (info1.InvCodes != null)
{
where.Add(" zpurpotail.cinvcode in @cinvcode");
}
if (!string.IsNullOrEmpty(info1.InvStd))
{
where.Add(" zpurpotail.cinvstd like @cInvStd ");
}
if (info1.PoCodes != null)
{
where.Add(" cpoid in @PoCodes ");
}
if (info1.AppCodes != null)
{
where.Add(" cupsocode in @AppCodes ");
}
if (info1.BeginDate != null && info1.EndDate != null)
{
where.Add(" zpurpoheader.dPODate between @beginDate and @endDate ");
}
if (info1.BeginDate2 != null && info1.EndDate2 != null)
{
where.Add(" d.dDate between @beginDate2 and @endDate2 ");
}
var aa = string.Join(" and ", where.ToArray());
if (!string.IsNullOrEmpty(aa))
{
sql += "where " + aa;
}
using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection)
{
return conn.Query<object>(sql, new { cinvcode = info1.InvCodes, cInvStd = $"%{info1.InvStd}%", info1.PoCodes, info1.AppCodes, info1.BeginDate, info1.EndDate, info1.BeginDate2, info1.EndDate2 });
}
}
public IEnumerable<object> Inventorybu(NX.ERP.Model.Request.Inventorybu info1) public IEnumerable<object> Inventorybu(NX.ERP.Model.Request.Inventorybu info1)
{ {

View File

@@ -43,6 +43,14 @@ namespace NX.ERP.WebAPi.Controllers
return PmcQuery.Inventorysocode(info); return PmcQuery.Inventorysocode(info);
} }
[HttpPost]
[Route("api/Pmc/InventoryPocode")]
public IEnumerable<object> InventoryPo(NX.ERP.Model.Request.PoOrderRequest info)
{
var PmcQuery = new NX.ERP.U8.Pmc.PmcQuery();
return PmcQuery.InventoryPo(info);
}
[HttpPost] [HttpPost]
[Route("api/Pmc/Inventorybu")] [Route("api/Pmc/Inventorybu")]