select WE.DESCRIPTION 任务说明,
DECODE(WE.SOURCE_CODE, 'MRP', '工作台', '', '手工') 下达方式, DECODE(WE.FIRM_PLANNED_FLAG, '1', '是', '2', '否') 是否固定, WT.WIP_ENTITY_NAME 任务名称, MSI.SEGMENT1 装配件, MSI.DESCRIPTION 描述, FLV.MEANING 车间状态, WE.CLASS_CODE 车间类别, TO_CHAR(WE.CREATION_DATE, 'YYYY-MM-DD') 创建日期, TO_CHAR(WE.SCHEDULED_START_DATE, 'YYYY-MM-DD' 计划开始日期, TO_CHAR(WE.SCHEDULED_COMPLETION_DATE, 'YYYY-MM-DD') 计划完成日期, TO_CHAR(WE.DATE_RELEASED, 'YYYY-MM-DD') 发放日期, TO_CHAR(WE.DATE_COMPLETED, 'YYYY-MM-DD') 完成日期, TO_CHAR(WE.DATE_CLOSED, 'YYYY-MM-DD') 关闭日期, WE.START_QUANTITY 开始数量, we.QUANTITY_COMPLETED 完成数量from WIP.WIP_DISCRETE_JOBS WE, WIP.WIP_ENTITIES WT, APPS.FND_LOOKUP_VALUES FLV, INV.MTL_SYSTEM_ITEMS_B MSIwhere we.wip_entity_id=wt.wip_entity_id and msi.inventory_item_id=we.primary_item_id and msi.organization_id=we.organization_id and msi.organization_id=X and FLV.LOOKUP_TYPE = 'WIP_JOB_STATUS'and WE.STATUS_TYPE = FLV.LOOKUP_CODE(+)
and FLV.LANGUAGE = 'ZHS' and we.status_type in (1,3) --1未发放,3已发放--and msi.mrp_planning_code=4 --MPS计划类型
and MSI.ITEM_TYPE='FG' and WE.FIRM_PLANNED_FLAG=2 and WE.JOB_TYPE = 1