LEFT JOIN ST_BS_WorkGroup gro ON gro.group_uuid = issuebilldtl.group_uuid
AND gro.is_active = '1'
LEFT JOIN MD_CS_Factory factory ON factory.factory_uuid = issuebilldtl.factory_uuid
LEFT JOIN ST_BS_WMSMaterial mater ON mater.wmsmaterial_uuid = issuebilldtl.wmsmaterial_uuid
LEFT JOIN MD_PB_MeasureUnit unit ON unit.measure_unit_uuid = issuebilldtl.num_base_unit_uuid
LEFT JOIN MD_ME_MaterialBase mdme ON mdme.material_uuid = mater.material_uuid
left join IF_SAP_IssueBillProc bill on bill.issuebill_uuid = issuebilldtl.issuebill_uuid
AND bill.arbpl = gro.group_code
AND bill.MATNR = issuebilldtl.material_code
@ -494,71 +491,50 @@ ENDIF
IF 输入.flag = "12"
PAGEQUERY
SELECT DISTINCT
mater.wmsmaterial_uuid as id,
mater.wmsmaterial_uuid AS id,
mater.wmsmaterial_uuid,
mater.material_uuid,
mater.material_code,
mater.material_name,
mater.factory_uuid,
materialbase.net_weight,
ISNULL(a.canuse_num,0) AS canuse_num,
factory.factory_code,
ISNULL( a.canuse_num, 0 ) AS canuse_num,
factory.factory_name,
measureunit.unit_name AS material_unit_name,
classStandard.class_name AS baseclassify,
materialbase.photo AS photo,
materialbase.is_seal_up,
materialbase.material_spec,
materialbase.material_unit_uuid AS unit_uuid,
measureunit.unit_name AS unit_name,
measureunit.conv_coefficient AS coefficient,
measureunit.measure_unit_uuid as num_base_unit_uuid,
measureunit.unit_name AS num_base_unit_name,
measureunit.unit_name AS base_unit_name,
materialbase.base_unit_uuid,
measureunit2.unit_name AS base_unit_name,
measureunit2.conv_coefficient AS base_coefficient,
materialbase.asst_unit_uuid,
measureunit3.unit_name AS asst_unit_name,
measureunit3.conv_coefficient AS asst_coefficient,
materialbase.weight_unit_uuid,
measureunit4.unit_name AS weight_unit_name,
measureunit4.conv_coefficient AS weight_coefficient,
materialbase.material_prop_scode,
dic.sysdic_name AS material_prop_scode_name,
materialbase.gross_weight,
materialbase.cubage,
materialbase.sect_type AS sect_type,
materialbase.sect_uuid AS sect_uuid,
materialbase.sect_code AS sect_code,
sect_name = (
case when
materialbase.sect_type = '01' then '1002'
else
materialbase.sect_name
end
),
sdi.sysdic_name AS sect_type_name
FROM ST_BS_WMSMaterial mater
LEFT JOIN MD_ME_MaterialBase materialbase ON materialbase.material_uuid=mater.material_uuid
LEFT JOIN ST_BS_SectAttr sect on (sect.sect_uuid=materialbase.sect_uuid and materialbase.sect_type = '03') or (materialbase.sect_type <> '03' and sect.sect_type=materialbase.sect_type)
LEFT JOIN MD_CS_Factory factory ON factory.factory_uuid=mater.factory_uuid
LEFT JOIN PF_PB_SysDicInfo dic ON dic.sysdic_code = materialbase.material_prop_scode and dic.sysdic_type='MD_MATERIAL_PROP'
LEFT JOIN MD_PB_BaseData_ClassInfo classInfo ON classInfo.base_data_uuid = materialbase.material_uuid
LEFT JOIN MD_PB_BaseData_ClassStandard classStandard ON classStandard.class_uuid = classInfo.class_uuid
AND classStandard.base_data_type = classInfo.base_data_type
LEFT JOIN MD_PB_MeasureUnit measureunit ON measureunit.measure_unit_uuid = materialbase.material_unit_uuid
LEFT JOIN MD_PB_MeasureUnit measureunit2 ON measureunit2.measure_unit_uuid = materialbase.base_unit_uuid
LEFT JOIN MD_PB_MeasureUnit measureunit3 ON measureunit3.measure_unit_uuid = materialbase.asst_unit_uuid
LEFT JOIN MD_PB_MeasureUnit measureunit4 ON measureunit4.measure_unit_uuid = materialbase.weight_unit_uuid
sect_name = ( CASE WHEN materialbase.sect_type = '01' THEN '1002' ELSE materialbase.sect_name END ),
sdi.sysdic_name AS sect_type_name
FROM
ST_BS_WMSMaterial mater
LEFT JOIN MD_ME_MaterialBase materialbase ON materialbase.material_uuid= mater.material_uuid
LEFT JOIN ST_BS_SectAttr sect ON ( sect.sect_uuid= materialbase.sect_uuid AND materialbase.sect_type = '03' )
OR ( materialbase.sect_type <> '03' AND sect.sect_type= materialbase.sect_type )
LEFT JOIN MD_CS_Factory factory ON factory.factory_uuid= mater.factory_uuid
LEFT JOIN MD_PB_MeasureUnit measureunit ON measureunit.measure_unit_uuid = materialbase.base_unit_uuid
LEFT JOIN PF_PB_SysDicInfo sdi ON sdi.sysdic_code = materialbase.sect_type AND sdi.sysdic_type = 'ST_SECT_TYPE'
LEFT JOIN (SELECT sum(ISNULL(ivt.canuse_num,0)) AS canuse_num,ivt.material_code,ivt.factory_uuid FROM ST_IVT_StructIvt ivt where ivt.stor_uuid = 输入.stor_uuid group by ivt.material_code,ivt.factory_uuid)a ON a.material_code = mater.material_code and a.factory_uuid = mater.factory_uuid
WHERE 1=1
and materialbase.sysisdelete != '1'
inner JOIN (
SELECT SUM
( ISNULL( ivt.canuse_num, 0 ) ) AS canuse_num,
ivt.material_code,
ivt.factory_uuid
FROM
ST_IVT_StructIvt ivt
WHERE
ivt.stor_uuid = 输入.stor_uuid
GROUP BY
ivt.material_code,
ivt.factory_uuid
) a ON ( a.material_code = mater.material_code AND a.factory_uuid = mater.factory_uuid )