---存货供应类型iSupplyType,0:领用,1:入库倒冲,2:工序倒冲,3:虚拟件,4:直接供应
SELECT * FROM dbo.Inventory WHERE iSupplyType=1
UPDATE dbo.Inventory SET iSupplyType=0 WHERE iSupplyType=1
--生产订单信息
SELECT *
FROM dbo.mom_order
JOIN dbo.mom_orderdetail
ON mom_orderdetail.MoId = mom_order.MoId
AND mom_order.MoCode = 'T4B0222504';
--生产订单子件信息
--字段WIPType属性(1入库倒冲/2工序倒冲/3领料/5基于BOM)
SELECT WIPType
FROM mom_moallocate
WHERE
--WIPType = 0
-- AND
MoDId =
(
SELECT MoDId
FROM dbo.mom_order
JOIN dbo.mom_orderdetail
ON mom_orderdetail.MoId = mom_order.MoId
AND mom_order.MoCode = 'T4B0222504'
);
--UPDATE mom_moallocate SET WIPType=0 WHERE WIPType=1
BEGIN TRANSACTION
UPDATE mom_moallocate SET WIPType=3 WHERE
WIPType = 0
AND
MoDId =
(
SELECT MoDId
FROM dbo.mom_order
JOIN dbo.mom_orderdetail
ON mom_orderdetail.MoId = mom_order.MoId
AND mom_order.MoCode = 'T4B0222504'
);
COMMIT
UPDATE mom_moallocate SET WIPType=3 WHERE WIPType=1