|
|
|
<?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.op.open.mapper.OpenMapper">
|
|
|
|
<insert id="addSapLog">
|
|
|
|
insert into sys_sap_log
|
|
|
|
(id,messsge,create_time,reqcode,method,remark,status)
|
|
|
|
values(
|
|
|
|
#{id},#{messsge}, #{createTime}, #{reqcode},#{method},#{remark},#{status})
|
|
|
|
</insert>
|
|
|
|
<update id="updateSyncSapStatus">
|
|
|
|
update mes_report_work
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="uploadTime != null">upload_time = #{uploadTime},</if>
|
|
|
|
<if test="uploadStatus != null">upload_status = #{uploadStatus},</if>
|
|
|
|
<if test="uploadMsg != null">upload_msg = #{uploadMsg},</if>
|
|
|
|
</trim>
|
|
|
|
where 1=1
|
|
|
|
<if test="id != null">
|
|
|
|
and id = #{id}
|
|
|
|
</if>
|
|
|
|
<if test="reportCode != null">
|
|
|
|
and report_code = #{reportCode}
|
|
|
|
</if>
|
|
|
|
</update>
|
|
|
|
<update id="updateWorkOrderStatus">
|
|
|
|
update pro_order_workorder set status = #{status} where belong_work_order = #{workorderCode}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<!--获取在邦rfid 工单的信息-->
|
|
|
|
<select id="getRfidInfo" resultType="com.op.system.api.domain.mes.ProRfidProcessDetail">
|
|
|
|
select
|
|
|
|
top 1
|
|
|
|
rfid.workorder_code workorderCode,
|
|
|
|
rfid.now_process_id nowProcessId,
|
|
|
|
rfid.next_process_id nextProcessId,
|
|
|
|
p.equipment machineCode,
|
|
|
|
bp.product_code productCode,
|
|
|
|
bp.product_model productModel,
|
|
|
|
w.prod_line_code prodLineCode
|
|
|
|
from pro_rfid_process_detail rfid with (NOLOCK)
|
|
|
|
left join pro_process p on p.process_id = rfid.next_process_id
|
|
|
|
left join pro_order_workorder w on w.workorder_code = rfid.workorder_code
|
|
|
|
left join base_product bp on bp.product_code = w.product_code
|
|
|
|
where rfid.bind_status = '1'
|
|
|
|
and rfid.rfid = #{rfidNo}
|
|
|
|
order by rfid.create_time desc
|
|
|
|
</select>
|
|
|
|
<select id="getStationType" resultType="java.lang.String">
|
|
|
|
select
|
|
|
|
case when equipment_type_code ='equ_type_spj' then '3'
|
|
|
|
when equipment_type_code ='equ_type_hf' then '2'
|
|
|
|
else '' end
|
|
|
|
from base_equipment
|
|
|
|
where equipment_code = #{equipmentCode}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getEquipNum" resultType="java.lang.Integer">
|
|
|
|
select isvalue from base_equipment_attached
|
|
|
|
where property = 'dollyNumber'
|
|
|
|
and device_code = #{machineCode}
|
|
|
|
</select>
|
|
|
|
<select id="getEquipStatus" resultType="java.lang.String">
|
|
|
|
select status from base_equipment where equipment_code = #{machineCode} and del_flag = '0'
|
|
|
|
</select>
|
|
|
|
<select id="getEquipMode" resultType="java.lang.String">
|
|
|
|
select isvalue from base_equipment_attached
|
|
|
|
where property = 'Mode'
|
|
|
|
and device_code = #{machineCode}
|
|
|
|
</select>
|
|
|
|
<select id="getReportWorkList" resultType="com.op.system.api.domain.mes.MesReportWorkDTO">
|
|
|
|
select ow.order_code orderCode,
|
|
|
|
ow.workorder_code workorderCode,
|
|
|
|
ow.workorder_code_sap workorderCodeSap,
|
|
|
|
ow.route_code routeCode,
|
|
|
|
ow.quantity_split quantitySplit,
|
|
|
|
rte.tec_machine sac1,
|
|
|
|
rte.tec_man sac2,
|
|
|
|
rte.tec_depreciation sac3,
|
|
|
|
rte.tec_other sac4,
|
|
|
|
rte.tec_conf_acivity5 sac5,
|
|
|
|
rte.tec_conf_acivity6 sac6,
|
|
|
|
mrw.id,
|
|
|
|
mrw.quantity_feedback quantityFeedback,
|
|
|
|
mrw.product_code productCode,
|
|
|
|
mrw.product_name productName,
|
|
|
|
mrw.end_report endReport
|
|
|
|
from mes_report_work mrw
|
|
|
|
left join pro_order_workorder ow on mrw.workorder_code = ow.workorder_code
|
|
|
|
left join pro_route rte on rte.route_code = ow.route_code
|
|
|
|
where mrw.upload_status != #{uploadStatus} and mrw.prod_type = #{prodType}
|
|
|
|
<if test="reportCode != null ">
|
|
|
|
and mrw.report_code = #{reportCode}
|
|
|
|
</if>
|
|
|
|
order by mrw.create_time
|
|
|
|
</select>
|
|
|
|
<select id="getProdResult" resultType="com.op.system.api.domain.mes.MesReportWorkDTO">
|
|
|
|
select
|
|
|
|
mrw.workorder_code workorderCode,
|
|
|
|
sum(mrw.quantity_feedback) quantityFeedback
|
|
|
|
from mes_report_work mrw
|
|
|
|
where mrw.del_flag = '0' and mrw.workorder_code = #{workorderCode}
|
|
|
|
group by mrw.workorder_code
|
|
|
|
</select>
|
|
|
|
<select id="getOrderByCode" resultType="com.op.system.api.domain.mes.ProOrderWorkorderDTO">
|
|
|
|
select workorder_code workorderCode,
|
|
|
|
parent_order parentOrder,
|
|
|
|
quantity_split quantitySplit,
|
|
|
|
unit
|
|
|
|
from pro_order_workorder where workorder_code = #{workorderCode}
|
|
|
|
</select>
|
|
|
|
<select id="getLGInfo" resultType="com.op.system.api.domain.dto.WCSDTO">
|
|
|
|
SELECT distinct
|
|
|
|
pw.bucket_code bucketCode,
|
|
|
|
pw.material_code materialCode,
|
|
|
|
pw.material_name materialName
|
|
|
|
from
|
|
|
|
pro_wet_material_plan_detail pw
|
|
|
|
where CONVERT(varchar(10),plan_time, 120) = #{reqTime}
|
|
|
|
</select>
|
|
|
|
<select id="getSapWorkOrder" resultType="java.lang.String">
|
|
|
|
select workorder_code_sap from pro_order_workorder
|
|
|
|
where belong_work_order = #{workorderCode} and del_flag = '0'
|
|
|
|
</select>
|
|
|
|
<select id="selectMesReportWorkConsumeList"
|
|
|
|
resultType="com.op.system.api.domain.mes.MesReportWorkConsumeDTO">
|
|
|
|
select
|
|
|
|
material_code materialCode,
|
|
|
|
quantity
|
|
|
|
from mes_report_work_consume
|
|
|
|
where
|
|
|
|
workorder_code = #{workorderCode} and del_flag = '0'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!--流水单号-->
|
|
|
|
<select id="selectOrderCodeSerialNumber" resultType="java.lang.Integer">
|
|
|
|
SELECT COUNT(order_id)+1 AS serialNum
|
|
|
|
FROM equ_repair_order
|
|
|
|
WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time)
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="insertEquRepairOrder" parameterType="DeviceRepairOrder">
|
|
|
|
insert into equ_repair_order
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="orderId != null">order_id,</if>
|
|
|
|
<if test="orderCode != null">order_code,</if>
|
|
|
|
<if test="equipmentCode != null">equipment_code,</if>
|
|
|
|
<if test="orderDesc != null">order_desc,</if>
|
|
|
|
<if test="orderBreakdownTime != null">order_breakdown_time,</if>
|
|
|
|
<if test="orderSource != null">order_source,</if>
|
|
|
|
<if test="orderTime != null">order_time,</if>
|
|
|
|
<if test="orderHandle != null">order_handle,</if>
|
|
|
|
<if test="orderRepairmanCode != null">order_repairman_code,</if>
|
|
|
|
<if test="orderRepairmanName != null">order_repairman_name,</if>
|
|
|
|
<if test="orderConnection != null">order_connection,</if>
|
|
|
|
<if test="orderStatus != null">order_status,</if>
|
|
|
|
<if test="orderRelevance != null">order_relevance,</if>
|
|
|
|
<if test="orderPicture != null">order_picture,</if>
|
|
|
|
<if test="attr1 != null">attr1,</if>
|
|
|
|
<if test="attr2 != null">attr2,</if>
|
|
|
|
<if test="attr3 != null">attr3,</if>
|
|
|
|
<if test="delFlag != null">del_flag,</if>
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
<if test="factoryCode != null">factory_code,</if>
|
|
|
|
<if test="repairDestination != null">repair_destination,</if>
|
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="orderId != null">#{orderId},</if>
|
|
|
|
<if test="orderCode != null">#{orderCode},</if>
|
|
|
|
<if test="equipmentCode != null">#{equipmentCode},</if>
|
|
|
|
<if test="orderDesc != null">#{orderDesc},</if>
|
|
|
|
<if test="orderBreakdownTime != null">#{orderBreakdownTime},</if>
|
|
|
|
<if test="orderSource != null">#{orderSource},</if>
|
|
|
|
<if test="orderTime != null">#{orderTime},</if>
|
|
|
|
<if test="orderHandle != null">#{orderHandle},</if>
|
|
|
|
<if test="orderRepairmanCode != null">#{orderRepairmanCode},</if>
|
|
|
|
<if test="orderRepairmanName != null">#{orderRepairmanName},</if>
|
|
|
|
<if test="orderConnection != null">#{orderConnection},</if>
|
|
|
|
<if test="orderStatus != null">#{orderStatus},</if>
|
|
|
|
<if test="orderRelevance != null">#{orderRelevance},</if>
|
|
|
|
<if test="orderPicture != null">#{orderPicture},</if>
|
|
|
|
<if test="attr1 != null">#{attr1},</if>
|
|
|
|
<if test="attr2 != null">#{attr2},</if>
|
|
|
|
<if test="attr3 != null">#{attr3},</if>
|
|
|
|
<if test="delFlag != null">#{delFlag},</if>
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
<if test="factoryCode != null">#{factoryCode},</if>
|
|
|
|
<if test="repairDestination != null">#{repairDestination},</if>
|
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
</mapper>
|