diff --git a/NX.ERP.Model/NX.ERP.Model.csproj b/NX.ERP.Model/NX.ERP.Model.csproj index e072c7a..db7ebf5 100644 --- a/NX.ERP.Model/NX.ERP.Model.csproj +++ b/NX.ERP.Model/NX.ERP.Model.csproj @@ -66,6 +66,7 @@ + diff --git a/NX.ERP.Model/Request/MomOrderRequest.cs b/NX.ERP.Model/Request/MomOrderRequest.cs new file mode 100644 index 0000000..6acd4ed --- /dev/null +++ b/NX.ERP.Model/Request/MomOrderRequest.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model.Request +{ + public class MomOrderRequest : BaseModel + { + + public List moCodes { get; set; } + public IEnumerable InvCodes { get; set; } + + + public bool byFinish { get; set; } + + public bool byiss { get; set; } + + } +} diff --git a/NX.ERP.U8/Pmc/PmcQuery.cs b/NX.ERP.U8/Pmc/PmcQuery.cs index 4055c21..696e5ec 100644 --- a/NX.ERP.U8/Pmc/PmcQuery.cs +++ b/NX.ERP.U8/Pmc/PmcQuery.cs @@ -123,7 +123,7 @@ namespace NX.ERP.U8.Pmc } - public IEnumerable Inventorymom(List moCodes) + public IEnumerable Inventorymom(NX.ERP.Model.Request.MomOrderRequest info) { string sql = $@" select *from ( @@ -134,7 +134,7 @@ SELECT m..mocode, md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitNam 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 + CASE WHEN md.Status = 2 THEN '锁定' WHEN md.Status = 3 THEN '审核' ELSE '新建' END AS st, md.Status 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 @@ -145,13 +145,13 @@ SELECT m..mocode, md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitNam 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 mom.MoId, ma.invcode,SUM(isnull(ma.qty, 0) - isnull(issqty, 0)) mdqty + (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 - GROUP BY ma.InvCode,mom.MoId) mdsss ON ma.InvCode = mdsss.InvCode and m.MoId=mdsss.MoId LEFT JOIN + GROUP BY ma.InvCode) mdsss ON ma.InvCode = mdsss.InvCode LEFT JOIN (SELECT ma.invcode, SUM( isnull(issqty, 0)) issqty FROM mom_moallocate ma WITH (NOLOCK) INNER JOIN @@ -206,16 +206,116 @@ SELECT m..mocode, md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitNam (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 ) mmm + ) mmm "; - List where = new List(); + if (info.moCodes != null && info.moCodes.Count > 0) + { + sql = $@" +select *from ( + +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,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, md.Status + 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 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 mom.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 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 WITH (NOLOCK) + 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') + GROUP BY cInvCode) ds ON ma.InvCode = ds.cInvCode + INNER 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 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 + 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 ma.InvCode = prd.cInvCode LEFT JOIN + (SELECT CINVCODE, SUM(RQTY) AS RQTY1 + FROM (SELECT ommds.cInvCode, ommds.iQuantity - ISNULL(rds.qty, 0) AS rqty + FROM OM_MOMain omm WITH (nolock) INNER JOIN + OM_MODetails ommds WITH (nolock) ON omm.MOID = ommds.MOID LEFT JOIN + (SELECT iomodid, sum(iquantity) AS qty + FROM rdrecords01 WITH (nolock) + GROUP BY iOMoDID) rds ON ommds.MODetailsID = rds.iOMoDID + WHERE ISNULL(OMM.cCloser, N'') = N'' AND ISNULL(ommds.cbCloser, N'') = N'' AND + ommds.iQuantity - ISNULL(rds.qty, 0) > 0) OM + GROUP BY cInvCode) OMM ON MA.INVCODE = OMM.CINVCODE LEFT JOIN + (SELECT CINVCODE, SUM(RQTY) AS RQTY3 + FROM (SELECT ommds.cInvCode, ommds.fquantity - ISNULL(rds.qty, 0) 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) pu_App ON MA.INVCODE = pu_App.CINVCODE LEFT JOIN + (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 + ) mmm + "; + } + + List where = new List(); ///处理- - if (moCodes != null && moCodes.Count>0 ) + if (info.moCodes != null && info.moCodes.Count > 0) { where.Add(" mmm.mocode in @moCodes"); } + if (info.InvCodes!= null ) + { + where.Add(" mmm.invcode1 in @invcode1"); + } + if (!info.byFinish) + { + where.Add(" mmm.Status <> 4"); + } + if (!info.byiss) + { + where.Add(" isnull(mmm.qty1,0)- isnull(mmm.issqty,0)> 0"); + } + else { where.Add(" mmm.issqty > 0"); } var aa = string.Join(" and ", where.ToArray()); @@ -229,7 +329,7 @@ SELECT m..mocode, md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitNam using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection) { - return conn.Query(sql, new { moCodes = moCodes }); + return conn.Query(sql, new { moCodes = info.moCodes, invcode1=info.InvCodes }); } } @@ -442,8 +542,8 @@ SELECT m..mocode, md.SortSeq, md.InvCode, p.cInvName, p.cInvStd,KK.cComUnitNam public IEnumerable 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 + Select cpoid,CONVERT(varchar(100),dpodate, 23) as dpodate,zpurpoheader.cvenabbname,zpurpotail.cinvcode,zpurpotail.cinvname,zpurpotail.cinvstd,zpurpotail.cinvm_unit,zpurpotail.ireceivedqty, + iquantity,prd.rqty,CONVERT(varchar(100), zpurpotail.darrivedate, 23) as darrivedate,cupsocode, CONVERT(varchar(100), d.ddate, 23) as ddate, CONVERT(varchar(100), c.drequirdate, 23) as 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 diff --git a/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs b/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs index 2b96b55..79041a7 100644 --- a/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs +++ b/NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs @@ -21,10 +21,10 @@ namespace NX.ERP.WebAPi.Controllers [HttpPost] [Route("api/Pmc/Inventorymom")] - public IEnumerable Inventorymom([FromBody] List moCodes) + public IEnumerable Inventorymom(NX.ERP.Model.Request.MomOrderRequest info) { var PmcQuery = new NX.ERP.U8.Pmc.PmcQuery(); - return PmcQuery.Inventorymom(moCodes).OrderByDescending(m=> m.Mocode).ThenBy(m => m.SortSeq).ThenBy(m => m.Invcode1); + return PmcQuery.Inventorymom(info).OrderByDescending(m=> m.Mocode).ThenBy(m => m.SortSeq).ThenBy(m => m.Invcode1); } [HttpPost] diff --git a/NX.ERP.WebAPi/Web.config b/NX.ERP.WebAPi/Web.config index b6945a4..9e67996 100644 --- a/NX.ERP.WebAPi/Web.config +++ b/NX.ERP.WebAPi/Web.config @@ -4,73 +4,73 @@ https://go.microsoft.com/fwlink/?LinkId=301879 --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/NX.ERP.Webapp/src/App.vue b/NX.ERP.Webapp/src/App.vue index 0f021b9..542a0aa 100644 --- a/NX.ERP.Webapp/src/App.vue +++ b/NX.ERP.Webapp/src/App.vue @@ -13,6 +13,7 @@ 销售订单表 序列号查询 补料量查询 + 采购订单列表 diff --git a/NX.ERP.Webapp/src/api/pmc.js b/NX.ERP.Webapp/src/api/pmc.js index b1f751b..5222805 100644 --- a/NX.ERP.Webapp/src/api/pmc.js +++ b/NX.ERP.Webapp/src/api/pmc.js @@ -14,4 +14,6 @@ export const getInventorysocode=(info)=>{ export const getInventorybu=(info)=>{ return axios.post('/api/Pmc/Inventorybu',info) } - +export const getInventorypo=(info)=>{ + return axios.post('/api/Pmc/InventoryPocode',info) +} diff --git a/NX.ERP.Webapp/src/libs/tools.js b/NX.ERP.Webapp/src/libs/tools.js index 9491526..9f2546b 100644 --- a/NX.ERP.Webapp/src/libs/tools.js +++ b/NX.ERP.Webapp/src/libs/tools.js @@ -88,6 +88,51 @@ export const sortByKey=(array,key)=> { }) } + +export const getMonth=(type, months) =>{//type为字符串类型,有两种选择,"s"代表开始,"e"代表结束,months为数字类型,不传或0代表本月,-1代表上月,1代表下月 + var d = new Date(); + var year = d.getFullYear(); + var month = d.getMonth() + 1; + if (Math.abs(months) > 12) { + months = months % 12; + }; + if (months != 0) { + if (month + months > 12) { + year++; + month = (month + months) % 12; + } else if (month + months < 1) { + year--; + month = 12 + month + months; + } else { + month = month + months; + }; + }; + month = month < 10 ? "0" + month: month; + var date = d.getDate(); + var firstday = year + "-" + month + "-" + "01"; + var lastday = ""; + if (month == "01" || month == "03" || month == "05" || month == "07" || month == "08" || month == "10" || month == "12") { + lastday = year + "-" + month + "-" + 31; + } else if (month == "02") { + if ((year % 4 == 0 && year % 100 != 0) || (year % 100 == 0 && year % 400 == 0)) { + lastday = year + "-" + month + "-" + 29; +} else { + lastday = year + "-" + month + "-" + 28; + }; + } else { + lastday = year + "-" + month + "-" + 30; + }; + var day = ""; + if (type == "s") { + day = firstday; + } else { + day = lastday; + }; + return day; +} + + + export const pageingData = (data, pagesize, index) => { if (!data) return [] let pageNo = 1 diff --git a/NX.ERP.Webapp/src/route/index.js b/NX.ERP.Webapp/src/route/index.js index 43e66f9..3bd02e9 100644 --- a/NX.ERP.Webapp/src/route/index.js +++ b/NX.ERP.Webapp/src/route/index.js @@ -5,6 +5,7 @@ import InventoryMonth from '@/views/inventory-month.vue' import InventorySo from '@/views/inventory-so.vue' import inventorySNDetail from '@/views/inventory-SNDetail.vue' import inventorybu from '@/views/inventory-bu.vue' +import inventorypo from '@/views/inventory-po.vue' export default [ { path: '/', @@ -17,5 +18,6 @@ export default [ { path: '/InventoryMonth', component: InventoryMonth }, { path: '/inventory-SNDetail', component: inventorySNDetail }, { path: '/InventorySo', component: InventorySo }, - { path: '/inventorybu', component: inventorybu } + { path: '/inventorybu', component: inventorybu }, + { path: '/inventorypo', component: inventorypo } ] diff --git a/NX.ERP.Webapp/src/views/inventory-mom.vue b/NX.ERP.Webapp/src/views/inventory-mom.vue index 1baef7c..f29d3cf 100644 --- a/NX.ERP.Webapp/src/views/inventory-mom.vue +++ b/NX.ERP.Webapp/src/views/inventory-mom.vue @@ -3,12 +3,29 @@

跟单记录表

- + + + + + - -