This commit is contained in:
gongxh
2021-05-25 13:17:49 +08:00
14 changed files with 1533 additions and 24 deletions

View File

@@ -75,6 +75,7 @@
<Compile Include="Request\MaterialAppVouch.cs" /> <Compile Include="Request\MaterialAppVouch.cs" />
<Compile Include="Request\MomOrderRequest.cs" /> <Compile Include="Request\MomOrderRequest.cs" />
<Compile Include="Request\MomRequest.cs" /> <Compile Include="Request\MomRequest.cs" />
<Compile Include="Request\PurchasesumRequest.cs" />
<Compile Include="Request\PoOrderRequest.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" />

View File

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

View File

@@ -50,6 +50,7 @@
<Compile Include="Mom\MomOrderDAL.cs" /> <Compile Include="Mom\MomOrderDAL.cs" />
<Compile Include="Pmc\FinanceQuery.cs" /> <Compile Include="Pmc\FinanceQuery.cs" />
<Compile Include="Pmc\PmcQuery.cs" /> <Compile Include="Pmc\PmcQuery.cs" />
<Compile Include="Pmc\PurchaseQuery.cs" />
<Compile Include="Purchase\ArrivalDAL.cs" /> <Compile Include="Purchase\ArrivalDAL.cs" />
<Compile Include="Sale\DispatchListDAL.cs" /> <Compile Include="Sale\DispatchListDAL.cs" />
<Compile Include="Store\BaseBill.cs" /> <Compile Include="Store\BaseBill.cs" />

View File

@@ -20,12 +20,17 @@ namespace NX.ERP.U8.Pmc
public IEnumerable<NX.ERP.Model.PmcInventoryallRes> GetPmcInventoryallRes(NX.ERP.Model.Request.Inventoryall info) public IEnumerable<NX.ERP.Model.PmcInventoryallRes> GetPmcInventoryallRes(NX.ERP.Model.Request.Inventoryall info)
{ {
string sql = $@" string sql = $@"
SELECT c.cInvCode invcode1, SELECT c.cInvCode invcode1,
c.cInvName cinvname1, c.cInvStd cinvstd1,LL.cComUnitName, CASE WHEN c.bPurchase = 1 AND c.cInvName cinvname1, c.cInvStd cinvstd1,LL.cComUnitName, CASE
c.bProxyForeign = 1 THEN '委外' WHEN c.bPurchase = 1 THEN '外购' WHEN c.bself = 1 THEN '自制' ELSE '其它' END AS WHEN c.bPurchase = 1 AND c.bProxyForeign = 1 and c.bself = 1 THEN '委外,自制'
std, isnull(mas.wqty,0) wqty, ISNULL(cs.qty, 0) cqty,ISNULL(misss.issqty, 0) issqty , ISNULL(ds.qty, 0) dqty,isnull(prd.Rqty, 0) rqty, WHEN c.bPurchase = 1 AND c.bProxyForeign = 1 and c.bself <>1 THEN '委外'
ISNULL(OMM.RQTY1, 0) AS rqty1, ISNULL(pu_App.RQTY3, 0) AS rqty3,ISNULL(momq.momqty, 0) AS momqty, ISNULL(MX.MQTY, 0) MQTY, isnull(mas.wqty,0) - isnull(cs.qty, 0) - ISNULL(prd.Rqty, 0) WHEN c.bPurchase = 1 AND c.bProxyForeign <> 1 and c.bself <> 1 THEN '外购'
- ISNULL(omm.RQTY1, 0) - ISNULL(MX.MQTY, 0) AS q WHEN c.bPurchase = 1 AND c.bProxyForeign <> 1 and c.bself = 1 THEN '外购,自制'
WHEN c.bPurchase <> 1 AND c.bProxyForeign <> 1 and c.bself = 1 THEN '自制'
ELSE '其它'
END AS std, isnull(mas.wqty,0) wqty, ISNULL(cs.qty, 0) cqty,ISNULL(misss.issqty, 0) issqty , ISNULL(ds.qty, 0) dqty,isnull(prd.Rqty, 0) rqty,
ISNULL(OMM.RQTY1, 0) AS rqty1, ISNULL(pu_App.RQTY3, 0) AS rqty3,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
FROM Inventory c WITH (NOLOCK) LEFT JOIN FROM Inventory c WITH (NOLOCK) LEFT JOIN
(SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) wqty (SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) wqty
@@ -129,12 +134,17 @@ namespace NX.ERP.U8.Pmc
select *from ( select *from (
SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate ,CONVERT(varchar(100), mor.DueDate, 23) as DueDate ,DATEDIFF(day,GETDATE(),mor.DueDate) AS jandete , md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitName, md.Qty, md.QualifiedInQty,(md.Qty-md.QualifiedInQty) as wwc, ma.InvCode invcode1, SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate ,CONVERT(varchar(100), mor.DueDate, 23) as DueDate ,DATEDIFF(day,GETDATE(),mor.DueDate) AS jandete , md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitName, md.Qty, md.QualifiedInQty,(md.Qty-md.QualifiedInQty) as wwc, ma.InvCode invcode1,
c.cInvName cinvname1, c.cInvStd cinvstd1,LL.cComUnitName as cComUnitName1, CASE WHEN c.bPurchase = 1 AND c.cInvName cinvname1, c.cInvStd cinvstd1,LL.cComUnitName as cComUnitName1, CASE
c.bProxyForeign = 1 THEN '委外' WHEN c.bPurchase = 1 THEN '外购' WHEN c.bself = 1 THEN '自制' ELSE '其它' END AS WHEN c.bPurchase = 1 AND c.bProxyForeign = 1 and c.bself = 1 THEN '委外,自制'
std,dtyl.dtty, ma.Qty qty1, ma.IssQty issqty,(ma.Qty-ma.IssQty) as wll,mdsss.mdqty,shwl.shwl,sdwl.sdwl WHEN c.bPurchase = 1 AND c.bProxyForeign = 1 and c.bself <>1 THEN '委外'
,mas.wqty wqty, ISNULL(cs.qty, 0) cqty, ISNULL(misss.issqty, 0) issqtyxc,ISNULL(ds.qty, 0) dqty,isnull(prd.Rqty, 0) rqty, WHEN c.bPurchase = 1 AND c.bProxyForeign <> 1 and c.bself <> 1 THEN '外购'
ISNULL(OMM.RQTY1, 0) AS rqty1, ISNULL(pu_App.RQTY3, 0) AS rqty3,ISNULL(momq.momqty, 0) AS momqty, ISNULL(MX.MQTY, 0) MQTY, mas.wqty - isnull(ds.qty, 0) - ISNULL(prd.Rqty, 0) WHEN c.bPurchase = 1 AND c.bProxyForeign <> 1 and c.bself = 1 THEN '外购,自制'
- ISNULL(omm.RQTY1, 0) - ISNULL(MX.MQTY, 0)- ISNULL(pu_App.RQTY3, 0) AS q, motype.description, WHEN c.bPurchase <> 1 AND c.bProxyForeign <> 1 and c.bself = 1 THEN '自制'
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) - 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 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 FROM mom_order m WITH (NOLOCK) INNER JOIN
mom_orderdetail md WITH (NOLOCK) ON m.MoId = md.MoId INNER JOIN mom_orderdetail md WITH (NOLOCK) ON m.MoId = md.MoId INNER JOIN
@@ -242,12 +252,17 @@ SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate ,CONVER
select *from ( select *from (
SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate ,CONVERT(varchar(100), mor.DueDate, 23) as DueDate ,DATEDIFF(day,GETDATE(),mor.DueDate) AS jandete , md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitName, md.Qty, md.QualifiedInQty,(md.Qty-md.QualifiedInQty) as wwc, ma.InvCode invcode1, SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate ,CONVERT(varchar(100), mor.DueDate, 23) as DueDate ,DATEDIFF(day,GETDATE(),mor.DueDate) AS jandete , md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitName, md.Qty, md.QualifiedInQty,(md.Qty-md.QualifiedInQty) as wwc, ma.InvCode invcode1,
c.cInvName cinvname1, c.cInvStd cinvstd1,LL.cComUnitName as cComUnitName1, CASE WHEN c.bPurchase = 1 AND c.cInvName cinvname1, c.cInvStd cinvstd1,LL.cComUnitName as cComUnitName1,CASE
c.bProxyForeign = 1 THEN '委外' WHEN c.bPurchase = 1 THEN '外购' WHEN c.bself = 1 THEN '自制' ELSE '其它' END AS WHEN c.bPurchase = 1 AND c.bProxyForeign = 1 and c.bself = 1 THEN '委外,自制'
std,dtyl.dtty, ma.Qty qty1, ma.IssQty issqty,(ma.Qty-ma.IssQty) as wll,mdsss.mdqty,shwl.shwl,sdwl.sdwl WHEN c.bPurchase = 1 AND c.bProxyForeign = 1 and c.bself <>1 THEN '委外'
WHEN c.bPurchase = 1 AND c.bProxyForeign <> 1 and c.bself <> 1 THEN '外购'
WHEN c.bPurchase = 1 AND c.bProxyForeign <> 1 and c.bself = 1 THEN '外购,自制'
WHEN c.bPurchase <> 1 AND c.bProxyForeign <> 1 and c.bself = 1 THEN '自制'
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, ,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, mas.wqty - isnull(ds.qty, 0) - ISNULL(prd.Rqty, 0) 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) - ISNULL(MX.MQTY, 0)- ISNULL(pu_App.RQTY3, 0) AS q, motype.description, - 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 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 FROM mom_order m WITH (NOLOCK) INNER JOIN
mom_orderdetail md WITH (NOLOCK) ON m.MoId = md.MoId INNER JOIN mom_orderdetail md WITH (NOLOCK) ON m.MoId = md.MoId INNER JOIN
@@ -658,7 +673,7 @@ SELECT m..mocode,CONVERT(varchar(100), mor.StartDate, 23) as StartDate ,CONVER
} }
if (!info1.byFinish) if (!info1.byFinish)
{ {
where.Add(" isnull(zpurpotail.cbcloser,'') ='' "); where.Add(" isnull(zpurpotail.cbcloser,'') ='' and zpurpotail.ireceivedqty <> zpurpotail.iquantity ");
} }
var aa = string.Join(" and ", where.ToArray()); var aa = string.Join(" and ", where.ToArray());

View File

@@ -0,0 +1,508 @@
using NX.ERP.U8.Purchase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Dapper;
namespace NX.ERP.U8.Purchase
{
public class PurchaseQuery
{
/// <summary>
///
/// </summary>
/// <param name="strWhere"></param>
/// <param name="param"></param>
/// <returns></returns>
public IEnumerable<object> InventoryPoc(NX.ERP.Model.Request.PoOrderRequest info1)
{
string sql = $@"
select *from (
select A.cpersonname ,A.cordercode , CONVERT(varchar(100), A.dpodate, 23) as dpodate , CONVERT(varchar(100), A.dArriveDate, 23) as dArriveDate ,
A.cvenabbname , A.cinvcode , A.cinvname ,A.cinvstd ,cinvm_unit ,A.iquantity
,(A.iquantity-isnull(b.YDH,0)) AS wjh,(A.iquantity-isnull(b.YDH,0)+isnull(E.fRealQuantity,0)) AS wrk ,isnull(d.iQuantity,0) AS xcl,isnull(F.iqty,0) AS qll,(isnull(d.iQuantity,0)- isnull(F.iqty,0)) AS bull, a0.iQuantity as iQuantity00 ,a1.iQuantity as iQuantity01 from (
SELECT cpersonname,cordercode,dpodate,dArriveDate,cvencode,cvenabbname,cinvcode,cinvname,cinvstd,cinvm_unit,iquantity ,id from copypolist WITH (NOLOCK)
where bposourcearr=1
and bservice <> 1 and binvtype<>1
and (isnull(iquantity,0)>isnull(iarrqty,0) or (isnull(inum,0)>isnull(iarrnum,0) and iGroupType = 2 ))
and isnull(cbustype,'')<>N'直运采购' and ((isnull(cVerifier,'')<>'' and isnull(cchanger,'')='') or (isnull(cchangverifier,'')<>'')) AND 1=1
and bInvEntrust=0 AND isnull(cbustype,'')=N'普通采购' and 1=1 and iDiscountTaxType=0
) A left join
(
select iPOsID,cInvCode,sum(iQuantity)AS YDH from PU_ArrivalVouchs WITH (NOLOCK) group by iPOsID,cInvCode
) B on A.ID=B.iPOsID and a.cInvCode =B.cInvCode
left join
CurrentStock D WITH (NOLOCK) on A.cinvcode=D.cInvCode and d.cWhCode=2
left join
(
select
A.cInvCode ,
A.fRealQuantity,
B.cVenCode ,
A.iPOsID
from
PU_ArrivalVouchs A WITH (NOLOCK) left join
PU_ArrivalVouch B WITH (NOLOCK) on A.ID =B.ID
where isnull(cbcloser,'')='' And iBillType =N'0' and cverifier is not null
and (isnull(iQuantity,0)-isnull(fRefuseQuantity,0)>isnull(fValidInQuan,0) or ( isnull(inum,0)-isnull(frefusenum,0)>isnull(fvalidinnum,0))) )
E on A.cinvcode=e.cInvCode and a.id=e.iPOsID
left join
(
SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) iqty
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId
WHERE md.Status <> 4 AND ma.Qty - ISNULL(ma.IssQty, 0) > 0
GROUP BY ma.InvCode) F on A.cinvcode=F.InvCode
left join
(select a.cinvcode, sum(a.iQuantity) as iQuantity from (
select a.cinvcode, 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(getdate())+1,getdate()),112)
and convert(varchar,dateadd(day,-day(getdate()),dateadd(month,1,getdate())),112)
union all
select a.cinvcode, iQuantity from rdrecords32 a WITH (nolock) left join rdrecord32 b WITH (nolock) on a.id=b.id
where convert(varchar,b.dDate,112) between convert(varchar,dateadd(day,-day(getdate())+1,getdate()),112)
and convert(varchar,dateadd(day,-day(getdate()),dateadd(month,1,getdate())),112)
) a
group by a.cinvcode
) a0 on a.cInvCode=a0.cInvCode
left join
( select a.cinvcode, sum(a.iQuantity) as iQuantity from (
select a.cinvcode, sum(a.iQuantity) as iQuantity from rdrecords32 a WITH (nolock) left join rdrecord32 b WITH (nolock) on a.id=b.id
where convert(varchar,b.dDate,112) between convert(varchar,dateadd(day,-day(dateadd(month,-1,getdate()))+1,dateadd(month,-1,getdate())),112)
and convert(varchar,dateadd(day,-day(dateadd(month,-1,getdate())),dateadd(month,1,dateadd(month,-1,getdate()))),112)
group by a.cinvcode
union all
select a.cinvcode, sum(a.iQuantity) as iQuantity from rdrecords32 a WITH (nolock) left join rdrecord32 b WITH (nolock) on a.id=b.id
where convert(varchar,b.dDate,112) between convert(varchar,dateadd(day,-day(dateadd(month,-1,getdate()))+1,dateadd(month,-1,getdate())),112)
and convert(varchar,dateadd(day,-day(dateadd(month,-1,getdate())),dateadd(month,1,dateadd(month,-1,getdate()))),112)
group by a.cinvcode
) a
group by a.cinvcode
) a1 on a.cInvCode =a1.cInvCode
) mmm
";
if (info1.BeginDate2 != null && info1.EndDate2 != null)
{
sql = $@"select *from (
select A.cpersonname ,A.cordercode , CONVERT(varchar(100), A.dpodate, 23) as dpodate , CONVERT(varchar(100), A.dArriveDate, 23) as dArriveDate ,
A.cvencode , A.cvenabbname , A.cinvcode , A.cinvname ,A.cinvstd ,cinvm_unit ,A.iquantity
,(A.iquantity-isnull(b.YDH,0)) AS wjh,(A.iquantity-isnull(b.YDH,0)+isnull(E.fRealQuantity,0)) AS wrk ,isnull(d.iQuantity,0) AS xcl,isnull(F.iqty,0) AS qll,(isnull(d.iQuantity,0)- isnull(F.iqty,0)) AS bull, a0.iQuantity as iQuantity00 ,a1.iQuantity as iQuantity01 from (
SELECT cpersonname,cordercode,dpodate,dArriveDate,cvencode,cvenabbname,cinvcode,cinvname,cinvstd,cinvm_unit,iquantity ,id from copypolist WITH (NOLOCK)
where bposourcearr=1
and bservice <> 1 and binvtype<>1
and (isnull(iquantity,0)>isnull(iarrqty,0) or (isnull(inum,0)>isnull(iarrnum,0) and iGroupType = 2 ))
and isnull(cbustype,'')<>N'直运采购' and ((isnull(cVerifier,'')<>'' and isnull(cchanger,'')='') or (isnull(cchangverifier,'')<>'')) AND 1=1
and bInvEntrust=0 AND isnull(cbustype,'')=N'普通采购' and 1=1 and iDiscountTaxType=0
) A left join
(
select iPOsID,cInvCode,sum(iQuantity)AS YDH from PU_ArrivalVouchs WITH (NOLOCK) group by iPOsID,cInvCode
) B on A.ID=B.iPOsID and a.cInvCode =B.cInvCode
left join
CurrentStock D WITH (NOLOCK) on A.cinvcode=D.cInvCode and d.cWhCode=2
left join
(
select
A.cInvCode ,
A.fRealQuantity,
B.cVenCode ,
A.iPOsID
from
PU_ArrivalVouchs A WITH (NOLOCK) left join
PU_ArrivalVouch B WITH (NOLOCK) on A.ID =B.ID
where isnull(cbcloser,'')='' And iBillType =N'0' and cverifier is not null
and (isnull(iQuantity,0)-isnull(fRefuseQuantity,0)>isnull(fValidInQuan,0) or ( isnull(inum,0)-isnull(frefusenum,0)>isnull(fvalidinnum,0))) )
E on A.cinvcode=e.cInvCode and a.id=e.iPOsID
left join
(
SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) iqty
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId left join
mom_morder mor WITH (NOLOCK) ON ma.MoDId= mor.MoDId
WHERE md.Status <> 4 AND ma.Qty - ISNULL(ma.IssQty, 0) > 0 and mor.DueDate between @beginDate2 and @endDate2
GROUP BY ma.InvCode) F on A.cinvcode=F.InvCode
left join
(select a.cinvcode, sum(a.iQuantity) as iQuantity from (
select a.cinvcode, 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(getdate())+1,getdate()),112)
and convert(varchar,dateadd(day,-day(getdate()),dateadd(month,1,getdate())),112)
union all
select a.cinvcode, iQuantity from rdrecords32 a WITH (nolock) left join rdrecord32 b WITH (nolock) on a.id=b.id
where convert(varchar,b.dDate,112) between convert(varchar,dateadd(day,-day(getdate())+1,getdate()),112)
and convert(varchar,dateadd(day,-day(getdate()),dateadd(month,1,getdate())),112)
) a
group by a.cinvcode
) a0 on a.cInvCode=a0.cInvCode
left join
( select a.cinvcode, sum(a.iQuantity) as iQuantity from (
select a.cinvcode, sum(a.iQuantity) as iQuantity from rdrecords32 a WITH (nolock) left join rdrecord32 b WITH (nolock) on a.id=b.id
where convert(varchar,b.dDate,112) between convert(varchar,dateadd(day,-day(dateadd(month,-1,getdate()))+1,dateadd(month,-1,getdate())),112)
and convert(varchar,dateadd(day,-day(dateadd(month,-1,getdate())),dateadd(month,1,dateadd(month,-1,getdate()))),112)
group by a.cinvcode
union all
select a.cinvcode, sum(a.iQuantity) as iQuantity from rdrecords32 a WITH (nolock) left join rdrecord32 b WITH (nolock) on a.id=b.id
where convert(varchar,b.dDate,112) between convert(varchar,dateadd(day,-day(dateadd(month,-1,getdate()))+1,dateadd(month,-1,getdate())),112)
and convert(varchar,dateadd(day,-day(dateadd(month,-1,getdate())),dateadd(month,1,dateadd(month,-1,getdate()))),112)
group by a.cinvcode
) a
group by a.cinvcode
) a1 on a.cInvCode =a1.cInvCode
) mmm
";
}
List<string> where = new List<string>();
if (info1.InvCodes != null)
{
where.Add(" mmm.cinvcode in @cinvcode");
}
if (!string.IsNullOrEmpty(info1.InvStd))
{
where.Add(" mmm.cinvstd like @cInvStd ");
}
if (info1.PoCodes != null)
{
where.Add(" mmm.cordercode in @PoCodes ");
}
if (info1.BeginDate != null && info1.EndDate != null)
{
where.Add(" mmm.dPODate between @beginDate and @endDate ");
}
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> Purchasesum(NX.ERP.Model.Request.PurchasesumRequest info)
{
string sql = $@"
DECLARE @RdRecord table(
cPsn_Num nvarchar(30),
cpersonname nvarchar(30),
puappnumall int,
puappnum03 int,
mommouth02 int,
mommouth04 int
)
DECLARE @RdRecord2 table(
cpersonname nvarchar(30),
puappnumall int
)
DECLARE @RdRecord3 table(
cpersonname nvarchar(30),
puappnumall int
)
DECLARE @RdRecord4 table(
cpersonname nvarchar(30),
puappnumall int
)
DECLARE @RdRecord5 table(
cpersonname nvarchar(30),
puappnumall int
)
insert into @RdRecord
select cPsn_Num, cPsn_Name,0,0,0,0 from hr_v_HR31_show where cDepCode ='52' and rEmployState ='在职'
insert into @RdRecord
select 'qt999','其他',0,0,0,0
insert into @RdRecord2
select cPsn_Num,sum(RQTY3) as puappnumall from (
select RQTY3,isnull(cMaker,'其他') as cPsn_Num from
(
SELECT CINVCODE, SUM(RQTY) AS RQTY3
FROM (
SELECT ommds.cInvCode, 1 as RQTY
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
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
ommds.fquantity - ISNULL(rds.qty, 0) > 0) OM
GROUP BY cInvCode
) as tbl1
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
)
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.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
where a.cpersonname='其他'
insert into @RdRecord3
select cPsn_Num,sum(RQTY3) as puappnumall from (
select RQTY3,isnull(cMaker,'其他') as cPsn_Num from
(
SELECT CINVCODE, SUM(RQTY) AS RQTY3
FROM (
SELECT ommds.cInvCode, 1 as RQTY
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
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
ommds.fquantity - ISNULL(rds.qty, 0) > 0) OM
GROUP BY cInvCode
) as tbl1
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
)
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.puappnum03= a.puappnumall +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
where a.cpersonname='其他'
insert into @RdRecord4
select cPsn_Num,sum(RQTY3) as puappnumall from (
select RQTY3,isnull(cMaker,'其他') as cPsn_Num from
(
SELECT CINVCODE, SUM(RQTY) AS RQTY3
FROM (
select a.InvCode as CINVCODE ,1 as RQTY From (
SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) iqty
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId left join
mom_morder mor WITH (NOLOCK) ON ma.MoDId= mor.MoDId
WHERE md.Status <> 4 AND ma.Qty - ISNULL(ma.IssQty, 0) > 0 and
mor.DueDate between @beginDate and @endDate
GROUP BY ma.InvCode
) a left join
CurrentStock cur WITH (NOLOCK) ON cur.cInvCode = a.InvCode where (cur.iQuantity -iqty) <0) OM
GROUP BY cInvCode
) as tbl1
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
)
as tbl on tbl1.cinvcode=tbl.cInvCode )
q group by cPsn_Num
update a set a.mommouth02=b.puappnumall From @RdRecord a left join @RdRecord4 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
where a.cpersonname='其他'
insert into @RdRecord5
select cPsn_Num,sum(RQTY3) as puappnumall from (
select RQTY3,isnull(cMaker,'其他') as cPsn_Num from
(
SELECT CINVCODE, SUM(RQTY) AS RQTY3
FROM (
select a.InvCode as CINVCODE ,1 as RQTY From (
SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) iqty
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId left join
mom_morder mor WITH (NOLOCK) ON ma.MoDId= mor.MoDId
WHERE md.Status <> 4 AND ma.Qty - ISNULL(ma.IssQty, 0) > 0 and
mor.DueDate between @beginDate2 and @endDate2
GROUP BY ma.InvCode
) a left join
CurrentStock cur WITH (NOLOCK) ON cur.cInvCode = a.InvCode where (cur.iQuantity -iqty) <0) OM
GROUP BY cInvCode
) as tbl1
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
)
as tbl on tbl1.cinvcode=tbl.cInvCode )
q group by cPsn_Num
update a set a.mommouth04=b.puappnumall From @RdRecord a left join @RdRecord5 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='其他'
select *from @RdRecord
";
using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection)
{
return conn.Query<object>(sql, new { info.BeginDate, info.EndDate, info.BeginDate2, info.EndDate2 });
}
}
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
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
FROM PO_Podetails WITH (nolock)
GROUP BY iAppIds) rds ON ommds.autoid = 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
ommds.fquantity - ISNULL(rds.qty, 0) > 0 ) puu
";
List<string> where = new List<string>();
if (!string.IsNullOrEmpty(info.cpersonname))
{
where.Add(" puu.cMaker = @cpersonname");
}
if (info.InvCodes != null)
{
where.Add(" puu.cInvCode in @InvCodes");
}
if (info.cday > 0)
{
where.Add(" DATEDIFF(day,puu.ddate ,GETDATE()) >=@cday");
}
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 { info.cpersonname, info.InvCodes, info.cday });
}
}
public IEnumerable<object> Purchasesummom(NX.ERP.Model.Request.PurchasesumRequest info)
{
string sql = $@"
DECLARE @RdRecord table(
CINVCODE nvarchar(200),
RQTY int,
iqty int,
iQuantity int,
bull int,
cpersonname nvarchar(200),
cInvName nvarchar(200),
cInvStd nvarchar(500)
)
insert into @RdRecord
select *from (
select a.*,isnull(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
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId left join
mom_morder mor WITH (NOLOCK) ON ma.MoDId= mor.MoDId
WHERE md.Status <> 4 AND ma.Qty - ISNULL(ma.IssQty, 0) > 0 and
mor.DueDate between @beginDate and @endDate
GROUP BY ma.InvCode
) a left join
CurrentStock cur WITH (NOLOCK) ON cur.cInvCode = a.InvCode where (cur.iQuantity -iqty) <0
) 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 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 ='在职')
select *From @RdRecord
";
List<string> where = new List<string>();
if (!string.IsNullOrEmpty(info.cpersonname))
{
where.Add(" cpersonname = @cpersonname");
}
if (info.InvCodes != null)
{
where.Add(" cInvCode = @InvCodes");
}
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 { info.cpersonname, info.InvCodes, info.cday, info.BeginDate, info.EndDate });
}
}
}
}

View File

@@ -0,0 +1,51 @@
using NX.ERP.U8.Purchase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
namespace NX.ERP.WebAPi.Controllers
{
public class PurchaseController : ApiController
{
[Obsolete]
[HttpPost]
[Route("api/Purchase/InventoryPoc")]
public IEnumerable<object> InventoryPoc(NX.ERP.Model.Request.PoOrderRequest info)
{
var PurchaseQuery = new NX.ERP.U8.Purchase.PurchaseQuery();
return PurchaseQuery.InventoryPoc(info);
}
[HttpPost]
[Route("api/Purchase/Purchasesum")]
public IEnumerable<object> Purchasesum(NX.ERP.Model.Request.PurchasesumRequest info)
{
var PurchaseQuery = new NX.ERP.U8.Purchase.PurchaseQuery();
return PurchaseQuery.Purchasesum( info);
}
[HttpPost]
[Route("api/Purchase/Purchasesumpuapp")]
public IEnumerable<object> Purchasesumpuapp(NX.ERP.Model.Request.PurchasesumRequest info)
{
var PurchaseQuery = new NX.ERP.U8.Purchase.PurchaseQuery();
return PurchaseQuery.Purchasesumpuapp(info);
}
[HttpPost]
[Route("api/Purchase/Purchasesummom")]
public IEnumerable<object> Purchasesummom(NX.ERP.Model.Request.PurchasesumRequest info)
{
var PurchaseQuery = new NX.ERP.U8.Purchase.PurchaseQuery();
return PurchaseQuery.Purchasesummom(info);
}
}
}

View File

@@ -160,6 +160,7 @@
<Compile Include="Controllers\AP\APController.cs" /> <Compile Include="Controllers\AP\APController.cs" />
<Compile Include="Controllers\MOM\BomController.cs" /> <Compile Include="Controllers\MOM\BomController.cs" />
<Compile Include="Controllers\MOM\MomOrderController.cs" /> <Compile Include="Controllers\MOM\MomOrderController.cs" />
<Compile Include="Controllers\Pmc\PurchaseController.cs" />
<Compile Include="Controllers\Pmc\FinanceController.cs" /> <Compile Include="Controllers\Pmc\FinanceController.cs" />
<Compile Include="Controllers\Pmc\PmcController.cs" /> <Compile Include="Controllers\Pmc\PmcController.cs" />
<Compile Include="Controllers\Purchase\ArrivalController.cs" /> <Compile Include="Controllers\Purchase\ArrivalController.cs" />

View File

@@ -7,7 +7,7 @@
<appSettings> <appSettings>
<add key="server" value="10.0.0.12" /> <add key="server" value="10.0.0.12" />
<add key="AccId" value="u8-2@001" /> <add key="AccId" value="u8-2@001" />
<add key="UserId" value="wx995" /> <add key="UserId" value="wx899" />
<add key="Password" value="1" /> <add key="Password" value="1" />
<add key="EaiPort" value="80" /> <add key="EaiPort" value="80" />
<add key="EaiPath" value="U8EAI/import.asp" /> <add key="EaiPath" value="U8EAI/import.asp" />

View File

@@ -13,7 +13,9 @@
<MenuItem to="/InventorySo" name="3-5">销售订单表</MenuItem> <MenuItem to="/InventorySo" name="3-5">销售订单表</MenuItem>
<MenuItem to="/inventory-SNDetail" name="3-6">序列号查询</MenuItem> <MenuItem to="/inventory-SNDetail" name="3-6">序列号查询</MenuItem>
<MenuItem to="/inventorybu" name="3-7">补料量查询</MenuItem> <MenuItem to="/inventorybu" name="3-7">补料量查询</MenuItem>
<MenuItem to="/inventorypo" name="3-8">采购订单列表</MenuItem> <MenuItem to="/inventorypo" name="3-8">采购订单列表(PMC)</MenuItem>
<MenuItem to="/inventorypoc" name="3-9">采购跟进表(采购部)</MenuItem>
<MenuItem to="/Purchasesum" name="3-99">采购查询汇总</MenuItem>
</MenuGroup> </MenuGroup>
</Submenu> </Submenu>
</Menu> </Menu>

View File

@@ -0,0 +1,23 @@
import axios from 'axios'
export const InventoryPoc = (info) => {
return axios.post('/api/Purchase/InventoryPoc', info)
}
export const Userrole = (info) => {
return axios.post('/api/System/Userrole', info)
}
export const Purchasesum = (info) => {
return axios.post('/api/Purchase/Purchasesum', info)
}
export const Purchasesumpuapp = (info) => {
return axios.post('/api/Purchase/Purchasesumpuapp', info)
}
export const Purchasesummom = (info) => {
return axios.post('/api/Purchase/Purchasesummom', info)
}

View File

@@ -6,6 +6,9 @@ import InventorySo from '@/views/inventory-so.vue'
import inventorySNDetail from '@/views/inventory-SNDetail.vue' import inventorySNDetail from '@/views/inventory-SNDetail.vue'
import inventorybu from '@/views/inventory-bu.vue' import inventorybu from '@/views/inventory-bu.vue'
import inventorypo from '@/views/inventory-po.vue' import inventorypo from '@/views/inventory-po.vue'
import inventorypoc from '@/views/inventory-poc.vue'
import Purchasesum from '@/views/Purchasesum.vue'
export default [ export default [
{ {
path: '/', path: '/',
@@ -19,5 +22,7 @@ export default [
{ path: '/inventory-SNDetail', component: inventorySNDetail }, { path: '/inventory-SNDetail', component: inventorySNDetail },
{ path: '/InventorySo', component: InventorySo }, { path: '/InventorySo', component: InventorySo },
{ path: '/inventorybu', component: inventorybu }, { path: '/inventorybu', component: inventorybu },
{ path: '/inventorypo', component: inventorypo } { path: '/inventorypo', component: inventorypo },
{ path: '/inventorypoc', component: inventorypoc },
{ path: '/Purchasesum', component: Purchasesum }
] ]

View File

@@ -0,0 +1,533 @@
<template>
<div>
<h4>采购查询汇总</h4>
<div>
<Row :gutter="16">
<Col span="3">
<label>第一生产期间</label>
<div>
<DatePicker v-model="filter.dates" type="daterange"></DatePicker>
</div>
</Col>
<Col span="3">
<label>第二生产期间</label>
<div>
<DatePicker v-model="filter.dates2" type="daterange"></DatePicker>
</div>
</Col>
<Col span="4">
<Button
size="large"
type="primary"
icon="ios-search"
@click="handleClick"
>查询</Button
>
<Button size="large" type="success" @click="handelExport"
>导出</Button
>
</Col>
<Col span="10">
<Modal
width="1366"
v-model="modal1"
title="请购详情"
@on-cancel="cancel"
>
<Table
style="margin-top: 20px"
height="768"
size="small"
border
:columns="columnsDetail"
:data="dataDetail"
>
</Table>
</Modal>
</Col>
<Col span="20">
<Modal
width="1366"
v-model="modal2"
title="缺件详情"
@on-cancel="cancel"
>
<Table
style="margin-top: 20px"
height="768"
size="small"
border
:columns="columnsDetail2"
:data="dataDetail2"
>
</Table>
</Modal>
</Col>
</Row>
</div>
<Table
style="margin-top: 20px"
size="small"
show-summary
border
:loading="loading"
:columns="columns"
:data="pagedData"
>
</Table>
<Page
style="margin-top: 20px"
:current="pageNo"
:page-size="pageSize"
:total="total"
:page-size-opts="PageSizeOpts"
@on-change="handlePagechange"
@on-page-size-change="handlePageSize"
show-elevator
show-sizer
show-total
size="small"
/>
</div>
</template>
<script>
import { Purchasesum, Purchasesumpuapp, Purchasesummom } from "@/api/Purchase";
import {
pageingData,
export_col_to_excel,
dateFormatFull,
dateFormat,
sortByKey,
getMonth,
} from "@/libs/tools";
export default {
data() {
return {
PageSizeOpts: [10, 15, 20, 30],
pageNo: 1,
modal1: false,
modal2: false,
loading: false,
strfilter: "",
multiple: false,
pageSize: 15,
dataDetail: [],
dataDetail2: [],
datas: [],
filter: {
inv_codes: "",
inv_std: "",
po_codes: "",
app_codes: "",
dates: [getMonth("s", -1), getMonth("e", 0)],
dates2: [getMonth("s", -1), getMonth("e", 1)],
by_finish: false,
},
columnsDetail: [
{
title: "业务员",
align: "center",
key: "cMaker",
},
{
title: "请购单号",
align: "center",
key: "ccode",
},
{
title: "请购日期",
align: "center",
key: "dDatel",
},
{
title: "存货编码",
align: "center",
key: "cInvCode",
},
{
title: "存货名称",
align: "center",
key: "cinvname",
},
{
title: "规格型号",
align: "center",
key: "cinvstd",
},
{
title: "数量",
align: "center",
key: "RQTY",
},
],
columnsDetail2: [
{
title: "业务员",
align: "center",
key: "cpersonname",
},
{
title: "存货编码",
align: "center",
key: "CINVCODE",
},
{
title: "存货名称",
align: "center",
key: "cInvName",
},
{
title: "规格型号",
align: "center",
key: "cInvStd",
},
{
title: "需求数量",
align: "center",
key: "iqty",
},
{
title: "现存量",
align: "center",
key: "iQuantity",
},
{
title: "补料量",
align: "center",
key: "bull",
},
],
columns: [
{
title: "业务员",
align: "center",
key: "cpersonname",
},
{
title: "请购未下单记录",
align: "center",
key: "puappnumall",
render: (h, params) => {
return h("div", [
h(
"a",
{
props: {
type: "primary",
size: "small",
},
style: { color: "#2db7f5" },
domProps: {
title: params.row.puappnumall, //添加title属性
},
on: {
click: () => {
this.handleShow(params.row.cpersonname); //点击事件
},
},
},
params.row.puappnumall
),
]);
},
},
{
title: "请购三天后未下单记录",
align: "center",
key: "puappnum03",
render: (h, params) => {
return h("div", [
h(
"a",
{
props: {
type: "primary",
size: "small",
},
style: { color: "#2db7f5" },
domProps: {
title: params.row.puappnum03, //添加title属性
},
on: {
click: () => {
this.handleShow2(params.row.cpersonname); //点击事件
},
},
},
params.row.puappnum03
),
]);
},
},
{
title: "第一期间内计划工单缺件品种数",
align: "center",
key: "mommouth02",
render: (h, params) => {
return h("div", [
h(
"a",
{
props: {
type: "primary",
size: "small",
},
style: { color: "#2db7f5" },
domProps: {
title: params.row.mommouth02, //添加title属性
},
on: {
click: () => {
this.handleShow3(params.row.cpersonname); //点击事件
},
},
},
params.row.mommouth02
),
]);
},
},
{
title: "第二期间内计划工单缺件品种数",
align: "center",
key: "mommouth04",
render: (h, params) => {
return h("div", [
h(
"a",
{
props: {
type: "primary",
size: "small",
},
style: { color: "#2db7f5" },
domProps: {
title: params.row.mommouth04, //添加title属性
},
on: {
click: () => {
this.handleShow4(params.row.cpersonname); //点击事件
},
},
},
params.row.mommouth04
),
]);
},
},
],
};
},
computed: {
total() {
return this.datas.length;
},
pagedData() {
return pageingData(this.datas, this.pageSize, this.pageNo);
},
},
mounted() {
this.loadData();
},
methods: {
handelExport() {
export_col_to_excel(this.columns, this.datas);
},
handleClick() {
this.loadData();
},
async handleShow(h) {
let _filert2 = {
cpersonname: h,
cInvCode: null,
cday: 0,
};
let respd = await Purchasesumpuapp(_filert2);
this.dataDetail = sortByKey(respd.data.data, "ccode");
this.modal1 = true;
},
async handleShow2(h) {
let _filert2 = {
cpersonname: h,
cInvCode: null,
cday: 3,
};
let respd = await Purchasesumpuapp(_filert2);
this.dataDetail = sortByKey(respd.data.data, "ccode");
this.modal1 = true;
},
async handleShow3(h) {
let _beginDate = null;
let _endDate = null;
let _beginDate2 = null;
let _endDate2 = null;
if (
this.filter.dates.length == 2 &&
this.filter.dates[0] !== "" &&
this.filter.dates[0] !== ""
) {
_beginDate = this.filter.dates[0];
_endDate = this.filter.dates[1];
}
if (
this.filter.dates2.length == 2 &&
this.filter.dates2[0] !== "" &&
this.filter.dates2[0] !== ""
) {
_beginDate2 = this.filter.dates2[0];
_endDate2 = this.filter.dates2[1];
}
let _filert = {
cpersonname: h,
cInvCode: null,
begin_date: _beginDate,
end_date: _endDate,
};
let respd = await Purchasesummom(_filert);
this.dataDetail2 = sortByKey(respd.data.data, "CINVCODE");
this.modal2 = true;
},
async handleShow4(h) {
let _beginDate = null;
let _endDate = null;
let _beginDate2 = null;
let _endDate2 = null;
if (
this.filter.dates.length == 2 &&
this.filter.dates[0] !== "" &&
this.filter.dates[0] !== ""
) {
_beginDate = this.filter.dates[0];
_endDate = this.filter.dates[1];
}
if (
this.filter.dates2.length == 2 &&
this.filter.dates2[0] !== "" &&
this.filter.dates2[0] !== ""
) {
_beginDate2 = this.filter.dates2[0];
_endDate2 = this.filter.dates2[1];
}
let _filert = {
cpersonname: h,
cInvCode: null,
begin_date: _beginDate2,
end_date: _endDate2,
};
let respd = await Purchasesummom(_filert);
this.dataDetail2 = sortByKey(respd.data.data, "CINVCODE");
this.modal2 = true;
},
cancel() {
this.dataDetail = [];
this.dataDetail2 = [];
this.modal1 = false;
this.modal2 = false;
},
async loadData() {
let _beginDate = null;
let _endDate = null;
let _beginDate2 = null;
let _endDate2 = null;
if (
this.filter.dates.length == 2 &&
this.filter.dates[0] !== "" &&
this.filter.dates[0] !== ""
) {
_beginDate = this.filter.dates[0];
_endDate = this.filter.dates[1];
}
if (
this.filter.dates2.length == 2 &&
this.filter.dates2[0] !== "" &&
this.filter.dates2[0] !== ""
) {
_beginDate2 = this.filter.dates2[0];
_endDate2 = this.filter.dates2[1];
}
let _filert = {
begin_date: _beginDate,
end_date: _endDate,
begin_date2: _beginDate2,
end_date2: _endDate2,
};
try {
this.loading = true;
let resp = await Purchasesum(_filert);
this.pageNo = 1;
this.datas = resp.data.data;
// this.datas = sortByKey(resp.data.data, "cordercode");
} catch (error) {
} finally {
this.loading = false;
}
},
handlePagechange(page) {
this.pageNo = page;
},
handlePageSize(pageSize) {
this.pageSize = pageSize;
},
},
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style >
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
.ivu-table .demo-table-info-row td {
background-color: #2db7f5;
color: #fff;
}
.ivu-table .demo-table-error-row td {
background-color: #ff6600;
color: #fff;
}
.ivu-table td.demo-table-info-old {
color: #2db7f5;
}
.ivu-table td.demo-table-info-new {
color: #ff6600;
}
.ivu-table td.demo-table-info-ex {
color: #187;
font-weight: 600;
}
body {
padding: 10px 1;
}
</style>

View File

@@ -105,16 +105,16 @@ export default {
inv_std: "", inv_std: "",
po_codes: "", po_codes: "",
app_codes: "", app_codes: "",
dates: [getMonth("s", -1), getMonth("e", 0)], dates: [getMonth("s", -6), getMonth("e", 0)],
dates2: [], dates2: [],
by_finish: false by_finish: false
}, },
columns: [ columns: [
{ {
title: "采购订单号", title: "采购订单号",
align: "center", align: "center",
key: "cpoid", key: "cpoid",
width: 110,
}, },
{ {

View File

@@ -0,0 +1,335 @@
<template>
<div>
<h4>采购订单跟进表</h4>
<div>
<Row :gutter="16">
<Col span="4">
<label>采购订单编号</label>
<Input autosize type="textarea" v-model="filter.po_codes" />
</Col>
<Col span="3">
<label>采购订单期间</label>
<div>
<DatePicker v-model="filter.dates" type="daterange"></DatePicker>
</div>
</Col>
<Col span="3">
<label>物料编号</label>
<Input autosize type="textarea" v-model="filter.inv_codes" />
</Col>
<Col span="3">
<label>规格</label>
<Input v-model="filter.inv_std" />
</Col>
<Col span="3">
<label>生产订单期间</label>
<div>
<DatePicker v-model="filter.dates2" type="daterange"></DatePicker>
</div>
</Col>
<Col span="4">
<Button
size="large"
type="primary"
icon="ios-search"
@click="handleClick"
>查询</Button
>
<Button size="large" type="success" @click="handelExport"
>导出</Button
>
</Col>
</Row>
</div>
<Table
style="margin-top: 20px"
size="small"
border
:loading="loading"
:columns="columns"
:data="pagedData"
>
</Table>
<Page
style="margin-top: 20px"
:current="pageNo"
:page-size="pageSize"
:total="total"
:page-size-opts="PageSizeOpts"
@on-change="handlePagechange"
@on-page-size-change="handlePageSize"
show-elevator
show-sizer
show-total
size="small"
/>
</div>
</template>
<script>
import { InventoryPoc } from "@/api/Purchase";
import {
pageingData,
export_col_to_excel,
dateFormatFull,
dateFormat,
sortByKey,
getMonth,
} from "@/libs/tools";
export default {
data() {
return {
PageSizeOpts: [10, 15, 20, 30],
pageNo: 1,
loading: false,
strfilter: "",
multiple: false,
pageSize: 15,
datas: [],
filter: {
inv_codes: "",
inv_std: "",
po_codes: "",
app_codes: "",
dates: [getMonth("s", -6), getMonth("e", 0)],
dates2: [getMonth("s", -6), getMonth("e", 2)],
by_finish: false
},
columns: [
{
title: "业务员",
align: "center",
key: "cpersonname",
},
{
title: "订单号",
align: "center",
key: "cordercode",
},
{
title: "订单日期",
align: "center",
key: "dpodate",
},
{
title: "预计到货日期",
align: "center",
key: "dArriveDate",
},
{
title: "供应商",
align: "center",
key: "cvenabbname",
},
{
title: "存货编码",
align: "center",
key: "cinvcode",
},
{
title: "存货名称",
align: "center",
key: "cinvname",
className: "demo-table-info-new",
},
{
title: "规格型号",
align: "center",
key: "cinvstd",
},
{
title: "单位",
align: "center",
key: "cinvm_unit",
},
{
title: "订单数量",
align: "center",
key: "iquantity",
width: 100,
},
{
title: "未交量",
align: "center",
key: "wjh",
width: 100,
},
{
title: "未入库",
align: "center",
key: "wrk",
width: 100,
},
{
title: "现存量",
align: "center",
key: "xcl",
width: 100,
},
{
title: "缺料量",
align: "center",
key: "qll",
width: 100,
},
{
title: "补料量",
align: "center",
key: "bull",
width: 100,
},
{
title: "本月出库",
align: "center",
key: "iQuantity00",
width: 100,
},
{
title: "上月出库",
align: "center",
key: "iQuantity01",
width: 100,
},
],
};
},
computed: {
total() {
return this.datas.length;
},
pagedData() {
return pageingData(this.datas, this.pageSize, this.pageNo);
},
},
mounted() {
this.loadData();
},
methods: {
handelExport() {
export_col_to_excel(this.columns, this.datas);
},
handleClick() {
this.loadData();
},
async loadData() {
try {
let _beginDate = null;
let _endDate = null;
let _beginDate2 = null;
let _endDate2 = null;
if (
this.filter.dates.length == 2 &&
this.filter.dates[0] !== "" &&
this.filter.dates[0] !== ""
) {
_beginDate = this.filter.dates[0];
_endDate = this.filter.dates[1];
}
if (
this.filter.dates2.length == 2 &&
this.filter.dates2[0] !== "" &&
this.filter.dates2[0] !== ""
) {
_beginDate2 = this.filter.dates2[0];
_endDate2 = this.filter.dates2[1];
}
let _filert = {
inv_codes:
this.filter.inv_codes !== ""
? this.filter.inv_codes.split(/[,\s\n,]/)
: null,
inv_std: this.filter.inv_std,
po_codes:
this.filter.po_codes !== ""
? this.filter.po_codes.split(/[,\s\n,]/)
: null,
app_codes:
this.filter.app_codes !== ""
? this.filter.app_codes.split(/[,\s\n,]/)
: null,
begin_date: _beginDate,
end_date: _endDate,
begin_date2: _beginDate2,
end_date2: _endDate2,
by_finish: this.filter.by_finish
};
this.loading = true;
let resp = await InventoryPoc(_filert);
this.pageNo = 1;
this.datas = resp.data.data;
this.datas = sortByKey(resp.data.data, "cordercode");
} catch (error) {
} finally {
this.loading = false;
}
},
handlePagechange(page) {
this.pageNo = page;
},
handlePageSize(pageSize) {
this.pageSize = pageSize;
},
},
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style >
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
.ivu-table .demo-table-info-row td {
background-color: #2db7f5;
color: #fff;
}
.ivu-table .demo-table-error-row td {
background-color: #ff6600;
color: #fff;
}
.ivu-table td.demo-table-info-old {
color: #2db7f5;
}
.ivu-table td.demo-table-info-new {
color: #ff6600;
}
.ivu-table td.demo-table-info-ex {
color: #187;
font-weight: 600;
}
body {
padding: 10px 1;
}
</style>