|
@@ -89,13 +89,13 @@
|
|
</where>
|
|
</where>
|
|
</sql>
|
|
</sql>
|
|
<sql id="Base_Column_List" >
|
|
<sql id="Base_Column_List" >
|
|
- id, customer_id, customer_code, warehouse_id, warehouse_code, status_code, status_name,
|
|
|
|
- in_order_id, in_order_no1, supplier_code, sku, barcode, batch_no, production_date,
|
|
|
|
- shelf_life_days, expiry_date, expiry_code, quality_code, quality_name, product_name,
|
|
|
|
- model, qty_total, qty_sale, qty_avail_sale, qty_avail, qty_lock1, qty_lock2, qty_lock3,
|
|
|
|
- qty_lock4, is_lock, data_version, zone_type_code, zone_code, location_code, remark_by_user_code,
|
|
|
|
- remark, created_time, created_by_user_id, created_by_user_code, update_time, update_by_user_id,
|
|
|
|
- update_by_user_code, freeze_time, freeze_by_user_code, unfreeze_time, unfreeze_by_user_code,
|
|
|
|
|
|
+ id, customer_id, customer_code, warehouse_id, warehouse_code, status_code, status_name,
|
|
|
|
+ in_order_id, in_order_no1, supplier_code, sku, barcode, batch_no, production_date,
|
|
|
|
+ shelf_life_days, expiry_date, expiry_code, quality_code, quality_name, product_name,
|
|
|
|
+ model, qty_total, qty_sale, qty_avail_sale, qty_avail, qty_lock1, qty_lock2, qty_lock3,
|
|
|
|
+ qty_lock4, is_lock, data_version, zone_type_code, zone_code, location_code, remark_by_user_code,
|
|
|
|
+ remark, created_time, created_by_user_id, created_by_user_code, update_time, update_by_user_id,
|
|
|
|
+ update_by_user_code, freeze_time, freeze_by_user_code, unfreeze_time, unfreeze_by_user_code,
|
|
extend1, extend2, main_pic, packet_no, box_no, volume_m, volume, length, width, height
|
|
extend1, extend2, main_pic, packet_no, box_no, volume_m, volume, length, width, height
|
|
</sql>
|
|
</sql>
|
|
<sql id="Base_Column_List_Sum_Qty">
|
|
<sql id="Base_Column_List_Sum_Qty">
|
|
@@ -104,7 +104,7 @@
|
|
status_code, status_name,
|
|
status_code, status_name,
|
|
in_order_id, in_order_no1,
|
|
in_order_id, in_order_no1,
|
|
supplier_code, sku, barcode, batch_no, production_date,
|
|
supplier_code, sku, barcode, batch_no, production_date,
|
|
- shelf_life_days, expiry_date, expiry_code, quality_code,
|
|
|
|
|
|
+ shelf_life_days, expiry_date, expiry_code, quality_code,
|
|
quality_name,product_name, model,
|
|
quality_name,product_name, model,
|
|
sum(qty_total) as qty_total,
|
|
sum(qty_total) as qty_total,
|
|
sum(qty_sale) as qty_sale,
|
|
sum(qty_sale) as qty_sale,
|
|
@@ -124,7 +124,7 @@
|
|
unfreeze_time,freeze_time, unfreeze_by_user_code, freeze_by_user_code, extend1, extend2,
|
|
unfreeze_time,freeze_time, unfreeze_by_user_code, freeze_by_user_code, extend1, extend2,
|
|
main_pic, packet_no, box_no, volume_m, volume, length, width, height
|
|
main_pic, packet_no, box_no, volume_m, volume, length, width, height
|
|
</sql>
|
|
</sql>
|
|
-
|
|
|
|
|
|
+
|
|
<select id="selectByConditionList" resultMap="BaseResultMap" parameterType="com.lote.wms.inventory.inventory.entity.InventoryCriteria" >
|
|
<select id="selectByConditionList" resultMap="BaseResultMap" parameterType="com.lote.wms.inventory.inventory.entity.InventoryCriteria" >
|
|
select
|
|
select
|
|
<if test="distinct" >
|
|
<if test="distinct" >
|
|
@@ -143,7 +143,7 @@
|
|
</if>
|
|
</if>
|
|
</select>
|
|
</select>
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
|
|
- select
|
|
|
|
|
|
+ select
|
|
<include refid="Base_Column_List" />
|
|
<include refid="Base_Column_List" />
|
|
from i_inventory
|
|
from i_inventory
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
@@ -682,8 +682,8 @@
|
|
<!-- 根据库区号查询库位 -->
|
|
<!-- 根据库区号查询库位 -->
|
|
<select id="selectLocationByZoneCode" resultType="string">
|
|
<select id="selectLocationByZoneCode" resultType="string">
|
|
SELECT
|
|
SELECT
|
|
- location_code FROM i_inventory
|
|
|
|
- WHERE
|
|
|
|
|
|
+ location_code FROM i_inventory
|
|
|
|
+ WHERE
|
|
warehouse_code = #{warehouseCode} and
|
|
warehouse_code = #{warehouseCode} and
|
|
zone_code=#{zoneCode}
|
|
zone_code=#{zoneCode}
|
|
</select>
|
|
</select>
|
|
@@ -691,10 +691,10 @@
|
|
<!-- 根据库区号查询数量大于0的库位 -->
|
|
<!-- 根据库区号查询数量大于0的库位 -->
|
|
<select id="selectNotEmptyLocationByZoneCode" resultType="string">
|
|
<select id="selectNotEmptyLocationByZoneCode" resultType="string">
|
|
SELECT
|
|
SELECT
|
|
- location_code FROM i_inventory
|
|
|
|
|
|
+ location_code FROM i_inventory
|
|
WHERE qty_total> 0 and
|
|
WHERE qty_total> 0 and
|
|
warehouse_code = #{warehouseCode} and
|
|
warehouse_code = #{warehouseCode} and
|
|
- zone_code=#{zoneCode}
|
|
|
|
|
|
+ zone_code=#{zoneCode}
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<!-- 更新库存数量,调用者需要自己计算好更改为多少数量 -->
|
|
<!-- 更新库存数量,调用者需要自己计算好更改为多少数量 -->
|
|
@@ -755,25 +755,25 @@
|
|
<if test="updateByUserCode != null">
|
|
<if test="updateByUserCode != null">
|
|
update_by_user_code = #{updateByUserCode,jdbcType=VARCHAR},
|
|
update_by_user_code = #{updateByUserCode,jdbcType=VARCHAR},
|
|
</if>
|
|
</if>
|
|
-
|
|
|
|
|
|
+
|
|
<if test="freezeByUserCode != null">
|
|
<if test="freezeByUserCode != null">
|
|
freeze_by_user_code = #{freezeByUserCode ,jdbcType=VARCHAR},
|
|
freeze_by_user_code = #{freezeByUserCode ,jdbcType=VARCHAR},
|
|
</if>
|
|
</if>
|
|
<if test="freezeTime != null">
|
|
<if test="freezeTime != null">
|
|
freeze_time = #{freezeTime,jdbcType=TIMESTAMP},
|
|
freeze_time = #{freezeTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
</if>
|
|
-
|
|
|
|
|
|
+
|
|
<if test="unfreezeByUserCode != null">
|
|
<if test="unfreezeByUserCode != null">
|
|
unfreeze_by_user_code = #{unfreezeByUserCode ,jdbcType=VARCHAR},
|
|
unfreeze_by_user_code = #{unfreezeByUserCode ,jdbcType=VARCHAR},
|
|
</if>
|
|
</if>
|
|
<if test="unfreezeTime != null">
|
|
<if test="unfreezeTime != null">
|
|
unfreeze_time = #{unfreezeTime,jdbcType=TIMESTAMP},
|
|
unfreeze_time = #{unfreezeTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
</if>
|
|
-
|
|
|
|
|
|
+
|
|
</set>
|
|
</set>
|
|
where id = #{id,jdbcType=VARCHAR} and data_version = #{dataVersion,jdbcType=INTEGER}
|
|
where id = #{id,jdbcType=VARCHAR} and data_version = #{dataVersion,jdbcType=INTEGER}
|
|
</update>
|
|
</update>
|
|
-
|
|
|
|
|
|
+
|
|
<!-- 更新备注 -->
|
|
<!-- 更新备注 -->
|
|
<update id="updateRemark" parameterType="com.lote.wms.inventory.inventory.entity.expand.InventoryVo">
|
|
<update id="updateRemark" parameterType="com.lote.wms.inventory.inventory.entity.expand.InventoryVo">
|
|
update i_inventory
|
|
update i_inventory
|
|
@@ -795,7 +795,7 @@
|
|
</if>
|
|
</if>
|
|
</set>
|
|
</set>
|
|
where id = #{id,jdbcType=VARCHAR} and data_version = #{dataVersion,jdbcType=INTEGER}
|
|
where id = #{id,jdbcType=VARCHAR} and data_version = #{dataVersion,jdbcType=INTEGER}
|
|
- </update>
|
|
|
|
|
|
+ </update>
|
|
|
|
|
|
<!-- 更新锁定 盘点功能专用-->
|
|
<!-- 更新锁定 盘点功能专用-->
|
|
<update id="updateIsLock" parameterType="com.lote.wms.inventory.inventory.entity.expand.InventoryVo">
|
|
<update id="updateIsLock" parameterType="com.lote.wms.inventory.inventory.entity.expand.InventoryVo">
|
|
@@ -805,7 +805,7 @@
|
|
</set>
|
|
</set>
|
|
where id = #{id,jdbcType=VARCHAR} and data_version = #{dataVersion,jdbcType=INTEGER}
|
|
where id = #{id,jdbcType=VARCHAR} and data_version = #{dataVersion,jdbcType=INTEGER}
|
|
</update>
|
|
</update>
|
|
-
|
|
|
|
|
|
+
|
|
<!-- 出库订单分配库存查询 -->
|
|
<!-- 出库订单分配库存查询 -->
|
|
<select id="selectForAllocate" resultMap="BaseResultMap">
|
|
<select id="selectForAllocate" resultMap="BaseResultMap">
|
|
SELECT
|
|
SELECT
|
|
@@ -818,13 +818,13 @@
|
|
and is_lock = 0
|
|
and is_lock = 0
|
|
</where>
|
|
</where>
|
|
<choose>
|
|
<choose>
|
|
- <when test="orderByClause != null and orderByClause !='' ">
|
|
|
|
|
|
+ <when test="orderByClause != null and orderByClause !='' ">
|
|
ORDER BY ${orderByClause}
|
|
ORDER BY ${orderByClause}
|
|
</when>
|
|
</when>
|
|
- <otherwise>
|
|
|
|
|
|
+ <otherwise>
|
|
ORDER BY qty_avail asc
|
|
ORDER BY qty_avail asc
|
|
</otherwise>
|
|
</otherwise>
|
|
- </choose>
|
|
|
|
|
|
+ </choose>
|
|
</select>
|
|
</select>
|
|
<!-- vo 查询条件语句 -->
|
|
<!-- vo 查询条件语句 -->
|
|
<sql id="selectForVo">
|
|
<sql id="selectForVo">
|
|
@@ -851,7 +851,7 @@
|
|
open="(" close=")">
|
|
open="(" close=")">
|
|
#{temp}
|
|
#{temp}
|
|
</foreach>
|
|
</foreach>
|
|
- </if>
|
|
|
|
|
|
+ </if>
|
|
<if test="customerId !=null and customerId!='' ">
|
|
<if test="customerId !=null and customerId!='' ">
|
|
and customer_id =#{customerId}
|
|
and customer_id =#{customerId}
|
|
</if>
|
|
</if>
|
|
@@ -863,7 +863,7 @@
|
|
</if>
|
|
</if>
|
|
<if test="inOrderNo1 !=null and inOrderNo1!='' ">
|
|
<if test="inOrderNo1 !=null and inOrderNo1!='' ">
|
|
and in_order_no1 =#{inOrderNo1}
|
|
and in_order_no1 =#{inOrderNo1}
|
|
- </if>
|
|
|
|
|
|
+ </if>
|
|
<if test="batchNo != null and batchNo !='' ">
|
|
<if test="batchNo != null and batchNo !='' ">
|
|
and batch_no =#{batchNo}
|
|
and batch_no =#{batchNo}
|
|
</if>
|
|
</if>
|
|
@@ -884,7 +884,7 @@
|
|
</if>
|
|
</if>
|
|
<if test="productName !=null and productName !='' ">
|
|
<if test="productName !=null and productName !='' ">
|
|
and product_name like "%"#{productName}"%"
|
|
and product_name like "%"#{productName}"%"
|
|
- </if>
|
|
|
|
|
|
+ </if>
|
|
<if test="qualityCode !=null and qualityCode !='' ">
|
|
<if test="qualityCode !=null and qualityCode !='' ">
|
|
and quality_code=#{qualityCode}
|
|
and quality_code=#{qualityCode}
|
|
</if>
|
|
</if>
|
|
@@ -892,7 +892,7 @@
|
|
and status_code=#{statusCode}
|
|
and status_code=#{statusCode}
|
|
</if>
|
|
</if>
|
|
<if test="idList !=null and idList.size>0">
|
|
<if test="idList !=null and idList.size>0">
|
|
- and id in
|
|
|
|
|
|
+ and id in
|
|
<foreach collection="idList" item="id" open="(" close=")" separator=",">
|
|
<foreach collection="idList" item="id" open="(" close=")" separator=",">
|
|
#{id}
|
|
#{id}
|
|
</foreach>
|
|
</foreach>
|
|
@@ -971,7 +971,7 @@
|
|
and update_time <= #{updateTimeEnd,jdbcType=VARCHAR}
|
|
and update_time <= #{updateTimeEnd,jdbcType=VARCHAR}
|
|
</if>
|
|
</if>
|
|
</sql>
|
|
</sql>
|
|
-
|
|
|
|
|
|
+
|
|
<!-- 库存列表查询 -->
|
|
<!-- 库存列表查询 -->
|
|
<select id="selectByVoList" flushCache="true" resultMap="BaseResultMap">
|
|
<select id="selectByVoList" flushCache="true" resultMap="BaseResultMap">
|
|
select
|
|
select
|
|
@@ -982,13 +982,14 @@
|
|
</where>
|
|
</where>
|
|
order by created_time desc
|
|
order by created_time desc
|
|
</select>
|
|
</select>
|
|
-
|
|
|
|
|
|
+
|
|
<!-- SKU库存查询 -->
|
|
<!-- SKU库存查询 -->
|
|
<select id="selectByVoGpBySkuList" resultMap="BaseResultMap">
|
|
<select id="selectByVoGpBySkuList" resultMap="BaseResultMap">
|
|
- select
|
|
|
|
|
|
+ select
|
|
a.id,
|
|
a.id,
|
|
a.warehouse_code,
|
|
a.warehouse_code,
|
|
a.customer_code,
|
|
a.customer_code,
|
|
|
|
+ a.barcode,
|
|
a.sku,
|
|
a.sku,
|
|
a.batch_no,
|
|
a.batch_no,
|
|
a.product_name,
|
|
a.product_name,
|
|
@@ -1001,13 +1002,16 @@
|
|
a.qty_lock2,
|
|
a.qty_lock2,
|
|
a.qty_lock3,
|
|
a.qty_lock3,
|
|
a.qty_lock4 ,
|
|
a.qty_lock4 ,
|
|
- a.main_pic
|
|
|
|
- from
|
|
|
|
|
|
+ a.main_pic,
|
|
|
|
+ a.location_code
|
|
|
|
+ from
|
|
(
|
|
(
|
|
- select
|
|
|
|
|
|
+ select
|
|
id,
|
|
id,
|
|
warehouse_code,
|
|
warehouse_code,
|
|
customer_code,
|
|
customer_code,
|
|
|
|
+ group_concat(barcode) as barcode,
|
|
|
|
+
|
|
sku,
|
|
sku,
|
|
batch_no,
|
|
batch_no,
|
|
product_name,
|
|
product_name,
|
|
@@ -1020,21 +1024,22 @@
|
|
sum(qty_lock2) as qty_lock2,
|
|
sum(qty_lock2) as qty_lock2,
|
|
sum(qty_lock3) as qty_lock3,
|
|
sum(qty_lock3) as qty_lock3,
|
|
sum(qty_lock4) as qty_lock4,
|
|
sum(qty_lock4) as qty_lock4,
|
|
- main_pic
|
|
|
|
- from i_inventory
|
|
|
|
|
|
+ main_pic,
|
|
|
|
+ group_concat(location_code) as location_code
|
|
|
|
+ from i_inventory
|
|
GROUP BY warehouse_code,customer_code,sku
|
|
GROUP BY warehouse_code,customer_code,sku
|
|
) a LEFT JOIN
|
|
) a LEFT JOIN
|
|
(
|
|
(
|
|
- select
|
|
|
|
|
|
+ select
|
|
a.warehouse_code,
|
|
a.warehouse_code,
|
|
a.customer_code,
|
|
a.customer_code,
|
|
b.sku,
|
|
b.sku,
|
|
sum(b.quantity) as qty_sale
|
|
sum(b.quantity) as qty_sale
|
|
- from out_order a
|
|
|
|
|
|
+ from out_order a
|
|
LEFT JOIN out_order_item b on a.id = b.out_order_id
|
|
LEFT JOIN out_order_item b on a.id = b.out_order_id
|
|
- where a.status_code = '10' and a.id is not null and a.is_cancel = 'N'
|
|
|
|
|
|
+ where a.status_code = '10' and a.id is not null and a.is_cancel = 'N'
|
|
GROUP BY a.warehouse_code,a.customer_code,b.sku
|
|
GROUP BY a.warehouse_code,a.customer_code,b.sku
|
|
- ) b
|
|
|
|
|
|
+ ) b
|
|
on a.warehouse_code = b.warehouse_code and a.customer_code = b.customer_code and a.sku = b.sku
|
|
on a.warehouse_code = b.warehouse_code and a.customer_code = b.customer_code and a.sku = b.sku
|
|
<where>
|
|
<where>
|
|
1=1
|
|
1=1
|
|
@@ -1047,7 +1052,7 @@
|
|
open="(" close=")">
|
|
open="(" close=")">
|
|
#{temp}
|
|
#{temp}
|
|
</foreach>
|
|
</foreach>
|
|
- </if>
|
|
|
|
|
|
+ </if>
|
|
<if test="customerCode !=null and customerCode!='' ">
|
|
<if test="customerCode !=null and customerCode!='' ">
|
|
and a.customer_code =#{customerCode}
|
|
and a.customer_code =#{customerCode}
|
|
</if>
|
|
</if>
|
|
@@ -1059,7 +1064,7 @@
|
|
</if>
|
|
</if>
|
|
<if test="locationCode !=null and locationCode!='' ">
|
|
<if test="locationCode !=null and locationCode!='' ">
|
|
and a.location_code =#{locationCode}
|
|
and a.location_code =#{locationCode}
|
|
- </if>
|
|
|
|
|
|
+ </if>
|
|
<if test="sku !=null and sku !='' ">
|
|
<if test="sku !=null and sku !='' ">
|
|
and a.sku=#{sku}
|
|
and a.sku=#{sku}
|
|
</if>
|
|
</if>
|
|
@@ -1071,18 +1076,18 @@
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</where>
|
|
</select>
|
|
</select>
|
|
-
|
|
|
|
|
|
+
|
|
<!-- 查询SKU的批次明细 -->
|
|
<!-- 查询SKU的批次明细 -->
|
|
<select id="selectBatchsBySku" resultMap="BaseResultMap">
|
|
<select id="selectBatchsBySku" resultMap="BaseResultMap">
|
|
select
|
|
select
|
|
<include refid="Base_Column_List_Sum_Qty" />
|
|
<include refid="Base_Column_List_Sum_Qty" />
|
|
- from i_inventory
|
|
|
|
|
|
+ from i_inventory
|
|
<where>
|
|
<where>
|
|
<include refid="selectForVo" />
|
|
<include refid="selectForVo" />
|
|
</where>
|
|
</where>
|
|
GROUP BY sku,batch_no,expiry_date
|
|
GROUP BY sku,batch_no,expiry_date
|
|
- </select>
|
|
|
|
-
|
|
|
|
|
|
+ </select>
|
|
|
|
+
|
|
<!-- 按条码分组库存查询 -->
|
|
<!-- 按条码分组库存查询 -->
|
|
<select id="selectByVoGpByBarcodeList" resultMap="BaseResultMap">
|
|
<select id="selectByVoGpByBarcodeList" resultMap="BaseResultMap">
|
|
select
|
|
select
|
|
@@ -1091,10 +1096,10 @@
|
|
<where>
|
|
<where>
|
|
<include refid="selectForVo" />
|
|
<include refid="selectForVo" />
|
|
</where>
|
|
</where>
|
|
- GROUP BY warehouse_code,customer_code,sku,barcode
|
|
|
|
|
|
+ GROUP BY warehouse_code,customer_code,sku,barcode
|
|
order by created_time desc
|
|
order by created_time desc
|
|
- </select>
|
|
|
|
-
|
|
|
|
|
|
+ </select>
|
|
|
|
+
|
|
<!-- 按条码+批次分组库存查询 -->
|
|
<!-- 按条码+批次分组库存查询 -->
|
|
<select id="selectByVoGpByBarcodeBatchNoList" resultMap="BaseResultMap">
|
|
<select id="selectByVoGpByBarcodeBatchNoList" resultMap="BaseResultMap">
|
|
select
|
|
select
|
|
@@ -1103,10 +1108,10 @@
|
|
<where>
|
|
<where>
|
|
<include refid="selectForVo" />
|
|
<include refid="selectForVo" />
|
|
</where>
|
|
</where>
|
|
- GROUP BY warehouse_code,customer_code,sku,barcode,batch_no
|
|
|
|
|
|
+ GROUP BY warehouse_code,customer_code,sku,barcode,batch_no
|
|
order by created_time desc
|
|
order by created_time desc
|
|
- </select>
|
|
|
|
-
|
|
|
|
|
|
+ </select>
|
|
|
|
+
|
|
<!-- 按供应商分组库存查询 -->
|
|
<!-- 按供应商分组库存查询 -->
|
|
<select id="selectByVoGpBySupplierList" resultMap="BaseResultMap">
|
|
<select id="selectByVoGpBySupplierList" resultMap="BaseResultMap">
|
|
select
|
|
select
|
|
@@ -1117,8 +1122,8 @@
|
|
</where>
|
|
</where>
|
|
group by warehouse_code,customer_code,supplier_code
|
|
group by warehouse_code,customer_code,supplier_code
|
|
order by created_time desc
|
|
order by created_time desc
|
|
- </select>
|
|
|
|
-
|
|
|
|
|
|
+ </select>
|
|
|
|
+
|
|
<!-- 统计查询 -->
|
|
<!-- 统计查询 -->
|
|
<select id="countDistinctByVo" resultType="int">
|
|
<select id="countDistinctByVo" resultType="int">
|
|
select
|
|
select
|
|
@@ -1132,12 +1137,12 @@
|
|
<!-- 按货主,SKU统计触及安全库存的SKU数 -->
|
|
<!-- 按货主,SKU统计触及安全库存的SKU数 -->
|
|
<select id="countUnSafety" resultType="int">
|
|
<select id="countUnSafety" resultType="int">
|
|
select count(1)
|
|
select count(1)
|
|
- from i_inventory_safety_stock a
|
|
|
|
|
|
+ from i_inventory_safety_stock a
|
|
LEFT JOIN (
|
|
LEFT JOIN (
|
|
select customer_code ,sku,sum(qty_total) as qty from i_inventory
|
|
select customer_code ,sku,sum(qty_total) as qty from i_inventory
|
|
GROUP BY customer_code,sku
|
|
GROUP BY customer_code,sku
|
|
) b on a.customer_code = b.customer_code and a.sku = b.sku
|
|
) b on a.customer_code = b.customer_code and a.sku = b.sku
|
|
where a.safety_qty > b.qty;
|
|
where a.safety_qty > b.qty;
|
|
- </select>
|
|
|
|
-
|
|
|
|
-</mapper>
|
|
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+</mapper>
|