盘点模块修改
This commit is contained in:
@@ -55,11 +55,15 @@ public class InventoryMatchScanController extends BaseController {
|
||||
*/
|
||||
@GetMapping("/countList")
|
||||
public TableDataInfo countList(InventoryMatchScan matchScan) {
|
||||
// 开启分页
|
||||
startPage();
|
||||
// 调用 service 层查询数据
|
||||
List<RkInfoMatchVO> list = inventoryMatchScanService.selectMatchScanCountList(matchScan);
|
||||
// 返回分页后的结果
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据任务名称分页查询盘点结果
|
||||
* @param dto
|
||||
|
||||
@@ -60,12 +60,17 @@ public class InventoryMatchScanServiceImpl implements InventoryMatchScanService
|
||||
|
||||
@Override
|
||||
public List<RkInfoMatchVO> selectMatchScanCountList(InventoryMatchScan param) {
|
||||
// 状态=2:只查扫描表中的数据
|
||||
if ("2".equals(param.getStatus())) {
|
||||
return mapper.selectOnlyFromMatchScan(param);
|
||||
} else if ("1".equals(param.getStatus())) {
|
||||
String wh = taskMapper.getWhByTaskId(param.getTaskId());
|
||||
}
|
||||
// 状态=1:查询指定仓库下未被扫描的库位
|
||||
else if ("1".equals(param.getStatus())) {
|
||||
String wh = taskMapper.getWhByTaskId(param.getTaskId()); // 根据任务ID获取仓库ID
|
||||
return rkInfoMapper.getUnscannedPcodeByWh(wh, param.getTaskId());
|
||||
} else {
|
||||
}
|
||||
// 其它情况:返回扫描表和库存表的关联数据
|
||||
else {
|
||||
return mapper.selectJoinRkInfo(param);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class HdInventoryController {
|
||||
@Autowired
|
||||
private IRkInfoService rkInfoService;
|
||||
|
||||
@ApiModelProperty("盘点对比")
|
||||
@ApiModelProperty("开始匹配")
|
||||
@PostMapping("/match")
|
||||
public AjaxResult match(@RequestBody QueryDTO dto) {
|
||||
|
||||
|
||||
@@ -80,4 +80,11 @@ public interface InventoryTaskMapper
|
||||
* @param status
|
||||
*/
|
||||
void updateStatus(@Param("taskId") String taskId, @Param("status") String status);
|
||||
|
||||
/**
|
||||
* 根据任务ID查询场景ID
|
||||
* @param taskId
|
||||
* @return
|
||||
*/
|
||||
String selectSceneIdById(String taskId);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.zg.project.wisdom.controller;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -8,7 +7,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.zg.project.wisdom.domain.dto.*;
|
||||
import com.zg.project.wisdom.domain.vo.BillGroupVO;
|
||||
import com.zg.project.wisdom.domain.vo.PcodeQtyVO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -39,7 +38,7 @@ public class RkInfoController extends BaseController
|
||||
/**
|
||||
* 查询出库,借料,待审批,撤销出入库单据主列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wisdom:stock:list')")
|
||||
// @PreAuthorize("@ss.hasPermi('wisdom:stock:list')")
|
||||
@PostMapping("/list")
|
||||
public TableDataInfo list(@RequestBody RkInfoQueryDTO rkInfo) {
|
||||
PageHelper.startPage(rkInfo.getPageNum(), rkInfo.getPageSize());
|
||||
@@ -47,6 +46,14 @@ public class RkInfoController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('wisdom:stock:stat')")
|
||||
@GetMapping("/pcode/{pcode}")
|
||||
public AjaxResult listRkInfoByPcode(@PathVariable String pcode) {
|
||||
List<RkInfo> rows = rkInfoService.listRkInfoByPcode(pcode);
|
||||
return AjaxResult.success(rows);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("按单据分组(bill_no)列表:若存在出库则同时返回 bill_no_ck")
|
||||
@PreAuthorize("@ss.hasPermi('wisdom:stock:list')")
|
||||
@PostMapping("/bill/groups")
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// vo/PcodeQtyVO.java
|
||||
package com.zg.project.wisdom.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PcodeQtyVO {
|
||||
/** 库位码 */
|
||||
private String pcode;
|
||||
|
||||
/** 在库总数量(real_qty 之和) */
|
||||
private BigDecimal totalQty;
|
||||
}
|
||||
@@ -1,14 +1,12 @@
|
||||
package com.zg.project.wisdom.mapper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.zg.project.Inventory.domain.vo.PcdeCntVO;
|
||||
import com.zg.project.Inventory.domain.vo.RkInfoMatchVO;
|
||||
import com.zg.project.wisdom.domain.RkInfo;
|
||||
import com.zg.project.wisdom.domain.StockPhoto;
|
||||
import com.zg.project.wisdom.domain.dto.RkInfoQueryDTO;
|
||||
import com.zg.project.wisdom.domain.vo.PcodeQtyVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
@@ -129,25 +127,22 @@ public interface RkInfoMapper
|
||||
int cancelStockOut(String billNoCk);
|
||||
|
||||
/**
|
||||
* 查看盘点扫描正常数据
|
||||
* @param pcdeIds
|
||||
* @return
|
||||
* 查看盘点扫描正常数据(限定场景)
|
||||
*/
|
||||
List<RkInfo> getByPcodeIdList(List<String> pcdeIds);
|
||||
List<RkInfo> getByPcodeIdList(@Param("list") List<String> pcdeIds,
|
||||
@Param("sceneId") String sceneId);
|
||||
|
||||
/**
|
||||
* 盘点扫描未正常数据
|
||||
* @param pcdeIds
|
||||
* @return
|
||||
* 查看盘点扫描未正常数据(限定场景)
|
||||
*/
|
||||
List<RkInfo> getMissedPcodeIds(List<String> pcdeIds);
|
||||
List<RkInfo> getMissedPcodeIds(@Param("list") List<String> pcdeIds,
|
||||
@Param("sceneId") String sceneId);
|
||||
|
||||
/**
|
||||
* 判断盘点扫描的id是否存在
|
||||
* @param id
|
||||
* @return
|
||||
* 判断盘点扫描的id在场景内是否存在
|
||||
*/
|
||||
int existsByPcodeId(String id);
|
||||
int existsByPcodeId(@Param("pcodeId") String pcodeId,
|
||||
@Param("sceneId") String sceneId);
|
||||
|
||||
/**
|
||||
* 获取指定仓库的盘点数据
|
||||
@@ -223,4 +218,7 @@ public interface RkInfoMapper
|
||||
* @return
|
||||
*/
|
||||
List<RkInfo> selectRkInfoByIds(@Param("ids") Long[] ids);
|
||||
|
||||
List<RkInfo> listRkInfoByPcode(String pcode);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.zg.project.Inventory.domain.dto.QueryDTO;
|
||||
import com.zg.project.Inventory.domain.vo.ChartDataVO;
|
||||
import com.zg.project.wisdom.domain.RkInfo;
|
||||
import com.zg.project.wisdom.domain.dto.*;
|
||||
import com.zg.project.wisdom.domain.vo.BillGroupVO;
|
||||
import com.zg.project.wisdom.domain.vo.PcodeQtyVO;
|
||||
|
||||
/**
|
||||
* 库存单据主Service接口
|
||||
@@ -148,4 +148,11 @@ public interface IRkInfoService
|
||||
*/
|
||||
void revertByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 按库位查询货物数量
|
||||
* @param pcode
|
||||
* @return
|
||||
*/
|
||||
List<RkInfo> listRkInfoByPcode(String pcode);
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.zg.project.system.service.ISysConfigService;
|
||||
import com.zg.project.wisdom.domain.AuditSignature;
|
||||
import com.zg.project.wisdom.domain.GysJh;
|
||||
import com.zg.project.wisdom.domain.dto.*;
|
||||
import com.zg.project.wisdom.domain.vo.PcodeQtyVO;
|
||||
import com.zg.project.wisdom.mapper.AuditSignatureMapper;
|
||||
import com.zg.project.wisdom.mapper.GysJhMapper;
|
||||
import com.zg.project.wisdom.utils.BillNoUtil;
|
||||
@@ -737,32 +738,18 @@ public class RkInfoServiceImpl implements IRkInfoService
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void matchWithStatus(QueryDTO dto) {
|
||||
List<String> pcdeIds = dto.getIds();
|
||||
if (pcdeIds == null || pcdeIds.isEmpty()) return;
|
||||
|
||||
// 一、三类匹配数据
|
||||
List<RkInfo> matchedAll = rkInfoMapper.getByPcodeIdList(pcdeIds);
|
||||
matchedAll.forEach(r -> r.setStatus("0"));
|
||||
// 场景ID:优先取 DTO;没有就通过任务查
|
||||
String sceneId = taskMapper.selectSceneIdById(dto.getTaskId());
|
||||
if (sceneId == null || sceneId.trim().isEmpty()) {
|
||||
throw new ServiceException("匹配失败:缺少场景ID");
|
||||
}
|
||||
|
||||
List<RkInfo> missedAll = rkInfoMapper.getMissedPcodeIds(pcdeIds);
|
||||
missedAll.forEach(r -> r.setStatus("1"));
|
||||
|
||||
List<String> errorIds = pcdeIds.stream()
|
||||
.filter(id -> rkInfoMapper.existsByPcodeId(id) == 0)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<RkInfo> errorAll = errorIds.stream()
|
||||
.map(id -> {
|
||||
RkInfo r = new RkInfo();
|
||||
r.setPcodeId(id);
|
||||
r.setStatus("2");
|
||||
return r;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 二、封装入库记录
|
||||
String tmeStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
// 自动盘点必须要设备ID
|
||||
String deviceId = dto.getDeviceId();
|
||||
int scanType = dto.getScanType() != null ? dto.getScanType() : 0;
|
||||
String taskId = dto.getTaskId();
|
||||
@@ -771,7 +758,28 @@ public class RkInfoServiceImpl implements IRkInfoService
|
||||
throw new ServiceException("自动盘点必须传递设备ID");
|
||||
}
|
||||
|
||||
// 三类数据(限定在 sceneId 内)
|
||||
List<RkInfo> matchedAll = rkInfoMapper.getByPcodeIdList(pcdeIds, sceneId);
|
||||
matchedAll.forEach(r -> r.setStatus("0"));
|
||||
|
||||
List<RkInfo> missedAll = rkInfoMapper.getMissedPcodeIds(pcdeIds, sceneId);
|
||||
missedAll.forEach(r -> r.setStatus("1"));
|
||||
|
||||
List<String> errorIds = pcdeIds.stream()
|
||||
.filter(id -> rkInfoMapper.existsByPcodeId(id, sceneId) == 0)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<RkInfo> errorAll = errorIds.stream().map(id -> {
|
||||
RkInfo r = new RkInfo();
|
||||
r.setPcodeId(id);
|
||||
r.setStatus("2");
|
||||
return r;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// 统一落表
|
||||
String tmeStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
List<InventoryMatchScan> toSave = new ArrayList<>();
|
||||
|
||||
for (RkInfo r : matchedAll) {
|
||||
toSave.add(buildScanRecord(taskId, r.getPcodeId(), "0", deviceId, tmeStr, scanType));
|
||||
}
|
||||
@@ -786,7 +794,9 @@ public class RkInfoServiceImpl implements IRkInfoService
|
||||
matchScanMapper.insertBatch(toSave);
|
||||
}
|
||||
|
||||
taskMapper.updateStatus(taskId, "1");
|
||||
if (taskId != null && !taskId.trim().isEmpty()) {
|
||||
taskMapper.updateStatus(taskId, "1"); // 已完成
|
||||
}
|
||||
}
|
||||
|
||||
private InventoryMatchScan buildScanRecord(String taskId, String pcode, String status,
|
||||
@@ -935,4 +945,9 @@ public class RkInfoServiceImpl implements IRkInfoService
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RkInfo> listRkInfoByPcode(String pcode) {
|
||||
return rkInfoMapper.listRkInfoByPcode(pcode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -197,21 +197,19 @@
|
||||
resultType="com.zg.project.Inventory.domain.vo.RkInfoMatchVO">
|
||||
SELECT
|
||||
r.pcode AS rkPcode,
|
||||
r.real_qty AS realQty
|
||||
COALESCE(SUM(r.real_qty), 0) AS realQty
|
||||
FROM rk_info r
|
||||
WHERE r.pcode_id IN (
|
||||
SELECT DISTINCT i.pcode
|
||||
FROM inventory_match_scan i
|
||||
LEFT JOIN rk_info r ON i.pcode = r.pcode_id
|
||||
<where>
|
||||
<if test="taskId != null and taskId != ''">
|
||||
AND i.task_id = #{taskId}
|
||||
</if>
|
||||
<if test="deviceId != null and deviceId != ''">
|
||||
AND i.device_id = #{deviceId}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND i.status = #{status}
|
||||
</if>
|
||||
<if test="taskId != null and taskId != ''">AND i.task_id = #{taskId}</if>
|
||||
<if test="deviceId != null and deviceId != ''">AND i.device_id = #{deviceId}</if>
|
||||
<if test="status != null and status != ''">AND i.status = #{status}</if>
|
||||
</where>
|
||||
ORDER BY i.tme DESC
|
||||
)
|
||||
GROUP BY r.pcode
|
||||
ORDER BY MAX(r.create_time) DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -85,6 +85,14 @@
|
||||
where id = #{taskId}
|
||||
</select>
|
||||
|
||||
<select id="selectSceneIdById" parameterType="string" resultType="java.lang.String">
|
||||
SELECT scene_id
|
||||
FROM inventory_task
|
||||
WHERE id = #{id}
|
||||
AND is_delete = '0'
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<insert id="insertInventoryTask" parameterType="InventoryTask" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into inventory_task
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
@@ -325,62 +325,59 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
-->
|
||||
<select id="selectGroupedByBill" resultMap="RkInfoResult" parameterType="map">
|
||||
SELECT
|
||||
/* ============= 主键:取单据内任一(用最小 ID 代表) ============= */
|
||||
MIN(t.id) AS id,
|
||||
|
||||
/* ============= 单据号 ============= */
|
||||
t.bill_no AS bill_no, -- 入库单据号(分组键)
|
||||
ANY_VALUE(t.bill_no_ck) AS bill_no_ck, -- 出库单据号(若单据发生过出库则可能有值)
|
||||
|
||||
/* ============= 通用字段(代表值/聚合) ============= */
|
||||
ANY_VALUE(t.rk_type) AS rk_type, -- 入库类型编码(type_code)
|
||||
-- 入库类型名称(由 stock_in_type 反查)
|
||||
(SELECT si.type_name
|
||||
FROM stock_in_type si
|
||||
WHERE si.type_code = ANY_VALUE(t.rk_type)
|
||||
LIMIT 1) AS rk_type_name,
|
||||
|
||||
ANY_VALUE(t.wl_type) AS wl_type, -- 物资类型
|
||||
ANY_VALUE(t.cangku) AS cangku, -- 仓库(编码)
|
||||
MIN(t.rk_time) AS rk_time, -- 入库时间(单据内最早)
|
||||
ANY_VALUE(t.lihuo_y) AS lihuo_y, -- 理货员(ID)
|
||||
MAX(t.is_chuku) AS is_chuku, -- 是否出库(单据内只要有出库,用最大值反映)
|
||||
ANY_VALUE(t.xj) AS xj, -- 县局
|
||||
|
||||
ANY_VALUE(t.xm_no) AS xm_no, -- 入库项目号
|
||||
ANY_VALUE(t.xm_ms) AS xm_ms, -- 入库项目描述
|
||||
ANY_VALUE(t.xm_no_ck) AS xm_no_ck, -- 出库项目号
|
||||
ANY_VALUE(t.xm_ms_ck) AS xm_ms_ck, -- 出库项目描述
|
||||
|
||||
ANY_VALUE(t.wl_no) AS wl_no, -- 物料号
|
||||
ANY_VALUE(t.wl_ms) AS wl_ms, -- 物料描述
|
||||
ANY_VALUE(t.gys_no) AS gys_no, -- 供应商编码
|
||||
ANY_VALUE(t.sap_no) AS sap_no, -- SAP 订单号
|
||||
|
||||
/* ============= 出库附加信息 ============= */
|
||||
ANY_VALUE(t.ck_type) AS ck_type, -- 出库类型编码
|
||||
(SELECT s.type_name
|
||||
FROM stock_out_type s
|
||||
WHERE s.type_code = ANY_VALUE(t.ck_type)
|
||||
LIMIT 1) AS ck_type_name, -- 出库类型名称
|
||||
|
||||
MAX(t.ly_time) AS ly_time, -- 领用时间(单据内最新)
|
||||
|
||||
ANY_VALUE(t.ck_lihuo_y) AS ck_lihuo_y, -- 出库理货员ID
|
||||
(SELECT u.user_name
|
||||
FROM sys_user u
|
||||
WHERE u.user_id = ANY_VALUE(t.ck_lihuo_y)
|
||||
LIMIT 1) AS ck_lihuo_y_name -- 出库理货员姓名
|
||||
|
||||
a.id,
|
||||
a.bill_no,
|
||||
a.bill_no_ck,
|
||||
a.rk_type,
|
||||
si.type_name AS rk_type_name,
|
||||
a.wl_type,
|
||||
a.cangku,
|
||||
a.rk_time,
|
||||
a.lihuo_y,
|
||||
a.is_chuku,
|
||||
a.xj,
|
||||
a.xm_no,
|
||||
a.xm_ms,
|
||||
a.xm_no_ck,
|
||||
a.xm_ms_ck,
|
||||
a.wl_no,
|
||||
a.wl_ms,
|
||||
a.gys_no,
|
||||
a.sap_no,
|
||||
a.ck_type,
|
||||
so.type_name AS ck_type_name,
|
||||
a.ly_time,
|
||||
a.ck_lihuo_y,
|
||||
u.user_name AS ck_lihuo_y_name
|
||||
FROM (
|
||||
<!-- 这里完全复用你已有的 SELECT + JOIN 片段,列别名与 RkInfoResult 一致 -->
|
||||
SELECT
|
||||
MIN(t.id) AS id, -- 代表ID
|
||||
t.bill_no AS bill_no, -- 分组键
|
||||
MIN(t.bill_no_ck) AS bill_no_ck, -- 代表值
|
||||
MIN(t.rk_type) AS rk_type,
|
||||
MIN(t.wl_type) AS wl_type,
|
||||
MIN(t.cangku) AS cangku,
|
||||
MIN(t.rk_time) AS rk_time, -- 单据内最早入库时间
|
||||
MIN(t.lihuo_y) AS lihuo_y,
|
||||
MAX(t.is_chuku) AS is_chuku, -- 单据内只要有出库则为1
|
||||
MIN(t.xj) AS xj,
|
||||
MIN(t.xm_no) AS xm_no,
|
||||
MIN(t.xm_ms) AS xm_ms,
|
||||
MIN(t.xm_no_ck) AS xm_no_ck,
|
||||
MIN(t.xm_ms_ck) AS xm_ms_ck,
|
||||
MIN(t.wl_no) AS wl_no,
|
||||
MIN(t.wl_ms) AS wl_ms,
|
||||
MIN(t.gys_no) AS gys_no,
|
||||
MIN(t.sap_no) AS sap_no,
|
||||
MIN(t.ck_type) AS ck_type,
|
||||
MAX(t.ly_time) AS ly_time,
|
||||
MIN(t.ck_lihuo_y) AS ck_lihuo_y
|
||||
FROM (
|
||||
<!-- 复用已有的明细查询(列别名与 RkInfoResult 一致) -->
|
||||
<include refid="selectRkInfoVo"/>
|
||||
) t
|
||||
|
||||
<where>
|
||||
<!-- ================= 与 /list 相同的筛选条件(把 ri.* 改为 t.*) ================= -->
|
||||
|
||||
<!-- is_chuku:优先列表,其次单值 -->
|
||||
<!-- is_chuku 优先列表,其次单值 -->
|
||||
<choose>
|
||||
<when test="q.isChukuList != null and q.isChukuList.size > 0">
|
||||
AND t.is_chuku IN
|
||||
@@ -396,29 +393,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<!-- 关键词模糊 -->
|
||||
<if test="q.keyword != null and q.keyword != ''">
|
||||
AND (
|
||||
t.xm_no like concat('%', #{q.keyword}, '%')
|
||||
or t.xm_ms like concat('%', #{q.keyword}, '%')
|
||||
or t.wl_no like concat('%', #{q.keyword}, '%')
|
||||
or t.wl_ms like concat('%', #{q.keyword}, '%')
|
||||
or t.gys_no like concat('%', #{q.keyword}, '%')
|
||||
or t.gys_mc like concat('%', #{q.keyword}, '%')
|
||||
or t.sap_no like concat('%', #{q.keyword}, '%')
|
||||
or t.bill_no like concat('%', #{q.keyword}, '%')
|
||||
or t.bill_no_ck like concat('%', #{q.keyword}, '%')
|
||||
or t.ck_type like concat('%', #{q.keyword}, '%')
|
||||
or t.pcode like concat('%', #{q.keyword}, '%')
|
||||
t.xm_no LIKE concat('%', #{q.keyword}, '%')
|
||||
OR t.xm_ms LIKE concat('%', #{q.keyword}, '%')
|
||||
OR t.wl_no LIKE concat('%', #{q.keyword}, '%')
|
||||
OR t.wl_ms LIKE concat('%', #{q.keyword}, '%')
|
||||
OR t.gys_no LIKE concat('%', #{q.keyword}, '%')
|
||||
OR t.gys_mc LIKE concat('%', #{q.keyword}, '%')
|
||||
OR t.sap_no LIKE concat('%', #{q.keyword}, '%')
|
||||
OR t.bill_no LIKE concat('%', #{q.keyword}, '%')
|
||||
OR t.bill_no_ck LIKE concat('%', #{q.keyword}, '%')
|
||||
OR t.ck_type LIKE concat('%', #{q.keyword}, '%')
|
||||
OR t.pcode LIKE concat('%', #{q.keyword}, '%')
|
||||
)
|
||||
</if>
|
||||
|
||||
<!-- 维度筛选 -->
|
||||
<if test="q.rkType != null and q.rkType != ''">
|
||||
AND t.rk_type like concat('%', #{q.rkType}, '%')
|
||||
AND t.rk_type LIKE concat('%', #{q.rkType}, '%')
|
||||
</if>
|
||||
<if test="q.wlType != null and q.wlType != ''">
|
||||
AND t.wl_type like concat('%', #{q.wlType}, '%')
|
||||
AND t.wl_type LIKE concat('%', #{q.wlType}, '%')
|
||||
</if>
|
||||
<if test="q.cangku != null and q.cangku != ''">
|
||||
AND t.cangku like concat('%', #{q.cangku}, '%')
|
||||
AND t.cangku LIKE concat('%', #{q.cangku}, '%')
|
||||
</if>
|
||||
|
||||
<!-- ID 列表 -->
|
||||
@@ -447,88 +444,74 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<!-- 其它模糊/等值 -->
|
||||
<if test="q.lihuoY != null and q.lihuoY != ''">
|
||||
AND t.lihuo_y like concat('%', #{q.lihuoY}, '%')
|
||||
AND t.lihuo_y LIKE concat('%', #{q.lihuoY}, '%')
|
||||
</if>
|
||||
<if test="q.xj != null and q.xj != ''">
|
||||
AND t.xj like concat('%', #{q.xj}, '%')
|
||||
AND t.xj LIKE concat('%', #{q.xj}, '%')
|
||||
</if>
|
||||
<if test="q.billNo != null and q.billNo != ''">
|
||||
AND t.bill_no like concat('%', #{q.billNo}, '%')
|
||||
AND t.bill_no LIKE concat('%', #{q.billNo}, '%')
|
||||
</if>
|
||||
<if test="q.billNoCk != null and q.billNoCk != ''">
|
||||
AND t.bill_no_ck like concat('%', #{q.billNoCk}, '%')
|
||||
AND t.bill_no_ck LIKE concat('%', #{q.billNoCk}, '%')
|
||||
</if>
|
||||
<if test="q.xmNo != null and q.xmNo != ''">
|
||||
AND t.xm_no like concat('%', #{q.xmNo}, '%')
|
||||
AND t.xm_no LIKE concat('%', #{q.xmNo}, '%')
|
||||
</if>
|
||||
<if test="q.xmMs != null and q.xmMs != ''">
|
||||
AND t.xm_ms like concat('%', #{q.xmMs}, '%')
|
||||
AND t.xm_ms LIKE concat('%', #{q.xmMs}, '%')
|
||||
</if>
|
||||
<if test="q.wlNo != null and q.wlNo != ''">
|
||||
AND t.wl_no like concat('%', #{q.wlNo}, '%')
|
||||
AND t.wl_no LIKE concat('%', #{q.wlNo}, '%')
|
||||
</if>
|
||||
<if test="q.wlMs != null and q.wlMs != ''">
|
||||
AND t.wl_ms like concat('%', #{q.wlMs}, '%')
|
||||
AND t.wl_ms LIKE concat('%', #{q.wlMs}, '%')
|
||||
</if>
|
||||
<if test="q.gysNo != null and q.gysNo != ''">
|
||||
AND t.gys_no like concat('%', #{q.gysNo}, '%')
|
||||
AND t.gys_no LIKE concat('%', #{q.gysNo}, '%')
|
||||
</if>
|
||||
<if test="q.gysMc != null and q.gysMc != ''">
|
||||
AND t.gys_mc like concat('%', #{q.gysMc}, '%')
|
||||
AND t.gys_mc LIKE concat('%', #{q.gysMc}, '%')
|
||||
</if>
|
||||
|
||||
<if test="q.jhAmt != null">
|
||||
AND t.jh_amt = #{q.jhAmt}
|
||||
</if>
|
||||
<if test="q.htDj != null">
|
||||
AND t.ht_dj = #{q.htDj}
|
||||
</if>
|
||||
<if test="q.jhAmt != null"> AND t.jh_amt = #{q.jhAmt} </if>
|
||||
<if test="q.htDj != null"> AND t.ht_dj = #{q.htDj} </if>
|
||||
|
||||
<if test="q.sapNo != null and q.sapNo != ''">
|
||||
AND t.sap_no like concat('%', #{q.sapNo}, '%')
|
||||
AND t.sap_no LIKE concat('%', #{q.sapNo}, '%')
|
||||
</if>
|
||||
<if test="q.xh != null and q.xh != ''">
|
||||
AND t.xh like concat('%', #{q.xh}, '%')
|
||||
</if>
|
||||
<if test="q.jhQty != null">
|
||||
AND t.jh_qty = #{q.jhQty}
|
||||
</if>
|
||||
<if test="q.htQty != null">
|
||||
AND t.ht_qty = #{q.htQty}
|
||||
AND t.xh LIKE concat('%', #{q.xh}, '%')
|
||||
</if>
|
||||
<if test="q.jhQty != null"> AND t.jh_qty = #{q.jhQty} </if>
|
||||
<if test="q.htQty != null"> AND t.ht_qty = #{q.htQty} </if>
|
||||
<if test="q.dw != null and q.dw != ''">
|
||||
AND t.dw like concat('%', #{q.dw}, '%')
|
||||
</if>
|
||||
<if test="q.realQty != null">
|
||||
AND t.real_qty = #{q.realQty}
|
||||
AND t.dw LIKE concat('%', #{q.dw}, '%')
|
||||
</if>
|
||||
<if test="q.realQty != null"> AND t.real_qty = #{q.realQty} </if>
|
||||
|
||||
<if test="q.pcode != null and q.pcode != ''">
|
||||
AND t.pcode like concat('%', #{q.pcode}, '%')
|
||||
</if>
|
||||
<if test="q.lyTime != null">
|
||||
AND t.ly_time = #{q.lyTime}
|
||||
</if>
|
||||
<if test="q.returnTime != null">
|
||||
AND t.return_time = #{q.returnTime}
|
||||
AND t.pcode LIKE concat('%', #{q.pcode}, '%')
|
||||
</if>
|
||||
<if test="q.lyTime != null"> AND t.ly_time = #{q.lyTime} </if>
|
||||
<if test="q.returnTime != null"> AND t.return_time = #{q.returnTime} </if>
|
||||
<if test="q.trayCode != null and q.trayCode != ''">
|
||||
AND t.tray_code like concat('%', #{q.trayCode}, '%')
|
||||
AND t.tray_code LIKE concat('%', #{q.trayCode}, '%')
|
||||
</if>
|
||||
<if test="q.entityId != null and q.entityId != ''">
|
||||
AND t.entity_id like concat('%', #{q.entityId}, '%')
|
||||
AND t.entity_id LIKE concat('%', #{q.entityId}, '%')
|
||||
</if>
|
||||
<if test="q.ckType != null and q.ckType != ''">
|
||||
AND t.ck_type like concat('%', #{q.ckType}, '%')
|
||||
AND t.ck_type LIKE concat('%', #{q.ckType}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 若查询出库单据:单值 is_chuku=1 或 列表包含 1,都要求已生成出库单号 -->
|
||||
<!-- 若查询出库单据,则要求已生成出库单号 -->
|
||||
<if test="(q.isChuku != null and q.isChuku == 1)
|
||||
or (q.isChukuList != null and q.isChukuList.size > 0 and q.isChukuList.contains(1))">
|
||||
AND t.bill_no_ck IS NOT NULL
|
||||
</if>
|
||||
|
||||
<!-- 删除标记(默认 0) -->
|
||||
<!-- 删除标记(默认0) -->
|
||||
<choose>
|
||||
<when test="q.isDelete != null and q.isDelete != ''">
|
||||
AND t.is_delete = #{q.isDelete}
|
||||
@@ -538,7 +521,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
<!-- 审核开启:剔除“审核失败”的明细(未审核/通过保留) -->
|
||||
<!-- 审核开启:剔除审核失败(不使用 <>,而用 != 或 CDATA) -->
|
||||
<if test="needAudit != null and needAudit == 1">
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
@@ -549,13 +532,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
|
||||
GROUP BY t.bill_no
|
||||
ORDER BY MIN(t.rk_time) DESC
|
||||
) a
|
||||
LEFT JOIN stock_in_type si ON a.rk_type = si.type_code
|
||||
LEFT JOIN stock_out_type so ON a.ck_type = so.type_code
|
||||
LEFT JOIN sys_user u ON a.ck_lihuo_y = u.user_id
|
||||
ORDER BY a.rk_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectRkInfoById" parameterType="Long" resultMap="RkInfoResult">
|
||||
<include refid="selectRkInfoVo"/>
|
||||
where ri.id = #{id} and ri.is_delete = 0
|
||||
@@ -600,7 +585,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
WHERE bill_no = #{billNo} AND sap_no IS NOT NULL
|
||||
</select>
|
||||
|
||||
<select id="getByPcodeIdList" parameterType="list" resultMap="RkInfoResult">
|
||||
<!-- 正常数据:扫描到的库位(限定场景) -->
|
||||
<select id="getByPcodeIdList" parameterType="map" resultMap="RkInfoResult">
|
||||
SELECT
|
||||
ri.id, ri.rk_type, ri.wl_type, ri.cangku, ri.rk_time, ri.lihuo_y,
|
||||
ri.is_chuku, ri.bill_no, ri.bill_no_ck,
|
||||
@@ -611,40 +597,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ri.ck_lihuo_y, ri.ck_type, ri.team_code, ri.ly_time, ri.ck_remark,
|
||||
ri.create_by, ri.create_time, ri.update_by, ri.update_time, ri.is_delete
|
||||
FROM rk_info ri
|
||||
JOIN pcde_detail pd ON ri.pcode_id = pd.encoded_id
|
||||
WHERE ri.is_delete = '0'
|
||||
AND pd.is_delete = '0'
|
||||
AND ri.is_chuku = '0'
|
||||
AND pd.scene = #{sceneId}
|
||||
AND ri.pcode_id IN
|
||||
<foreach collection="list" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getMissedPcodeIds" parameterType="list" resultMap="RkInfoResult">
|
||||
<!-- 未扫描到的数据(限定场景) -->
|
||||
<select id="getMissedPcodeIds" parameterType="map" resultMap="RkInfoResult">
|
||||
SELECT
|
||||
id, rk_type, wl_type, cangku, rk_time, lihuo_y,
|
||||
is_chuku, bill_no, bill_no_ck,
|
||||
remark, xj, xm_no, xm_ms, wl_no, wl_ms, is_borrowed,
|
||||
gys_no, gys_mc, jh_amt, ht_dj, sap_no, xh,
|
||||
jh_qty, ht_qty, dw, real_qty,
|
||||
pcode, pcode_id, tray_code, entity_id,
|
||||
ck_lihuo_y, ck_type, team_code, ly_time, ck_remark,
|
||||
create_by, create_time, update_by, update_time, is_delete
|
||||
FROM rk_info
|
||||
WHERE is_delete = '0'
|
||||
ri.id, ri.rk_type, ri.wl_type, ri.cangku, ri.rk_time, ri.lihuo_y,
|
||||
ri.is_chuku, ri.bill_no, ri.bill_no_ck,
|
||||
ri.remark, ri.xj, ri.xm_no, ri.xm_ms, ri.wl_no, ri.wl_ms, ri.is_borrowed,
|
||||
ri.gys_no, ri.gys_mc, ri.jh_amt, ri.ht_dj, ri.sap_no, ri.xh,
|
||||
ri.jh_qty, ri.ht_qty, ri.dw, ri.real_qty,
|
||||
ri.pcode, ri.pcode_id, ri.tray_code, ri.entity_id,
|
||||
ri.ck_lihuo_y, ri.ck_type, ri.team_code, ri.ly_time, ri.ck_remark,
|
||||
ri.create_by, ri.create_time, ri.update_by, ri.update_time, ri.is_delete
|
||||
FROM rk_info ri
|
||||
JOIN pcde_detail pd ON ri.pcode_id = pd.encoded_id
|
||||
WHERE ri.is_delete = '0'
|
||||
AND ri.is_chuku = '0'
|
||||
AND pd.is_delete = '0'
|
||||
AND pd.scene = #{sceneId}
|
||||
<if test="list != null and list.size() > 0">
|
||||
AND pcode_id NOT IN
|
||||
AND ri.pcode_id NOT IN
|
||||
<foreach collection="list" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="existsByPcodeId" parameterType="string" resultType="java.lang.Integer">
|
||||
<!-- 判断某个库位在场景内是否存在 -->
|
||||
<select id="existsByPcodeId" parameterType="map" resultType="java.lang.Integer">
|
||||
SELECT COUNT(1)
|
||||
FROM rk_info
|
||||
WHERE is_delete = '0'
|
||||
AND pcode_id = #{pcodeId}
|
||||
FROM rk_info ri
|
||||
JOIN pcde_detail pd ON ri.pcode_id = pd.encoded_id
|
||||
WHERE ri.is_delete = '0'
|
||||
AND pd.is_delete = '0'
|
||||
AND ri.is_chuku = '0'
|
||||
AND ri.pcode_id = #{pcodeId}
|
||||
AND pd.scene = #{sceneId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="countGetByWh" resultType="java.lang.Integer" parameterType="java.lang.String">
|
||||
SELECT COUNT(1) FROM rk_info
|
||||
WHERE is_delete = '0'
|
||||
@@ -871,5 +872,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND bill_no IS NOT NULL
|
||||
</update>
|
||||
|
||||
<select id="listRkInfoByPcode"
|
||||
parameterType="string"
|
||||
resultMap="RkInfoResult">
|
||||
SELECT
|
||||
t.*,
|
||||
wh.warehouse_name AS cangku_name
|
||||
FROM rk_info t
|
||||
LEFT JOIN warehouse_info wh
|
||||
ON wh.warehouse_code = t.cangku
|
||||
WHERE t.is_delete = 0
|
||||
AND t.is_chuku = 0
|
||||
AND t.pcode = #{pcode}
|
||||
ORDER BY t.rk_time DESC, t.id DESC
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user