diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/ST_OUTIVT01.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/ST_OUTIVT01.wql index 1b7b91496..0148fd1fc 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/ST_OUTIVT01.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/ST_OUTIVT01.wql @@ -92,15 +92,16 @@ IF 输入.flag = "2" QUERY - SELECT + SELECT * from (SELECT attr.storagevehicle_code, - attr.struct_id, - sum(ivt.canuse_qty) AS canuse_qty, - ivt.material_id + MAX( attr.struct_id ) AS struct_id, + sum( ivt.canuse_qty ) AS canuse_qty, + MAX( ivt.material_id ) AS material_id, + MAX(ivt.instorage_time ) AS instorage_time FROM ST_IVT_StructIvt ivt LEFT JOIN ST_IVT_StructAttr attr ON attr.struct_id = ivt.struct_id - LEFT JOIN PDM_BI_SubPackageRelation sub ON attr.storagevehicle_code = sub.package_box_SN + LEFT JOIN PDM_BI_SubPackageRelation sub ON attr.storagevehicle_code = sub.package_box_SN AND ivt.pcsn = sub.container_name WHERE ivt.quality_scode = '01' AND attr.lock_type = '1' @@ -126,9 +127,9 @@ attr.block_num = 输入.block_num ENDOPTION - group by attr.storagevehicle_code + group by attr.storagevehicle_code) a - order by ivt.instorage_time ASC + order by a.instorage_time ASC ENDSELECT ENDQUERY