diff --git a/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs b/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs index 95a42fa..66c1bb4 100644 --- a/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs +++ b/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs @@ -1643,11 +1643,11 @@ c.Sequence+'~'+a.Sequence as Sequence, if (Type == "2" || Type == "12") { sqls = @"select - a.ApplyCode as Code,a.Sequence, a.InvCode, b.InvName, b.InvStd, b.InvUnit, SUM(ISNULL(a.Quantity, 0)) AS iQuantity, a.WhCode,a.ExtensionID + a.ApplyCode as Code,a.Sequence, a.InvCode, b.InvName, b.InvStd, b.InvUnit, (SUM(ISNULL(a.Quantity, 0))-SUM(ISNULL(a.IssueQuantity, 0))) AS iQuantity, a.WhCode,a.ExtensionID FROM ICSMOApply a LEFT JOIN ICSINVENTORY b ON a.InvCode = b.InvCode AND a.WorkPoint=b.WorkPoint - WHERE a.ApplyCode in ({0}) AND a.WorkPoint = '{1}' + WHERE a.ApplyCode in ({0}) AND a.WorkPoint = '{1}' AND ISNULL(a.Quantity, 0)>ISNULL(a.IssueQuantity, 0) GROUP BY a.ApplyCode,a.InvCode,b.InvName,b.InvStd,b.InvUnit,a.WhCode,a.ExtensionID,a.Sequence"; } if (Type == "3") @@ -1701,12 +1701,12 @@ a.Sequence, b.InvName, b.InvStd, b.InvUnit, - SUM(ISNULL(a.Quantity, 0)) AS iQuantity, + (SUM(ISNULL(a.Quantity, 0))-SUM(ISNULL(a.IssueQuantity,0))) AS iQuantity, a.WhCode,a.ExtensionID FROM ICSOApply a LEFT JOIN ICSINVENTORY b ON a.InvCode = b.InvCode AND a.WorkPoint=b.WorkPoint - WHERE a.ApplyCode in ({0}) AND a.WorkPoint = '{1}' + WHERE a.ApplyCode in ({0}) AND a.WorkPoint = '{1}' AND ISNULL(a.Quantity, 0)>ISNULL(a.IssueQuantity, 0) GROUP BY a.ApplyCode,a.InvCode,b.InvName,b.InvStd,b.InvUnit,a.WhCode,a.ExtensionID,a.Sequence"; #endregion } @@ -1740,13 +1740,13 @@ a.Sequence, b.InvName, b.InvStd, b.InvUnit, - SUM(ISNULL(a.Quantity, 0)) AS iQuantity, + (SUM(ISNULL(a.Quantity, 0))-SUM(ISNULL(a.SDNQuantity, 0))) AS iQuantity, a.WhCode, a.ExtensionID FROM ICSSDN a LEFT JOIN ICSINVENTORY b ON a.InvCode = b.InvCode AND a.WorkPoint=b.WorkPoint - WHERE a.SDNCode in ({0}) AND a.WorkPoint = '{1}' + WHERE a.SDNCode in ({0}) AND a.WorkPoint = '{1}' AND ISNULL(a.Quantity, 0)>ISNULL(a.SDNQuantity, 0) GROUP BY a.SDNCode,a.InvCode,b.InvName,b.InvStd,b.InvUnit,a.WhCode,a.ExtensionID,a.Sequence"; #endregion } @@ -1760,13 +1760,13 @@ a.Sequence, b.InvName, b.InvStd, b.InvUnit, - SUM(ISNULL(a.Quantity, 0)) AS iQuantity, + (SUM(ISNULL(a.Quantity, 0))-SUM(ISNULL(a.OutQuantity, 0))) AS iQuantity, a.WhCode, a.ExtensionID FROM ICSOtherOut a LEFT JOIN ICSINVENTORY b ON a.InvCode = b.InvCode AND a.WorkPoint=b.WorkPoint - WHERE a.OutCode in ({0}) AND a.WorkPoint = '{1}' + WHERE a.OutCode in ({0}) AND a.WorkPoint = '{1}' AND ISNULL(a.Quantity, 0)>ISNULL(a.OutQuantity, 0) GROUP BY a.OutCode,a.InvCode,b.InvName,b.InvStd,b.InvUnit,a.WhCode,a.ExtensionID,a.Sequence"; #endregion } @@ -1800,13 +1800,13 @@ a.Sequence, b.InvName, b.InvStd, b.InvUnit, - SUM(ISNULL(a.Quantity, 0)) AS iQuantity, + (SUM(ISNULL(a.Quantity, 0))-SUM(ISNULL(a.TransferQuantity, 0))) AS iQuantity, a.FromWarehouseCode as WhCode, a.ExtensionID FROM ICSTransfer a LEFT JOIN ICSINVENTORY b ON a.InvCode = b.InvCode AND a.WorkPoint=b.WorkPoint - WHERE a.TransferNO in ({0}) AND a.WorkPoint = '{1}' + WHERE a.TransferNO in ({0}) AND a.WorkPoint = '{1}' AND ISNULL(a.Quantity, 0)>ISNULL(a.TransferQuantity, 0) GROUP BY a.TransferNO,a.InvCode,b.InvName,b.InvStd,b.InvUnit,a.FromWarehouseCode,a.ExtensionID,a.Sequence"; #endregion }