|
|
@ -812,12 +812,12 @@ where a.IssueCode='{0}' and a.WorkPoint='{1}'"; |
|
|
|
c.InvCode, |
|
|
|
c.InvName, |
|
|
|
c.InvStd, |
|
|
|
c.InvUnit, |
|
|
|
c.InvUnit, |
|
|
|
FLOOR(c.iQuantity) AS iQuantity, |
|
|
|
d.WarehouseCode, |
|
|
|
d.LocationCode, |
|
|
|
d.LotNO, |
|
|
|
FLOOR(ISNULL(d.Quantity, 0)) AS QTY, |
|
|
|
m.LotNO, |
|
|
|
(case when m.LotNo is null then 0 else FLOOR(ISNULL(d.Quantity, 0)) end) AS QTY, |
|
|
|
CONVERT(varchar(100),d.MTIME, 23) MTIME, |
|
|
|
FLOOR(f.QTYTotal) QTYTotal INTO #temp |
|
|
|
FROM |
|
|
@ -830,6 +830,7 @@ c.InvUnit, |
|
|
|
DECLARE @ItemCode VARCHAR(50), |
|
|
|
@QTY DECIMAL(18,3), |
|
|
|
@ItemCodeCurrent VARCHAR(50), |
|
|
|
@Lotno VARCHAR(50), |
|
|
|
@QTYCurrent DECIMAL(18,3), |
|
|
|
@iQuantityCurrent DECIMAL(18,3), |
|
|
|
@CanDelete BIT, |
|
|
@ -839,10 +840,11 @@ SET @Row = @@rowcount |
|
|
|
SET @rowCurrent=1 |
|
|
|
SET @CanDelete=0 |
|
|
|
SET @ItemCode='' |
|
|
|
SET @Lotno = '' |
|
|
|
|
|
|
|
WHILE @rowCurrent<=@Row |
|
|
|
BEGIN |
|
|
|
SELECT @ItemCodeCurrent=InvCode,@QTYCurrent=QTY,@iQuantityCurrent=iQuantity FROM #temp WHERE rowNo=@rowCurrent |
|
|
|
SELECT @ItemCodeCurrent=InvCode,@QTYCurrent=QTY,@iQuantityCurrent=iQuantity,@Lotno = Lotno FROM #temp WHERE rowNo=@rowCurrent |
|
|
|
|
|
|
|
PRINT(@rowCurrent) |
|
|
|
IF @ItemCode<>@ItemCodeCurrent |
|
|
@ -859,8 +861,8 @@ PRINT(@rowCurrent) |
|
|
|
CONTINUE |
|
|
|
END |
|
|
|
|
|
|
|
SET @QTY += @QTYCurrent |
|
|
|
IF @QTY>=@iQuantityCurrent |
|
|
|
SET @QTY += @QTYCurrent |
|
|
|
IF @LotNo is null or @QTY>=@iQuantityCurrent |
|
|
|
BEGIN |
|
|
|
SET @CanDelete=1 |
|
|
|
END |
|
|
@ -882,7 +884,7 @@ DROP TABLE #temp |
|
|
|
b.InvStd, |
|
|
|
SUM(ISNULL(a.Quantity, 0)) AS iQuantity, |
|
|
|
a.WhCode, |
|
|
|
b.InvUnit, |
|
|
|
b.InvUnit, |
|
|
|
a.ExtensionID |
|
|
|
FROM |
|
|
|
ICSMOPick a |
|
|
@ -919,7 +921,7 @@ b.InvUnit, |
|
|
|
a.InvCode, |
|
|
|
b.InvName, |
|
|
|
b.InvStd, |
|
|
|
b.InvUnit, |
|
|
|
b.InvUnit, |
|
|
|
SUM(ISNULL(a.Quantity, 0)) AS iQuantity, |
|
|
|
a.WhCode, |
|
|
|
a.ExtensionID |
|
|
@ -933,7 +935,7 @@ b.InvUnit, |
|
|
|
if (Type=="4") |
|
|
|
{ |
|
|
|
#region 委外备料SQL
|
|
|
|
sqls = @" select
|
|
|
|
sqls = @" select
|
|
|
|
c.OOCode as Code, |
|
|
|
a.InvCode, |
|
|
|
b.InvName, |
|
|
@ -1015,10 +1017,10 @@ a.ExtensionID |
|
|
|
a.InvCode, |
|
|
|
b.InvName, |
|
|
|
b.InvStd, |
|
|
|
b.InvUnit, |
|
|
|
b.InvUnit, |
|
|
|
SUM(ISNULL(a.Quantity, 0)) AS iQuantity, |
|
|
|
a.WhCode, |
|
|
|
a.ExtensionID |
|
|
|
a.ExtensionID |
|
|
|
FROM |
|
|
|
ICSOtherOut a |
|
|
|
LEFT JOIN ICSINVENTORY b ON a.InvCode = b.InvCode AND a.WorkPoint=b.WorkPoint |
|
|
|