|
|
@ -1404,7 +1404,8 @@ inner join dbo.ICSInventory e on a.InvCode=e.InvCode and a.WorkPoint=e.WorkPoint |
|
|
|
left join dbo.ICSWareHouseLotInfo d on c.LotNo=d.LotNo and a.WorkPoint=b.WorkPoint |
|
|
|
inner join ICSDepartment f on a.DepCode=f.DepCode and a.WorkPoint=f.WorkPoint |
|
|
|
where isnull(d.LotNo,'')='' |
|
|
|
group by c.ProductDate,e.InvName,f.DepName ";
|
|
|
|
group by c.ProductDate,e.InvName,f.DepName |
|
|
|
order by f.DepName desc ";
|
|
|
|
|
|
|
|
|
|
|
|
DataTable dt = SqlHelper.GetDataTableBySql(SqlText); |
|
|
@ -1460,14 +1461,33 @@ where ODNType='1' and a.Quantity-a.RCVQuantity>0"; |
|
|
|
string SqlText = ""; |
|
|
|
|
|
|
|
SqlText = @"
|
|
|
|
select a.存货编码,a.存货名称,sum(a.数量) as 数量,a.产线,a.调拨时间 from( |
|
|
|
select a.InvCode as '存货编码',b.InvName as '存货名称', |
|
|
|
case when b.AmountEnable='1' then a.Quantity/b.EATTRIBUTE1 else a.Quantity end '数量', |
|
|
|
a.FromWarehouseCode as '产线',FORMAT(a.MTIME , 'yyyy-MM-dd') as '调拨时间' |
|
|
|
from ICSTransfer a |
|
|
|
left join dbo.ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint |
|
|
|
where FORMAT(a.MTIME , 'yyyy-MM-dd')=FORMAT(getdate() , 'yyyy-MM-dd')) a |
|
|
|
group by a.调拨时间 ,a.存货编码,a.存货名称,a.产线";
|
|
|
|
select a.存货编码,a.存货名称,a.数量, |
|
|
|
case when a.产线='021' then 'L1' when a.产线='022' then 'L2' when a.产线='023' then 'L3' when a.产线='024' then 'L4' |
|
|
|
when a.产线='025' then 'L5' when a.产线='026' then 'L6' when a.产线='027' then 'L7' when a.产线='015' then 'C1' end as '产线' |
|
|
|
,a.调拨时间 from ( |
|
|
|
|
|
|
|
select a.存货编码,a.存货名称, |
|
|
|
sum(case when a.Flag='负' then -1*a.数量 else a.数量 end ) as 数量, |
|
|
|
case when a.仓库F not in ('021','022','023','024','025','026','027','015') and a.仓库T in ('021','022','023','024','025','026','027','015') then a.仓库T |
|
|
|
when a.仓库F = '015' and a.仓库T in ('021','022','023','024','025','026','027') then a.仓库T |
|
|
|
when a.仓库F in ('021','022','023','024','025','026','027') and a.仓库T='015' then a.仓库F |
|
|
|
else a.仓库F end as '产线' |
|
|
|
,a.调拨时间 |
|
|
|
from( |
|
|
|
select a.InvCode as '存货编码',b.InvName as '存货名称', |
|
|
|
case when b.AmountEnable='1' then a.Quantity/b.EATTRIBUTE1 else a.Quantity end '数量', |
|
|
|
a.FromWarehouseCode as '仓库F', |
|
|
|
a.ToWarehouseCode as '仓库T', |
|
|
|
case when a.FromWarehouseCode not in('021','022','023','024','025','026','027','015') and a.ToWarehouseCode in ('021','022','023','024','025','026','027','015') then '正' else '负' end Flag , |
|
|
|
format(a.MTIME , 'yyyy-MM-dd') as '调拨时间' |
|
|
|
from dbo.ICSWareHouseLotInfoLog a |
|
|
|
inner join dbo.ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint |
|
|
|
inner join dbo.ICSWarehouse c on a.ToWarehouseCode=c.WarehouseCode and a.WorkPoint=c.WorkPoint |
|
|
|
where BusinessCode in ('70','47') and a.TransType in ('6','14') |
|
|
|
and (a.FromWarehouseCode in('021','022','023','024','025','026','027')or a.ToWarehouseCode in('021','022','023','024','025','026','027')) |
|
|
|
)a |
|
|
|
group by a.调拨时间 ,a.存货编码,a.存货名称,a.仓库F,a.仓库T |
|
|
|
) a";
|
|
|
|
|
|
|
|
|
|
|
|
DataTable dt = SqlHelper.GetDataTableBySql(SqlText); |
|
|
@ -1555,15 +1575,34 @@ select OOCode as '委外订单号','' as '状态','' as '出库单号',PlanArriv |
|
|
|
)d |
|
|
|
|
|
|
|
|
|
|
|
select count(*) as DB into #Temp5 from( |
|
|
|
select a.存货编码,a.存货名称,sum(a.数量) as 数量,a.产线,a.调拨时间 from( |
|
|
|
select a.InvCode as '存货编码',b.InvName as '存货名称', |
|
|
|
case when b.AmountEnable='1' then a.Quantity/b.EATTRIBUTE1 else a.Quantity end '数量', |
|
|
|
a.FromWarehouseCode as '产线',FORMAT(a.MTIME , 'yyyy-MM-dd') as '调拨时间' |
|
|
|
from ICSTransfer a |
|
|
|
left join dbo.ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint |
|
|
|
where FORMAT(a.MTIME , 'yyyy-MM-dd')=FORMAT(getdate() , 'yyyy-MM-dd')) a |
|
|
|
group by a.调拨时间 ,a.存货编码,a.存货名称,a.产线 |
|
|
|
select count(*) as DB into #Temp5 from( |
|
|
|
select a.存货编码,a.存货名称,a.数量, |
|
|
|
case when a.产线='021' then 'L1' when a.产线='022' then 'L2' when a.产线='023' then 'L3' when a.产线='024' then 'L4' |
|
|
|
when a.产线='025' then 'L5' when a.产线='026' then 'L6' when a.产线='027' then 'L7' when a.产线='015' then 'C1' end as '产线' |
|
|
|
,a.调拨时间 from ( |
|
|
|
|
|
|
|
select a.存货编码,a.存货名称, |
|
|
|
sum(case when a.Flag='负' then -1*a.数量 else a.数量 end ) as 数量, |
|
|
|
case when a.仓库F not in ('021','022','023','024','025','026','027','015') and a.仓库T in ('021','022','023','024','025','026','027','015') then a.仓库T |
|
|
|
when a.仓库F = '015' and a.仓库T in ('021','022','023','024','025','026','027') then a.仓库T |
|
|
|
when a.仓库F in ('021','022','023','024','025','026','027') and a.仓库T='015' then a.仓库F |
|
|
|
else a.仓库F end as '产线' |
|
|
|
,a.调拨时间 |
|
|
|
from( |
|
|
|
select a.InvCode as '存货编码',b.InvName as '存货名称', |
|
|
|
case when b.AmountEnable='1' then a.Quantity/b.EATTRIBUTE1 else a.Quantity end '数量', |
|
|
|
a.FromWarehouseCode as '仓库F', |
|
|
|
a.ToWarehouseCode as '仓库T', |
|
|
|
case when a.FromWarehouseCode not in('021','022','023','024','025','026','027','015') and a.ToWarehouseCode in ('021','022','023','024','025','026','027','015') then '正' else '负' end Flag , |
|
|
|
format(a.MTIME , 'yyyy-MM-dd') as '调拨时间' |
|
|
|
from dbo.ICSWareHouseLotInfoLog a |
|
|
|
inner join dbo.ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint |
|
|
|
inner join dbo.ICSWarehouse c on a.ToWarehouseCode=c.WarehouseCode and a.WorkPoint=c.WorkPoint |
|
|
|
where BusinessCode in ('70','47') and a.TransType in ('6','14') |
|
|
|
and (a.FromWarehouseCode in('021','022','023','024','025','026','027')or a.ToWarehouseCode in('021','022','023','024','025','026','027')) |
|
|
|
)a |
|
|
|
group by a.调拨时间 ,a.存货编码,a.存货名称,a.仓库F,a.仓库T |
|
|
|
) a |
|
|
|
)e |
|
|
|
|
|
|
|
|
|
|
|