|
@ -816,8 +816,8 @@ c.InvUnit, |
|
|
FLOOR(c.iQuantity) AS iQuantity, |
|
|
FLOOR(c.iQuantity) AS iQuantity, |
|
|
d.WarehouseCode, |
|
|
d.WarehouseCode, |
|
|
d.LocationCode, |
|
|
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, |
|
|
CONVERT(varchar(100),d.MTIME, 23) MTIME, |
|
|
FLOOR(f.QTYTotal) QTYTotal INTO #temp |
|
|
FLOOR(f.QTYTotal) QTYTotal INTO #temp |
|
|
FROM |
|
|
FROM |
|
@ -830,6 +830,7 @@ c.InvUnit, |
|
|
DECLARE @ItemCode VARCHAR(50), |
|
|
DECLARE @ItemCode VARCHAR(50), |
|
|
@QTY DECIMAL(18,3), |
|
|
@QTY DECIMAL(18,3), |
|
|
@ItemCodeCurrent VARCHAR(50), |
|
|
@ItemCodeCurrent VARCHAR(50), |
|
|
|
|
|
@Lotno VARCHAR(50), |
|
|
@QTYCurrent DECIMAL(18,3), |
|
|
@QTYCurrent DECIMAL(18,3), |
|
|
@iQuantityCurrent DECIMAL(18,3), |
|
|
@iQuantityCurrent DECIMAL(18,3), |
|
|
@CanDelete BIT, |
|
|
@CanDelete BIT, |
|
@ -839,10 +840,11 @@ SET @Row = @@rowcount |
|
|
SET @rowCurrent=1 |
|
|
SET @rowCurrent=1 |
|
|
SET @CanDelete=0 |
|
|
SET @CanDelete=0 |
|
|
SET @ItemCode='' |
|
|
SET @ItemCode='' |
|
|
|
|
|
SET @Lotno = '' |
|
|
|
|
|
|
|
|
WHILE @rowCurrent<=@Row |
|
|
WHILE @rowCurrent<=@Row |
|
|
BEGIN |
|
|
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) |
|
|
PRINT(@rowCurrent) |
|
|
IF @ItemCode<>@ItemCodeCurrent |
|
|
IF @ItemCode<>@ItemCodeCurrent |
|
@ -860,7 +862,7 @@ PRINT(@rowCurrent) |
|
|
END |
|
|
END |
|
|
|
|
|
|
|
|
SET @QTY += @QTYCurrent |
|
|
SET @QTY += @QTYCurrent |
|
|
IF @QTY>=@iQuantityCurrent |
|
|
|
|
|
|
|
|
IF @LotNo is null or @QTY>=@iQuantityCurrent |
|
|
BEGIN |
|
|
BEGIN |
|
|
SET @CanDelete=1 |
|
|
SET @CanDelete=1 |
|
|
END |
|
|
END |
|
|