Commit e135875d by yubin

导入无库存插入-库存 加导入手动标识 导入日志

parent 583b1606
......@@ -109,5 +109,6 @@ public class OutboundOrders extends BaseEntity
/** 出库单明细信息 */
private List<OutboundOrderItems> outboundOrderItemsList;
@Excel(name = "导入标识")
private Long isImport; // 对应数据库字段is_import,驼峰命名转换
}
\ No newline at end of file
package com.ruoyi.inventory.utils;
import com.ruoyi.inventory.domain.Inventory;
import java.util.AbstractMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 库存映射全局缓存(解决导入新增库存即时可见问题)
*/
public class InventoryCache {
// 并发安全Map,Key=物料ID_库位ID_库存类型,Value=库存对象
private static final Map<String, Inventory> INVENTORY_MAP = new ConcurrentHashMap<>();
// 添加库存(直接存对象,避免参数不匹配)
public static void addInventory(String key, Inventory inventory) {
INVENTORY_MAP.put(key, inventory);
}
// 获取库存
public static Inventory getInventory(String key) {
return INVENTORY_MAP.get(key);
}
// 清空缓存
public static void clear() {
INVENTORY_MAP.clear();
}
// 获取全部缓存(核心:供loadInventoryGroupMap直接读取)
public static Map<String, Inventory> getAll() {
return INVENTORY_MAP;
}
}
\ No newline at end of file
......@@ -435,7 +435,7 @@
and inventory_status = '1'
]]>
</select>
<insert id="insertInventory" parameterType="Inventory">
<insert id="insertInventory" parameterType="Inventory" flushCache="true">
insert into inventory
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
......@@ -563,6 +563,7 @@ and inventory_status = '1'
left join inventory i on i.material_id = m.id
and i.is_used = 1
and i.unit_price > 0
and i.inventory_status=1
and i.last_inbound_time >= DATE_FORMAT(CURDATE(), '%Y-%m-01')
and i.last_inbound_time &lt; DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 MONTH), '%Y-%m-01')
where
......@@ -580,6 +581,7 @@ and inventory_status = '1'
from materials m
left join inventory i on i.material_id = m.id
and i.is_used = 1
and i.inventory_status=1
and i.last_inbound_time >= DATE_FORMAT(CURDATE(), '%Y-%m-01')
and i.last_inbound_time &lt; DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 MONTH), '%Y-%m-01')
where
......
......@@ -16,7 +16,6 @@
<result property="ownerId" column="owner_id" />
<result property="ownerName" column="owner_name" />
<result property="orderStatus" column="order_status" />
<!-- 保留原字段映射,新增startDate/endDate用于查询 -->
<result property="inboundDate" column="inbound_date" />
<result property="destination" column="destination" />
<result property="totalPlannedQuantity" column="total_planned_quantity" />
......@@ -29,6 +28,8 @@
<result property="createUserCode" column="create_user_code" />
<result property="updateTime" column="update_time" />
<result property="updateUserCode" column="update_user_code" />
<!-- 新增 isImport 字段映射 -->
<result property="isImport" column="is_import" />
</resultMap>
<resultMap id="OutboundOrdersOutboundOrderItemsResult" type="com.ruoyi.inventory.domain.OutboundOrders" extends="OutboundOrdersResult">
......@@ -94,7 +95,8 @@
oo.create_time,
oo.create_user_code,
oo.update_time,
oo.update_user_code
oo.update_user_code,
oo.is_import
from outbound_orders oo
left join owners o on oo.owner_id = o.id and o.is_used = 1
left join warehouses w on oo.warehouse_id = w.id and w.is_used = 1 and w.is_enabled = 1
......@@ -111,7 +113,8 @@
<if test="warehouseId != null and warehouseId != ''"> and oo.warehouse_id = #{warehouseId}</if>
<if test="ownerId != null and ownerId != ''"> and oo.owner_id = #{ownerId}</if>
<if test="orderStatus != null "> and oo.order_status = #{orderStatus}</if>
<!-- 替换为时间段查询:startDate和endDate -->
<!-- 新增 isImport 查询条件 -->
<if test="isImport != null "> and oo.is_import = #{isImport}</if>
<if test="startDate != null"> and oo.inbound_date &gt;= #{startDate}</if>
<if test="endDate != null"> and oo.inbound_date &lt;= #{endDate}</if>
<if test="destination != null and destination != ''"> and oo.destination = #{destination}</if>
......@@ -147,7 +150,8 @@
oo.create_time,
oo.create_user_code,
oo.update_time,
oo.update_user_code
oo.update_user_code,
oo.is_import
from outbound_orders oo
left join owners o on oo.owner_id = o.id
left join warehouses w on oo.warehouse_id = w.id
......@@ -202,7 +206,6 @@
<if test="warehouseId != null">warehouse_id,</if>
<if test="ownerId != null">owner_id,</if>
<if test="orderStatus != null">order_status,</if>
<!-- 保留inboundDate字段的插入(业务字段仍需存储) -->
<if test="inboundDate != null">inbound_date,</if>
<if test="destination != null">destination,</if>
<if test="totalPlannedQuantity != null">total_planned_quantity,</if>
......@@ -215,6 +218,8 @@
<if test="createUserCode != null">create_user_code,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateUserCode != null">update_user_code,</if>
<!-- 新增 is_import 字段插入 -->
<if test="isImport != null">is_import,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
......@@ -238,6 +243,8 @@
<if test="createUserCode != null">#{createUserCode},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateUserCode != null">#{updateUserCode},</if>
<!-- 新增 is_import 字段值 -->
<if test="isImport != null">#{isImport},</if>
</trim>
</insert>
......@@ -264,6 +271,8 @@
<if test="createUserCode != null">create_user_code = #{createUserCode},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateUserCode != null">update_user_code = #{updateUserCode},</if>
<!-- 新增 is_import 字段更新 -->
<if test="isImport != null">is_import = #{isImport},</if>
</trim>
where id = #{id}
</update>
......@@ -316,6 +325,7 @@
left join outbound_order_items ooi
on ooi.material_id = m.id
and ooi.is_used = 1
and ooi.item_status=3
and ooi.shipped_at >= DATE_FORMAT(CURDATE(), '%Y-%m-01 00:00:00')
and ooi.shipped_at &lt; DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 MONTH), '%Y-%m-01 00:00:00')
where
......@@ -334,6 +344,7 @@
left join outbound_order_items ooi
on ooi.material_id = m.id
and ooi.is_used = 1
and ooi.item_status=3
and ooi.shipped_at >= DATE_FORMAT(CURDATE(), '%Y-%m-01 00:00:00')
and ooi.shipped_at &lt; DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 MONTH), '%Y-%m-01 00:00:00')
where
......@@ -346,8 +357,8 @@
<select id="outboundOrdersCount" resultType="String">
select count(*) from outbound_orders where is_used = 1 and order_status=2
and inbound_date &gt;= DATE_FORMAT(CURDATE(), '%Y-%m-01')
and inbound_date &lt; DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 MONTH), '%Y-%m-01')
and inbound_date &gt;= DATE_FORMAT(CURDATE(), '%Y-%m-01')
and inbound_date &lt; DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 MONTH), '%Y-%m-01')
</select>
<update id="batchUpdateInventory">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论