<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.qianwen.smartman.modules.coproduction.mapper.OrderProcessMapper">
|
|
<select id="startDetailGeneral" resultType="com.qianwen.smartman.modules.coproduction.vo.OrderProcessGeneralDetailVO">
|
SELECT bop.id AS orderProcessId,
|
bop.process_code AS processCode,
|
bop.process_name AS processName,
|
bo.order_code AS orderCode,
|
bo.id AS orderId,
|
product.CODE AS productCode,
|
product.NAME AS productName,
|
product.id AS productId,
|
bop.input_num AS inputNum,
|
bop.qualify_num AS qualifyNum,
|
bop.scrapped_num AS scrappedNum,
|
bop.qualify_num + bop.scrapped_num AS reportNum,
|
bop.input_num - bop.qualify_num - bop.scrapped_num AS waitReportNum,
|
bop.workstation_id AS workstationId,
|
bop.workstation_name AS workstationName
|
FROM blade_order_process bop
|
LEFT JOIN blade_order bo ON bop.order_id = bo.id
|
AND bo.is_deleted = 0
|
LEFT JOIN blade_plan bp ON bo.plan_id = bp.id
|
AND bp.is_deleted = 0
|
LEFT JOIN blade_product product ON bp.product_id = product.id
|
AND product.is_deleted = 0
|
WHERE bop.is_deleted = 0
|
AND bop.id = #{orderProcessId}
|
</select>
|
|
<resultMap id="orderProcessRelateDetailVO"
|
type="com.qianwen.smartman.modules.coproduction.vo.OrderProcessDetailVO">
|
<id column="id" property="id"/>
|
<result column="process_name" property="processName"/>
|
<result column="process_code" property="processCode"/>
|
<result column="sort" property="sort"/>
|
<result column="remark" property="remark"/>
|
<result column="plan_id" property="planId"/>
|
<result column="order_id" property="orderId"/>
|
<result column="program_id" property="programId"/>
|
<result column="program_name" property="programName"/>
|
<result column="process_status_before" property="processStatusBefore"/>
|
<result column="process_status" property="processStatus"/>
|
<result column="processStatusStr" property="processStatusStr"/>
|
<result column="input_num" property="inputNum"/>
|
<result column="qualify_num" property="qualifyNum"/>
|
<result column="scrapped_num" property="scrappedNum"/>
|
<result column="standard_time" property="standardTime"/>
|
<result column="start_time" property="startTime"/>
|
<result column="end_time" property="endTime"/>
|
<result column="workstation_id" property="workstationId"/>
|
<result column="workstation_name" property="workstationName"/>
|
<result column="art_bag_id" property="artBagId"/>
|
<result column="art_bag_name" property="artBagName"/>
|
<result column="prepare_time" property="prepareTime"/>
|
<result column="disassembly_time" property="disassemblyTime"/>
|
<result column="transport_time" property="transportTime"/>
|
<result column="whether_test" property="whetherTest"/>
|
<result column="whether_parallel" property="whetherParallel"/>
|
<result column="workType" property="workType"/>
|
<result column="workTypeStr" property="workTypeStr"/>
|
<result column="main_sequence_id" property="mainSequenceId"/>
|
<result column="parentId" property="parentId"/>
|
</resultMap>
|
|
<select id="listByOrderId" resultType="com.qianwen.smartman.modules.coproduction.vo.OrderProcessDetailVO">
|
select bop.id,
|
bop.plan_id,
|
bop.order_id,
|
bop.sort,
|
bop.process_code,
|
bop.process_name,
|
bop.program_id,
|
bop.program_name,
|
bop.process_status_before,
|
bop.process_status,
|
bd1.dict_value processStatusStr,
|
bop.input_num,
|
bop.qualify_num,
|
bop.scrapped_num,
|
bop.standard_time,
|
bop.start_time,
|
bop.end_time,
|
bop.workstation_id,
|
bop.workstation_name,
|
bop.art_bag_id,
|
bop.art_bag_name,
|
bop.prepare_time,
|
bop.disassembly_time,
|
bop.transport_time,
|
bop.whether_test,
|
bop.whether_parallel,
|
bop.main_sequence_id,
|
bop.main_sequence_id parentId,
|
bpro.type workType,
|
bd.dict_value workTypeStr,
|
bp.craft_id,
|
bp.craft_version
|
from blade_order_process bop
|
left join blade_order bo on bo.id = bop.order_id and bo.is_deleted = 0
|
left join blade_process bpro on bpro.code = bop.process_code and bpro.is_deleted = 0
|
left join blade_plan bp on bp.id = bop.plan_id and bp.is_deleted = 0
|
left join blade_dict bd on bd.dict_key = bpro.type and bd.code = 'work_type' and bd.is_deleted = 0
|
left join blade_dict bd1
|
on bd1.dict_key = bop.process_status and bd1.code = 'process_status' and bd1.is_deleted = 0
|
where bop.is_deleted = 0
|
and bo.id = #{orderId}
|
order by bop.sort
|
</select>
|
|
<select id="startDetailGeneralByParallel"
|
resultType="com.qianwen.smartman.modules.coproduction.vo.OrderProcessGeneralDetailVO">
|
SELECT bop.id AS orderProcessId,
|
bop.process_code AS processCode,
|
bop.process_name AS processName,
|
bo.order_code AS orderCode,
|
bo.id AS orderId,
|
product.CODE AS productCode,
|
product.NAME AS productName,
|
product.id AS productId,
|
bop.input_num AS inputNum,
|
bop.qualify_num AS qualifyNum,
|
bop.scrapped_num AS scrappedNum,
|
bop.qualify_num + bop.scrapped_num AS reportNum,
|
bop.input_num - bop.qualify_num - bop.scrapped_num AS waitReportNum,
|
bop.workstation_id AS workstationId,
|
bop.workstation_name AS workstationName
|
FROM blade_order_process bop
|
LEFT JOIN blade_order bo ON bop.order_id = bo.id
|
AND bo.is_deleted = 0
|
LEFT JOIN blade_plan bp ON bo.plan_id = bp.id
|
AND bp.is_deleted = 0
|
LEFT JOIN blade_product product ON bp.product_id = product.id
|
AND product.is_deleted = 0
|
WHERE bop.is_deleted = 0
|
AND bop.main_sequence_id = #{orderProcessId}
|
</select>
|
|
<resultMap id="orderProcessRelationVO"
|
type="com.qianwen.smartman.modules.coproduction.vo.OrderProcessRelationVO">
|
<id column="process_id" property="processId"/>
|
<collection property="fixtureVOList" ofType="com.qianwen.smartman.modules.cps.vo.FixtureVO">
|
<id column="fixtureId" property="id"/>
|
<result column="fixtureCode" property="code"/>
|
<result column="fixtureName" property="name"/>
|
<result column="fixtureGroupId" property="fixtureGroupId"/>
|
<result column="fixtureGroupName" property="fixtureGroupName"/>
|
<result column="trayId" property="trayId"/>
|
<result column="trayCode" property="trayCode"/>
|
<result column="trayName" property="trayName"/>
|
</collection>
|
<collection property="toolManageVOList" ofType="com.qianwen.smartman.modules.tool.vo.ToolManageVO">
|
<id column="toolId" property="id"/>
|
<result column="toolCode" property="code"/>
|
<result column="toolCategoryId" property="toolCategoryId"/>
|
<result column="toolCategory" property="toolCategory"/>
|
<result column="toolModelId" property="toolModelId"/>
|
<result column="toolModel" property="toolModel"/>
|
</collection>
|
</resultMap>
|
|
<select id="getRelation" resultMap="orderProcessRelationVO">
|
select bcp.process_id,
|
bf.id fixtureId,
|
bf.code fixtureCode,
|
bf.name fixtureName,
|
bcg.id fixtureGroupId,
|
bcg.name fixtureGroupName,
|
btr.id trayId,
|
btr.code trayCode,
|
btr.name trayName,
|
bt.id toolId,
|
bt.code toolCode,
|
btc.id toolCategoryId,
|
btc.name toolCategory,
|
btm.id toolModelId,
|
btm.model toolModel
|
from blade_production_craft_version bcv
|
left join blade_production_craft_process bcp on bcp.version_id = bcv.id and bcp.is_deleted = 0
|
left join blade_production_craft_process_related_fixture bcf on bcf.version_process_id = bcp.id
|
left join blade_fixture bf on bf.id = bcf.fixture_id and bf.is_deleted = 0
|
left join blade_common_group_of_item bgi on bgi.item_id = bf.id
|
left join blade_common_group bcg
|
on bcg.group_type = 'group_fixture' and bcg.group_category = 1 and bcg.id = bgi.group_id
|
and bcg.is_deleted = 0
|
left join blade_tray_fixture btf on btf.fix_id = bf.id and btf.is_deleted = 0
|
left join blade_tray btr on btr.id = btf.tray_id and btr.is_deleted = 0
|
left join blade_production_craft_process_related_tool bct on bct.version_process_id = bcp.id
|
left join blade_tool bt on bt.id = bct.tool_id and bt.is_deleted = 0
|
left join blade_tool_category btc on btc.id = bt.tool_category_id and btc.is_deleted = 0
|
left join blade_tool_model btm on btm.id = bt.tool_model_id and btm.is_deleted = 0
|
where bcv.craft_id = #{orderProcessRelationQueryVO.craftId}
|
and bcv.id = #{orderProcessRelationQueryVO.craftVersionId}
|
and bcv.is_deleted = 0
|
and bcp.process_code = #{orderProcessRelationQueryVO.processCode}
|
and bcp.sort = #{orderProcessRelationQueryVO.sort}
|
</select>
|
<select id="listDetailByOrderId" resultType="com.qianwen.smartman.modules.coproduction.vo.OrderProcessDetailVO">
|
select bop.id,
|
bop.plan_id,
|
bop.order_id,
|
bop.sort,
|
bop.process_code,
|
bop.process_name,
|
bop.program_id,
|
bop.program_name,
|
bop.process_status_before,
|
bop.process_status,
|
bd1.dict_value processStatusStr,
|
bop.input_num,
|
bop.qualify_num,
|
bop.scrapped_num,
|
bop.standard_time,
|
bop.start_time,
|
bop.end_time,
|
bop.workstation_id,
|
bop.workstation_name,
|
bop.art_bag_id,
|
bop.art_bag_name,
|
bop.prepare_time,
|
bop.disassembly_time,
|
bop.transport_time,
|
bop.whether_test,
|
bop.whether_parallel,
|
bop.main_sequence_id,
|
bop.main_sequence_id parentId,
|
bpro.type workType,
|
bd.dict_value workTypeStr,
|
bp.craft_id,
|
bp.craft_version,
|
<if test="_databaseId=='mysql'">
|
GROUP_CONCAT( DISTINCT (borr.producer_user_name) SEPARATOR ',' ) AS producerUserName
|
</if>
|
<if test="_databaseId=='dm'">
|
WM_CONCAT( DISTINCT (borr.producer_user_name)) AS producerUserName
|
</if>
|
<if test="_databaseId=='oracle'">
|
LISTAGG ( DISTINCT (borr.producer_user_name), ',' ) WITHIN GROUP ( ORDER BY borr.producer_user_name ) AS producerUserName
|
</if>
|
from blade_order_process bop
|
left join blade_order bo on bo.id = bop.order_id and bo.is_deleted = 0
|
left join blade_process bpro on bpro.code = bop.process_code and bpro.is_deleted = 0
|
left join blade_plan bp on bp.id = bop.plan_id and bp.is_deleted = 0
|
left join blade_dict bd on bd.dict_key = bpro.type and bd.code = 'work_type' and bd.is_deleted = 0
|
left join blade_dict bd1
|
on bd1.dict_key = bop.process_status and bd1.code = 'process_status' and bd1.is_deleted = 0
|
left join blade_order_report_record borr on borr.process_id = bop.id and borr.is_deleted = 0
|
where bop.is_deleted = 0
|
and bo.id = #{orderId}
|
group by bop.id,
|
bop.plan_id,
|
bop.order_id,
|
bop.sort,
|
bop.process_code,
|
bop.process_name,
|
bop.program_id,
|
bop.program_name,
|
bop.process_status_before,
|
bop.process_status,
|
bd1.dict_value,
|
bop.input_num,
|
bop.qualify_num,
|
bop.scrapped_num,
|
bop.standard_time,
|
bop.start_time,
|
bop.end_time,
|
bop.workstation_id,
|
bop.workstation_name,
|
bop.art_bag_id,
|
bop.art_bag_name,
|
bop.prepare_time,
|
bop.disassembly_time,
|
bop.transport_time,
|
bop.whether_test,
|
bop.whether_parallel,
|
bop.main_sequence_id,
|
bop.main_sequence_id,
|
bpro.type,
|
bd.dict_value,
|
bp.craft_id,
|
bp.craft_version
|
order by bop.sort
|
</select>
|
</mapper>
|