包括 直接调拨单, 分布式调出单, 分布式调入单, 生产领料单, 生产退料单, 生产入库单, 销售出库单, 采购入库单, 其他出库单
-- 直接调拨单
SELECT * from xx_directallot_item WHERE direct_allot=(SELECT id FROM xx_directallot WHERE invoicesid='ZJDB000656');
SELECT * from xx_directallot where invoicesid='ZJDB000656';
DELETE FROM xx_directallot_item WHERE direct_allot=(SELECT id FROM xx_directallot WHERE invoicesid='ZJDB000656');
DELETE from xx_directallot where invoicesid='ZJDB000656';
-- 分布式调出单
SELECT * from xx_distributedout where invoicesid='fbdc005266';
select * from xx_distributedout_item where distributed_out=(select id from xx_distributedout where invoicesid='fbdc005266');
DELETE from xx_distributedout_item where distributed_out=(select id from xx_distributedout where invoicesid='fbdc005266');
DELETE from xx_distributedout where invoicesid='fbdc005266';
-- 分布式调入单
select * from xx_distributedget_item where distributed_get=(select id from xx_distributedget where invoicesid='FBDR001771');
select * from xx_distributedget WHERE invoicesid='FBDR001771';
DELETE from xx_distributedget_item where distributed_get=(select id from xx_distributedget where invoicesid='FBDR001771');
DELETE from xx_distributedget WHERE invoicesid='FBDR001771';
-- 生产领料单
select * from xx_productionget_item where production_get=(select id from xx_productionget where invoicesid='SOUT00030086');
select * from xx_productionget WHERE invoicesid='SOUT00030086';
delete from xx_productionget_item where production_get=(select id from xx_productionget where invoicesid='SOUT00030086');
delete from xx_productionget where invoicesid='SOUT00030086';
-- 生产退料单
SELECT * from xx_productionreturn_item where production_return=(select id from xx_productionreturn where invoicesid='SCTL00000021');
select * from xx_productionreturn where invoicesid='SCTL00000021';
delete from xx_productionreturn_item where production_return=(select id from xx_productionreturn where invoicesid='SCTL00000021');
delete from xx_productionreturn where invoicesid='SCTL00000021';
-- 生产入库单
SELECT * FROM xx_productioninstock_item where production_in_stock=(select id from xx_productioninstock where invoicesid='SCRK00036352');
select * from xx_productioninstock WHERE invoicesid='SCRK00036352';
DELETE FROM xx_productioninstock_item WHERE production_in_stock=(select id from xx_productioninstock where invoicesid='SCRK00036352');
DELETE from xx_productioninstock WHERE invoicesid='SCRK00036352';
-- 销售出库单
SELECT * FROM xx_selloutstock_item where sell_out_stock=(select id from xx_selloutstock where invoicesid='XSCKD045201');
select * from xx_selloutstock WHERE invoicesid='XSCKD045201';
DELETE FROM xx_selloutstock_item WHERE sell_out_stock=(select id from xx_selloutstock where invoicesid='XSCKD045201');
DELETE from xx_selloutstock WHERE invoicesid='XSCKD045201';
-- 采购入库单
SELECT * from xx_procurementinstock_item where procurement_in_stock =(SELECT id from xx_procurementinstock where djsn='CGRK02775');
select * from xx_procurementinstock WHERE djsn='CGRK02775';
DELETE from xx_procurementinstock_item where procurement_in_stock =(SELECT id from xx_procurementinstock where djsn='CGRK02775');
DELETE from xx_procurementinstock WHERE djsn='CGRK02775';
-- 其他出库单
select * from xx_otheroutstock_item WHERE other_out_stock=(select id from xx_otheroutstock where invoicesid='QT20181126135017');
select * from xx_otheroutstock WHERE invoicesid='QT20181126135017';
DELETE from xx_otheroutstock_item WHERE other_out_stock=(select id from xx_otheroutstock where invoicesid='QT20181126135017');
DELETE from xx_otheroutstock WHERE invoicesid='QT20181126135017';
如果需要查看删除那些单据有问题,可以用类似命令查看和优化: