add:开发
This commit is contained in:
@@ -0,0 +1,212 @@
|
||||
<?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="cn.code.nl.module.wms.dal.mysql.iostorinvdtl.IostorinvDtlMapper">
|
||||
|
||||
<sql id="availableInventoryColumns">
|
||||
gp.group_id AS group_id,
|
||||
gp.vehicle_code AS vehicle_code,
|
||||
gp.pcsn AS pcsn,
|
||||
gp.material_id AS material_id,
|
||||
gp.material_code AS material_code,
|
||||
mb.material_name AS material_name,
|
||||
gp.qty - COALESCE(gp.frozen_qty, 0) AS available_qty,
|
||||
gp.qty_unit_id AS qty_unit_id,
|
||||
gp.qty_unit_name AS qty_unit_name,
|
||||
gp.ext_code AS ext_code,
|
||||
gp.ext_type AS ext_type,
|
||||
gp.ext_dtl_code AS ext_dtl_code,
|
||||
sa.stor_id AS stor_id,
|
||||
sa.stor_code AS stor_code,
|
||||
sa.stor_name AS stor_name
|
||||
</sql>
|
||||
|
||||
<select id="selectAvailableInventoryPage"
|
||||
resultType="cn.code.nl.module.wms.controller.admin.iostorinv.vo.AvailableInventoryRespVO">
|
||||
SELECT <include refid="availableInventoryColumns"/>
|
||||
FROM wms_group_plate gp
|
||||
INNER JOIN (
|
||||
SELECT stor_id, storagevehicle_code, MAX(stor_code) AS stor_code, MAX(stor_name) AS stor_name
|
||||
FROM wms_structattr
|
||||
WHERE deleted = 0
|
||||
GROUP BY stor_id, storagevehicle_code
|
||||
) sa ON sa.storagevehicle_code = gp.vehicle_code
|
||||
LEFT JOIN base_materialbase mb ON mb.material_id = gp.material_id AND mb.deleted = 0
|
||||
WHERE sa.stor_id = #{reqVO.storId}
|
||||
AND gp.status = '02'
|
||||
AND gp.qty - COALESCE(gp.frozen_qty, 0) > 0
|
||||
AND gp.deleted = 0
|
||||
<if test="reqVO.materialCode != null and reqVO.materialCode != ''">
|
||||
AND gp.material_code LIKE CONCAT('%', #{reqVO.materialCode}, '%')
|
||||
</if>
|
||||
<if test="reqVO.vehicleCode != null and reqVO.vehicleCode != ''">
|
||||
AND gp.vehicle_code LIKE CONCAT('%', #{reqVO.vehicleCode}, '%')
|
||||
</if>
|
||||
<if test="reqVO.pcsn != null and reqVO.pcsn != ''">
|
||||
AND gp.pcsn LIKE CONCAT('%', #{reqVO.pcsn}, '%')
|
||||
</if>
|
||||
ORDER BY gp.vehicle_code, gp.group_id
|
||||
</select>
|
||||
|
||||
<select id="selectAvailableInventoryByVehicleCodes"
|
||||
resultType="cn.code.nl.module.wms.controller.admin.iostorinv.vo.AvailableInventoryRespVO">
|
||||
SELECT <include refid="availableInventoryColumns"/>
|
||||
FROM wms_group_plate gp
|
||||
INNER JOIN (
|
||||
SELECT stor_id, storagevehicle_code, MAX(stor_code) AS stor_code, MAX(stor_name) AS stor_name
|
||||
FROM wms_structattr
|
||||
WHERE deleted = 0
|
||||
GROUP BY stor_id, storagevehicle_code
|
||||
) sa ON sa.storagevehicle_code = gp.vehicle_code
|
||||
LEFT JOIN base_materialbase mb ON mb.material_id = gp.material_id AND mb.deleted = 0
|
||||
WHERE sa.stor_id = #{storId}
|
||||
AND gp.status = '02'
|
||||
AND gp.qty - COALESCE(gp.frozen_qty, 0) > 0
|
||||
AND gp.deleted = 0
|
||||
AND gp.vehicle_code IN
|
||||
<foreach collection="vehicleCodes" item="vehicleCode" open="(" separator="," close=")">
|
||||
#{vehicleCode}
|
||||
</foreach>
|
||||
ORDER BY gp.vehicle_code, gp.group_id
|
||||
</select>
|
||||
|
||||
<select id="selectAvailableInventoryByVehicleCodesForUpdate"
|
||||
resultType="cn.code.nl.module.wms.controller.admin.iostorinv.vo.AvailableInventoryRespVO">
|
||||
SELECT <include refid="availableInventoryColumns"/>
|
||||
FROM wms_group_plate gp
|
||||
INNER JOIN (
|
||||
SELECT stor_id, storagevehicle_code, MAX(stor_code) AS stor_code, MAX(stor_name) AS stor_name
|
||||
FROM wms_structattr
|
||||
WHERE deleted = 0
|
||||
GROUP BY stor_id, storagevehicle_code
|
||||
) sa ON sa.storagevehicle_code = gp.vehicle_code
|
||||
LEFT JOIN base_materialbase mb ON mb.material_id = gp.material_id AND mb.deleted = 0
|
||||
WHERE sa.stor_id = #{storId}
|
||||
AND gp.status = '02'
|
||||
AND gp.qty - COALESCE(gp.frozen_qty, 0) > 0
|
||||
AND gp.deleted = 0
|
||||
AND gp.vehicle_code IN
|
||||
<foreach collection="vehicleCodes" item="vehicleCode" open="(" separator="," close=")">
|
||||
#{vehicleCode}
|
||||
</foreach>
|
||||
ORDER BY gp.vehicle_code, gp.group_id
|
||||
FOR UPDATE
|
||||
</select>
|
||||
|
||||
<select id="selectEditDetails"
|
||||
resultType="cn.code.nl.module.wms.controller.admin.iostorinv.vo.IostorInvDetailRespVO">
|
||||
SELECT d.iostorinvdtl_id,
|
||||
d.seq_no,
|
||||
d.bill_status,
|
||||
d.assign_qty,
|
||||
d.unassign_qty,
|
||||
d.material_code,
|
||||
d.material_id,
|
||||
mb.material_name,
|
||||
d.pcsn,
|
||||
d.plan_qty,
|
||||
d.qty_unit_id,
|
||||
d.source_bill_code,
|
||||
d.source_bill_type,
|
||||
d.source_billdtl_id,
|
||||
d.source_load_port AS vehicle_code,
|
||||
d.remark
|
||||
FROM wms_iostorinvdtl d
|
||||
LEFT JOIN base_materialbase mb
|
||||
ON mb.material_id = d.material_id
|
||||
WHERE d.iostorinv_id = #{iostorinvId}
|
||||
ORDER BY d.seq_no, d.iostorinvdtl_id
|
||||
</select>
|
||||
|
||||
<select id="selectAllocationInventoryForUpdate"
|
||||
resultType="cn.code.nl.module.wms.controller.admin.iostorinv.vo.AllocationInventoryRespVO">
|
||||
SELECT gp.group_id,
|
||||
gp.vehicle_code,
|
||||
gp.material_id,
|
||||
gp.material_code,
|
||||
gp.pcsn,
|
||||
gp.qty - COALESCE(gp.frozen_qty, 0) AS available_qty,
|
||||
gp.qty_unit_id,
|
||||
gp.qty_unit_name,
|
||||
sa.sect_id,
|
||||
sa.sect_code,
|
||||
sa.sect_name,
|
||||
sa.struct_id,
|
||||
sa.struct_code,
|
||||
sa.struct_name
|
||||
FROM wms_group_plate gp
|
||||
INNER JOIN wms_structattr sa
|
||||
ON sa.storagevehicle_code = gp.vehicle_code
|
||||
AND sa.deleted = 0
|
||||
WHERE gp.deleted = 0
|
||||
AND gp.status = '02'
|
||||
AND gp.qty - COALESCE(gp.frozen_qty, 0) > 0
|
||||
AND sa.stor_id = #{storId}
|
||||
AND (sa.lock_type IS NULL OR sa.lock_type IN ('0', '1'))
|
||||
<if test="sectId != null and sectId != ''">
|
||||
AND sa.sect_id = #{sectId}
|
||||
</if>
|
||||
AND gp.material_id = #{materialId}
|
||||
<choose>
|
||||
<when test="pcsn != null and pcsn != ''">AND gp.pcsn = #{pcsn}</when>
|
||||
<otherwise>AND (gp.pcsn IS NULL OR gp.pcsn = '')</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="sourceBillCode != null and sourceBillCode != ''">AND gp.ext_code = #{sourceBillCode}</when>
|
||||
<otherwise>AND (gp.ext_code IS NULL OR gp.ext_code = '')</otherwise>
|
||||
</choose>
|
||||
ORDER BY gp.create_time, gp.group_id
|
||||
FOR UPDATE
|
||||
</select>
|
||||
|
||||
<select id="selectManualAllocationInventory"
|
||||
resultType="cn.code.nl.module.wms.controller.admin.iostorinv.vo.AllocationInventoryRespVO">
|
||||
SELECT gp.group_id,
|
||||
gp.vehicle_code,
|
||||
gp.material_id,
|
||||
gp.material_code,
|
||||
mb.material_name,
|
||||
gp.pcsn,
|
||||
gp.qty - COALESCE(gp.frozen_qty, 0) AS available_qty,
|
||||
gp.qty_unit_id,
|
||||
gp.qty_unit_name,
|
||||
sa.sect_id,
|
||||
sa.sect_code,
|
||||
sa.sect_name,
|
||||
sa.struct_id,
|
||||
sa.struct_code,
|
||||
sa.struct_name
|
||||
FROM wms_group_plate gp
|
||||
INNER JOIN wms_structattr sa
|
||||
ON sa.storagevehicle_code = gp.vehicle_code
|
||||
AND sa.deleted = 0
|
||||
LEFT JOIN base_materialbase mb
|
||||
ON mb.material_id = gp.material_id
|
||||
AND mb.deleted = 0
|
||||
WHERE gp.deleted = 0
|
||||
AND gp.status = '02'
|
||||
AND gp.qty - COALESCE(gp.frozen_qty, 0) > 0
|
||||
AND sa.stor_id = #{storId}
|
||||
AND (sa.lock_type IS NULL OR sa.lock_type IN ('0', '1'))
|
||||
AND gp.material_id = #{materialId}
|
||||
<if test="sectId != null and sectId != ''">
|
||||
AND sa.sect_id = #{sectId}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="pcsn != null and pcsn != ''">AND gp.pcsn = #{pcsn}</when>
|
||||
<otherwise>AND (gp.pcsn IS NULL OR gp.pcsn = '')</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="sourceBillCode != null and sourceBillCode != ''">AND gp.ext_code = #{sourceBillCode}</when>
|
||||
<otherwise>AND (gp.ext_code IS NULL OR gp.ext_code = '')</otherwise>
|
||||
</choose>
|
||||
<if test="groupIds != null and !groupIds.isEmpty()">
|
||||
AND gp.group_id IN
|
||||
<foreach collection="groupIds" item="groupId" open="(" separator="," close=")">
|
||||
#{groupId}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY gp.vehicle_code, gp.group_id
|
||||
<if test="forUpdate">FOR UPDATE</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user