From 9ef67db2068dd63b8d8f6597a1704df65bfc0502 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=B0=20=E6=9C=B1?= <501697962@qq.com>
Date: Thu, 29 Apr 2021 13:55:18 +0800
Subject: [PATCH] 1
---
NX.ERP.Model/NX.ERP.Model.csproj | 2 +
NX.ERP.Model/Request/Inventoryall.cs | 15 ++
.../Response/Pmc/PmcInventoryallRes.cs | 46 ++++
NX.ERP.U8/NX.ERP.U8.csproj | 12 +-
NX.ERP.U8/Pmc/PmcQuery.cs | 204 ++++++++++++++++++
.../Controllers/Pmc/PmcController.cs | 33 +++
NX.ERP.WebAPi/NX.ERP.WebAPi.csproj | 4 +
NX.ERP.WebAPi/Web.config | 10 +-
NX.ERP.WebAPi/packages.config | 1 +
9 files changed, 317 insertions(+), 10 deletions(-)
create mode 100644 NX.ERP.Model/Request/Inventoryall.cs
create mode 100644 NX.ERP.Model/Response/Pmc/PmcInventoryallRes.cs
create mode 100644 NX.ERP.U8/Pmc/PmcQuery.cs
create mode 100644 NX.ERP.WebAPi/Controllers/Pmc/PmcController.cs
diff --git a/NX.ERP.Model/NX.ERP.Model.csproj b/NX.ERP.Model/NX.ERP.Model.csproj
index fd5da50..72730d1 100644
--- a/NX.ERP.Model/NX.ERP.Model.csproj
+++ b/NX.ERP.Model/NX.ERP.Model.csproj
@@ -63,6 +63,8 @@
+
+
diff --git a/NX.ERP.Model/Request/Inventoryall.cs b/NX.ERP.Model/Request/Inventoryall.cs
new file mode 100644
index 0000000..867bb58
--- /dev/null
+++ b/NX.ERP.Model/Request/Inventoryall.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace NX.ERP.Model.Request
+{
+ public class Inventoryall: BaseModel
+ {
+ public IEnumerable cInvCode { get; set; }
+
+ public string cInvStd { get; set; }
+
+ }
+}
diff --git a/NX.ERP.Model/Response/Pmc/PmcInventoryallRes.cs b/NX.ERP.Model/Response/Pmc/PmcInventoryallRes.cs
new file mode 100644
index 0000000..9af5e50
--- /dev/null
+++ b/NX.ERP.Model/Response/Pmc/PmcInventoryallRes.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Newtonsoft.Json;
+namespace NX.ERP.Model
+{
+ public class PmcInventoryallRes : BaseModel
+ {
+
+ public string invcode1 { get; set; }
+
+ public string cinvname1 { get; set; }
+
+ public string cinvstd1 { get; set; }
+
+ public string cComUnitName { get; set; }
+
+ public string std { get; set; }
+
+
+ public double wqty { get; set; }
+
+ public double cqty { get; set; }
+
+ public double issqty { get; set; }
+
+ public double dqty { get; set; }
+
+ public double rqty { get; set; }
+
+
+ public double rqty1 { get; set; }
+
+ public double rqty3 { get; set; }
+
+ public double momqty { get; set; }
+
+
+ public double MQTY { get; set; }
+
+ public double q { get; set; }
+
+
+ }
+}
diff --git a/NX.ERP.U8/NX.ERP.U8.csproj b/NX.ERP.U8/NX.ERP.U8.csproj
index 101a0c9..f452fd2 100644
--- a/NX.ERP.U8/NX.ERP.U8.csproj
+++ b/NX.ERP.U8/NX.ERP.U8.csproj
@@ -43,6 +43,7 @@
+
@@ -74,7 +75,7 @@
..\packages\Dapper.1.42\lib\net35\Dapper.dll
- E:\U8SOFT\Interop\Interop.MSXML2.dll
+ D:\U8SOFT\Interop\Interop.MSXML2.dll
True
@@ -86,17 +87,17 @@
- E:\U8SOFT\UFMOM\U8APIFramework\UFIDA.U8.MomServiceCommon.dll
+ D:\U8SOFT\UFMOM\U8APIFramework\UFIDA.U8.MomServiceCommon.dll
- E:\U8SOFT\UFMOM\U8APIFramework\UFIDA.U8.U8APIFramework.dll
+ D:\U8SOFT\UFMOM\U8APIFramework\UFIDA.U8.U8APIFramework.dll
- E:\U8SOFT\UFMOM\U8APIFramework\UFIDA.U8.U8MOMAPIFramework.dll
+ D:\U8SOFT\UFMOM\U8APIFramework\UFIDA.U8.U8MOMAPIFramework.dll
False
- E:\U8SOFT\Framework\UFSoft.U8.Framework.Login.UI.dll
+ D:\U8SOFT\Framework\UFSoft.U8.Framework.Login.UI.dll
False
@@ -115,5 +116,6 @@
+
\ No newline at end of file
diff --git a/NX.ERP.U8/Pmc/PmcQuery.cs b/NX.ERP.U8/Pmc/PmcQuery.cs
new file mode 100644
index 0000000..79aafb2
--- /dev/null
+++ b/NX.ERP.U8/Pmc/PmcQuery.cs
@@ -0,0 +1,204 @@
+using NX.ERP.U8.Purchase;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using Dapper;
+
+
+namespace NX.ERP.U8.Pmc
+
+{
+ public class PmcQuery
+ {
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public IEnumerable Post1(NX.ERP.Model.Request.Inventoryall info)
+ {
+ string sql = $@"
+ 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
+ (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
+ 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
+ WHERE md.Status <> 4
+ GROUP BY ma.InvCode) misss ON c.cInvCode = misss.InvCode LEFT JOIN
+
+ (SELECT cinvcode, SUM(iquantity) qty
+ FROM currentstock
+ 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')
+ 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
+ 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
+ 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 c.cInvCode = 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 c.cInvCode = 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 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
+
+ left join ComputationUnit LL WITH (nolock) on c.cComUnitCode=LL.cComunitCode
+ ";
+
+ List where = new List();
+
+ if (info.cInvCode != null)
+ {
+ where.Add(" c.cinvcode in @cinvcode");
+ }
+ if (!string.IsNullOrEmpty(info.cInvStd))
+ {
+ where.Add(" c.cInvStd like @cInvStd ");
+ }
+
+ var aa = string.Join(" and ", where.ToArray());
+
+ if (!string.IsNullOrEmpty(aa))
+ {
+ sql += "where " + aa;
+ }
+
+
+
+ using (var conn = new System.Data.SqlClient.SqlConnection("Data Source =10.0.0.12;Initial Catalog =UFDATA_001_2019;User Id = sa;Password =1qaz@WSX;"))
+ {
+ return conn.Query(sql, new { cinvcode = info.cInvCode, info.cInvStd });
+ }
+ }
+
+
+ public IEnumerable
+
+ ..\packages\Dapper.1.40\lib\net45\Dapper.dll
+
..\packages\Swashbuckle.Core.5.6.0\lib\net40\Swashbuckle.Core.dll
@@ -148,6 +151,7 @@
+
diff --git a/NX.ERP.WebAPi/Web.config b/NX.ERP.WebAPi/Web.config
index d326e0f..b79fc18 100644
--- a/NX.ERP.WebAPi/Web.config
+++ b/NX.ERP.WebAPi/Web.config
@@ -5,11 +5,11 @@
-->
-
-
-
-
-
+
+
+
+
+
diff --git a/NX.ERP.WebAPi/packages.config b/NX.ERP.WebAPi/packages.config
index 3e4d02b..8513c27 100644
--- a/NX.ERP.WebAPi/packages.config
+++ b/NX.ERP.WebAPi/packages.config
@@ -1,6 +1,7 @@
+