|
|
@ -1402,80 +1402,95 @@ namespace ICSSoft.DataProject |
|
|
|
// LEFT JOIN ICSContainer con ON conlot.ContainerID=con.ID AND conlot.WorkPoint=con.WorkPoint
|
|
|
|
// INNER JOIN ICSInventory inv ON a.InvCode=inv.InvCode AND a.WorkPoint=inv.WorkPoint
|
|
|
|
// WHERE a.Quantity>0 and a.WorkPoint='{3}'";
|
|
|
|
Losql = @"DECLARE @aa VARCHAR(MAX)
|
|
|
|
DECLARE @bb VARCHAR(MAX) |
|
|
|
DECLARE @cc VARCHAR(MAX) |
|
|
|
DECLARE @b VARCHAR(MAX) |
|
|
|
set @b = |
|
|
|
'SELECT a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode, |
|
|
|
inv.InvName, |
|
|
|
inv.InvStd, |
|
|
|
inv.InvUnit, |
|
|
|
inv.LotEnable, |
|
|
|
s.WarehouseCode,sum(a.Quantity) as Qty,s.sumQty, |
|
|
|
inv.AmountUnit, |
|
|
|
ext.ID AS ExtensionID, |
|
|
|
ext.ProjectCode, |
|
|
|
ext.Version, |
|
|
|
ext.Brand, |
|
|
|
ext.cFree1, |
|
|
|
ext.cFree2, |
|
|
|
ext.cFree3, |
|
|
|
ext.cFree4, |
|
|
|
ext.cFree5, |
|
|
|
ext.cFree6, |
|
|
|
ext.cFree7, |
|
|
|
ext.cFree8, |
|
|
|
ext.cFree9, |
|
|
|
ext.cFree10, |
|
|
|
a.MUSER AS [User], |
|
|
|
a.MTIME AS [MTime] |
|
|
|
FROM ICSWareHouseLotInfo a |
|
|
|
LEFT JOIN ICSLocation b ON a.LocationCode = b.LocationCode and a.WorkPoint=b.WorkPoint |
|
|
|
INNER JOIN ICSInventoryLot lot ON a.LotNo=lot.LotNo AND a.WorkPoint=lot.WorkPoint |
|
|
|
INNER JOIN ICSExtension ext ON lot.ExtensionID=ext.ID AND lot.WorkPoint=ext.WorkPoint |
|
|
|
LEFT JOIN (select SUM(Quantity) AS sumQty,WarehouseCode,INVCode from ICSWareHouseLotInfo group by WarehouseCode,INVCode)s ON a.INVCode=s.INVCode |
|
|
|
LEFT JOIN ICSContainerLot conlot ON a.LotNo=conlot.LotNo AND a.WorkPoint=conlot.WorkPoint |
|
|
|
LEFT JOIN ICSContainer con ON conlot.ContainerID=con.ID AND conlot.WorkPoint=con.WorkPoint |
|
|
|
INNER JOIN ICSInventory inv ON a.InvCode=inv.InvCode AND a.WorkPoint=inv.WorkPoint |
|
|
|
WHERE a.Quantity>0 and a.WorkPoint=''{3}'' and' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @aa=id from ICSWareHouseLotInfo where LotNo='{2}' |
|
|
|
|
|
|
|
IF @aa IS NOT NULL |
|
|
|
BEGIN |
|
|
|
set @b = @b+' lot.invcode IN(SELECT invcode FROM ICSWareHouseLotInfo where LotNo=''{2}'') |
|
|
|
group by a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,inv.LotEnable,s.WarehouseCode, inv.INVCODE,inv.INVNAME,inv.INVSTD,s.sumQty,inv.AmountUnit, |
|
|
|
ext.ID,ext.ProjectCode,ext.Version,ext.Brand,ext.cFree1,ext.cFree2,ext.cFree3,ext.cFree4,ext.cFree5,ext.cFree6,ext.cFree7,ext.cFree8,ext.cFree9,ext.cFree10,a.MUSER ,a.MTIME |
|
|
|
' |
|
|
|
END |
|
|
|
|
|
|
|
Losql = @" DECLARE @wheresql VARCHAR(MAX)
|
|
|
|
DECLARE @groupsql VARCHAR(MAX) |
|
|
|
DECLARE @aa VARCHAR(MAX) |
|
|
|
DECLARE @bb VARCHAR(MAX) |
|
|
|
DECLARE @cc VARCHAR(MAX) |
|
|
|
DECLARE @dd VARCHAR(MAX) |
|
|
|
DECLARE @b VARCHAR(MAX) |
|
|
|
|
|
|
|
select @aa=id from ICSWareHouseLotInfo where LotNo='{2}' |
|
|
|
IF @aa IS NOT NULL |
|
|
|
BEGIN |
|
|
|
set @wheresql='and a.lotno=''{2}'' and s.invcode IN(SELECT invcode FROM ICSWareHouseLotInfo where LotNo=''{2}'') and a.invcode=s.invcode ' |
|
|
|
set @groupsql=' group by inv.LotEnable,a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,inv.LotEnable,a.warehouseCode,a.LocationCode, inv.INVCODE,inv.INVNAME,inv.INVSTD,a.Quantity,inv.AmountUnit, |
|
|
|
ext.ID,ext.ProjectCode,ext.Version,ext.Brand,ext.cFree1,ext.cFree2,ext.cFree3,ext.cFree4,ext.cFree5,ext.cFree6,ext.cFree7,ext.cFree8,ext.cFree9,ext.cFree10,a.MUSER ,a.MTIME' |
|
|
|
END |
|
|
|
|
|
|
|
select @bb=id from ICSLocation where LocationCode='{2}' |
|
|
|
select @bb=id from ICSLocation where LocationCode='{2}' |
|
|
|
IF @bb IS not NULL |
|
|
|
BEGIN |
|
|
|
set @wheresql='and a.locationcode=s.locationcode and a.LocationCode=''{2}'' ' |
|
|
|
set @groupsql = 'group by inv.LotEnable,a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,inv.LotEnable,a.warehouseCode,a.LocationCode, inv.INVCODE,inv.INVNAME,inv.INVSTD,a.Quantity,inv.AmountUnit, |
|
|
|
ext.ID,ext.ProjectCode,ext.Version,ext.Brand,ext.cFree1,ext.cFree2,ext.cFree3,ext.cFree4,ext.cFree5,ext.cFree6,ext.cFree7,ext.cFree8,ext.cFree9,ext.cFree10,a.MUSER ,a.MTIME' |
|
|
|
END |
|
|
|
|
|
|
|
IF @bb IS not NULL |
|
|
|
BEGIN |
|
|
|
set @b = @b+' a.WarehouseCode=s.WarehouseCode and a.LocationCode=''{2}'' |
|
|
|
group by a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,inv.LotEnable,s.WarehouseCode, inv.INVCODE,inv.INVNAME,inv.INVSTD,s.sumQty,inv.AmountUnit, |
|
|
|
ext.ID,ext.ProjectCode,ext.Version,ext.Brand,ext.cFree1,ext.cFree2,ext.cFree3,ext.cFree4,ext.cFree5,ext.cFree6,ext.cFree7,ext.cFree8,ext.cFree9,ext.cFree10,a.MUSER ,a.MTIME' |
|
|
|
END |
|
|
|
select @cc=id from ICSInventory where invcode='{2}' |
|
|
|
IF @cc IS not NULL |
|
|
|
BEGIN |
|
|
|
set @wheresql='and inv.invcode=''{2}'' and a.invcode=s.invcode ' |
|
|
|
set @groupsql='group by inv.LotEnable,a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,inv.LotEnable,a.WarehouseCode,a.LocationCode, inv.INVCODE,inv.INVNAME,inv.INVSTD,a.Quantity,inv.AmountUnit, |
|
|
|
ext.ID,ext.ProjectCode,ext.Version,ext.Brand,ext.cFree1,ext.cFree2,ext.cFree3,ext.cFree4,ext.cFree5,ext.cFree6,ext.cFree7,ext.cFree8,ext.cFree9,ext.cFree10,a.MUSER ,a.MTIME' |
|
|
|
END |
|
|
|
|
|
|
|
select @dd=id from ICSInventory where InvStd LIKE '%{2}%' |
|
|
|
IF @dd IS not NULL |
|
|
|
BEGIN |
|
|
|
set @wheresql='and inv.InvStd LIKE ''%{2}%'' ' |
|
|
|
set @groupsql='group by inv.LotEnable,a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,inv.LotEnable,a.WarehouseCode,a.LocationCode, inv.INVCODE,inv.INVNAME,inv.INVSTD,a.Quantity,inv.AmountUnit, |
|
|
|
ext.ID,ext.ProjectCode,ext.Version,ext.Brand,ext.cFree1,ext.cFree2,ext.cFree3,ext.cFree4,ext.cFree5,ext.cFree6,ext.cFree7,ext.cFree8,ext.cFree9,ext.cFree10,a.MUSER ,a.MTIME' |
|
|
|
END |
|
|
|
|
|
|
|
IF @aa IS NULL and @bb IS NULL and @cc IS NULL and @dd IS NULL |
|
|
|
BEGIN |
|
|
|
RAISERROR('" + language.GetNameByCode("WMSAPIInfo478") + @"',16,1) |
|
|
|
END |
|
|
|
ELSE |
|
|
|
BEGIN |
|
|
|
|
|
|
|
set @b = |
|
|
|
'SELECT a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode, |
|
|
|
inv.InvName, |
|
|
|
inv.InvStd, |
|
|
|
inv.InvUnit, |
|
|
|
inv.LotEnable, |
|
|
|
a.WarehouseCode,a.LocationCode,a.Quantity as Qty,SUM(s.sumQty) sumQty, |
|
|
|
inv.AmountUnit, |
|
|
|
ext.ID AS ExtensionID, |
|
|
|
ext.ProjectCode, |
|
|
|
ext.Version, |
|
|
|
ext.Brand, |
|
|
|
ext.cFree1, |
|
|
|
ext.cFree2, |
|
|
|
ext.cFree3, |
|
|
|
ext.cFree4, |
|
|
|
ext.cFree5, |
|
|
|
ext.cFree6, |
|
|
|
ext.cFree7, |
|
|
|
ext.cFree8, |
|
|
|
ext.cFree9, |
|
|
|
ext.cFree10, |
|
|
|
a.MUSER AS [User], |
|
|
|
a.MTIME AS [MTime] |
|
|
|
FROM ICSWareHouseLotInfo a |
|
|
|
LEFT JOIN ICSLocation b ON a.LocationCode = b.LocationCode and a.WorkPoint=b.WorkPoint |
|
|
|
INNER JOIN ICSInventoryLot lot ON a.LotNo=lot.LotNo AND a.WorkPoint=lot.WorkPoint |
|
|
|
INNER JOIN ICSExtension ext ON lot.ExtensionID=ext.ID AND lot.WorkPoint=ext.WorkPoint |
|
|
|
LEFT JOIN (select SUM(Quantity) AS sumQty,WarehouseCode,INVCode,LocationCode,workpoint from ICSWareHouseLotInfo where quantity>0 group by WarehouseCode,INVCode,LocationCode,workpoint)s ON a.workpoint=s.workpoint |
|
|
|
LEFT JOIN ICSContainerLot conlot ON a.LotNo=conlot.LotNo AND a.WorkPoint=conlot.WorkPoint |
|
|
|
LEFT JOIN ICSContainer con ON conlot.ContainerID=con.ID AND conlot.WorkPoint=con.WorkPoint |
|
|
|
INNER JOIN ICSInventory inv ON a.InvCode=inv.InvCode AND a.WorkPoint=inv.WorkPoint |
|
|
|
WHERE a.Quantity>0 and a.WorkPoint=''{3}'' ' + @wheresql + @groupsql |
|
|
|
END |
|
|
|
|
|
|
|
exec(@b) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @cc=id from ICSInventory where invcode='{2}' |
|
|
|
IF @cc IS not NULL |
|
|
|
BEGIN |
|
|
|
set @b = @b+' a.WarehouseCode=s.WarehouseCode and inv.invcode=''{2}'' |
|
|
|
group by a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,inv.LotEnable,s.WarehouseCode, inv.INVCODE,inv.INVNAME,inv.INVSTD,s.sumQty,inv.AmountUnit, |
|
|
|
ext.ID,ext.ProjectCode,ext.Version,ext.Brand,ext.cFree1,ext.cFree2,ext.cFree3,ext.cFree4,ext.cFree5,ext.cFree6,ext.cFree7,ext.cFree8,ext.cFree9,ext.cFree10,a.MUSER ,a.MTIME' |
|
|
|
END |
|
|
|
exec(@b) |
|
|
|
|
|
|
|
|
|
|
|
";
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
{ |
|
|
|
if (ScanType == "LOTNO") |
|
|
|