ShipmentHeaderMapper.xml 13 KB
<?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.huaheng.pc.shipment.shipmentHeader.mapper.ShipmentHeaderMapper">

    <insert id="HeaderToHistory" parameterType="string">
        INSERT INTO shipment_header_history (
            code,warehouseCode,companyId,sourceCode,sourcePlatform,shipmentTypeId,shipTo,priority,station,totalQty,
            totalLines,remark,uploadremark,uploadTime,appointmentTime,firstStatus,lastStatus,uploadStatus,created,
            createdBy,lastUpdated,lastUpdatedBy,enable,deleted,userDef1,userDef2,userDef3)
        SELECT
            code,warehouseCode,companyId,sourceCode,sourcePlatform,shipmentTypeId,shipTo,priority,station,totalQty,
            totalLines,remark,uploadremark,uploadTime,appointmentTime,firstStatus,lastStatus,uploadStatus,created,
            createdBy,lastUpdated,lastUpdatedBy,enable,1,userDef1,userDef2,userDef3
        FROM shipment_header WHERE code = #{code,jdbcType=VARCHAR}
    </insert>

    <insert id="DetailToHistory" parameterType="string">
         INSERT INTO shipment_detail_history (
            sourceLine,shipmentCode,materialCode,batch,lot,project,manufactureDate,agingDate,inventoryStatus,qty,
            price,created,createdBy,lastUpdated,lastUpdatedBy,enable,deleted,userDef1,userDef2,userDef3)
         SELECT
            sourceLine,shipmentCode,materialCode,batch,lot,project,manufactureDate,agingDate,inventoryStatus,qty,
            price,created,createdBy,lastUpdated,lastUpdatedBy,enable,1,userDef1,userDef2,userDef3
         FROM shipment_detail WHERE shipmentCode = #{code,jdbcType=VARCHAR}
    </insert>


    <select id="list" resultType="com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader">
        select * from shipment_header
        <where>
            <if test="shipmentCode != null">
                and code = #{shipmentCode}
            </if>
            <if test="shipmentType != 0">
                and shipmentTypeId = #{shipmentType}
            </if>
            <if test="company != 0">
                and companyId = #{company}
            </if>
            <if test="firstStatus != null">
                and firstStatus = #{firstStatus}
            </if>
            <if test="lastStatus != null">
                and lastStatus = #{lastStatus}
            </if>
            <if test="beginTime != null">
                and created &gt;= #{beginTime}
            </if>
            <if test="endTime != null">
                and created &lt;= #{endTime}
            </if>
        </where>
    </select>
    <select id="getShipDetail" resultType="java.util.Map">
        SELECT detail.id, detail.shipmentId, detail.shipmentCode, detail.materialCode, detail.materialName,detail.qty, detail.qtyCompleted, m.name, i.locationCode,inventoryStatus, '个' unit
        FROM shipment_detail detail
        INNER JOIN material m ON detail.materialId = m.id and m.deleted = FALSE AND detail.shipmentCode = #{code}
        INNER JOIN sys_dict_data s ON s.dictType = 'inventoryStatus' AND detail.inventoryStatus = s.dictValue AND s.enable = TRUE AND s.deleted = FALSE
        INNER JOIN inventory i ON i.materialCode = detail.materialCode
    </select>
    <select id="getContainerMaterial" resultType="java.util.Map">
        SELECT  rch.locationCode, rcd.id, rd.receiptId, m.barcode, m.name, rd.qty
        FROM receipt_container_header rch
        INNER JOIN receipt_container_detail rcd ON rcd.headerId = rch.id AND rch.receiptContainerCode = #{containerCode,jdbcType=VARCHAR}
        INNER JOIN receipt_detail rd ON rd.id = rcd.receiptDetailId
        INNER JOIN material m ON rd.materialId = m.id AND m.deleted = FALSE
    </select>
    <select id="createCode" resultType="java.lang.String">
        SELECT code FROM shipment_header WHERE type = #{shipmentType,jdbcType=VARCHAR} ORDER BY id DESC LIMIT 1
    </select>

    <select id="selectModel"
            resultType="com.huaheng.api.U8.domain.ICSShipmentHeader">
        SELECT cCode, ID, dPODate, cVenCode, cVenName, cBusType, cDepCode, cDepName, cPersonCode, cPersonName, cMemo, cMaker, type, cVerifier, CompanyCode, cModifyDate,cTVCode, dDate, cRDName, cWHCode, cWHName,oWHCode, oWHName, MoId, MoCode, DLID, cDLCode, cCusCode, cCusName, cSTName
        from icsshipment_header
        <where>
            <if test="cCode != null">
                AND cCode = #{cCode}
            </if>
            <if test="ID != null">
                AND ID = #{ID}
            </if>
            <if test="dPODate != null">
                AND dPODate = #{dPODate}
            </if>
            <if test="cVenCode != null">
                AND cVenCode = #{cVenCode}
            </if>
            <if test="cVenName != null">
                AND cVenName = #{cVenName}
            </if>
            <if test="cBusType != null">
                AND cBusType = #{cBusType}
            </if>
            <if test="cDepCode != null">
                AND cDepCode = #{cDepCode}
            </if>
            <if test="cDepName != null">
                AND cDepName = #{cDepName}
            </if>
            <if test="cPersonCode != null">
                AND cPersonCode = #{cPersonCode}
            </if>
            <if test="cPersonName != null">
                AND cPersonName = #{cPersonName}
            </if>
            <if test="cMemo != null">
                AND cMemo = #{cMemo}
            </if>
            <if test="cMaker != null">
                AND cMaker = #{cMaker}
            </if>
            <if test="cVerifier != null">
                AND cVerifier = #{cVerifier}
            </if>
            <if test="CompanyCode != null">
                AND CompanyCode = #{CompanyCode}
            </if>
            <if test="cModifyDate != null">
                AND cModifyDate = #{cModifyDate}
            </if>
            <if test="dDate != null">
                AND dDate = #{dDate}
            </if>
            <if test="cRDName != null">
                AND cRDName = #{cRDName}
            </if>
            <if test="cWHCode != null">
                AND cWHCode = #{cWHCode}
            </if>
            <if test="cWHName != null">
                AND cWHName = #{cWHName}
            </if>
            <if test="oWHCode != null">
                AND oWHCode = #{oWHCode}
            </if>
            <if test="oWHName != null">
                AND oWHName = #{oWHName}
            </if>
            <if test="cTVCode != null">
                AND cTVCode = #{cTVCode}
            </if>
            <if test="MoId != null">
                AND MoId = #{MoId}
            </if>
            <if test="MoCode != null">
                AND MoCode = #{MoCode}
            </if>
            <if test="DLID != null">
                AND DLID = #{DLID}
            </if>
            <if test="cDLCode != null">
                AND cDLCode = #{cDLCode}
            </if>
            <if test="cCusCode != null">
                AND cCusCode = #{cCusCode}
            </if>
            <if test="cCusName != null">
                AND cCusName = #{cCusName}
            </if>
            <if test="cSTName != null">
                AND cSTName = #{cSTName}
            </if>
            <if test="type != null">
                AND type = #{type}
            </if>
        </where>
    </select>




    <insert id="insertModel">
        INSERT INTO icsshipment_header
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="cCode != null">
                cCode,
            </if>
            <if test="ID != null">
                ID,
            </if>
            <if test="dPODate != null">
                dPODate,
            </if>
            <if test="cVenCode != null">
                cVenCode,
            </if>
            <if test="cVenName != null">
                cVenName,
            </if>
            <if test="cBusType != null">
                cBusType,
            </if>
            <if test="cDepCode != null">
                cDepCode,
            </if>
            <if test="cDepName != null">
                cDepName,
            </if>
            <if test="cPersonCode != null">
                cPersonCode,
            </if>
            <if test="cPersonName != null">
                cPersonName,
            </if>
            <if test="cMemo != null">
                cMemo,
            </if>
            <if test="cMaker != null">
                cMaker,
            </if>
            <if test="cVerifier != null">
                cVerifier,
            </if>
            <if test="CompanyCode != null">
                CompanyCode,
            </if>
            <if test="cModifyDate != null">
                cModifyDate,
            </if>
            <if test="dDate != null">
                dDate,
            </if>
            <if test="cRDName != null">
                cRDName,
            </if>
            <if test="cWHCode != null">
                cWHCode,
            </if>
            <if test="cWHName != null">
                cWHName,
            </if>
            <if test="oWHCode != null">
                oWHCode,
            </if>
            <if test="oWHName != null">
                oWHName,
            </if>
            <if test="cTVCode != null">
                cTVCode,
            </if>
            <if test="MoId != null">
                MoId,
            </if>
            <if test="MoCode != null">
                MoCode,
            </if>
            <if test="DLID != null">
                DLID,
            </if>
            <if test="cDLCode != null">
                cDLCode,
            </if>
            <if test="cCusCode != null">
                cCusCode,
            </if>
            <if test="cCusName != null">
                cCusName,
            </if>
            <if test="cSTName != null">
                cSTName,
            </if>
            <if test="type != null">
                type,
            </if>
        </trim>
        <trim prefix=" values (" suffix=")" suffixOverrides=",">
            <if test="cCode != null">
                #{cCode, jdbcType=VARCHAR},
            </if>
            <if test="ID != null">
                #{ID, jdbcType=INTEGER},
            </if>
            <if test="dPODate != null">
                #{dPODate, jdbcType=TIMESTAMP},
            </if>
            <if test="cVenCode != null">
                #{cVenCode, jdbcType=VARCHAR},
            </if>
            <if test="cVenName != null">
                #{cVenName, jdbcType=VARCHAR},
            </if>
            <if test="cBusType != null">
                #{cBusType, jdbcType=VARCHAR},
            </if>
            <if test="cDepCode != null">
                #{cDepCode, jdbcType=VARCHAR},
            </if>
            <if test="cDepName != null">
                #{cDepName, jdbcType=VARCHAR},
            </if>
            <if test="cPersonCode != null">
                #{cPersonCode, jdbcType=VARCHAR},
            </if>
            <if test="cPersonName != null">
                #{cPersonName, jdbcType=VARCHAR},
            </if>
            <if test="cMemo != null">
                #{cMemo, jdbcType=VARCHAR},
            </if>
            <if test="cMaker != null">
                #{cMaker, jdbcType=VARCHAR},
            </if>
            <if test="cVerifier != null">
                #{cVerifier, jdbcType=VARCHAR},
            </if>
            <if test="CompanyCode != null">
                #{CompanyCode, jdbcType=VARCHAR},
            </if>
            <if test="cModifyDate != null">
                #{cModifyDate, jdbcType=TIMESTAMP},
            </if>
            <if test="dDate != null">
                #{dDate, jdbcType=TIMESTAMP},
            </if>
            <if test="cRDName != null">
                #{cRDName, jdbcType=VARCHAR},
            </if>
            <if test="cWHCode != null">
                #{cWHCode, jdbcType=VARCHAR},
            </if>
            <if test="cWHName != null">
                #{cWHName, jdbcType=VARCHAR},
            </if>
            <if test="oWHCode != null">
                #{oWHCode, jdbcType=VARCHAR},
            </if>
            <if test="oWHName != null">
                #{oWHName, jdbcType=VARCHAR},
            </if>
            <if test="cTVCode != null">
                #{cTVCode, jdbcType=VARCHAR},
            </if>
            <if test="MoId != null">
                #{MoId, jdbcType=INTEGER},
            </if>
            <if test="MoCode != null">
                #{MoCode, jdbcType=VARCHAR},
            </if>
            <if test="DLID != null">
                #{DLID, jdbcType=INTEGER},
            </if>
            <if test="cDLCode != null">
                #{cDLCode, jdbcType=VARCHAR},
            </if>
            <if test="cCusCode != null">
                #{cCusCode, jdbcType=VARCHAR},
            </if>
            <if test="cCusName != null">
                #{cCusName, jdbcType=VARCHAR},
            </if>
            <if test="cSTName != null">
                #{cSTName, jdbcType=VARCHAR},
            </if>
            <if test="type != null">
                #{type, jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
</mapper>