Browse Source
2025-12-05
2025-12-05
增加"标签变动记录"功能(WMS - 仓库报表管理 - 标签变动记录)
1、明细表展示所有数据(默认是今天的)
2、其他页签根据document_type区分
master
8 changed files with 241 additions and 1 deletions
-
1src/main/java/com/gaotao/modules/pms/data/QcFAIRecordData.java
-
62src/main/java/com/gaotao/modules/warehouse/controller/LabelTransactionLogController.java
-
25src/main/java/com/gaotao/modules/warehouse/dao/LabelTransactionLogMapper.java
-
21src/main/java/com/gaotao/modules/warehouse/service/LabelTransactionLogService.java
-
30src/main/java/com/gaotao/modules/warehouse/service/impl/LabelTransactionLogServiceImpl.java
-
3src/main/resources/application-dev.yml
-
3src/main/resources/mapper/pms/QcMapper.xml
-
97src/main/resources/mapper/warehouse/LabelTransactionLogMapper.xml
@ -0,0 +1,62 @@ |
|||||
|
package com.gaotao.modules.warehouse.controller; |
||||
|
|
||||
|
import com.gaotao.common.constant.SysMsgConstant; |
||||
|
import com.gaotao.common.utils.PageUtils; |
||||
|
import com.gaotao.common.utils.R; |
||||
|
import com.gaotao.modules.sys.controller.AbstractController; |
||||
|
import com.gaotao.modules.sys.entity.SysUserEntity; |
||||
|
import com.gaotao.modules.warehouse.service.LabelTransactionLogService; |
||||
|
import org.apache.shiro.SecurityUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 标签变动记录控制器 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("warehouse/labelTransactionLog") |
||||
|
public class LabelTransactionLogController extends AbstractController { |
||||
|
|
||||
|
@Autowired |
||||
|
private LabelTransactionLogService labelTransactionLogService; |
||||
|
|
||||
|
/** |
||||
|
* 查询标签变动记录列表(带分页) |
||||
|
*/ |
||||
|
@PostMapping("list") |
||||
|
public R list(@RequestBody Map<String, Object> params) { |
||||
|
try { |
||||
|
// 添加当前用户信息(根据userName查询用户有权访问的site和buNo) |
||||
|
params.put("userName", ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername()); |
||||
|
|
||||
|
// 获取分页参数 |
||||
|
int page = params.get("page") != null ? Integer.parseInt(params.get("page").toString()) : 1; |
||||
|
int limit = params.get("limit") != null ? Integer.parseInt(params.get("limit").toString()) : 20; |
||||
|
|
||||
|
// 计算偏移量 |
||||
|
int offset = (page - 1) * limit; |
||||
|
params.put("offset", offset); |
||||
|
|
||||
|
// 查询列表 |
||||
|
List<Map<String, Object>> list = labelTransactionLogService.queryList(params); |
||||
|
|
||||
|
// 查询总数 |
||||
|
int total = labelTransactionLogService.queryTotal(params); |
||||
|
|
||||
|
// 封装分页数据 |
||||
|
PageUtils pageUtils = new PageUtils(list, total, limit, page); |
||||
|
|
||||
|
return R.ok() |
||||
|
.put("code", 0) |
||||
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000)) |
||||
|
.put("page", pageUtils); |
||||
|
} catch (Exception e) { |
||||
|
logger.error("查询标签变动记录列表失败", e); |
||||
|
return R.error("查询标签变动记录列表失败: " + e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
@ -0,0 +1,25 @@ |
|||||
|
package com.gaotao.modules.warehouse.dao; |
||||
|
|
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 标签变动记录Mapper |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface LabelTransactionLogMapper { |
||||
|
|
||||
|
/** |
||||
|
* 查询标签变动记录列表 |
||||
|
*/ |
||||
|
List<Map<String, Object>> queryList(@Param("query") Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 查询标签变动记录总数 |
||||
|
*/ |
||||
|
int queryTotal(@Param("query") Map<String, Object> params); |
||||
|
} |
||||
|
|
||||
@ -0,0 +1,21 @@ |
|||||
|
package com.gaotao.modules.warehouse.service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 标签变动记录Service |
||||
|
*/ |
||||
|
public interface LabelTransactionLogService { |
||||
|
|
||||
|
/** |
||||
|
* 查询标签变动记录列表 |
||||
|
*/ |
||||
|
List<Map<String, Object>> queryList(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 查询标签变动记录总数 |
||||
|
*/ |
||||
|
int queryTotal(Map<String, Object> params); |
||||
|
} |
||||
|
|
||||
@ -0,0 +1,30 @@ |
|||||
|
package com.gaotao.modules.warehouse.service.impl; |
||||
|
|
||||
|
import com.gaotao.modules.warehouse.dao.LabelTransactionLogMapper; |
||||
|
import com.gaotao.modules.warehouse.service.LabelTransactionLogService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 标签变动记录Service实现类 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class LabelTransactionLogServiceImpl implements LabelTransactionLogService { |
||||
|
|
||||
|
@Autowired |
||||
|
private LabelTransactionLogMapper labelTransactionLogMapper; |
||||
|
|
||||
|
@Override |
||||
|
public List<Map<String, Object>> queryList(Map<String, Object> params) { |
||||
|
return labelTransactionLogMapper.queryList(params); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public int queryTotal(Map<String, Object> params) { |
||||
|
return labelTransactionLogMapper.queryTotal(params); |
||||
|
} |
||||
|
} |
||||
|
|
||||
@ -0,0 +1,97 @@ |
|||||
|
<?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.gaotao.modules.warehouse.dao.LabelTransactionLogMapper"> |
||||
|
|
||||
|
<!-- 查询标签变动记录列表 --> |
||||
|
<select id="queryList" resultType="java.util.Map"> |
||||
|
SELECT |
||||
|
a.Site as site, |
||||
|
a.bu_no as buNo, |
||||
|
a.transaction_id as transactionId, |
||||
|
a.document_type AS documentType, |
||||
|
a.document_no AS documentNo, |
||||
|
a.order_no AS orderNo, |
||||
|
a.order_line_no as orderLineNo, |
||||
|
a.roll_no AS rollNo, |
||||
|
a.roll_qty AS rollQty, |
||||
|
a.part_no AS partNo, |
||||
|
a.warehouse_id as warehouseId, |
||||
|
b.WareHouseName as warehouseName, |
||||
|
a.location_id as locationId, |
||||
|
c.LocationName as locationName, |
||||
|
CASE WHEN a.synced_flag = 'Y' THEN '已传输' ELSE '待传输' END as syncedFlag, |
||||
|
CONVERT(VARCHAR(19), a.synced_time, 120) AS syncedTime, |
||||
|
a.synced_error_msg AS syncedErrorMsg, |
||||
|
a.bom_item_no AS bomItemNo, |
||||
|
a.transaction_by as transactionBy, |
||||
|
CONVERT(VARCHAR(19), a.transaction_date, 120) AS transactionDate |
||||
|
FROM StockTransactionLog as a |
||||
|
LEFT JOIN WareHouse as b ON a.site = b.site AND a.bu_no = b.bu_no AND a.warehouse_id = b.WareHouseID |
||||
|
LEFT JOIN Location as c ON a.site = c.site AND a.bu_no = c.bu_no AND a.location_id = c.LocationID |
||||
|
WHERE a.site IN (SELECT site FROM AccessSite WHERE userID = #{query.userName}) |
||||
|
AND a.bu_no IN (SELECT bu_no FROM AccessBu WHERE username = #{query.userName}) |
||||
|
<if test="query.buNo != null and query.buNo != ''"> |
||||
|
AND a.bu_no = #{query.buNo} |
||||
|
</if> |
||||
|
<if test="query.documentType != null and query.documentType != ''"> |
||||
|
AND a.document_type = #{query.documentType} |
||||
|
</if> |
||||
|
<if test="query.rollNo != null and query.rollNo != ''"> |
||||
|
AND a.roll_no LIKE '%' + #{query.rollNo} + '%' |
||||
|
</if> |
||||
|
<if test="query.partNo != null and query.partNo != ''"> |
||||
|
AND a.part_no LIKE '%' + #{query.partNo} + '%' |
||||
|
</if> |
||||
|
<if test="query.partSpec != null and query.partSpec != ''"> |
||||
|
AND EXISTS ( |
||||
|
SELECT 1 FROM Part p |
||||
|
WHERE p.site = a.site AND p.bu_no = a.bu_no AND p.PartNo = a.part_no |
||||
|
AND p.PartSpecification LIKE '%' + #{query.partSpec} + '%' |
||||
|
) |
||||
|
</if> |
||||
|
<if test="query.startDate != null and query.startDate != ''"> |
||||
|
AND a.transaction_date >= #{query.startDate} |
||||
|
</if> |
||||
|
<if test="query.endDate != null and query.endDate != ''"> |
||||
|
AND a.transaction_date < DATEADD(DAY, 1, #{query.endDate}) |
||||
|
</if> |
||||
|
ORDER BY a.transaction_date DESC, a.transaction_id DESC |
||||
|
OFFSET #{query.offset} ROWS FETCH NEXT #{query.limit} ROWS ONLY |
||||
|
</select> |
||||
|
|
||||
|
<!-- 查询标签变动记录总数 --> |
||||
|
<select id="queryTotal" resultType="int"> |
||||
|
SELECT COUNT(1) |
||||
|
FROM StockTransactionLog as a |
||||
|
WHERE a.site IN (SELECT site FROM AccessSite WHERE userID = #{query.userName}) |
||||
|
AND a.bu_no IN (SELECT bu_no FROM AccessBu WHERE username = #{query.userName}) |
||||
|
<if test="query.buNo != null and query.buNo != ''"> |
||||
|
AND a.bu_no = #{query.buNo} |
||||
|
</if> |
||||
|
<if test="query.documentType != null and query.documentType != ''"> |
||||
|
AND a.document_type = #{query.documentType} |
||||
|
</if> |
||||
|
<if test="query.rollNo != null and query.rollNo != ''"> |
||||
|
AND a.roll_no LIKE '%' + #{query.rollNo} + '%' |
||||
|
</if> |
||||
|
<if test="query.partNo != null and query.partNo != ''"> |
||||
|
AND a.part_no LIKE '%' + #{query.partNo} + '%' |
||||
|
</if> |
||||
|
<if test="query.partSpec != null and query.partSpec != ''"> |
||||
|
AND EXISTS ( |
||||
|
SELECT 1 FROM Part p |
||||
|
WHERE p.site = a.site AND p.bu_no = a.bu_no AND p.PartNo = a.part_no |
||||
|
AND p.PartSpecification LIKE '%' + #{query.partSpec} + '%' |
||||
|
) |
||||
|
</if> |
||||
|
<if test="query.startDate != null and query.startDate != ''"> |
||||
|
AND a.transaction_date >= #{query.startDate} |
||||
|
</if> |
||||
|
<if test="query.endDate != null and query.endDate != ''"> |
||||
|
AND a.transaction_date < DATEADD(DAY, 1, #{query.endDate}) |
||||
|
</if> |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
||||
|
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue