" LEFT OUTER JOIN ( SELECT MAX ( Id ) Id, MaterialCode, CustomerPartCode, MaterialDesc, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, CustomerPartCode ) AS c ON a.MaterialCode = c.CustomerPartCode\n"+
" LEFT JOIN ( SELECT SUM ( Qty ) Qty, OrderBillNum, MaterialCode FROM Set_WmsSharePart90OutPutDetial WHERE State = 2 GROUP BY OrderBillNum, MaterialCode ) AS b ON a.PurchaseOrderNo= b.OrderBillNum \n"+
" AND a.SapCode = b.MaterialCode \n"+
" WHERE\n"+
" b.OrderBillNum IS NULL \n"+
" AND b.MaterialCode IS NULL \n"+
" ) AS temp1\n"+
" LEFT JOIN ( SELECT * FROM set_backQty ) temp3 ON temp1.采购订单号 = temp3.Code \n"+
" AND temp1.SAP编码= temp3.MaterialCode\n"+
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n"+
" INNER JOIN ( SELECT SUM ( Qty ) ReceiptQty, OrderBillNum, MaterialCode FROM Set_WmsSharePart90OutPutDetial WHERE State = 2 GROUP BY OrderBillNum, MaterialCode ) AS b ON a.PurchaseOrderNo= b.OrderBillNum \n"+
" AND a.MaterialCode = b.MaterialCode\n"+
" LEFT OUTER JOIN ( SELECT MAX ( Id ) Id, MaterialCode, CustomerPartCode, MaterialDesc, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, CustomerPartCode ) AS c ON a.MaterialCode = c.CustomerPartCode \n"+
" WHERE\n"+
" a.ReceiptQty> b.ReceiptQty \n"+
" ) AS temp1\n"+
" LEFT JOIN ( SELECT * FROM set_backQty ) temp3 ON temp1.采购订单号 = temp3.Code \n"+
" AND temp1.SAP编码= temp3.MaterialCode\n"+
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n"+
" INNER JOIN ( SELECT MaterialCode, PurchaseOrderNo FROM Set_WMSSparePart GROUP BY MaterialCode, PurchaseOrderNo HAVING COUNT ( * ) > 1 ) B ON A.PurchaseOrderNo = B.PurchaseOrderNo \n"+
" AND A.MaterialCode = B.MaterialCode\n"+
" LEFT JOIN Set_material t1 ON a.MaterialCode= t1.CustomerPartCode \n"+
" LEFT JOIN ( SELECT MaterialCode, PurchaseOrderNo FROM Set_WMSSparePart GROUP BY MaterialCode, PurchaseOrderNo HAVING COUNT ( * ) > 1 ) B ON A.PurchaseOrderNo = B.PurchaseOrderNo \n"+
" AND A.MaterialCode = B.MaterialCode\n"+
" LEFT JOIN Set_material t1 ON a.MaterialCode= t1.CustomerPartCode \n"+