解决方案: | 检验商品是否被使用的脚本 --验证是否商品被使用的脚本,注意只要把商品编码‘f’修改为,需要验证的商品编码即可,如果编码不唯一建议将编码改为唯一后在验证。 d elete product where s_syb=-1 --盘点单 s elect '未过账盘点单' 标识,masterbilldft.billsn,listprodcheckdft.old_number prod_number,product.u_code,product.u_name from listprodcheckdft join masterbilldft on listprodcheckdft.bill_id=masterbilldft.s_id join product on listprodcheckdft.prod_id=product.s_id where listprodcheckdft.prod_id=(s elect s_id from product where u_code='f') union s elect '已过账盘点单' 标识,masterbill.billsn,listprodcheck.old_number prod_number,product.u_code,product.u_name from listprodcheck join masterbill on listprodcheck.bill_id=masterbill.autoid join product on listprodcheck.prod_id=product.s_id where listprodcheck.prod_id=(s elect s_id from product where u_code='f') --进货单 union s elect '已过账进货单' 标识,masterbill.billsn,listbuy.prod_number,product.u_code,product.u_name from listbuy join masterbill on listbuy.bill_id=masterbill.autoid join product on listbuy.prod_id=product.s_id where listbuy.prod_id=(s elect s_id from product where u_code='f') union s elect '进货单草稿' 标识,masterbillDft.billsn,listbuyDft.prod_number,product.u_code,product.u_name from listbuyDft join masterbillDft on listbuyDft.bill_id=masterbilldft.s_id join product on listbuyDft.prod_id=product.s_id where listbuyDft.prod_id=(s elect s_id from product where u_code='f') union --销售单 s elect '已过账销售单' 标识,masterbill.billsn,listsale.prod_number,product.u_code,product.u_name from listsale join masterbill on listsale.bill_id=masterbill.autoid join product on listsale.prod_id=product.s_id where listsale.prod_id=(s elect s_id from product where u_code='f') union s elect '销售单草稿' 标识,masterbillDft.billsn,listsaleDft.prod_number,product.u_code,product.u_name from listsaleDft join masterbillDft on listsaleDft.bill_id=masterbilldft.s_id join product on listsaleDft.prod_id=product.s_id where listsaleDft.prod_id=(s elect s_id from product where u_code='f') union --其他单据 s elect '已过账其他类单据' 标识,masterbill.billsn,listother.prod_number,product.u_code,product.u_name from listother join masterbill on listother.bill_id=masterbill.autoid join product on listother.prod_id=product.s_id where listother.prod_id=(s elect s_id from product where u_code='f') union s elect '未过账其他类草稿' 标识,masterbillDft.billsn,listotherDft.prod_number,product.u_code,product.u_name from listotherDft join masterbillDft on listotherDft.bill_id=masterbilldft.s_id join product on listotherDft.prod_id=product.s_id where listotherDft.prod_id=(s elect s_id from product where u_code='f') --订单 union s elect '正式订单' 标识,masterorder.billsn,listorder.prod_number,product.u_code,product.u_name from listorder join masterorder on listorder.bill_id=masterorder.autoid join product on listorder.prod_id=product.s_id where listorder.prod_id=(s elect s_id from product where u_code='f') union s elect '其他订单' 标识,masterorderdft.billsn,listorderdft.prod_number,product.u_code,product.u_name from listorderdft join masterorderdft on listorderdft.bill_id=masterorderdft.s_id join product on listorderdft.prod_id=product.s_id where listorderdft.prod_id=(s elect s_id from product where u_code='f') --零售暂存单 union s elect '暂存零售单' 标识,masterbilldft.billsn,ListRetailDft.prod_number,product.u_code,product.u_name from ListRetailDft join masterbilldft on ListRetailDft.bill_id=masterbilldft.s_id join product on ListRetailDft.prod_id=product.s_id where ListRetailDft.prod_id=(s elect s_id from product where u_code='f')
|