K3 批量更新BOM用量的

时间:2022-07-09 14:54:15
不解释(不懂解释了也没有用),看懂后再动手……


将部分BOM的原料从'01.0050.0011升级为'01.0050.0014,单位用量由以前的降低25%


update b set b.FItemID=(select FItemID from t_ICItem where t_ICItem.fnumber='01.0050.0014'),b.FQty=ROUND(b.FQty*(100-25)/100,(select FQtyDecimal from t_ICItem where t_ICItem.fnumber='01.0050.0014'))
--,b.FAuxQty=b.fqty  
from ICBOM a ,ICBOMCHILD  b,t_ICItem c,t_ICItem d
where a.finterid=b.finterid
and a.fitemid=c.FItemID
and b.fitemid=d.FItemID
and a.FUseStatus=1072
and d.fnumber in 
('01.0050.0011')
and c.fnumber in 
(
'1-00268-2001-00-00',
'1-00888-2001-02-00',
'1-01588-2001-01-00',
'1-01598-2001-01-00',
'1-01608-2001-01-00',
'1-03010-2001-01-00',
'1-03011-2001-00-00',
'1-03011-2001-01-00',
'1-03011-2002-00-00',
'1-03011-2003-01-00',
'1-03011-2004-01-00',
'1-04258-2001-01-00',

'1-04258-2002-01-00'

)

/*
select * from t_BillLockTable
select * from ICBOMCHILD b where b.FAuxQty<>b.fqty
select * from ICBOMCHILD b where b.FAuxQty>=0
go
update b set b.FAuxQty=b.fqty from ICBOMCHILD b where b.FAuxQty<>b.fqty
*/