You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
390 lines
17 KiB
XML
390 lines
17 KiB
XML
<?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} AND sync_flag='Y' AND del_flag='0'
|
|
</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>
|
|
<select id="getTodayMaxNum" resultType="java.lang.Integer">
|
|
select count(0)+1
|
|
from qc_check_task
|
|
where CONVERT(varchar(10),create_time, 120) = CONVERT(varchar(10),GETDATE(), 120)
|
|
</select>
|
|
<select id="getTPByTypeMaterial" resultType="com.op.system.api.domain.quality.QcCheckTaskDetailDTO">
|
|
select qctp.id typeProjectId,
|
|
qctp.project_id projectId,
|
|
qctp.project_no projectNo,
|
|
qctp.standard_value standardValue,
|
|
qctp.upper_diff upperDiff,
|
|
qctp.down_diff downDiff,
|
|
qctp.sample,
|
|
qctp.sort,
|
|
qcp.rule_name ruleName,
|
|
qcp.property_code propertyCode,
|
|
qcp.check_tool checkTool,
|
|
qcp.unit_code unitCode,
|
|
qcp.check_mode checkMode
|
|
<!--,qcp.check_standard checkStandard-->
|
|
from qc_check_type_project qctp
|
|
left join qc_check_project qcp on qcp.id = qctp.project_id
|
|
where qctp.del_flag = '0' and qctp.status = '1'
|
|
and qctp.material_code = #{materialCode}
|
|
and qctp.type_id = #{typeId}
|
|
order by qctp.sort
|
|
</select>
|
|
<select id="getGroupByMaterial" resultType="com.op.system.api.domain.quality.QcMaterialGroupDetailDTO">
|
|
select top 1 group_id groupId
|
|
from qc_material_group_detail
|
|
where material_code = #{materialCode}
|
|
and del_flag = '0'
|
|
order by create_time desc
|
|
</select>
|
|
<select id="getTPByTypeGroup" resultType="com.op.system.api.domain.quality.QcCheckTaskDetailDTO">
|
|
select qctp.id typeProjectId,
|
|
qctp.project_id projectId,
|
|
qctp.project_no projectNo,
|
|
qctp.standard_value standardValue,
|
|
qctp.upper_diff upperDiff,
|
|
qctp.down_diff downDiff,
|
|
qctp.sample,
|
|
qctp.sort,
|
|
qcp.rule_name ruleName,
|
|
qcp.property_code propertyCode,
|
|
qcp.check_tool checkTool,
|
|
qcp.unit_code unitCode,
|
|
qcp.check_mode checkMode
|
|
<!--,qcp.check_standard checkStandard-->
|
|
from qc_check_type_project qctp
|
|
left join qc_check_project qcp on qcp.id = qctp.project_id
|
|
where qctp.del_flag = '0' and qctp.status = '1'
|
|
and qctp.group_id = #{groupId}
|
|
and qctp.type_id = #{typeId}
|
|
order by qctp.sort
|
|
</select>
|
|
<select id="getCheckUsers" resultType="com.op.system.api.domain.quality.QcUserMaterialDTO">
|
|
select qum.user_code userCode,
|
|
qum.user_name userName
|
|
from qc_user_material qum
|
|
where qum.material_code = #{checkType} and qum.del_flag = '0'
|
|
</select>
|
|
<select id="getSampNum" resultType="java.lang.String">
|
|
select sample_quality
|
|
from qc_sample_rule
|
|
where end_value>= #{quality} and #{quality}>=start_value and del_flag = '0'
|
|
and check_type = #{checkType}
|
|
</select>
|
|
<select id="getLastTask" resultType="java.util.Date">
|
|
select max(create_time) from qc_check_task
|
|
where check_type = #{checkType}
|
|
and order_no= #{orderNo}
|
|
and income_batch_no = #{incomeBatchNo}
|
|
and del_flag='0'
|
|
</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>
|
|
<insert id="insertQcCheckTaskProduce">
|
|
insert into qc_check_task
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="recordId != null">record_id,</if>
|
|
<if test="checkNo != null">check_no,</if>
|
|
<if test="incomeBatchNo != null">income_batch_no,</if>
|
|
<if test="orderNo != null">order_no,</if>
|
|
<if test="materialCode != null">material_code,</if>
|
|
<if test="materialName != null">material_name,</if>
|
|
<if test="quality != null">quality,</if>
|
|
<if test="sampleQuality != null">sample_quality,</if>
|
|
<if test="noOkQuality != null">noOk_quality,</if>
|
|
<if test="aNoOkquality != null">aNoOkquality,</if>
|
|
<if test="bNoOkquality != null">bNoOkquality,</if>
|
|
<if test="cNoOkquality != null">cNoOkquality,</if>
|
|
<if test="unit != null">unit,</if>
|
|
<if test="supplierCode != null">supplier_code,</if>
|
|
<if test="supplierName != null">supplier_name,</if>
|
|
<if test="incomeTime != null">income_time,</if>
|
|
<if test="checkLoc != null">check_loc,</if>
|
|
<if test="checkStatus != null">check_status,</if>
|
|
<if test="checkManCode != null">check_man_code,</if>
|
|
<if test="checkManName != null">check_man_name,</if>
|
|
<if test="checkTime != null">check_time,</if>
|
|
<if test="checkResult != null">check_result,</if>
|
|
<if test="status != null">status,</if>
|
|
<if test="attr1 != null">attr1,</if>
|
|
<if test="attr2 != null">attr2,</if>
|
|
<if test="attr3 != null">attr3,</if>
|
|
<if test="attr4 != null">attr4,</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 and factoryCode != ''">factory_code,</if>
|
|
<if test="delFlag != null">del_flag,</if>
|
|
<if test="checkType != null">check_type,</if>
|
|
<if test="typeCode != null">type_code,</if>
|
|
<if test="sampleQuality != null">sample_quality,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="recordId != null">#{recordId},</if>
|
|
<if test="checkNo != null">#{checkNo},</if>
|
|
<if test="incomeBatchNo != null">#{incomeBatchNo},</if>
|
|
<if test="orderNo != null">#{orderNo},</if>
|
|
<if test="materialCode != null">#{materialCode},</if>
|
|
<if test="materialName != null">#{materialName},</if>
|
|
<if test="quality != null">#{quality},</if>
|
|
<if test="sampleQuality != null">#{sampleQuality},</if>
|
|
<if test="noOkQuality != null">#{noOkQuality},</if>
|
|
<if test="aNoOkquality != null">#{aNoOkquality},</if>
|
|
<if test="bNoOkquality != null">#{bNoOkquality},</if>
|
|
<if test="cNoOkquality != null">#{cNoOkquality},</if>
|
|
<if test="unit != null">#{unit},</if>
|
|
<if test="supplierCode != null">#{supplierCode},</if>
|
|
<if test="supplierName != null">#{supplierName},</if>
|
|
<if test="incomeTime != null">#{incomeTime},</if>
|
|
<if test="checkLoc != null">#{checkLoc},</if>
|
|
<if test="checkStatus != null">#{checkStatus},</if>
|
|
<if test="checkManCode != null">#{checkManCode},</if>
|
|
<if test="checkManName != null">#{checkManName},</if>
|
|
<if test="checkTime != null">#{checkTime},</if>
|
|
<if test="checkResult != null">#{checkResult},</if>
|
|
<if test="status != null">#{status},</if>
|
|
<if test="attr1 != null">#{attr1},</if>
|
|
<if test="attr2 != null">#{attr2},</if>
|
|
<if test="attr3 != null">#{attr3},</if>
|
|
<if test="attr4 != null">#{attr4},</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 and factoryCode != ''">#{factoryCode},</if>
|
|
<if test="delFlag != null">#{delFlag},</if>
|
|
<if test="checkType != null">#{checkType},</if>
|
|
<if test="typeCode != null">#{typeCode},</if>
|
|
<if test="sampleQuality != null">#{sampleQuality},</if>
|
|
</trim>
|
|
</insert>
|
|
<insert id="addBatch">
|
|
insert into qc_check_task_detail(
|
|
record_id,belong_to,
|
|
project_id,project_no,rule_name,order_num,
|
|
property_code,check_mode,
|
|
check_tool,unit_code,
|
|
check_standard,actual_value,
|
|
status,create_by,create_time,
|
|
factory_code,del_flag,type_project_id
|
|
) values
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
|
(
|
|
#{item.recordId},#{item.belongTo},
|
|
#{item.projectId},#{item.projectNo},#{item.ruleName},#{item.sort},
|
|
#{item.propertyCode},#{item.checkMode},
|
|
#{item.checkTool},#{item.unitCode},
|
|
#{item.standardValue},#{item.actualValue},
|
|
#{item.status},#{item.createBy},#{item.createTime},
|
|
#{item.factoryCode},'0',#{item.typeProjectId}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
<insert id="addCheckUsers">
|
|
insert into qc_check_task_user(
|
|
record_id,belong_to,check_no,
|
|
check_man_code,check_man_name,
|
|
create_by,create_time,factory_code
|
|
) values
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
|
(
|
|
#{item.id},#{item.belongTo},#{item.checkNo},
|
|
#{item.userCode},#{item.userName},
|
|
#{item.createBy},#{item.createTime},#{item.factoryCode}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
</mapper>
|