|
|
|
|
@ -215,6 +215,170 @@ |
|
|
|
|
ORDER BY mwor.create_time DESC |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
<select id="exportOemOrder" resultMap="simpleOemOrderVOResultMap"> |
|
|
|
|
SELECT |
|
|
|
|
-- 主表字段 |
|
|
|
|
mwor.id, |
|
|
|
|
mwor.create_time, |
|
|
|
|
mwor.create_user, |
|
|
|
|
mwor.wo_id, |
|
|
|
|
mwor.run_type, |
|
|
|
|
mwor.out_team, |
|
|
|
|
mwor.in_team, |
|
|
|
|
mwor.approval_man, |
|
|
|
|
mwor.approval_memo, |
|
|
|
|
mwor.print_flag, |
|
|
|
|
mwor.deliver_key, |
|
|
|
|
mwor.run_status, |
|
|
|
|
mwor.approval_time, |
|
|
|
|
mwor.batch_reason, |
|
|
|
|
mwor.oem_status, |
|
|
|
|
mwor.wo_code, |
|
|
|
|
|
|
|
|
|
-- 车间订单表字段 |
|
|
|
|
two.card_no, |
|
|
|
|
two.batch_no, |
|
|
|
|
two.priority, |
|
|
|
|
two.demand_date, |
|
|
|
|
two.mes_card_no, |
|
|
|
|
two.memo, |
|
|
|
|
two.run_status AS work_run_status, |
|
|
|
|
two.inventory_qty, |
|
|
|
|
two.send_down_time, |
|
|
|
|
two.put_store_time, |
|
|
|
|
two.approval_status, |
|
|
|
|
tyo.yp_code, |
|
|
|
|
tyo.part_code, |
|
|
|
|
tyo.part_name, |
|
|
|
|
tyo.release_date, |
|
|
|
|
tyo.plate, |
|
|
|
|
tyo.product_ident, |
|
|
|
|
tyo.use_dept, |
|
|
|
|
tyo.yp_qty, |
|
|
|
|
tyo.yp_area, |
|
|
|
|
NVL(tyo.yp_qty, 0) - NVL(two.inventory_qty, 0) AS unsubmitted_num, |
|
|
|
|
NVL(oem.code, 'N/A') || '/' || NVL(oem.oc_name, 'Unknown') AS oem_ode, |
|
|
|
|
-- 转出班组名称 |
|
|
|
|
-- out_team.ts_name as out_ts_name, |
|
|
|
|
-- 转入班组名称 |
|
|
|
|
-- in_team.ts_name as in_ts_name, |
|
|
|
|
-- 审批人员名称 |
|
|
|
|
-- approval_user.name as approval_user_name, |
|
|
|
|
-- 计划员名称 |
|
|
|
|
-- planner_user.real_name as planner_name, |
|
|
|
|
-- 调度员名称 |
|
|
|
|
tyo.plan_user as planner_name, |
|
|
|
|
dispatcher_user.real_name as dispatcher_name, |
|
|
|
|
case |
|
|
|
|
when two.run_status = 17 then '已交接' |
|
|
|
|
when two.run_status = 15 then '订单完工' |
|
|
|
|
when mwor.oem_status = 3 then '外协完工' |
|
|
|
|
when mwor.oem_status = 2 then '外协中' |
|
|
|
|
else '未知' end AS oem_status_title |
|
|
|
|
FROM MES_WORK_ORDER_RUN mwor |
|
|
|
|
-- 关联车间订单表 |
|
|
|
|
INNER JOIN MES_WORK_ORDER two ON mwor.wo_id = two.id |
|
|
|
|
-- 关联生产订单表 |
|
|
|
|
INNER JOIN MES_YIELD_ORDER tyo ON two.yo_id = tyo.id |
|
|
|
|
-- 关联转出班组(只取名称) |
|
|
|
|
LEFT JOIN BS_TEAM_SET out_team ON mwor.out_team = out_team.id |
|
|
|
|
-- 关联转入班组(只取名称) |
|
|
|
|
LEFT JOIN BS_TEAM_SET in_team ON mwor.in_team = in_team.id |
|
|
|
|
-- 关联审批人员(只取名称) |
|
|
|
|
LEFT JOIN blade_user approval_user ON mwor.approval_man = approval_user.id |
|
|
|
|
-- 关联计划员 |
|
|
|
|
-- LEFT JOIN blade_user planner_user ON two.planner = planner_user.id |
|
|
|
|
-- 关联调度员 |
|
|
|
|
LEFT JOIN blade_user dispatcher_user ON two.dispatcher = dispatcher_user.id |
|
|
|
|
-- 关联外协厂商 |
|
|
|
|
LEFT JOIN BS_OEM oem ON mwor.in_customer = oem.id |
|
|
|
|
|
|
|
|
|
where |
|
|
|
|
mwor.IS_DELETED = 0 |
|
|
|
|
AND two.IS_DELETED = 0 |
|
|
|
|
<!-- 查询条件 --> |
|
|
|
|
<if test="runStatus != null"> |
|
|
|
|
AND mwor.run_status > #{runStatus} |
|
|
|
|
</if> |
|
|
|
|
<if test="runType != null"> |
|
|
|
|
AND mwor.run_type = #{runType} |
|
|
|
|
</if> |
|
|
|
|
<if test="orderCode != null and orderCode != ''"> |
|
|
|
|
AND two.wo_code LIKE CONCAT('%', CONCAT(#{orderCode}, '%')) |
|
|
|
|
</if> |
|
|
|
|
<if test="partCode != null and partCode != ''"> |
|
|
|
|
AND tyo.part_code LIKE CONCAT('%', CONCAT(#{partCode}, '%')) |
|
|
|
|
</if> |
|
|
|
|
<if test="partName != null and partName != ''"> |
|
|
|
|
AND tyo.part_name LIKE CONCAT('%', CONCAT(#{partName}, '%')) |
|
|
|
|
</if> |
|
|
|
|
<if test="plate != null and plate != ''"> |
|
|
|
|
AND tyo.plate LIKE CONCAT('%', CONCAT(#{plate}, '%')) |
|
|
|
|
</if> |
|
|
|
|
<if test="productIdent != null and productIdent != ''"> |
|
|
|
|
AND tyo.product_ident LIKE CONCAT('%', CONCAT(#{productIdent}, '%')) |
|
|
|
|
</if> |
|
|
|
|
<if test="batchNo != null and batchNo != ''"> |
|
|
|
|
AND two.batch_no LIKE CONCAT('%', CONCAT(#{batchNo}, '%')) |
|
|
|
|
</if> |
|
|
|
|
<if test="cardNo != null and cardNo != ''"> |
|
|
|
|
AND two.card_no LIKE CONCAT('%', CONCAT(#{cardNo}, '%')) |
|
|
|
|
</if> |
|
|
|
|
<if test="deptName != null and deptName != ''"> |
|
|
|
|
AND tyo.use_dept LIKE CONCAT('%', CONCAT(#{deptName}, '%')) |
|
|
|
|
</if> |
|
|
|
|
<if test="planner != null and planner != ''"> |
|
|
|
|
AND tyo.plan_user LIKE CONCAT('%', CONCAT(#{planner}, '%')) |
|
|
|
|
</if> |
|
|
|
|
<if test="dispatcher != null and dispatcher != ''"> |
|
|
|
|
AND dispatcher_user.real_name LIKE CONCAT('%', CONCAT(#{dispatcher}, '%')) |
|
|
|
|
</if> |
|
|
|
|
<if test="oemCode != null and oemCode != ''"> |
|
|
|
|
AND (oem.code LIKE CONCAT('%', CONCAT(#{oemCode}, '%')) |
|
|
|
|
OR oem.oc_name LIKE CONCAT('%', CONCAT(#{oemCode}, '%'))) |
|
|
|
|
</if> |
|
|
|
|
<if test="priority != null"> |
|
|
|
|
AND two.priority = #{priority} |
|
|
|
|
</if> |
|
|
|
|
<if test="planIssuanceTimeStart != null"> |
|
|
|
|
AND tyo.release_date >= #{planIssuanceTimeStart} |
|
|
|
|
</if> |
|
|
|
|
<if test="planIssuanceTimeEnd != null"> |
|
|
|
|
AND tyo.release_date < #{planIssuanceTimeEnd} + 1 |
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
<if test="postPlatingStorageTimeStart != null"> |
|
|
|
|
AND two.put_store_time >= #{postPlatingStorageTimeStart} |
|
|
|
|
</if> |
|
|
|
|
<if test="postPlatingStorageTimeEnd != null"> |
|
|
|
|
AND two.put_store_time < #{postPlatingStorageTimeEnd}+ 1 |
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
<if test="demandDateStart != null"> |
|
|
|
|
AND two.demand_date >= #{demandDateStart} |
|
|
|
|
</if> |
|
|
|
|
<if test="demandDateEnd != null"> |
|
|
|
|
AND two.demand_date < #{demandDateEnd}+ 1 |
|
|
|
|
</if> |
|
|
|
|
<if test="oemStatus != null and oemStatus != ''"> |
|
|
|
|
<choose> |
|
|
|
|
<when test='oemStatus == "1"'> |
|
|
|
|
AND mwor.oem_status = 2 |
|
|
|
|
</when> |
|
|
|
|
<when test='oemStatus == "2"'> |
|
|
|
|
AND mwor.oem_status = 3 |
|
|
|
|
</when> |
|
|
|
|
<when test='oemStatus == "3"'> |
|
|
|
|
AND two.run_status = 15 |
|
|
|
|
</when> |
|
|
|
|
<otherwise> |
|
|
|
|
AND two.run_status = 17 |
|
|
|
|
</otherwise> |
|
|
|
|
</choose> |
|
|
|
|
</if> |
|
|
|
|
ORDER BY mwor.create_time DESC |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
<!-- 结果映射配置 --> |
|
|
|
|
<resultMap id="oemApprovalVOResultMap" type="org.springblade.desk.oem.pojo.vo.OemApprovalVO"> |
|
|
|
|
<!-- 继承自WorkOrderRun的字段 --> |
|
|
|
|
@ -246,6 +410,8 @@ |
|
|
|
|
<!-- 人员信息字段 --> |
|
|
|
|
<result column="proposer_name" property="proposer"/> |
|
|
|
|
<result column="approver_name" property="approver"/> |
|
|
|
|
<result column="APPROVAL_DATE" property="approvalDate"/> |
|
|
|
|
<result column="CREATE_DATE" property="createDate"/> |
|
|
|
|
</resultMap> |
|
|
|
|
|
|
|
|
|
<select id="selectOemApproval" resultMap="oemApprovalVOResultMap"> |
|
|
|
|
@ -346,6 +512,106 @@ |
|
|
|
|
ORDER BY mwor.create_time DESC |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
<select id="exportOemApproval" resultMap="oemApprovalVOResultMap"> |
|
|
|
|
SELECT |
|
|
|
|
-- 主表字段 |
|
|
|
|
mwor.id, |
|
|
|
|
mwor.create_time, |
|
|
|
|
mwor.create_user, |
|
|
|
|
mwor.wo_id, |
|
|
|
|
mwor.run_type, |
|
|
|
|
mwor.out_team, |
|
|
|
|
mwor.in_team, |
|
|
|
|
mwor.approval_man, |
|
|
|
|
mwor.approval_memo, |
|
|
|
|
mwor.print_flag, |
|
|
|
|
mwor.deliver_key, |
|
|
|
|
mwor.run_status, |
|
|
|
|
mwor.approval_time, |
|
|
|
|
mwor.batch_reason, |
|
|
|
|
|
|
|
|
|
-- 车间订单表字段 |
|
|
|
|
two.wo_code, |
|
|
|
|
two.batch_no, |
|
|
|
|
two.inventory_qty, |
|
|
|
|
two.approval_status, |
|
|
|
|
tyo.part_code, |
|
|
|
|
tyo.part_name, |
|
|
|
|
tyo.product_ident, |
|
|
|
|
tyo.yp_qty, |
|
|
|
|
tyo.yp_area, |
|
|
|
|
approval_user.name as approver_name, |
|
|
|
|
proposer_user.real_name as proposer_name, |
|
|
|
|
to_char(mwor.approval_time, 'yyyy-MM-dd') as APPROVAL_DATE, |
|
|
|
|
to_char(mwor.create_time, 'yyyy-MM-dd') as CREATE_DATE |
|
|
|
|
FROM MES_WORK_ORDER_RUN mwor |
|
|
|
|
-- 关联车间订单表 |
|
|
|
|
LEFT JOIN MES_WORK_ORDER two ON mwor.wo_id = two.id |
|
|
|
|
-- 关联生产订单表 |
|
|
|
|
LEFT JOIN MES_YIELD_ORDER tyo ON two.yo_id = tyo.id |
|
|
|
|
-- 关联审批人员(只取名称) |
|
|
|
|
LEFT JOIN blade_user approval_user ON mwor.approval_man = approval_user.id |
|
|
|
|
-- 关联计划员 |
|
|
|
|
-- LEFT JOIN blade_user planner_user ON two.planner = planner_user.id |
|
|
|
|
-- 关联调度员 |
|
|
|
|
LEFT JOIN blade_user proposer_user ON mwor.create_user = proposer_user.id |
|
|
|
|
--关联外协厂商 |
|
|
|
|
LEFT JOIN BS_OEM oem ON mwor.in_customer = oem.id |
|
|
|
|
|
|
|
|
|
where |
|
|
|
|
mwor.IS_DELETED = 0 |
|
|
|
|
AND two.IS_DELETED = 0 |
|
|
|
|
<!-- 查询条件 --> |
|
|
|
|
<if test="runType != null"> |
|
|
|
|
AND mwor.run_type = #{runType} |
|
|
|
|
</if> |
|
|
|
|
<if test="systemData != null and systemData != ''"> |
|
|
|
|
AND mwor.system_data = #{systemData} |
|
|
|
|
</if> |
|
|
|
|
<if test="woCode != null and woCode != ''"> |
|
|
|
|
AND two.wo_code LIKE CONCAT('%', CONCAT(#{woCode}, '%')) |
|
|
|
|
</if> |
|
|
|
|
<if test="partCode != null and partCode != ''"> |
|
|
|
|
AND tyo.part_code LIKE CONCAT('%', CONCAT(#{partCode}, '%')) |
|
|
|
|
</if> |
|
|
|
|
<if test="batchNo != null and batchNo != ''"> |
|
|
|
|
AND two.batch_no LIKE CONCAT('%', CONCAT(#{batchNo}, '%')) |
|
|
|
|
</if> |
|
|
|
|
<if test="proposer != null and proposer != ''"> |
|
|
|
|
AND mwor.create_user LIKE CONCAT('%', CONCAT(#{proposer}, '%')) |
|
|
|
|
</if> |
|
|
|
|
<!-- 时间范围查询 --> |
|
|
|
|
<if test="startTime != null"> |
|
|
|
|
AND mwor.create_time >= #{startTime} |
|
|
|
|
</if> |
|
|
|
|
<if test="endTime != null"> |
|
|
|
|
AND mwor.create_time < #{endTime} + 1 |
|
|
|
|
</if> |
|
|
|
|
<choose> |
|
|
|
|
<when test='approvalStatus != null and approvalStatus != ""'> |
|
|
|
|
<choose> |
|
|
|
|
<when test='approvalStatus.contains("4")'> |
|
|
|
|
AND ( |
|
|
|
|
mwor.approval_time IS NOT NULL |
|
|
|
|
AND mwor.run_status NOT IN (2, 3) |
|
|
|
|
) |
|
|
|
|
</when> |
|
|
|
|
<otherwise> |
|
|
|
|
AND mwor.run_status IN |
|
|
|
|
<foreach collection="approvalStatus.split(',')" item="status" |
|
|
|
|
open="(" separator="," close=")" index="index"> |
|
|
|
|
#{status} |
|
|
|
|
</foreach> |
|
|
|
|
</otherwise> |
|
|
|
|
</choose> |
|
|
|
|
</when> |
|
|
|
|
<otherwise> |
|
|
|
|
AND mwor.run_status = 2 |
|
|
|
|
</otherwise> |
|
|
|
|
</choose> |
|
|
|
|
ORDER BY mwor.create_time DESC |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
<!-- 结果映射配置 --> |
|
|
|
|
<resultMap id="oemMaterialRequisitionMap" type="org.springblade.desk.oem.pojo.vo.MaterialRequisitionVO"> |
|
|
|
|
<id column="id" property="id"/> |
|
|
|
|
|