--查询有出库但是未完全开发票的销售订单selectdistinctpo.vreceiptcodefrombd_corpbp,so_salepo,so_saleorder_bso,so_saleexecutepb,bd_busitypebusiwherepo.dr=0andpb.dr=0andso.dr=0andpo.pk_corp=bp.pk_corpandpo.pk_corp=so.pk_corpandpo.csaleid=pb.csaleidandpo.cbiztype=busi.pk_busitypeandpb.ntotalinventorynumber>pb.ntotalinvoicenumber--ntotalinvoicenumber累计开票数量;ntotalinventorynumber累计出库数量andpb.ntotalinventorynumber>=0andpo.dbilldate<='2018-04-20'----andbusi.busicode='c001'andbusi.pk_corp='1001'andpb.bsquareendflag='N'--未关闭销售订单