mom 修改

This commit is contained in:
杰 朱
2021-05-06 11:35:41 +08:00
parent 3ab46b6c1f
commit 4f23bad34e
4 changed files with 112 additions and 57 deletions

View File

@@ -20,37 +20,37 @@ namespace NX.ERP.U8.Pmc
public IEnumerable<NX.ERP.Model.PmcInventoryallRes> GetPmcInventoryallRes(NX.ERP.Model.Request.Inventoryall info)
{
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.bProxyForeign = 1 THEN '委外' WHEN c.bPurchase = 1 THEN '外购' WHEN 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,ISNULL(momq.momqty, 0) AS momqty, ISNULL(MX.MQTY, 0) MQTY, isnull(mas.wqty,0) - isnull(cs.qty, 0) - ISNULL(prd.Rqty, 0)
- ISNULL(omm.RQTY1, 0) - ISNULL(MX.MQTY, 0) AS q
FROM Inventory c LEFT JOIN
FROM Inventory c WITH (NOLOCK) LEFT JOIN
(SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) wqty
FROM mom_moallocate ma INNER JOIN
mom_orderdetail md ON ma.MoDId = md.MoDId
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) mas ON c.cInvCode = mas.InvCode LEFT JOIN
(SELECT ma.invcode, SUM( isnull(issqty, 0)) issqty
FROM mom_moallocate ma INNER JOIN
mom_orderdetail md ON ma.MoDId = md.MoDId
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId
WHERE md.Status <> 4
GROUP BY ma.InvCode) misss ON c.cInvCode = misss.InvCode LEFT JOIN
(SELECT cinvcode, SUM(iquantity) qty
FROM currentstock
FROM currentstock WITH (NOLOCK)
GROUP BY cInvCode) cs ON c.cInvCode = cs.cInvCode
LEFT JOIN
(SELECT cinvcode, SUM(iquantity) qty
FROM InvPositionSum where cPosCode not in ('00701','00801','09001')
FROM InvPositionSum WITH (NOLOCK) where cPosCode not in ('00701','00801','09001')
GROUP BY cInvCode) ds ON c.cInvCode = ds.cInvCode
LEFT JOIN
(SELECT MD.INVCODE, SUM(MD.QTY - ISNULL(MD.QUALIFIEDINQTY, 0)) AS MQTY
FROM mom_orderdetail MD
FROM mom_orderdetail MD WITH (NOLOCK)
GROUP BY MD.INVCODE) MX ON c.cInvCode = MX.InvCode LEFT JOIN
(SELECT cinvcode, SUM(rqty) AS rqty
FROM (SELECT PDS.cInvCode, PDS.iQuantity - ISNULL(rds.qty, 0) AS Rqty
@@ -84,7 +84,7 @@ namespace NX.ERP.U8.Pmc
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 c.cInvCode = pu_App.CINVCODE LEFT JOIN
(select InvCode,sum(qty) as momqty from mom_orderdetail where Status=3 group by InvCode) momq on c.cInvCode = momq.InvCode
(select InvCode,sum(qty) as momqty from mom_orderdetail WITH (nolock) where Status=3 group by InvCode) momq on c.cInvCode = momq.InvCode
left join ComputationUnit LL WITH (nolock) on c.cComUnitCode=LL.cComunitCode
";
@@ -126,39 +126,48 @@ namespace NX.ERP.U8.Pmc
public IEnumerable<object> Inventorymom(List<string> moCodes)
{
string sql = $@"
SELECT m..mocode, md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitName, md.Qty, md.QualifiedInQty, ma.InvCode invcode1,
SELECT m..mocode, md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitName, md.Qty, md.QualifiedInQty, ma.InvCode invcode1,
c.cInvName cinvname1, c.cInvStd cinvstd1,LL.cComUnitName as cComUnitName1, CASE WHEN c.bPurchase = 1 AND
c.bProxyForeign = 1 THEN '委外' WHEN c.bPurchase = 1 THEN '外购' WHEN c.bself = 1 THEN '自制' ELSE '其它' END AS
std, ma.Qty qty1, ma.IssQty issqty, mas.wqty wqty, ISNULL(cs.qty, 0) cqty, ISNULL(misss.issqty, 0) issqtyxc,ISNULL(ds.qty, 0) dqty,isnull(prd.Rqty, 0) rqty,
std, ma.Qty qty1, ma.IssQty issqty,mdsss.mdqty, 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(cs.qty, 0) - ISNULL(prd.Rqty, 0)
- ISNULL(omm.RQTY1, 0) - ISNULL(MX.MQTY, 0) AS q,
CASE WHEN md.Status = 2 THEN '锁定' WHEN md.Status = 3 THEN '审核' ELSE '新建' END AS st
FROM mom_order m INNER JOIN
mom_orderdetail md ON m.MoId = md.MoId INNER JOIN
mom_moallocate ma ON md.MoDId = ma.MoDId
FROM mom_order m WITH (NOLOCK) INNER JOIN
mom_orderdetail md WITH (NOLOCK) ON m.MoId = md.MoId INNER JOIN
mom_moallocate ma WITH (NOLOCK) ON md.MoDId = ma.MoDId
INNER JOIN
(SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) wqty
FROM mom_moallocate ma INNER JOIN
mom_orderdetail md ON ma.MoDId = md.MoDId
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) mas ON ma.InvCode = mas.InvCode LEFT JOIN
(SELECT ma.invcode,SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) mdqty
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
WHERE md.Status <> 4 and MoCode in @moCodes
GROUP BY ma.InvCode) mdsss ON ma.InvCode = mdsss.InvCode LEFT JOIN
(SELECT ma.invcode, SUM( isnull(issqty, 0)) issqty
FROM mom_moallocate ma INNER JOIN
mom_orderdetail md ON ma.MoDId = md.MoDId
FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN
mom_orderdetail md WITH (NOLOCK) ON ma.MoDId = md.MoDId
WHERE md.Status <> 4
GROUP BY ma.InvCode) misss ON ma.InvCode = misss.InvCode LEFT JOIN
(SELECT cinvcode, SUM(iquantity) qty
FROM currentstock
FROM currentstock WITH (NOLOCK)
GROUP BY cInvCode) cs ON ma.InvCode = cs.cInvCode
LEFT JOIN
(SELECT cinvcode, SUM(iquantity) qty
FROM InvPositionSum where cPosCode not in ('00701','00801','09001')
FROM InvPositionSum WITH (NOLOCK) where cPosCode not in ('00701','00801','09001')
GROUP BY cInvCode) ds ON ma.InvCode = ds.cInvCode
INNER JOIN
Inventory p ON md.InvCode = p.cInvCode INNER JOIN
Inventory c ON ma.InvCode = c.cInvCode LEFT JOIN
Inventory p WITH (NOLOCK) ON md.InvCode = p.cInvCode INNER JOIN
Inventory c WITH (NOLOCK) ON ma.InvCode = c.cInvCode LEFT JOIN
(SELECT MD.INVCODE, SUM(MD.QTY - ISNULL(MD.QUALIFIEDINQTY, 0)) AS MQTY
FROM mom_orderdetail MD
FROM mom_orderdetail MD WITH (NOLOCK)
GROUP BY MD.INVCODE) MX ON MA.InvCode = MX.InvCode LEFT JOIN
(SELECT cinvcode, SUM(rqty) AS rqty
FROM (SELECT PDS.cInvCode, PDS.iQuantity - ISNULL(rds.qty, 0) AS Rqty
@@ -192,12 +201,12 @@ namespace NX.ERP.U8.Pmc
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
(select InvCode,sum(qty) as momqty from mom_orderdetail where Status=3 group by InvCode) momq on MA.INVCODE = momq.InvCode
(select InvCode,sum(qty) as momqty from mom_orderdetail WITH (NOLOCK) where Status=3 group by InvCode) momq on MA.INVCODE = momq.InvCode
left join ComputationUnit kk WITH (nolock) on p.cComUnitCode=kk.cComunitCode
left join ComputationUnit LL WITH (nolock) on c.cComUnitCode=LL.cComunitCode
WHERE md.Status <> 4 AND ma.Qty - IsNull(ma.IssQty, 0) > 0
and m..mocode in @moCodes
order by m.mocode
and m.mocode in @moCodes
order by m.mocode,md.SortSeq, ma.InvCode
";
using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection)
{
@@ -215,70 +224,70 @@ namespace NX.ERP.U8.Pmc
- ISNULL(omm.RQTY1, 0) - ISNULL(MX.MQTY, 0) AS q,isnull(a0.iQuantity,0) as iQuantity00 ,isnull(a1.iQuantity,0) as iQuantity01,
isnull(a2.iQuantity,0) as iQuantity02,isnull(a3.iQuantity,0) as iQuantity03,isnull(a4.iQuantity,0) as iQuantity04,isnull(a5.iQuantity,0) as iQuantity05
from
(select a.cinvcode from rdrecords11 a left join rdrecord11 b on a.id=b.id
(select a.cinvcode 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(dateadd(month,-5,getdate()))+1,dateadd(month,-5,getdate())),112)
and convert(varchar,dateadd(day,-day(getdate()),dateadd(month,1,getdate())),112)
group by a.cinvcode) a full join
(select left(convert(varchar,getdate(),112),6) as month1 , a.cinvcode, sum(a.iQuantity) as iQuantity from rdrecords11 a left join rdrecord11 b on a.id=b.id
(select left(convert(varchar,getdate(),112),6) as month1 , a.cinvcode, sum(a.iQuantity) as 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)
group by a.cinvcode
) a0 on a.cInvCode=a0.cInvCode
full join
(select left(convert(varchar,dateadd(month,-1,getdate()),112),6) as month1 , a.cinvcode, sum(a.iQuantity) as iQuantity from rdrecords11 a left join rdrecord11 b on a.id=b.id
(select left(convert(varchar,dateadd(month,-1,getdate()),112),6) as month1 , a.cinvcode, sum(a.iQuantity) as 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(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
) a1 on a.cInvCode =a1.cInvCode
full join
(select left(convert(varchar,dateadd(month,-3,getdate()),112),6) as month1 , a.cinvcode, sum(a.iQuantity) as iQuantity from rdrecords11 a left join rdrecord11 b on a.id=b.id
(select left(convert(varchar,dateadd(month,-3,getdate()),112),6) as month1 , a.cinvcode, sum(a.iQuantity) as 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(dateadd(month,-3,getdate()))+1,dateadd(month,-3,getdate())),112)
and convert(varchar,dateadd(day,-day(dateadd(month,-3,getdate())),dateadd(month,1,dateadd(month,-3,getdate()))),112)
group by a.cinvcode
) a2 on a.cInvCode =a2.cInvCode
full join
(select left(convert(varchar,dateadd(month,-2,getdate()),112),6) as month1 , a.cinvcode, sum(a.iQuantity) as iQuantity from rdrecords11 a left join rdrecord11 b on a.id=b.id
(select left(convert(varchar,dateadd(month,-2,getdate()),112),6) as month1 , a.cinvcode, sum(a.iQuantity) as 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(dateadd(month,-2,getdate()))+1,dateadd(month,-2,getdate())),112)
and convert(varchar,dateadd(day,-day(dateadd(month,-2,getdate())),dateadd(month,1,dateadd(month,-2,getdate()))),112)
group by a.cinvcode
) a3 on a.cInvCode =a3.cInvCode
full join
(select left(convert(varchar,dateadd(month,-4,getdate()),112),6) as month1 , a.cinvcode, sum(a.iQuantity) as iQuantity from rdrecords11 a left join rdrecord11 b on a.id=b.id
(select left(convert(varchar,dateadd(month,-4,getdate()),112),6) as month1 , a.cinvcode, sum(a.iQuantity) as 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(dateadd(month,-4,getdate()))+1,dateadd(month,-4,getdate())),112)
and convert(varchar,dateadd(day,-day(dateadd(month,-4,getdate())),dateadd(month,1,dateadd(month,-4,getdate()))),112)
group by a.cinvcode
) a4 on a.cInvCode =a4.cInvCode
full join
(select left(convert(varchar,dateadd(month,-5,getdate()),112),6) as month1 , a.cinvcode, sum(a.iQuantity) as iQuantity from rdrecords11 a left join rdrecord11 b on a.id=b.id
(select left(convert(varchar,dateadd(month,-5,getdate()),112),6) as month1 , a.cinvcode, sum(a.iQuantity) as 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(dateadd(month,-5,getdate()))+1,dateadd(month,-5,getdate())),112)
and convert(varchar,dateadd(day,-day(dateadd(month,-5,getdate())),dateadd(month,1,dateadd(month,-5,getdate()))),112)
group by a.cinvcode
) a5 on a.cInvCode =a5.cInvCode
left join Inventory c WITH (nolock) on a.cInvCode=c.cInvCode left join
(SELECT ma.invcode, SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) wqty
FROM mom_moallocate ma INNER JOIN
mom_orderdetail md ON ma.MoDId = md.MoDId
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) mas ON c.cInvCode = mas.InvCode LEFT JOIN
(SELECT ma.invcode, SUM( isnull(issqty, 0)) issqty
FROM mom_moallocate ma INNER JOIN
mom_orderdetail md ON ma.MoDId = md.MoDId
FROM mom_moallocate ma WITH (nolock) INNER JOIN
mom_orderdetail md WITH (nolock) ON ma.MoDId = md.MoDId
WHERE md.Status <> 4
GROUP BY ma.InvCode) misss ON c.cInvCode = misss.InvCode LEFT JOIN
(SELECT cinvcode, SUM(iquantity) qty
FROM currentstock
FROM currentstock WITH (nolock)
GROUP BY cInvCode) cs ON c.cInvCode = cs.cInvCode
LEFT JOIN
(SELECT cinvcode, SUM(iquantity) qty
FROM InvPositionSum where cPosCode not in ('00701','00801','09001')
FROM InvPositionSum WITH (nolock) where cPosCode not in ('00701','00801','09001')
GROUP BY cInvCode) ds ON c.cInvCode = ds.cInvCode
LEFT JOIN
(SELECT MD.INVCODE, SUM(MD.QTY - ISNULL(MD.QUALIFIEDINQTY, 0)) AS MQTY
FROM mom_orderdetail MD
FROM mom_orderdetail MD WITH (nolock)
GROUP BY MD.INVCODE) MX ON c.cInvCode = MX.InvCode LEFT JOIN
(SELECT cinvcode, SUM(rqty) AS rqty
FROM (SELECT PDS.cInvCode, PDS.iQuantity - ISNULL(rds.qty, 0) AS Rqty
@@ -312,7 +321,7 @@ namespace NX.ERP.U8.Pmc
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 c.cInvCode = pu_App.CINVCODE LEFT JOIN
(select InvCode,sum(qty) as momqty from mom_orderdetail where Status=3 group by InvCode) momq on c.cInvCode = momq.InvCode
(select InvCode,sum(qty) as momqty from mom_orderdetail WITH (nolock) where Status=3 group by InvCode) momq on c.cInvCode = momq.InvCode
left join ComputationUnit LL WITH (nolock) on c.cComUnitCode=LL.cComunitCode

1
NX.ERP.Webapp/bulid.bat Normal file
View File

@@ -0,0 +1 @@
npm run build

View File

@@ -1,16 +1,23 @@
<template>
<div>
<h4>物料在途在制查询表</h4>
<h4>跟单记录表</h4>
<div>
<Row :gutter="16">
<Col span="8">
<label>订单编号</label>
<Input autosize type="textarea" v-model="filter.inv_codes" />
</Col>
<Col span="4">
<Button @click="handleClick">查询</Button>
<Button @click="handelExport">导出</Button>
<Col span="8">
<Button
size="large"
type="primary"
icon="ios-search"
@click="handleClick"
>查询</Button
>
<Button size="large" type="success" @click="handelExport"
>导出</Button
>
</Col>
</Row>
</div>
@@ -42,7 +49,7 @@
<script>
import { getInventorymom } from "@/api/pmc";
import { pageingData, export_col_to_excel,sortByKey } from "@/libs/tools";
import { pageingData, export_col_to_excel,sortByKey,numberFormat } from "@/libs/tools";
export default {
data() {
return {
@@ -159,23 +166,58 @@ export default {
className: "demo-table-info-old",
},
{
title: "总需求(未领量)",
title: "单行需求",
align: "center",
key: "qty1",
width: 110,
},
{
title: "单行已领",
align: "center",
key: "issqty",
width: 110,
},
{
title: "单行未领",
align: "center",
width: 110,
render: (h, params) => {
return (
<span>
{numberFormat(
params.row.qty1 - params.row.issqty
)}
</span>
);
},
},
{
title: "条件内未领",
align: "center",
width: 110,
key: "mdqty",
},
{
title: "总未领量",
align: "center",
key: "wqty",
width: 120,
},
{
title: "总已领(现场)",
align: "center",
key: "issqtyxc",
width: 120,
},
{
title: "现存量",
align: "center",
key: "cqty",
width: 100,
},
{
title: "已领(现场)",
align: "center",
key: "issqty",
width: 110,
},
{
title: "现存无废品",
align: "center",
@@ -237,6 +279,8 @@ export default {
let resp = await getInventorymom(_filetr);
this.pageNo = 1;
this.datas = resp.data.data;
} catch (error) {}
},
handlePagechange(page) {

View File

@@ -29,7 +29,7 @@
<Table
style="margin-top: 20px"
width="20000"
size="small"
border
:columns="columns"
@@ -75,7 +75,7 @@ export default {
title: "存货编号",
align: "center",
key: "cInvCode",
width: "90",
width: "110",
className: "demo-table-info-new",
},
{
@@ -106,6 +106,7 @@ export default {
{
title: "总需求(未领量)",
align: "center",
width: "110",
key: "wqty",
},
{