<?xml version="1.0" encoding="UTF-8"?>
|
|
<!--
|
~
|
~ Copyright (c) 2018-2025, ztt All rights reserved.
|
~
|
~ Redistribution and use in source and binary forms, with or without
|
~ modification, are permitted provided that the following conditions are met:
|
~
|
~ Redistributions of source code must retain the above copyright notice,
|
~ this list of conditions and the following disclaimer.
|
~ Redistributions in binary form must reproduce the above copyright
|
~ notice, this list of conditions and the following disclaimer in the
|
~ documentation and/or other materials provided with the distribution.
|
~ Neither the name of the pig4cloud.com developer nor the names of its
|
~ contributors may be used to endorse or promote products derived from
|
~ this software without specific prior written permission.
|
~ Author: ztt
|
~
|
-->
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.chinaztt.mes.plan.mapper.ManufacturingOrderMatIssueMapper">
|
|
<resultMap id="manufacturingOrderMatIssue"
|
type="com.chinaztt.mes.plan.entity.ManufacturingOrderMatIssue">
|
<result property="id" column="id"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateTime" column="update_time"/>
|
<result property="createUser" column="create_user"/>
|
<result property="updateUser" column="update_user"/>
|
<result property="moId" column="mo_id"/>
|
<result property="partNo" column="part_no"/>
|
<result property="partName" column="part_name"/>
|
<result property="engChgLevel" column="eng_chg_level"/>
|
<result property="unit" column="unit"/>
|
<result property="warehouse" column="warehouse"/>
|
<result property="lotBatchNo" column="lot_batch_no"/>
|
<result property="locationNo" column="location_no"/>
|
<result property="locationName" column="location_name"/>
|
<result property="wdrNo" column="wdr_no"/>
|
<result property="releaseNo" column="release_no"/>
|
<result property="qtyRequired" column="qty_required"/>
|
<result property="qtyIssue" column="qty_issue"/>
|
<result property="serialNo" column="serial_no"/>
|
<result property="stockId" column="stock_id"/>
|
<result property="matFrom" column="mat_from"/>
|
<result property="ifsLineItemNo" column="ifs_line_item_no"/>
|
|
</resultMap>
|
|
<select id="getMatIssueFromStock" resultType="com.chinaztt.mes.plan.dto.ManufacturingOrderMatIssueDTO">
|
SELECT
|
pmsc.ID AS struc_id,
|
pmsc.part_id,
|
ws.ID AS stock_id,
|
'MES' AS mat_from,
|
bp.part_no,
|
bp.eng_chg_level,
|
bp.part_name,
|
ws.part_batch_no AS lot_batch_no,
|
bl.loc_no AS location_no,
|
bl.loc_name AS location_name,
|
bp.unit,
|
'*' AS serial_no,
|
ws.part_batch_no AS wdr_no,
|
pmsc.ifs_line_item_no,
|
CASE
|
WHEN ws.available_stock_quantity IS NULL THEN
|
0
|
ELSE ws.available_stock_quantity
|
END AS qty_required,
|
CASE
|
WHEN ws.available_stock_quantity IS NULL THEN
|
0
|
ELSE ws.available_stock_quantity
|
END AS qty_issue
|
FROM
|
plan_mo_structure_component pmsc
|
LEFT JOIN warehouse_stock ws ON ws.part_id = pmsc.part_id
|
LEFT JOIN basic_part bp ON bp."id" = pmsc.part_id
|
LEFT JOIN basic_location bl ON bl."id" = ws.location_id
|
WHERE
|
pmsc.parent = #{parent}
|
AND bl."id" IN (SELECT DISTINCT location_id FROM basic_workstation_location WHERE location_type = 4)
|
AND bp.material_type = '1'
|
AND pmsc.ifs_line_item_no IS NOT NULL
|
AND ws.available_stock_quantity > 0;
|
</select>
|
|
<select id="getMatIssuePartNoFromIfs" resultType="com.chinaztt.mes.plan.dto.MoStructureComponentDTO">
|
SELECT pmsc.*,bp.part_no
|
FROM
|
plan_mo_structure_component pmsc
|
LEFT JOIN basic_part bp ON bp."id" = pmsc.part_id
|
WHERE
|
pmsc.plan_manufacturing_order_id = #{moId}
|
AND parent IS NOT NULL;
|
</select>
|
|
</mapper>
|