BOM取料品仓库
如果BOM子项上已经有存储地点了且与料品不一样,这个脚本会强制刷成一样的
update A set SupplyWareHouse=C.WareHouse
from cbo_bomcomponent A,cbo_itemmaster B,CBO_InventoryInfo C,Base_Organization D
where A.itemmaster=B.ID and B.ID=C.itemmaster and B.Org=D.ID
and A.IssueStyle=0 and C.WareHouse is not null
and D.Code='10'
只刷料品存储地点非空时,且子项上供应地点为空的记录
update A set SupplyWareHouse=C.WareHouse
from cbo_bomcomponent A,cbo_itemmaster B,CBO_InventoryInfo C,Base_Organization D
where A.itemmaster=B.ID and B.ID=C.itemmaster and B.Org=D.ID
and A.IssueStyle=0 and C.WareHouse is not null and A.SupplyWareHouse is null
and D.Code='10'
生产订单备料取料品仓库
update A set SupplyWh=C.WareHouse
from MO_MOPickList A,cbo_itemmaster B,CBO_InventoryInfo C,Base_Organization D
where A.itemmaster=B.ID and B.ID=C.itemmaster and B.Org=D.ID
and A.IssueStyle=0 and C.WareHouse is not null and A.SupplyWh is null
and D.Code='20'