<?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.example.erp.mapper.mm.FinishedGoodsInventoryMapper">
|
|
<resultMap id="selectFinishedGoodsInventory" type="com.example.erp.entity.mm.FinishedGoodsInventory">
|
<id column="fid" property="id"/>
|
<result column="inventory" property="inventory"/>
|
<result column="area" property="area"/>
|
<result column="actual_signal_area" property="actualSignalArea"/>
|
<result column="quantity_available" property="quantityAvailable"/>
|
<result column="warehouse_number" property="warehouseNumber"/>
|
<result column="storage_region" property="storageRegion"/>
|
<result column="status" property="status"/>
|
<result column="enter_storage_time" property="enterStorageTime"/>
|
<result column="remark" property="remark"/>
|
<result column="update_time" property="updateTime"/>
|
<result column="end_time" property="endTime"/>
|
|
<result column="order_id" property="order.orderId"/>
|
<result column="project" property="order.project"/>
|
<result column="order_type" property="order.orderType"/>
|
|
|
<result column="order_number" property="orderDetail.orderNumber"/>
|
<result column="width" property="orderDetail.width"/>
|
<result column="height" property="orderDetail.height"/>
|
<result column="product_name" property="orderDetail.productName"/>
|
<result column="product_id" property="orderDetail.productId"/>
|
|
</resultMap>
|
|
<resultMap id="selectFlowCard" type="com.example.erp.entity.pp.FlowCard">
|
<id column="id" property="id"/>
|
<result column="order_number" property="orderNumber"/>
|
<result column="inventory_quantity" property="inventoryQuantity"/>
|
<result column="process_id" property="processId"/>
|
<result column="received_quantity" property="receivedQuantity"/>
|
|
|
<result column="order_id" property="order.orderId"/>
|
<result column="project" property="order.project"/>
|
<result column="creater" property="order.creater"/>
|
<result column="area" property="order.area"/>
|
<result column="batch" property="order.batch"/>
|
|
<result column="building_number" property="orderDetail.buildingNumber"/>
|
<result column="width" property="orderDetail.width"/>
|
<result column="height" property="orderDetail.height"/>
|
<result column="product_name" property="orderDetail.productName"/>
|
<result column="product_id" property="orderDetail.productId"/>
|
<result column="quantity" property="orderDetail.quantity"/>
|
</resultMap>
|
|
<update id="updateflowcard">
|
update pp.flow_card
|
set received_quantity=received_quantity+${inventoryQuantity}
|
where order_number=#{orderNumber} and process_id=#{processId}
|
</update>
|
|
<update id="updateInventory">
|
update mm.finished_goods_inventory
|
set inventory=inventory+${inventoryQuantity},quantity_available=quantity_available+${inventoryQuantity},
|
update_time=now(),area=area+actual_signal_area*${inventoryQuantity}
|
where order_number=#{orderNumber}
|
</update>
|
|
<insert id="insertFinishedGoodsInventory" useGeneratedKeys="true" >
|
insert into mm.finished_goods_inventory (order_id,
|
order_number,
|
inventory,
|
actual_signal_area,
|
area,
|
quantity_available,
|
warehouse_number,
|
storage_region,
|
`status`,
|
enter_storage_time,
|
update_time,
|
end_time,
|
remark
|
)
|
values (
|
#{flowCard.order.orderId} ,#{flowCard.orderNumber},#{flowCard.inventoryQuantity},ROUND(#{flowCard.orderDetail.width}*#{flowCard.orderDetail.height}/1000000,2),
|
ROUND(#{flowCard.orderDetail.width}*#{flowCard.orderDetail.height}*#{flowCard.inventoryQuantity}/1000000,2),
|
#{flowCard.inventoryQuantity},null,#{storageRegion},
|
0,now(),now(),null,#{remark}
|
)
|
</insert>
|
|
<select id="findOrderNumberdcount" >
|
select count(*)
|
from mm.`finished_goods_inventory`
|
where order_number = #{orderNumber}
|
|
</select>
|
|
<select id="findOrderNumberd" >
|
select *
|
from sd.finished_goods_inventory
|
where order_number = #{orderNumber}
|
|
</select>
|
|
<select id="getseletwarehousing" resultMap="selectFlowCard">
|
select
|
fc.id,
|
o.order_id,
|
od.building_number,
|
od.product_id,
|
od.product_name,
|
od.width,
|
od.height,
|
o.creater,
|
o.project,
|
fc.order_number,
|
od.quantity,
|
fc.inventory_quantity,
|
o.area,
|
fc.process_id,
|
fc.received_quantity,
|
o.batch
|
from pp.flow_card fc left join sd.order_detail od on fc.order_number=od.order_number inner join sd.`order` o on
|
o.order_id=fc.order_id
|
<where>
|
and fc.received_quantity <![CDATA[<]]> fc.inventory_quantity
|
<if test="flowCard.order.orderId != null and flowCard.order.orderId != ''">
|
and o.order_id regexp #{flowCard.order.orderId}
|
</if>
|
<if test="flowCard.orderDetail.buildingNumber != null and flowCard.orderDetail.buildingNumber != ''">
|
and od.building_number regexp #{flowCard.orderDetail.buildingNumber}
|
</if>
|
<if test="flowCard.orderDetail.productId != null and flowCard.orderDetail.productId != ''">
|
and od.product_id regexp #{flowCard.orderDetail.productId}
|
</if>
|
<if test="flowCard.orderDetail.productName != null and flowCard.orderDetail.productName != ''">
|
and od.product_name regexp #{flowCard.orderDetail.productName}
|
</if>
|
<if test="flowCard.orderDetail.width != null and flowCard.orderDetail.width != ''">
|
and od.width regexp #{flowCard.orderDetail.width}
|
</if>
|
<if test="flowCard.orderDetail.height != null and flowCard.orderDetail.height != ''">
|
and od.height regexp #{flowCard.orderDetail.height}
|
</if>
|
<if test="flowCard.order.creater != null and flowCard.order.creater != ''">
|
and o.creater regexp #{flowCard.order.creater}
|
</if>
|
<if test="flowCard.order.project != null and flowCard.order.project != ''">
|
and o.project regexp #{flowCard.order.project}
|
</if>
|
<if test="flowCard.orderNumber != null and flowCard.orderNumber != ''">
|
and fc.order_number regexp #{flowCard.orderNumber}
|
</if>
|
<if test="flowCard.orderDetail.quantity != null and flowCard.orderDetail.quantity != ''">
|
and od.quantity regexp #{flowCard.orderDetail.quantity}
|
</if>
|
<if test="flowCard.inventoryQuantity != null and flowCard.inventoryQuantity != ''">
|
and fc.inventory_quantity regexp #{flowCard.inventoryQuantity}
|
</if>
|
<if test="flowCard.order.area != null and flowCard.order.area != ''">
|
and o.area regexp #{flowCard.order.area}
|
</if>
|
<if test="flowCard.order.batch != null and flowCard.order.batch != ''">
|
and o.batch regexp #{flowCard.order.batch}
|
</if>
|
<if test="flowCard.processId != null and flowCard.processId != ''">
|
and fc.process_id regexp #{flowCard.processId}
|
</if>
|
<if test="flowCard.receivedQuantity != null and flowCard.receivedQuantity != ''">
|
and fc.received_quantity regexp #{flowCard.receivedQuantity}
|
</if>
|
|
</where>
|
group by fc.order_number,fc.process_id order by fc.create_time
|
limit #{offset},#{pageSize};
|
</select>
|
<select id="getseletwarehousingPageTotal" >
|
select CEILING(count(zu.order_number)/#{pageSize}) from (
|
select fc.order_number as order_number,fc.process_id from pp.flow_card fc left join sd.order_detail od on
|
fc.order_number=od.order_number inner join sd.`order` o on o.order_id=fc.order_id
|
<where>
|
and fc.received_quantity <![CDATA[<]]> fc.inventory_quantity
|
<if test="flowCard.order.orderId != null and flowCard.order.orderId != ''">
|
and o.order_id regexp #{flowCard.order.orderId}
|
</if>
|
<if test="flowCard.orderDetail.buildingNumber != null and flowCard.orderDetail.buildingNumber != ''">
|
and od.building_number regexp #{flowCard.orderDetail.buildingNumber}
|
</if>
|
<if test="flowCard.orderDetail.productId != null and flowCard.orderDetail.productId != ''">
|
and od.product_id regexp #{flowCard.orderDetail.productId}
|
</if>
|
<if test="flowCard.orderDetail.productName != null and flowCard.orderDetail.productName != ''">
|
and od.product_name regexp #{flowCard.orderDetail.productName}
|
</if>
|
<if test="flowCard.orderDetail.width != null and flowCard.orderDetail.width != ''">
|
and od.width regexp #{flowCard.orderDetail.width}
|
</if>
|
<if test="flowCard.orderDetail.height != null and flowCard.orderDetail.height != ''">
|
and od.height regexp #{flowCard.orderDetail.height}
|
</if>
|
<if test="flowCard.order.creater != null and flowCard.order.creater != ''">
|
and o.creater regexp #{flowCard.order.creater}
|
</if>
|
<if test="flowCard.order.project != null and flowCard.order.project != ''">
|
and o.project regexp #{flowCard.order.project}
|
</if>
|
<if test="flowCard.orderNumber != null and flowCard.orderNumber != ''">
|
and fc.order_number regexp #{flowCard.orderNumber}
|
</if>
|
<if test="flowCard.orderDetail.quantity != null and flowCard.orderDetail.quantity != ''">
|
and od.quantity regexp #{flowCard.orderDetail.quantity}
|
</if>
|
<if test="flowCard.inventoryQuantity != null and flowCard.inventoryQuantity != ''">
|
and fc.inventory_quantity regexp #{flowCard.inventoryQuantity}
|
</if>
|
<if test="flowCard.order.area != null and flowCard.order.area != ''">
|
and o.area regexp #{flowCard.order.area}
|
</if>
|
<if test="flowCard.order.batch != null and flowCard.order.batch != ''">
|
and o.batch regexp #{flowCard.order.batch}
|
</if>
|
<if test="flowCard.processId != null and flowCard.processId != ''">
|
and fc.process_id regexp #{flowCard.processId}
|
</if>
|
<if test="flowCard.receivedQuantity != null and flowCard.receivedQuantity != ''">
|
and fc.received_quantity regexp #{flowCard.receivedQuantity}
|
</if>
|
|
</where>
|
group by fc.order_number,fc.process_id order by fc.create_time) as zu
|
</select>
|
|
|
<select id="defaultfinishedGoods" resultMap="selectFinishedGoodsInventory">
|
select od.order_number,
|
o.order_id,
|
o.project,
|
o.order_type,
|
od.product_name,
|
od.product_id,
|
od.width,
|
od.height,
|
fgi.inventory,
|
fgi.quantity_available,
|
fgi.actual_signal_area,
|
fgi.area,
|
fgi.warehouse_number,
|
fgi.storage_region,
|
fgi.`status`,
|
fgi.update_time,
|
fgi.enter_storage_time,
|
fgi.end_time,
|
fgi.remark
|
from finished_goods_inventory fgi
|
left join sd.order_detail od on fgi.order_number = od.order_number
|
inner join sd.`order` o on fgi.order_id = o.order_id
|
<where>
|
<if test="finishedGoodsInventory.orderDetail.width != null and finishedGoodsInventory.orderDetail.width != ''">
|
and od.width regexp #{finishedGoodsInventory.orderDetail.width}
|
</if>
|
<if test="finishedGoodsInventory.orderDetail.orderNumber != null and finishedGoodsInventory.orderDetail.orderNumber != ''">
|
and od.order_number regexp #{finishedGoodsInventory.orderDetail.orderNumber}
|
</if>
|
<if test="finishedGoodsInventory.orderDetail.productName != null and finishedGoodsInventory.orderDetail.productName != ''">
|
and od.product_name regexp #{finishedGoodsInventory.orderDetail.productName}
|
</if>
|
<if test="finishedGoodsInventory.orderDetail.productId != null and finishedGoodsInventory.orderDetail.productId != ''">
|
and od.product_id regexp #{finishedGoodsInventory.orderDetail.productId}
|
</if>
|
<if test="finishedGoodsInventory.order.orderId != null and finishedGoodsInventory.order.orderId != ''">
|
and o.order_id regexp #{finishedGoodsInventory.order.orderId}
|
</if>
|
<if test="finishedGoodsInventory.order.project != null and finishedGoodsInventory.order.project != ''">
|
and o.project regexp #{finishedGoodsInventory.order.project}
|
</if>
|
<if test="finishedGoodsInventory.order.orderType != null and finishedGoodsInventory.order.orderType != ''">
|
and o.order_type regexp #{finishedGoodsInventory.order.orderType}
|
</if>
|
<if test="finishedGoodsInventory.orderDetail.height != null and finishedGoodsInventory.orderDetail.height != ''">
|
and od.height regexp #{finishedGoodsInventory.orderDetail.height}
|
</if>
|
<if test="finishedGoodsInventory.inventory != null and finishedGoodsInventory.inventory != ''">
|
and fgi.inventory regexp #{finishedGoodsInventory.inventory}
|
</if>
|
<if test="finishedGoodsInventory.quantityAvailable != null and finishedGoodsInventory.quantityAvailable != ''">
|
and fgi.quantity_available regexp #{finishedGoodsInventory.quantityAvailable}
|
</if>
|
<if test="finishedGoodsInventory.actualSignalArea != null and finishedGoodsInventory.actualSignalArea != ''">
|
and fgi.actual_signal_area regexp #{finishedGoodsInventory.actualSignalArea}
|
</if>
|
<if test="finishedGoodsInventory.area != null and finishedGoodsInventory.area != ''">
|
and fgi.area regexp #{finishedGoodsInventory.area}
|
</if>
|
<if test="finishedGoodsInventory.warehouseNumber != null and finishedGoodsInventory.warehouseNumber != ''">
|
and fgi.warehouse_number regexp #{finishedGoodsInventory.warehouseNumber}
|
</if>
|
<if test="finishedGoodsInventory.storageRegion != null and finishedGoodsInventory.storageRegion != ''">
|
and fgi.storage_region regexp #{finishedGoodsInventory.storageRegion}
|
</if>
|
<if test="finishedGoodsInventory.status != null and finishedGoodsInventory.status != ''">
|
and fgi.`status` regexp #{finishedGoodsInventory.status}
|
</if>
|
<if test="finishedGoodsInventory.enterStorageTime != null and finishedGoodsInventory.enterStorageTime != ''">
|
and fgi.enter_storage_time regexp #{finishedGoodsInventory.enterStorageTime}
|
</if>
|
<if test="finishedGoodsInventory.updateTime != null and finishedGoodsInventory.updateTime != ''">
|
and fgi.update_time regexp #{finishedGoodsInventory.updateTime}
|
</if>
|
<if test="finishedGoodsInventory.endTime != null and finishedGoodsInventory.endTime != ''">
|
and fgi.end_time regexp #{finishedGoodsInventory.endTime}
|
</if>
|
<if test="finishedGoodsInventory.remark != null and finishedGoodsInventory.remark != ''">
|
and fgi.remark regexp #{finishedGoodsInventory.remark}
|
</if>
|
|
</where>
|
order by fgi.id
|
|
limit #{offset},#{pageSize}
|
;
|
</select>
|
|
|
<select id="getPageTotal">
|
select
|
CEILING(count(fgi.id)/#{pageSize})
|
from finished_goods_inventory fgi
|
left join sd.order_detail od on fgi.order_number = od.order_number
|
inner join sd.`order` o on fgi.order_id = o.order_id
|
<where>
|
<if test="finishedGoodsInventory.orderDetail.width != null and finishedGoodsInventory.orderDetail.width != ''">
|
and od.width regexp #{finishedGoodsInventory.orderDetail.width}
|
</if>
|
<if test="finishedGoodsInventory.orderDetail.orderNumber != null and finishedGoodsInventory.orderDetail.orderNumber != ''">
|
and od.order_number regexp #{finishedGoodsInventory.orderDetail.orderNumber}
|
</if>
|
<if test="finishedGoodsInventory.orderDetail.productName != null and finishedGoodsInventory.orderDetail.productName != ''">
|
and od.product_name regexp #{finishedGoodsInventory.orderDetail.productName}
|
</if>
|
<if test="finishedGoodsInventory.orderDetail.productId != null and finishedGoodsInventory.orderDetail.productId != ''">
|
and od.product_id regexp #{finishedGoodsInventory.orderDetail.productId}
|
</if>
|
<if test="finishedGoodsInventory.order.orderId != null and finishedGoodsInventory.order.orderId != ''">
|
and o.order_id regexp #{finishedGoodsInventory.order.orderId}
|
</if>
|
<if test="finishedGoodsInventory.order.project != null and finishedGoodsInventory.order.project != ''">
|
and o.project regexp #{finishedGoodsInventory.order.project}
|
</if>
|
<if test="finishedGoodsInventory.order.orderType != null and finishedGoodsInventory.order.orderType != ''">
|
and o.order_type regexp #{finishedGoodsInventory.order.orderType}
|
</if>
|
<if test="finishedGoodsInventory.orderDetail.height != null and finishedGoodsInventory.orderDetail.height != ''">
|
and od.height regexp #{finishedGoodsInventory.orderDetail.height}
|
</if>
|
<if test="finishedGoodsInventory.inventory != null and finishedGoodsInventory.inventory != ''">
|
and fgi.inventory regexp #{finishedGoodsInventory.inventory}
|
</if>
|
<if test="finishedGoodsInventory.quantityAvailable != null and finishedGoodsInventory.quantityAvailable != ''">
|
and fgi.quantity_available regexp #{finishedGoodsInventory.quantityAvailable}
|
</if>
|
<if test="finishedGoodsInventory.actualSignalArea != null and finishedGoodsInventory.actualSignalArea != ''">
|
and fgi.actual_signal_area regexp #{finishedGoodsInventory.actualSignalArea}
|
</if>
|
<if test="finishedGoodsInventory.area != null and finishedGoodsInventory.area != ''">
|
and fgi.area regexp #{finishedGoodsInventory.area}
|
</if>
|
<if test="finishedGoodsInventory.warehouseNumber != null and finishedGoodsInventory.warehouseNumber != ''">
|
and fgi.warehouse_number regexp #{finishedGoodsInventory.warehouseNumber}
|
</if>
|
<if test="finishedGoodsInventory.storageRegion != null and finishedGoodsInventory.storageRegion != ''">
|
and fgi.storage_region regexp #{finishedGoodsInventory.storageRegion}
|
</if>
|
<if test="finishedGoodsInventory.status != null and finishedGoodsInventory.status != ''">
|
and fgi.`status` regexp #{finishedGoodsInventory.status}
|
</if>
|
<if test="finishedGoodsInventory.enterStorageTime != null and finishedGoodsInventory.enterStorageTime != ''">
|
and fgi.enter_storage_time regexp #{finishedGoodsInventory.enterStorageTime}
|
</if>
|
<if test="finishedGoodsInventory.updateTime != null and finishedGoodsInventory.updateTime != ''">
|
and fgi.update_time regexp #{finishedGoodsInventory.updateTime}
|
</if>
|
<if test="finishedGoodsInventory.endTime != null and finishedGoodsInventory.endTime != ''">
|
and fgi.end_time regexp #{finishedGoodsInventory.endTime}
|
</if>
|
<if test="finishedGoodsInventory.remark != null and finishedGoodsInventory.remark != ''">
|
and fgi.remark regexp #{finishedGoodsInventory.remark}
|
</if>
|
|
</where>
|
|
order by fgi.id desc
|
limit #{offset},#{pageSize}
|
;
|
</select>
|
|
</mapper>
|