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.

287 lines
22 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.hw.wms.mapper.WmsBaseWarehouseMapper">
<resultMap type="WmsBaseWarehouse" id="WmsBaseWarehouseResult">
<result property="warehouseId" column="warehouse_id" />
<result property="warehouseInstockType" column="warehouse_instock_type" />
<result property="warehouseType" column="warehouse_type" />
<result property="warehouseCode" column="warehouse_code" />
<result property="agvPositionCode" column="agv_position_code" />
<result property="warehouseName" column="warehouse_name" />
<result property="warehouseCategoryId" column="warehouse_category_id" />
<result property="warehouseFloor" column="warehouse_floor" />
<result property="deptId" column="dept_id" />
<result property="multiRowType" column="multi_row_type" />
<result property="multiSideType" column="multi_side_type" />
<result property="batchMix" column="batch_mix" />
<result property="productMix" column="product_mix" />
<result property="workbinFlag" column="workbin_flag" />
<result property="warehouseLocation" column="warehouse_location" />
<result property="activeFlag" column="active_flag" />
<result property="inRequirement" column="in_requirement" />
<result property="outRequirement" column="out_requirement" />
<result property="returnRequirement" column="return_requirement" />
<result property="autoFlag" column="auto_flag" />
<result property="returnFlag" column="return_flag" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="delFlag" column="del_flag" />
<result property="factoryId" column="factory_id" />
<result property="dataSource" column="data_source" />
<result property="schame" column="schame" />
<result property="lineFlag" column="line_flag" />
</resultMap>
<resultMap id="WmsBaseWarehouseWmsBaseLocationResult" type="WmsBaseWarehouse" extends="WmsBaseWarehouseResult">
<collection property="wmsBaseLocationList" notNullColumn="sub_location_id" javaType="java.util.List" resultMap="WmsBaseLocationResult" />
</resultMap>
<resultMap type="WmsBaseLocation" id="WmsBaseLocationResult">
<result property="locationId" column="sub_location_id" />
<result property="warehouseId" column="sub_warehouse_id" />
<result property="locationCode" column="sub_location_code" />
<result property="locRow" column="sub_loc_row" />
<result property="layerNum" column="sub_layer_num" />
<result property="locColumn" column="sub_loc_column" />
<result property="activeFlag" column="sub_active_flag" />
<result property="manualFlag" column="sub_manual_flag" />
<result property="qtyLimit" column="sub_qty_limit" />
<result property="instockFlag" column="sub_instock_flag" />
<result property="outstockFlag" column="sub_outstock_flag" />
<result property="locationStatus" column="sub_location_status" />
<result property="batchMix" column="sub_batch_mix" />
<result property="createBy" column="sub_create_by" />
<result property="createTime" column="sub_create_time" />
<result property="updateBy" column="sub_update_by" />
<result property="updateTime" column="sub_update_time" />
<result property="remark" column="sub_remark" />
<result property="delFlag" column="sub_del_flag" />
<result property="shelfOrder" column="sub_shelf_order" />
<result property="checkOrder" column="sub_check_order" />
<result property="pickOrder" column="sub_pick_order" />
<result property="pickFlag" column="sub_pick_flag" />
<result property="isOpenKnFlag" column="sub_is_open_kn_flag" />
<result property="locationScrapType" column="sub_location_scrap_type" />
<result property="volumeLimit" column="sub_volume_limit" />
<result property="weightLimit" column="sub_weight_limit" />
<result property="length" column="sub_length" />
<result property="width" column="sub_width" />
<result property="height" column="sub_height" />
</resultMap>
<sql id="selectWmsBaseWarehouseVo">
select warehouse_id, warehouse_instock_type, warehouse_type, warehouse_code,agv_position_code, warehouse_name, warehouse_category_id, warehouse_floor, dept_id, multi_row_type, multi_side_type, batch_mix, product_mix, workbin_flag, warehouse_location, active_flag, in_requirement, out_requirement, return_requirement, auto_flag, return_flag, remark, create_by, create_time, update_by, update_time, del_flag, factory_id, data_source, schame, line_flag from wms_base_warehouse
</sql>
<select id="selectWmsBaseWarehouseList" parameterType="WmsBaseWarehouse" resultMap="WmsBaseWarehouseResult">
<include refid="selectWmsBaseWarehouseVo"/>
<where>
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
<if test="warehouseInstockType != null and warehouseInstockType != ''"> and warehouse_instock_type = #{warehouseInstockType}</if>
<if test="warehouseType != null and warehouseType != ''"> and warehouse_type = #{warehouseType}</if>
<if test="warehouseCode != null and warehouseCode != ''"> and warehouse_code = #{warehouseCode}</if>
<if test="warehouseName != null and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>
<if test="warehouseCategoryId != null "> and warehouse_category_id = #{warehouseCategoryId}</if>
<if test="warehouseFloor != null "> and warehouse_floor = #{warehouseFloor}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="multiRowType != null and multiRowType != ''"> and multi_row_type = #{multiRowType}</if>
<if test="multiSideType != null and multiSideType != ''"> and multi_side_type = #{multiSideType}</if>
<if test="batchMix != null and batchMix != ''"> and batch_mix = #{batchMix}</if>
<if test="productMix != null and productMix != ''"> and product_mix = #{productMix}</if>
<if test="workbinFlag != null and workbinFlag != ''"> and workbin_flag = #{workbinFlag}</if>
<if test="warehouseLocation != null and warehouseLocation != ''"> and warehouse_location = #{warehouseLocation}</if>
<if test="activeFlag != null and activeFlag != ''"> and active_flag = #{activeFlag}</if>
<if test="inRequirement != null and inRequirement != ''"> and in_requirement = #{inRequirement}</if>
<if test="returnFlag != null and returnFlag != ''"> and return_flag = #{returnFlag}</if>
<if test="factoryId != null "> and factory_id = #{factoryId}</if>
<if test="dataSource != null and dataSource != ''"> and data_source = #{dataSource}</if>
<if test="schame != null and schame != ''"> and schame = #{schame}</if>
<if test="lineFlag != null and lineFlag != ''"> and line_flag = #{lineFlag}</if>
</where>
</select>
<select id="selectWmsBaseWarehouseWithLocationByWarehouseId" parameterType="Long" resultMap="WmsBaseWarehouseWmsBaseLocationResult">
select a.warehouse_id, a.warehouse_instock_type, a.warehouse_type, a.warehouse_code, a.warehouse_name, a.warehouse_category_id, a.warehouse_floor, a.dept_id, a.multi_row_type, a.multi_side_type, a.batch_mix, a.product_mix, a.workbin_flag, a.warehouse_location, a.active_flag, a.in_requirement, a.out_requirement,a.return_requirement,a.auto_flag, a.return_flag, a.remark, a.create_by, a.create_time, a.update_by, a.update_time, a.del_flag, a.factory_id, a.data_source, a.schame, a.line_flag,
b.location_id as sub_location_id, b.warehouse_id as sub_warehouse_id, b.location_code as sub_location_code, b.loc_row as sub_loc_row, b.layer_num as sub_layer_num, b.loc_column as sub_loc_column, b.active_flag as sub_active_flag, b.manual_flag as sub_manual_flag, b.qty_limit as sub_qty_limit, b.instock_flag as sub_instock_flag, b.outstock_flag as sub_outstock_flag, b.location_status as sub_location_status, b.batch_mix as sub_batch_mix, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time, b.remark as sub_remark, b.del_flag as sub_del_flag, b.shelf_order as sub_shelf_order, b.check_order as sub_check_order, b.pick_order as sub_pick_order, b.pick_flag as sub_pick_flag, b.is_open_kn_flag as sub_is_open_kn_flag, b.location_scrap_type as sub_location_scrap_type, b.volume_limit as sub_volume_limit, b.weight_limit as sub_weight_limit, b.length as sub_length, b.width as sub_width, b.height as sub_height
from wms_base_warehouse a
left join wms_base_location b on b.warehouse_id = a.warehouse_id
where a.warehouse_id = #{warehouseId}
</select>
<insert id="insertWmsBaseWarehouse" parameterType="WmsBaseWarehouse" useGeneratedKeys="true" keyProperty="warehouseId">
insert into wms_base_warehouse
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="warehouseInstockType != null and warehouseInstockType != ''">warehouse_instock_type,</if>
<if test="warehouseType != null and warehouseType != ''">warehouse_type,</if>
<if test="warehouseCode != null and warehouseCode != ''">warehouse_code,</if>
<if test="warehouseName != null and warehouseName != ''">warehouse_name,</if>
<if test="warehouseCategoryId != null">warehouse_category_id,</if>
<if test="warehouseFloor != null">warehouse_floor,</if>
<if test="deptId != null">dept_id,</if>
<if test="multiRowType != null and multiRowType != ''">multi_row_type,</if>
<if test="multiSideType != null and multiSideType != ''">multi_side_type,</if>
<if test="batchMix != null and batchMix != ''">batch_mix,</if>
<if test="productMix != null">product_mix,</if>
<if test="workbinFlag != null">workbin_flag,</if>
<if test="warehouseLocation != null">warehouse_location,</if>
<if test="activeFlag != null and activeFlag != ''">active_flag,</if>
<if test="inRequirement != null and inRequirement != ''">in_requirement,</if>
<if test="outRequirement != null and outRequirement != ''">out_requirement,</if>
<if test="returnRequirement != null and returnRequirement != ''">return_requirement,</if>
<if test="autoFlag != null and autoFlag != ''">auto_flag,</if>
<if test="returnFlag != null and returnFlag != ''">return_flag,</if>
<if test="remark != null">remark,</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="delFlag != null">del_flag,</if>
<if test="factoryId != null">factory_id,</if>
<if test="dataSource != null">data_source,</if>
<if test="schame != null">schame,</if>
<if test="lineFlag != null">line_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="warehouseInstockType != null and warehouseInstockType != ''">#{warehouseInstockType},</if>
<if test="warehouseType != null and warehouseType != ''">#{warehouseType},</if>
<if test="warehouseCode != null and warehouseCode != ''">#{warehouseCode},</if>
<if test="warehouseName != null and warehouseName != ''">#{warehouseName},</if>
<if test="warehouseCategoryId != null">#{warehouseCategoryId},</if>
<if test="warehouseFloor != null">#{warehouseFloor},</if>
<if test="deptId != null">#{deptId},</if>
<if test="multiRowType != null and multiRowType != ''">#{multiRowType},</if>
<if test="multiSideType != null and multiSideType != ''">#{multiSideType},</if>
<if test="batchMix != null and batchMix != ''">#{batchMix},</if>
<if test="productMix != null">#{productMix},</if>
<if test="workbinFlag != null">#{workbinFlag},</if>
<if test="warehouseLocation != null">#{warehouseLocation},</if>
<if test="activeFlag != null and activeFlag != ''">#{activeFlag},</if>
<if test="inRequirement != null and inRequirement != ''">#{inRequirement},</if>
<if test="outRequirement != null and outRequirement != ''">#{outRequirement},</if>
<if test="returnRequirement != null and returnRequirement != ''">#{returnRequirement},</if>
<if test="autoFlag != null and autoFlag != ''">#{autoFlag},</if>
<if test="returnFlag != null and returnFlag != ''">#{returnFlag},</if>
<if test="remark != null">#{remark},</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="delFlag != null">#{delFlag},</if>
<if test="factoryId != null">#{factoryId},</if>
<if test="dataSource != null">#{dataSource},</if>
<if test="schame != null">#{schame},</if>
<if test="lineFlag != null">#{lineFlag},</if>
</trim>
</insert>
<update id="updateWmsBaseWarehouse" parameterType="WmsBaseWarehouse">
update wms_base_warehouse
<trim prefix="SET" suffixOverrides=",">
<if test="warehouseInstockType != null and warehouseInstockType != ''">warehouse_instock_type = #{warehouseInstockType},</if>
<if test="warehouseType != null and warehouseType != ''">warehouse_type = #{warehouseType},</if>
<if test="warehouseCode != null and warehouseCode != ''">warehouse_code = #{warehouseCode},</if>
<if test="warehouseName != null and warehouseName != ''">warehouse_name = #{warehouseName},</if>
<if test="warehouseCategoryId != null">warehouse_category_id = #{warehouseCategoryId},</if>
<if test="warehouseFloor != null">warehouse_floor = #{warehouseFloor},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="multiRowType != null and multiRowType != ''">multi_row_type = #{multiRowType},</if>
<if test="multiSideType != null and multiSideType != ''">multi_side_type = #{multiSideType},</if>
<if test="batchMix != null and batchMix != ''">batch_mix = #{batchMix},</if>
<if test="productMix != null">product_mix = #{productMix},</if>
<if test="workbinFlag != null">workbin_flag = #{workbinFlag},</if>
<if test="warehouseLocation != null">warehouse_location = #{warehouseLocation},</if>
<if test="activeFlag != null and activeFlag != ''">active_flag = #{activeFlag},</if>
<if test="inRequirement != null and inRequirement != ''">in_requirement = #{inRequirement},</if>
<if test="outRequirement != null and outRequirement != ''">out_requirement = #{outRequirement},</if>
<if test="returnRequirement != null and returnRequirement != ''">return_requirement = #{returnRequirement},</if>
<if test="autoFlag != null and autoFlag != ''">auto_flag = #{autoFlag},</if>
<if test="returnFlag != null and returnFlag != ''">return_flag = #{returnFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="factoryId != null">factory_id = #{factoryId},</if>
<if test="dataSource != null">data_source = #{dataSource},</if>
<if test="schame != null">schame = #{schame},</if>
<if test="lineFlag != null">line_flag = #{lineFlag},</if>
</trim>
where warehouse_id = #{warehouseId}
</update>
<delete id="deleteWmsBaseWarehouseByWarehouseId" parameterType="Long">
delete from wms_base_warehouse where warehouse_id = #{warehouseId}
</delete>
<delete id="deleteWmsBaseWarehouseByWarehouseIds" parameterType="String">
delete from wms_base_warehouse where warehouse_id in
<foreach item="warehouseId" collection="array" open="(" separator="," close=")">
#{warehouseId}
</foreach>
</delete>
<delete id="deleteWmsBaseLocationByWarehouseIds" parameterType="String">
delete from wms_base_location where warehouse_id in
<foreach item="warehouseId" collection="array" open="(" separator="," close=")">
#{warehouseId}
</foreach>
</delete>
<delete id="deleteWmsBaseLocationByWarehouseId" parameterType="Long">
delete from wms_base_location where warehouse_id = #{warehouseId}
</delete>
<insert id="batchWmsBaseLocation">
insert into wms_base_location( location_id, warehouse_id, location_code, loc_row, layer_num, loc_column, active_flag, manual_flag, qty_limit, instock_flag, outstock_flag, location_status, batch_mix, create_by, create_time, update_by, update_time, remark, del_flag, shelf_order, check_order, pick_order, pick_flag, is_open_kn_flag, location_scrap_type, volume_limit, weight_limit, length, width, height) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.locationId}, #{item.warehouseId}, #{item.locationCode}, #{item.locRow}, #{item.layerNum}, #{item.locColumn}, #{item.activeFlag}, #{item.manualFlag}, #{item.qtyLimit}, #{item.instockFlag}, #{item.outstockFlag}, #{item.locationStatus}, #{item.batchMix}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark}, #{item.delFlag}, #{item.shelfOrder}, #{item.checkOrder}, #{item.pickOrder}, #{item.pickFlag}, #{item.isOpenKnFlag}, #{item.locationScrapType}, #{item.locationAttr}, #{item.turnDemand}, #{item.checkCode}, #{item.workArea}, #{item.volumeLimit}, #{item.weightLimit}, #{item.length}, #{item.width}, #{item.height})
</foreach>
</insert>
<select id="selectWmsBaseWarehouseJoinList" parameterType="WmsBaseWarehouse" resultMap="WmsBaseWarehouseResult">
select wbw.warehouse_id, wbw.warehouse_instock_type, wbw.warehouse_type, wbw.warehouse_code, wbw.warehouse_name,
wbw.warehouse_category_id, wbw.warehouse_floor, wbw.dept_id, wbw.multi_row_type, wbw.multi_side_type, wbw.batch_mix,
wbw.product_mix, wbw.workbin_flag, wbw.warehouse_location, wbw.active_flag, wbw.in_requirement,
wbw.out_requirement,wbw.return_requirement,wbw.auto_flag,
wbw.return_flag,wbc.category_name
from wms_base_warehouse wbw left join wms_base_category wbc on wbw.warehouse_category_id = wbc.category_id
<where>
<if test="warehouseInstockType != null and warehouseInstockType != ''"> and warehouse_instock_type = #{warehouseInstockType}</if>
<if test="warehouseType != null and warehouseType != ''"> and warehouse_type = #{warehouseType}</if>
<if test="warehouseCode != null and warehouseCode != ''"> and warehouse_code = #{warehouseCode}</if>
<if test="warehouseName != null and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>
<if test="warehouseCategoryId != null "> and warehouse_category_id = #{warehouseCategoryId}</if>
<if test="warehouseFloor != null "> and warehouse_floor = #{warehouseFloor}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="multiRowType != null and multiRowType != ''"> and multi_row_type = #{multiRowType}</if>
<if test="multiSideType != null and multiSideType != ''"> and multi_side_type = #{multiSideType}</if>
<if test="batchMix != null and batchMix != ''"> and batch_mix = #{batchMix}</if>
<if test="productMix != null and productMix != ''"> and product_mix = #{productMix}</if>
<if test="workbinFlag != null and workbinFlag != ''"> and workbin_flag = #{workbinFlag}</if>
<if test="warehouseLocation != null and warehouseLocation != ''"> and warehouse_location like concat('%', #{warehouseLocation}, '%')</if>
<if test="activeFlag != null and activeFlag != ''"> and active_flag = #{activeFlag}</if>
<if test="inRequirement != null and inRequirement != ''"> and in_requirement = #{inRequirement}</if>
<if test="outRequirement != null and outRequirement != ''"> and out_requirement = #{outRequirement}</if>
<if test="returnFlag != null and returnFlag != ''"> and return_flag = #{returnFlag}</if>
<if test="factoryId != null "> and factory_id = #{factoryId}</if>
</where>
</select>
<select id="selectWmsBaseWarehouseByWarehouseId" parameterType="Long" resultMap="WmsBaseWarehouseResult">
<include refid="selectWmsBaseWarehouseVo"/>
where warehouse_id = #{warehouseId}
</select>
</mapper>