1)清空在途
2) 关账,处理所有出入库单据。避免出现库存没有入库或者没有出库问题。
3)反关账,新增其他出库单,清空库存。(注意要所有的帐套清空,切记!)
4) 及时库存校对和清理零库存记录
5) 关账
6) 入库成本核算->出库成本核算->产品成本核算
7) 生成组装拆卸凭证,再次进行6步操作。
8) 反关账, 开始启用批号
查询某一个某一个组织的物料状态:
select t2.fcreateorgid,t2.fuseorgid,t2.fnumber,t1.fentryid,t1.fmaterialid,t1.FISBATCHMANAGE,t1.FBATCHRULEID,t1.FISKFPERIOD,t1.FEXPUNIT,t1.FEXPPERIOD,t1.FISSNMANAGE,t1.FISSNPRDTRACY,t1.FSNCODERULE,t1.fsnunit
-- into t_bd_materialstockbak930
from t_bd_materialstock t1 inner join T_BD_MATERIAL t2 on t1.fmaterialid=t2.fmaterialid
where t1.fmaterialid in ( select fmaterialid from T_BD_MATERIAL where
fuseorgid=100140 and
fnumber like ('CW0690S%'))
---物料类别说明:
---FCategoryID: 存货类别:
---产成品:241(启用批号序列号) ,
---服务型物料(不启用批号,序列号):242,
---半成品:237(启用批号),
---自制半成品: 239(启用批号),
---资产: 40040(不启用),
---外购商品(比如仪器): 401749 (启用)
--- 物料状态字段:
--B :FForbidStatus 禁用状态
--D: 重新审核,C--已审核,
以CW0690M为例:
---bakup
select * into t_bd_materialstockbak917 from t_bd_materialstock t
where fmaterialid in ( select fmaterialid from T_BD_MATERIAL where fuseorgid=100140 and fnumber in('CW0690M'))
select * into T_BD_MATERIALINVPTYbak917 from T_BD_MATERIALINVPTY t
where FINVPTYID =10004 and fmaterialid in ( select fmaterialid from T_BD_MATERIAL where fuseorgid=100140 and fnumber in('CW0690M'))
-- 启用批号
update t set FISBATCHMANAGE=1,FBATCHRULEID=110091,FISKFPERIOD=1,FEXPUNIT='D' from t_bd_materialstock t
where fmaterialid in ( select fmaterialid from T_BD_MATERIAL where
--- fuseorgid=100140 and
fnumber like ('CW0690S%'))
update t set FISENABLE=1 from T_BD_MATERIALINVPTY t
where FINVPTYID =10004 and fmaterialid in ( select fmaterialid from T_BD_MATERIAL where
fuseorgid=100140 and
fnumber like ('CW0690S%'))
--- 禁用批号
update t set FISBATCHMANAGE=0,FBATCHRULEID=null,FISKFPERIOD=0,FEXPUNIT='' from t_bd_materialstock t
where fmaterialid in ( select fmaterialid from T_BD_MATERIAL where
---fuseorgid=100140 and
fnumber like ('CW0690S%'))
update t set FISENABLE=0 from T_BD_MATERIALINVPTY t
where FINVPTYID =10004 and fmaterialid in ( select fmaterialid from T_BD_MATERIAL where
---fuseorgid=100140 and
fnumber like ('CW0690S%'))
--- 10001是仓库、10002是仓位、10003是BOM版本、10004是批号、10006是计划跟踪号
--- 启用序列号, 注意序列号单位fsnunit 需要以实际查到的为准, 默认pcs
update t set FISSNMANAGE=1,FSNCODERULE=776783,fsnunit=10101 FROM t_BD_MaterialStock t
WHERE FMATERIALID IN(select FMATERIALID from t_bd_material where
---fuseorgid=100140 and
fnumber like ('CW0690S%'))
--- 禁用序列号
update t set FISSNMANAGE=0,FSNCODERULE=null,fsnunit=null FROM t_BD_MaterialStock t
WHERE FMATERIALID IN(select FMATERIALID from t_bd_material where
---fuseorgid=100140 and
fnumber like ('CW0690S%'))
特殊物料不启用过滤,可选
---select FNUMBER from t_bd_material where fuseorgid=100140 and fnumber like ('CW3127S%') and FNUMBER not like ('%Q')
正式上线的sql:PN启用批次,CW开头启用批次序列号,其他不变, 服务性物料不启用批次,序列号
--- 启用批号
update t set FISBATCHMANAGE=1,FBATCHRULEID=110091,FISKFPERIOD=1,FEXPUNIT='D' from t_bd_materialstock t
where fmaterialid in ( select fmaterialid from T_BD_MATERIAL where
--- fuseorgid=100140 and
fnumber like ('CW%')
or fnumber like ('PN%')
)
update t set FISENABLE=1 from T_BD_MATERIALINVPTY t
where FINVPTYID =10004 and fmaterialid in ( select fmaterialid from T_BD_MATERIAL where
fuseorgid=100140 and
fnumber like ('CW%')
or fnumber like ('PN%')
)
--- 启用序列号
update t set FISSNMANAGE=1,FSNCODERULE=776783,fsnunit=10101 FROM t_BD_MaterialStock t
WHERE FMATERIALID IN(select FMATERIALID from t_bd_material where
---fuseorgid=100140 and
fnumber like ('CW%'))
--- 禁用批号
update t set FISBATCHMANAGE=0,FBATCHRULEID=null,FISKFPERIOD=0,FEXPUNIT='' from t_bd_materialstock t
where fmaterialid in ( select fmaterialid from T_BD_MATERIAL where
---fuseorgid=100140 and
fnumber like ('CW%')
or fnumber like ('PN%')
)
update t set FISENABLE=0 from T_BD_MATERIALINVPTY t
where FINVPTYID =10004 and fmaterialid in ( select fmaterialid from T_BD_MATERIAL where
---fuseorgid=100140 and
fnumber like ('CW%')
or fnumber like ('PN%')
)
--- 禁用序列号
update t set FISSNMANAGE=0,FSNCODERULE=null,fsnunit=null FROM t_BD_MaterialStock t
WHERE FMATERIALID IN(select FMATERIALID from t_bd_material where
---fuseorgid=100140 and
fnumber like ('CW%'))
可以通过导入导出的方式启用。有多个仓位信息的最好一个仓库导入一次。