仓库信息字段更新1212

This commit is contained in:
2025-12-12 14:52:48 +08:00
parent b7434d71df
commit 8e0d7b463a
67 changed files with 1533 additions and 681 deletions

View File

@@ -1,7 +1,7 @@
package com.zg.framework.websocket.config; package com.zg.framework.websocket.config;
import com.zg.project.Inventory.AutoInventory.service.IRfidService; import com.zg.project.inventory.AutoInventory.service.IRfidService;
import com.zg.project.Inventory.AutoInventory.utils.SpringContextUtils; import com.zg.project.inventory.AutoInventory.utils.SpringContextUtils;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;

View File

@@ -2,8 +2,8 @@ package com.zg.framework.websocket.config;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.zg.project.Inventory.AutoInventory.service.IRfidService; import com.zg.project.inventory.AutoInventory.service.IRfidService;
import com.zg.project.Inventory.AutoInventory.utils.SpringContextUtils; import com.zg.project.inventory.AutoInventory.utils.SpringContextUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.websocket.*; import javax.websocket.*;

View File

@@ -42,6 +42,16 @@ public class PcdeDetailController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/**
* 根据小仓编码查询库位列表
*/
// @PreAuthorize("@ss.hasPermi('information:pcdedetail:list')")
@GetMapping("/listByWarehouse/{warehouseCode}")
public AjaxResult listByWarehouse(@PathVariable("warehouseCode") String warehouseCode)
{
return success(pcdeDetailService.selectByWarehouseCode(warehouseCode));
}
/** /**
* 获取未被入库单据使用的库位列表 * 获取未被入库单据使用的库位列表
*/ */

View File

@@ -2,6 +2,8 @@ package com.zg.project.information.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.zg.project.information.domain.vo.WarehouseGroupVO;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@@ -46,6 +48,15 @@ public class WarehouseInfoController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
// @PreAuthorize("@ss.hasPermi('information:warehouseinfo:list')")
@GetMapping("/tree")
public AjaxResult tree()
{
List<WarehouseGroupVO> list = warehouseInfoService.selectWarehouseGroupList();
return success(list);
}
/** /**
* 查询仓库信息列表 * 查询仓库信息列表
* @return * @return

View File

@@ -1,6 +1,7 @@
package com.zg.project.information.domain; package com.zg.project.information.domain;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@@ -23,20 +24,28 @@ public class PcdeDetail extends BaseEntity {
@Excel(name = "库位编号") @Excel(name = "库位编号")
private String pcode; private String pcode;
/** 所属场景 */ /** 所属场景编号 */
@Excel(name = "所属场景编号") @Excel(name = "所属场景编号")
private String scene; private String scene;
/** 所属场景名称 */ /** 所属场景名称(冗余字段) */
@Excel(name = "所属场景名称") @Excel(name = "所属场景名称")
private String sceneName; private String sceneName;
/** 所属仓库 */ /** 所属大仓编码 */
@Excel(name = "所属仓库") @Excel(name = "所属大仓编码")
private String warehouse; private String parentWarehouseCode;
/** 所属仓名称 */ /** 所属仓名称 */
@Excel(name = "所属仓名称") @Excel(name = "所属仓名称")
private String parentWarehouseName;
/** 所属小仓编码 */
@Excel(name = "所属小仓编码")
private String warehouseCode;
/** 所属小仓名称 */
@Excel(name = "所属小仓名称")
private String warehouseName; private String warehouseName;
/** 编码后ID */ /** 编码后ID */
@@ -68,7 +77,7 @@ public class PcdeDetail extends BaseEntity {
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date updatedAt; private Date updatedAt;
// Getter & Setter // ==================== Getter & Setter ====================
public void setId(Long id) { public void setId(Long id) {
this.id = id; this.id = id;
@@ -102,12 +111,28 @@ public class PcdeDetail extends BaseEntity {
return sceneName; return sceneName;
} }
public void setWarehouse(String warehouse) { public String getParentWarehouseCode() {
this.warehouse = warehouse; return parentWarehouseCode;
} }
public String getWarehouse() { public void setParentWarehouseCode(String parentWarehouseCode) {
return warehouse; this.parentWarehouseCode = parentWarehouseCode;
}
public String getParentWarehouseName() {
return parentWarehouseName;
}
public void setParentWarehouseName(String parentWarehouseName) {
this.parentWarehouseName = parentWarehouseName;
}
public String getWarehouseCode() {
return warehouseCode;
}
public void setWarehouseCode(String warehouseCode) {
this.warehouseCode = warehouseCode;
} }
public void setWarehouseName(String warehouseName) { public void setWarehouseName(String warehouseName) {
@@ -138,6 +163,7 @@ public class PcdeDetail extends BaseEntity {
this.remark = remark; this.remark = remark;
} }
@Override
public String getRemark() { public String getRemark() {
return remark; return remark;
} }
@@ -182,6 +208,8 @@ public class PcdeDetail extends BaseEntity {
return updatedAt; return updatedAt;
} }
// ==================== toString ====================
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@@ -189,7 +217,9 @@ public class PcdeDetail extends BaseEntity {
.append("pcode", getPcode()) .append("pcode", getPcode())
.append("scene", getScene()) .append("scene", getScene())
.append("sceneName", getSceneName()) .append("sceneName", getSceneName())
.append("warehouse", getWarehouse()) .append("parentWarehouseCode", getParentWarehouseCode())
.append("parentWarehouseName", getParentWarehouseName())
.append("warehouseCode", getWarehouseCode())
.append("warehouseName", getWarehouseName()) .append("warehouseName", getWarehouseName())
.append("encodedId", getEncodedId()) .append("encodedId", getEncodedId())
.append("tag", getTag()) .append("tag", getTag())

View File

@@ -0,0 +1,48 @@
package com.zg.project.information.domain.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 小仓 VO子仓库节点
*/
@Data
public class WarehouseChildVO implements Serializable {
private static final long serialVersionUID = 1L;
/** 主键 ID */
private Long id;
/** 仓库编码(小仓编码) */
private String warehouseCode;
/** 仓库名称(小仓名称) */
private String warehouseName;
/** 仓库地址 */
private String address;
/** 所属大仓编码 */
private String parentWarehouseCode;
/** 所属大仓名称 */
private String parentWarehouseName;
/** 状态1=启用0=禁用) */
private Integer status;
/** 排序值 */
private Integer sort;
/** 备注 */
private String remark;
/** 创建时间created_at */
private Date createdAt;
/** 更新时间updated_at */
private Date updatedAt;
}

View File

@@ -0,0 +1,46 @@
package com.zg.project.information.domain.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 大仓 VO包含小仓列表
*/
@Data
public class WarehouseGroupVO implements Serializable {
private static final long serialVersionUID = 1L;
/** 主键 ID大仓自身的 ID */
private Long id;
/** 大仓编码warehouse_code */
private String warehouseCode;
/** 大仓名称warehouse_name */
private String warehouseName;
/** 大仓地址address */
private String address;
/** 状态1=启用0=禁用) */
private Integer status;
/** 排序值 */
private Integer sort;
/** 备注 */
private String remark;
/** 创建时间created_at */
private Date createdAt;
/** 更新时间updated_at */
private Date updatedAt;
/** 该大仓下的小仓列表 */
private List<WarehouseChildVO> children;
}

View File

@@ -81,4 +81,12 @@ public interface PcdeDetailMapper
* @return * @return
*/ */
int batchInsertIgnore(List<PcdeDetail> slice); int batchInsertIgnore(List<PcdeDetail> slice);
/**
* 根据小仓编码查询库位列表
*/
List<PcdeDetail> selectByWarehouseCode(String warehouseCode);
String selectWarehouseCodeByPcode(String pcode);
} }

View File

@@ -74,4 +74,9 @@ public interface IPcdeDetailService
*/ */
List<PcdeDetail> getAllPcde(); List<PcdeDetail> getAllPcde();
/**
* 根据小仓编码查询库位列表
*/
List<PcdeDetail> selectByWarehouseCode(String warehouseCode);
} }

View File

@@ -1,6 +1,7 @@
package com.zg.project.information.service; package com.zg.project.information.service;
import com.zg.project.information.domain.WarehouseInfo; import com.zg.project.information.domain.WarehouseInfo;
import com.zg.project.information.domain.vo.WarehouseGroupVO;
import java.util.List; import java.util.List;
@@ -59,4 +60,11 @@ public interface IWarehouseInfoService
* @return 结果 * @return 结果
*/ */
public int deleteWarehouseInfoById(Long id); public int deleteWarehouseInfoById(Long id);
/**
* 查询仓库信息列表(包含小仓)
*
* @return
*/
List<WarehouseGroupVO> selectWarehouseGroupList();
} }

View File

@@ -230,4 +230,10 @@ public class PcdeDetailServiceImpl implements IPcdeDetailService
return availableList; return availableList;
} }
@Override
public List<PcdeDetail> selectByWarehouseCode(String warehouseCode)
{
return pcdeDetailMapper.selectByWarehouseCode(warehouseCode);
}
} }

View File

@@ -1,6 +1,14 @@
package com.zg.project.information.service.impl; package com.zg.project.information.service.impl;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.zg.common.utils.StringUtils;
import com.zg.project.information.domain.vo.WarehouseChildVO;
import com.zg.project.information.domain.vo.WarehouseGroupVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zg.project.information.mapper.WarehouseInfoMapper; import com.zg.project.information.mapper.WarehouseInfoMapper;
@@ -90,4 +98,61 @@ public class WarehouseInfoServiceImpl implements IWarehouseInfoService
{ {
return warehouseInfoMapper.deleteWarehouseInfoById(id); return warehouseInfoMapper.deleteWarehouseInfoById(id);
} }
/**
* ⭐ 查询大仓及其包含的小仓(嵌套结构)
*/
@Override
public List<WarehouseGroupVO> selectWarehouseGroupList() {
// 1. 查询全部仓库
List<WarehouseInfo> allList = warehouseInfoMapper.selectWarehouseInfoList(new WarehouseInfo());
if (allList == null || allList.isEmpty()) {
return new ArrayList<>();
}
// 2. 按 parent_warehouse_code 分组(大仓 → 小仓)
Map<String, WarehouseGroupVO> groupMap = new LinkedHashMap<>();
for (WarehouseInfo w : allList) {
// 所属大仓编码/名称
String parentCode = w.getParentWarehouseCode();
String parentName = w.getParentWarehouseName();
// 如果 parent_warehouse_code 为空,则自己就是一个大仓
if (StringUtils.isBlank(parentCode)) {
parentCode = w.getWarehouseCode();
parentName = w.getWarehouseName();
}
// 2.1 获取或创建大仓节点
WarehouseGroupVO groupVO = groupMap.get(parentCode);
if (groupVO == null) {
groupVO = new WarehouseGroupVO();
groupVO.setWarehouseCode(parentCode);
groupVO.setWarehouseName(parentName);
groupVO.setChildren(new ArrayList<>());
groupMap.put(parentCode, groupVO);
}
// 2.2 把当前仓库作为“小仓”加入 children
WarehouseChildVO childVO = new WarehouseChildVO();
childVO.setId(w.getId());
childVO.setWarehouseCode(w.getWarehouseCode());
childVO.setWarehouseName(w.getWarehouseName());
childVO.setAddress(w.getAddress());
childVO.setParentWarehouseCode(w.getParentWarehouseCode());
childVO.setParentWarehouseName(w.getParentWarehouseName());
childVO.setRemark(w.getRemark());
childVO.setCreatedAt(w.getCreatedAt());
childVO.setUpdatedAt(w.getUpdatedAt());
groupVO.getChildren().add(childVO);
}
// 3. 返回树结构
return new ArrayList<>(groupMap.values());
}
} }

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.AutoInventory.config; package com.zg.project.inventory.AutoInventory.config;
import lombok.Data; import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;

View File

@@ -1,12 +1,12 @@
package com.zg.project.Inventory.AutoInventory.controller; package com.zg.project.inventory.AutoInventory.controller;
import com.zg.framework.web.controller.BaseController; import com.zg.framework.web.controller.BaseController;
import com.zg.framework.web.domain.AjaxResult; import com.zg.framework.web.domain.AjaxResult;
import com.zg.project.Inventory.AutoInventory.service.InventoryMatchScanService; import com.zg.project.inventory.AutoInventory.service.InventoryMatchScanService;
import com.zg.project.Inventory.domain.dto.QueryDTO; import com.zg.project.inventory.domain.dto.QueryDTO;
import com.zg.project.Inventory.domain.vo.ChartDataVO; import com.zg.project.inventory.domain.vo.ChartDataVO;
import com.zg.project.Inventory.AutoInventory.service.IRfidService; import com.zg.project.inventory.AutoInventory.service.IRfidService;
import com.zg.project.Inventory.AutoInventory.service.ISodService; import com.zg.project.inventory.AutoInventory.service.ISodService;
import com.zg.project.wisdom.service.IRkInfoService; import com.zg.project.wisdom.service.IRkInfoService;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

@@ -1,17 +1,14 @@
package com.zg.project.Inventory.AutoInventory.controller; package com.zg.project.inventory.AutoInventory.controller;
import com.zg.common.utils.poi.ExcelUtil; import com.zg.common.utils.poi.ExcelUtil;
import com.zg.framework.web.controller.BaseController; import com.zg.framework.web.controller.BaseController;
import com.zg.framework.web.domain.AjaxResult; import com.zg.framework.web.domain.AjaxResult;
import com.zg.framework.web.page.TableDataInfo; import com.zg.framework.web.page.TableDataInfo;
import com.zg.project.Inventory.AutoInventory.service.InventoryMatchScanService; import com.zg.project.inventory.AutoInventory.service.InventoryMatchScanService;
import com.zg.project.Inventory.domain.dto.MatchScanPageDTO; import com.zg.project.inventory.domain.dto.MatchScanPageDTO;
import com.zg.project.Inventory.domain.entity.InventoryMatchScan; import com.zg.project.inventory.domain.entity.InventoryMatchScan;
import com.zg.project.Inventory.domain.entity.InventoryTask; import com.zg.project.inventory.domain.vo.InventoryMatchScanVO;
import com.zg.project.Inventory.domain.vo.InventoryMatchScanSimpleVO; import com.zg.project.inventory.domain.vo.RkInfoMatchVO;
import com.zg.project.Inventory.domain.vo.InventoryMatchScanVO;
import com.zg.project.Inventory.domain.vo.RkInfoMatchVO;
import com.zg.project.wisdom.domain.RkInfo;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;

View File

@@ -1,10 +1,9 @@
package com.zg.project.Inventory.AutoInventory.controller; package com.zg.project.inventory.AutoInventory.controller;
import com.ZMPrinter.*; import com.ZMPrinter.*;
import com.ZMPrinter.LSF.LSFDecoder; import com.ZMPrinter.LSF.LSFDecoder;
import com.ZMPrinter.UsbUtility.UsbConnection; import com.ZMPrinter.UsbUtility.UsbConnection;
import com.zg.project.Inventory.AutoInventory.domain.entity.PrintRfid; import com.zg.project.inventory.AutoInventory.mapper.PrintRfidMapper;
import com.zg.project.Inventory.AutoInventory.mapper.PrintRfidMapper;
import com.zg.project.information.domain.PcdeDetail; import com.zg.project.information.domain.PcdeDetail;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.AutoInventory.controller; package com.zg.project.inventory.AutoInventory.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.zg.framework.aspectj.lang.annotation.Log; import com.zg.framework.aspectj.lang.annotation.Log;
import com.zg.framework.aspectj.lang.enums.BusinessType; import com.zg.framework.aspectj.lang.enums.BusinessType;
import com.zg.project.Inventory.AutoInventory.domain.entity.PrintRfid; import com.zg.project.inventory.AutoInventory.domain.entity.PrintRfid;
import com.zg.project.Inventory.AutoInventory.service.IPrintRfidService; import com.zg.project.inventory.AutoInventory.service.IPrintRfidService;
import com.zg.framework.web.controller.BaseController; import com.zg.framework.web.controller.BaseController;
import com.zg.framework.web.domain.AjaxResult; import com.zg.framework.web.domain.AjaxResult;
import com.zg.common.utils.poi.ExcelUtil; import com.zg.common.utils.poi.ExcelUtil;

View File

@@ -1,11 +1,11 @@
package com.zg.project.Inventory.AutoInventory.mapper; package com.zg.project.inventory.AutoInventory.mapper;
import com.zg.project.Inventory.domain.dto.MatchScanPageDTO; import com.zg.project.inventory.domain.dto.MatchScanPageDTO;
import com.zg.project.Inventory.domain.entity.InventoryMatchScan; import com.zg.project.inventory.domain.entity.InventoryMatchScan;
import com.zg.project.Inventory.domain.entity.Sod; import com.zg.project.inventory.domain.entity.Sod;
import com.zg.project.Inventory.domain.vo.InventoryMatchScanSimpleVO; import com.zg.project.inventory.domain.vo.InventoryMatchScanSimpleVO;
import com.zg.project.Inventory.domain.vo.InventoryMatchScanVO; import com.zg.project.inventory.domain.vo.InventoryMatchScanVO;
import com.zg.project.Inventory.domain.vo.RkInfoMatchVO; import com.zg.project.inventory.domain.vo.RkInfoMatchVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;

View File

@@ -1,7 +1,7 @@
package com.zg.project.Inventory.AutoInventory.mapper; package com.zg.project.inventory.AutoInventory.mapper;
import java.util.List; import java.util.List;
import com.zg.project.Inventory.AutoInventory.domain.entity.PrintRfid; import com.zg.project.inventory.AutoInventory.domain.entity.PrintRfid;
/** /**
* 打印rfidMapper接口 * 打印rfidMapper接口

View File

@@ -1,9 +1,8 @@
package com.zg.project.Inventory.AutoInventory.mapper; package com.zg.project.inventory.AutoInventory.mapper;
import com.zg.project.Inventory.domain.dto.QueryDTO; import com.zg.project.inventory.domain.dto.QueryDTO;
import com.zg.project.Inventory.domain.entity.Sod; import com.zg.project.inventory.domain.entity.Sod;
import com.zg.project.Inventory.domain.vo.PcdeCntVO; import com.zg.project.inventory.domain.vo.SodVO;
import com.zg.project.Inventory.domain.vo.SodVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;

View File

@@ -1,7 +1,7 @@
package com.zg.project.Inventory.AutoInventory.service; package com.zg.project.inventory.AutoInventory.service;
import java.util.List; import java.util.List;
import com.zg.project.Inventory.AutoInventory.domain.entity.PrintRfid; import com.zg.project.inventory.AutoInventory.domain.entity.PrintRfid;
/** /**
* 打印rfidService接口 * 打印rfidService接口

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.AutoInventory.service; package com.zg.project.inventory.AutoInventory.service;
public interface IRfidService { public interface IRfidService {

View File

@@ -1,8 +1,7 @@
package com.zg.project.Inventory.AutoInventory.service; package com.zg.project.inventory.AutoInventory.service;
import com.zg.project.Inventory.domain.dto.QueryDTO; import com.zg.project.inventory.domain.dto.QueryDTO;
import com.zg.project.Inventory.domain.vo.ChartDataVO; import com.zg.project.inventory.domain.vo.SodVO;
import com.zg.project.Inventory.domain.vo.SodVO;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

View File

@@ -1,11 +1,9 @@
package com.zg.project.Inventory.AutoInventory.service; package com.zg.project.inventory.AutoInventory.service;
import com.zg.framework.web.page.TableDataInfo; import com.zg.project.inventory.domain.dto.MatchScanPageDTO;
import com.zg.project.Inventory.domain.dto.MatchScanPageDTO; import com.zg.project.inventory.domain.entity.InventoryMatchScan;
import com.zg.project.Inventory.domain.entity.InventoryMatchScan; import com.zg.project.inventory.domain.vo.InventoryMatchScanVO;
import com.zg.project.Inventory.domain.vo.InventoryMatchScanSimpleVO; import com.zg.project.inventory.domain.vo.RkInfoMatchVO;
import com.zg.project.Inventory.domain.vo.InventoryMatchScanVO;
import com.zg.project.Inventory.domain.vo.RkInfoMatchVO;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

View File

@@ -1,14 +1,12 @@
package com.zg.project.Inventory.AutoInventory.service.impl; package com.zg.project.inventory.AutoInventory.service.impl;
import com.zg.framework.web.page.TableDataInfo; import com.zg.project.inventory.Task.mapper.InventoryTaskMapper;
import com.zg.project.Inventory.Task.mapper.InventoryTaskMapper; import com.zg.project.inventory.domain.dto.MatchScanPageDTO;
import com.zg.project.Inventory.domain.dto.MatchScanPageDTO; import com.zg.project.inventory.domain.entity.InventoryMatchScan;
import com.zg.project.Inventory.domain.entity.InventoryMatchScan; import com.zg.project.inventory.AutoInventory.mapper.InventoryMatchScanMapper;
import com.zg.project.Inventory.AutoInventory.mapper.InventoryMatchScanMapper; import com.zg.project.inventory.AutoInventory.service.InventoryMatchScanService;
import com.zg.project.Inventory.AutoInventory.service.InventoryMatchScanService; import com.zg.project.inventory.domain.vo.InventoryMatchScanVO;
import com.zg.project.Inventory.domain.vo.InventoryMatchScanSimpleVO; import com.zg.project.inventory.domain.vo.RkInfoMatchVO;
import com.zg.project.Inventory.domain.vo.InventoryMatchScanVO;
import com.zg.project.Inventory.domain.vo.RkInfoMatchVO;
import com.zg.project.wisdom.mapper.RkInfoMapper; import com.zg.project.wisdom.mapper.RkInfoMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

View File

@@ -1,11 +1,11 @@
package com.zg.project.Inventory.AutoInventory.service.impl; package com.zg.project.inventory.AutoInventory.service.impl;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zg.project.Inventory.AutoInventory.mapper.PrintRfidMapper; import com.zg.project.inventory.AutoInventory.mapper.PrintRfidMapper;
import com.zg.project.Inventory.AutoInventory.domain.entity.PrintRfid; import com.zg.project.inventory.AutoInventory.domain.entity.PrintRfid;
import com.zg.project.Inventory.AutoInventory.service.IPrintRfidService; import com.zg.project.inventory.AutoInventory.service.IPrintRfidService;
/** /**
* 打印rfidService业务层处理 * 打印rfidService业务层处理

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.AutoInventory.service.impl; package com.zg.project.inventory.AutoInventory.service.impl;
import com.rfidread.Enumeration.eReadType; import com.rfidread.Enumeration.eReadType;
import com.rfidread.Interface.IAsynchronousMessage; import com.rfidread.Interface.IAsynchronousMessage;
@@ -6,7 +6,7 @@ import com.rfidread.Models.GPI_Model;
import com.rfidread.Models.Tag_Model; import com.rfidread.Models.Tag_Model;
import com.rfidread.RFIDReader; import com.rfidread.RFIDReader;
import com.zg.framework.websocket.config.WebSocketServer; import com.zg.framework.websocket.config.WebSocketServer;
import com.zg.project.Inventory.AutoInventory.service.IRfidService; import com.zg.project.inventory.AutoInventory.service.IRfidService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

View File

@@ -1,16 +1,14 @@
package com.zg.project.Inventory.AutoInventory.service.impl; package com.zg.project.inventory.AutoInventory.service.impl;
import com.zg.common.utils.PageUtils; import com.zg.common.utils.PageUtils;
import com.zg.framework.web.page.TableDataInfo; import com.zg.framework.web.page.TableDataInfo;
import com.zg.project.Inventory.domain.dto.QueryDTO; import com.zg.project.inventory.domain.dto.QueryDTO;
import com.zg.project.Inventory.domain.entity.InventoryMatchScan; import com.zg.project.inventory.domain.entity.InventoryMatchScan;
import com.zg.project.Inventory.domain.entity.Sod; import com.zg.project.inventory.domain.entity.Sod;
import com.zg.project.Inventory.domain.vo.ChartDataVO; import com.zg.project.inventory.domain.vo.SodVO;
import com.zg.project.Inventory.domain.vo.PcdeCntVO; import com.zg.project.inventory.AutoInventory.mapper.InventoryMatchScanMapper;
import com.zg.project.Inventory.domain.vo.SodVO; import com.zg.project.inventory.AutoInventory.mapper.SodMapper;
import com.zg.project.Inventory.AutoInventory.mapper.InventoryMatchScanMapper; import com.zg.project.inventory.AutoInventory.service.ISodService;
import com.zg.project.Inventory.AutoInventory.mapper.SodMapper;
import com.zg.project.Inventory.AutoInventory.service.ISodService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.AutoInventory.utils; package com.zg.project.inventory.AutoInventory.utils;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.AutoInventory.utils; package com.zg.project.inventory.AutoInventory.utils;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;

View File

@@ -1,8 +1,7 @@
package com.zg.project.Inventory.HdInventory; package com.zg.project.inventory.HdInventory;
import com.zg.framework.web.domain.AjaxResult; import com.zg.framework.web.domain.AjaxResult;
import com.zg.project.Inventory.AutoInventory.service.ISodService; import com.zg.project.inventory.domain.dto.QueryDTO;
import com.zg.project.Inventory.domain.dto.QueryDTO;
import com.zg.project.wisdom.service.IRkInfoService; import com.zg.project.wisdom.service.IRkInfoService;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -11,8 +10,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController @RestController
@RequestMapping("/HdInventory") @RequestMapping("/HdInventory")
public class HdInventoryController { public class HdInventoryController {

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.Task.controller; package com.zg.project.inventory.Task.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.zg.framework.aspectj.lang.annotation.Log; import com.zg.framework.aspectj.lang.annotation.Log;
import com.zg.framework.aspectj.lang.enums.BusinessType; import com.zg.framework.aspectj.lang.enums.BusinessType;
import com.zg.project.Inventory.domain.entity.InventoryTask; import com.zg.project.inventory.domain.entity.InventoryTask;
import com.zg.project.Inventory.Task.service.IInventoryTaskService; import com.zg.project.inventory.Task.service.IInventoryTaskService;
import com.zg.framework.web.controller.BaseController; import com.zg.framework.web.controller.BaseController;
import com.zg.framework.web.domain.AjaxResult; import com.zg.framework.web.domain.AjaxResult;
import com.zg.common.utils.poi.ExcelUtil; import com.zg.common.utils.poi.ExcelUtil;

View File

@@ -1,13 +1,10 @@
package com.zg.project.Inventory.Task.controller; package com.zg.project.inventory.Task.controller;
import com.zg.framework.aspectj.lang.annotation.Log;
import com.zg.framework.aspectj.lang.enums.BusinessType;
import com.zg.framework.web.controller.BaseController; import com.zg.framework.web.controller.BaseController;
import com.zg.framework.web.domain.AjaxResult; import com.zg.framework.web.domain.AjaxResult;
import com.zg.project.Inventory.Task.service.IInventoryTaskService; import com.zg.project.inventory.Task.service.IInventoryTaskService;
import com.zg.project.wisdom.service.IRkInfoService; import com.zg.project.wisdom.service.IRkInfoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@RestController @RestController

View File

@@ -1,7 +1,7 @@
package com.zg.project.Inventory.Task.mapper; package com.zg.project.inventory.Task.mapper;
import java.util.List; import java.util.List;
import com.zg.project.Inventory.domain.entity.InventoryTask; import com.zg.project.inventory.domain.entity.InventoryTask;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**

View File

@@ -1,7 +1,7 @@
package com.zg.project.Inventory.Task.service; package com.zg.project.inventory.Task.service;
import java.util.List; import java.util.List;
import com.zg.project.Inventory.domain.entity.InventoryTask; import com.zg.project.inventory.domain.entity.InventoryTask;
/** /**
* 盘点任务Service接口 * 盘点任务Service接口

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.Task.service.impl; package com.zg.project.inventory.Task.service.impl;
import java.util.List; import java.util.List;
@@ -6,9 +6,9 @@ import com.zg.common.utils.DateUtils;
import com.zg.common.utils.SecurityUtils; import com.zg.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zg.project.Inventory.Task.mapper.InventoryTaskMapper; import com.zg.project.inventory.Task.mapper.InventoryTaskMapper;
import com.zg.project.Inventory.domain.entity.InventoryTask; import com.zg.project.inventory.domain.entity.InventoryTask;
import com.zg.project.Inventory.Task.service.IInventoryTaskService; import com.zg.project.inventory.Task.service.IInventoryTaskService;
/** /**
* 盘点任务Service业务层处理 * 盘点任务Service业务层处理

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.domain.dto; package com.zg.project.inventory.domain.dto;
import lombok.Data; import lombok.Data;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.domain.dto; package com.zg.project.inventory.domain.dto;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.domain.dto; package com.zg.project.inventory.domain.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

View File

@@ -1,13 +1,10 @@
package com.zg.project.Inventory.domain.entity; package com.zg.project.inventory.domain.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zg.framework.aspectj.lang.annotation.Excel; import com.zg.framework.aspectj.lang.annotation.Excel;
import com.zg.framework.web.domain.BaseEntity; import com.zg.framework.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/** /**
* 盘点匹配数据记录表 InventoryMatchScan * 盘点匹配数据记录表 InventoryMatchScan
* *

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.domain.entity; package com.zg.project.inventory.domain.entity;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@@ -21,12 +21,12 @@ public class InventoryTask extends BaseEntity {
@Excel(name = "任务名称") @Excel(name = "任务名称")
private String taskName; private String taskName;
/** 仓库ID */ /** 所属小仓编码warehouse_code */
@Excel(name = "仓库ID") @Excel(name = "所属小仓编码")
private String warehouseId; private String warehouseCode;
/** 场景ID */ /** 场景编码scene_code */
@Excel(name = "场景ID") @Excel(name = "场景编码")
private String sceneId; private String sceneId;
/** 执行人用户ID */ /** 执行人用户ID */
@@ -68,7 +68,7 @@ public class InventoryTask extends BaseEntity {
/** 执行人姓名(扩展字段) */ /** 执行人姓名(扩展字段) */
private String userName; private String userName;
/** 仓名称(扩展字段) */ /** 仓名称(扩展字段) */
private String warehouseName; private String warehouseName;
/** 场景名称(扩展字段) */ /** 场景名称(扩展字段) */
@@ -82,8 +82,8 @@ public class InventoryTask extends BaseEntity {
public String getTaskName() { return taskName; } public String getTaskName() { return taskName; }
public void setTaskName(String taskName) { this.taskName = taskName; } public void setTaskName(String taskName) { this.taskName = taskName; }
public String getWarehouseId() { return warehouseId; } public String getWarehouseCode() { return warehouseCode; }
public void setWarehouseId(String warehouseId) { this.warehouseId = warehouseId; } public void setWarehouseCode(String warehouseCode) { this.warehouseCode = warehouseCode; }
public String getSceneId() { return sceneId; } public String getSceneId() { return sceneId; }
public void setSceneId(String sceneId) { this.sceneId = sceneId; } public void setSceneId(String sceneId) { this.sceneId = sceneId; }
@@ -129,7 +129,7 @@ public class InventoryTask extends BaseEntity {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("taskName", getTaskName()) .append("taskName", getTaskName())
.append("warehouseId", getWarehouseId()) .append("warehouseCode", getWarehouseCode())
.append("warehouseName", getWarehouseName()) .append("warehouseName", getWarehouseName())
.append("sceneId", getSceneId()) .append("sceneId", getSceneId())
.append("sceneName", getSceneName()) .append("sceneName", getSceneName())

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.AutoInventory.domain.entity; package com.zg.project.inventory.AutoInventory.domain.entity;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.domain.entity; package com.zg.project.inventory.domain.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.domain.vo; package com.zg.project.inventory.domain.vo;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.domain.vo; package com.zg.project.inventory.domain.vo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.domain.vo; package com.zg.project.inventory.domain.vo;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.domain.vo; package com.zg.project.inventory.domain.vo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.domain.vo; package com.zg.project.inventory.domain.vo;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.domain.vo; package com.zg.project.inventory.domain.vo;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.domain.vo; package com.zg.project.inventory.domain.vo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.zg.project.Inventory.domain.vo; package com.zg.project.inventory.domain.vo;
import lombok.Data; import lombok.Data;

View File

@@ -46,12 +46,57 @@ public class RkInfoController extends BaseController
*/ */
// @PreAuthorize("@ss.hasPermi('wisdom:stock:list')") // @PreAuthorize("@ss.hasPermi('wisdom:stock:list')")
@PostMapping("/list") @PostMapping("/list")
public TableDataInfo list(@RequestBody RkInfoQueryDTO rkInfo) { public TableDataInfo list(@RequestBody RkInfoQueryDTO query) {
PageHelper.startPage(rkInfo.getPageNum(), rkInfo.getPageSize()); PageHelper.startPage(
List<RkInfo> list = rkInfoService.selectRkInfoList(rkInfo); query.getPageNum() == null ? 1 : query.getPageNum(),
query.getPageSize() == null ? 10 : query.getPageSize()
);
List<RkInfo> list = rkInfoService.selectRkInfoList(query);
return getDataTable(list); return getDataTable(list);
} }
@PostMapping("/borrow/list")
public TableDataInfo borrowList(@RequestBody RkInfoQueryDTO query) {
PageHelper.startPage(
query.getPageNum() == null ? 1 : query.getPageNum(),
query.getPageSize() == null ? 10 : query.getPageSize()
);
List<RkInfo> list = rkInfoService.selectBorrowAndReturnList(query);
return getDataTable(list);
}
@PostMapping("/pageStatistics")
public Map<String, Object> pageStatistics(@RequestBody RkInfoQueryDTO dto) {
// 使用 PageHelper 分页
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
List<RkInfo> list = rkInfoService.selectAllRkInfo(dto);
// 统计金额
Long sumMoney = rkInfoService.selectStatistics(dto);
// 统计库位
Long pcdeCount = rkInfoService.selectPcde(dto);
Map<String,Object> dataInfo = new HashMap<>();
dataInfo.put("dataList",getDataTable(list));
dataInfo.put("sumMoney",sumMoney);
dataInfo.put("pcdeCount",pcdeCount);
return dataInfo;
}
/**
* 单据头信息:根据入库单号查询公共字段
*/
@PreAuthorize("@ss.hasPermi('wisdom:stock:query')")
@GetMapping("/header/{billNo}")
public AjaxResult getHeaderByBillNo(@PathVariable String billNo) {
RkInfo header = rkInfoService.selectHeaderByBillNo(billNo);
return success(header);
}
@GetMapping("/pcode/{pcode}") @GetMapping("/pcode/{pcode}")
public AjaxResult listRkInfoByPcode(@PathVariable String pcode) { public AjaxResult listRkInfoByPcode(@PathVariable String pcode) {
List<RkInfo> rows = rkInfoService.listRkInfoByPcode(pcode); List<RkInfo> rows = rkInfoService.listRkInfoByPcode(pcode);
@@ -230,7 +275,6 @@ public class RkInfoController extends BaseController
*/ */
@GetMapping("/delivery/list") @GetMapping("/delivery/list")
public AjaxResult listDelivery(RkInfo query) { public AjaxResult listDelivery(RkInfo query) {
// 保险起见,这里强制条件(也可以在 service 里写死)
query.setIsChuku("1"); query.setIsChuku("1");
query.setIsDelivery("1"); query.setIsDelivery("1");
List<DeliveryBillVO> list = rkInfoService.selectDeliveryBillList(query); List<DeliveryBillVO> list = rkInfoService.selectDeliveryBillList(query);
@@ -258,24 +302,6 @@ public class RkInfoController extends BaseController
} }
@PostMapping("/pageStatistics")
public Map<String, Object> pageStatistics(@RequestBody(required = false) RkInfoQueryDTO dto) {
// 使用 PageHelper 分页
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
List<RkInfo> list = rkInfoService.selectAllRkInfo(dto);
// 统计金额
Long sumMoney = rkInfoService.selectStatistics(dto);
// 统计库位
Long pcdeCount = rkInfoService.selectPcde(dto);
Map<String,Object> dataInfo = new HashMap<>();
dataInfo.put("dataList",getDataTable(list));
dataInfo.put("sumMoney",sumMoney);
dataInfo.put("pcdeCount",pcdeCount);
return dataInfo;
}
// 根据玉田需求,新添加的接口 // 根据玉田需求,新添加的接口
@PreAuthorize("@ss.hasPermi('wisdom:stock:edit')") @PreAuthorize("@ss.hasPermi('wisdom:stock:edit')")
@PostMapping("/editBill") @PostMapping("/editBill")

View File

@@ -17,8 +17,7 @@ import com.zg.framework.web.domain.BaseEntity;
* @author zg * @author zg
* @date 2025-05-28 * @date 2025-05-28
*/ */
public class RkInfo extends BaseEntity public class RkInfo extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 模糊搜索关键字(项目号、项目描述、物料号、物料描述、供应商编码、供应商名称,订单编号) */ /** 模糊搜索关键字(项目号、项目描述、物料号、物料描述、供应商编码、供应商名称,订单编号) */
@@ -48,7 +47,7 @@ public class RkInfo extends BaseEntity
/** 物资类型 */ /** 物资类型 */
private String wlType; private String wlType;
/** 所属仓库 */ /** 所属仓库(原始字段,表里存的仓库编码) */
private String cangku; private String cangku;
/** 多状态查询:是否出库(如 0=入库, 1=出库 等) */ /** 多状态查询:是否出库(如 0=入库, 1=出库 等) */
@@ -63,10 +62,34 @@ public class RkInfo extends BaseEntity
@Excel(name = "物资类型名称") @Excel(name = "物资类型名称")
private String wlTypeName; private String wlTypeName;
/** 所属仓库名称(联查显示用,导出专用) */ /** 所属仓库名称(联查显示用,导出专用,对应 cangku */
@Excel(name = "所属仓库名称") @Excel(name = "所属仓库名称")
private String cangkuName; private String cangkuName;
/* ================== 新增:大仓 / 小仓信息(非 rk_info 表字段,联查 pcde_detail + warehouse_info ================== */
/** 所属大仓编码 */
@TableField(exist = false)
@Excel(name = "所属大仓编码")
private String parentWarehouseCode;
/** 所属大仓名称 */
@TableField(exist = false)
@Excel(name = "所属大仓名称")
private String parentWarehouseName;
/** 所属小仓编码 */
@TableField(exist = false)
@Excel(name = "所属小仓编码")
private String warehouseCode;
/** 所属小仓名称 */
@TableField(exist = false)
@Excel(name = "所属小仓名称")
private String warehouseName;
/* =============================================================================================================== */
/** 入库时间(用户操作入库的日期) */ /** 入库时间(用户操作入库的日期) */
@Excel(name = "入库时间", dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "入库时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date rkTime; private Date rkTime;
@@ -88,7 +111,7 @@ public class RkInfo extends BaseEntity
/** 理货员名称(联查显示用,导出专用) */ /** 理货员名称(联查显示用,导出专用) */
private String lihuoYName; private String lihuoYName;
/** 是否已出库0未出1已出库 */ /** 是否已出库0已入1已出库2待审批3借料出库4入库撤销5出库撤销 */
@Excel(name = "是否已出库", readConverterExp = "0已入库1已出库2待审批3借料出库4入库撤销5出库撤销") @Excel(name = "是否已出库", readConverterExp = "0已入库1已出库2待审批3借料出库4入库撤销5出库撤销")
private String isChuku; private String isChuku;
@@ -100,7 +123,7 @@ public class RkInfo extends BaseEntity
@Excel(name = "出库单据号") @Excel(name = "出库单据号")
private String billNoCk; private String billNoCk;
/** 是否需要配送(0否 1是) */ /** 是否需要配送(0否 1是 2配送中 3配送完成) */
@Excel(name = "是否需要配送", readConverterExp = "0=否,1=是,2=配送中,3=配送完成") @Excel(name = "是否需要配送", readConverterExp = "0=否,1=是,2=配送中,3=配送完成")
private String isDelivery; private String isDelivery;
@@ -170,11 +193,11 @@ public class RkInfo extends BaseEntity
@Excel(name = "实际入库数量") @Excel(name = "实际入库数量")
private BigDecimal realQty; private BigDecimal realQty;
/** 库位码 */ /** 库位码(编码) */
@Excel(name = "库位码") @Excel(name = "库位码")
private String pcode; private String pcode;
/** 库位主键ID */ /** 库位主键IDpcde_detail.id */
@Excel(name = "库位主键ID") @Excel(name = "库位主键ID")
private String pcodeId; private String pcodeId;
@@ -186,7 +209,7 @@ public class RkInfo extends BaseEntity
@Excel(name = "实物ID") @Excel(name = "实物ID")
private String entityId; private String entityId;
/** 一货一图 - 货物照片URL */ /** 一货一图 - 货物照片URL(非表字段) */
@TableField(exist = false) @TableField(exist = false)
private String photoUrl; private String photoUrl;
@@ -217,15 +240,15 @@ public class RkInfo extends BaseEntity
@Excel(name = "是否移库过") @Excel(name = "是否移库过")
private String hasMoved; private String hasMoved;
/** 是否借料0否 1是 */ /** 是否借料0否 1是 2已归还 */
@Excel(name = "是否借料", readConverterExp = "0=否,1=是,2=已归还") @Excel(name = "是否借料", readConverterExp = "0=否,1=是,2=已归还")
private String isBorrowed; private String isBorrowed;
/** 签字图片URLimage_type = 0 */ /** 签字图片URLimage_type = sign非表字段 */
@TableField(exist = false) @TableField(exist = false)
private String signImageUrl; private String signImageUrl;
/** 现场图片URLimage_type = 1 */ /** 现场图片URLimage_type = photo非表字段 */
@TableField(exist = false) @TableField(exist = false)
private String scenePhotoUrl; private String scenePhotoUrl;
@@ -233,20 +256,20 @@ public class RkInfo extends BaseEntity
@TableField(exist = false) @TableField(exist = false)
private String auditResult; private String auditResult;
/** 开始时间 */ /** 开始时间(查询条件) */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime; private Date startTime;
/** 结束时间 */ /** 结束时间(查询条件) */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime; private Date endTime;
/** 领用开始时间 */ /** 领用开始时间(查询条件) */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@TableField(exist = false) @TableField(exist = false)
private Date lyStartTime; private Date lyStartTime;
/** 领用结束时间 */ /** 领用结束时间(查询条件) */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@TableField(exist = false) @TableField(exist = false)
private Date lyEndTime; private Date lyEndTime;
@@ -262,63 +285,67 @@ public class RkInfo extends BaseEntity
/** 是否删除0 表示正常1 表示已删除) */ /** 是否删除0 表示正常1 表示已删除) */
private String isDelete; private String isDelete;
// Getter Setter 方法 /* ======================= Getter / Setter ======================= */
public String getKeyword() { return keyword; } public String getKeyword() { return keyword; }
public void setKeyword(String keyword) { this.keyword = keyword; } public void setKeyword(String keyword) { this.keyword = keyword; }
public Long getId() { return id; } public Long getId() { return id; }
public void setId(Long id) { this.id = id; } public void setId(Long id) { this.id = id; }
public List<Long> getIds() { public List<Long> getIds() { return ids; }
return ids; public void setIds(List<Long> ids) { this.ids = ids; }
}
public void setIds(List<Long> ids) { public Long getGysJhId() { return gysJhId; }
this.ids = ids; public void setGysJhId(Long gysJhId) { this.gysJhId = gysJhId; }
}
public Long getGysJhId() {
return gysJhId;
}
public void setGysJhId(Long gysJhId) { public String getApproverId() { return approverId; }
this.gysJhId = gysJhId; public void setApproverId(String approverId) { this.approverId = approverId; }
}
public String getApproverId() {
return approverId;
}
public void setApproverId(String approverId) {
this.approverId = approverId;
}
public Long getStockAge() { return stockAge; } public Long getStockAge() { return stockAge; }
public void setStockAge(Long stockAge) { this.stockAge = stockAge; } public void setStockAge(Long stockAge) { this.stockAge = stockAge; }
public String getRkType() { return rkType; } public String getRkType() { return rkType; }
public void setRkType(String rkType) { this.rkType = rkType; } public void setRkType(String rkType) { this.rkType = rkType; }
public String getWlType() { return wlType; } public String getWlType() { return wlType; }
public void setWlType(String wlType) { this.wlType = wlType; } public void setWlType(String wlType) { this.wlType = wlType; }
public String getCangku() { return cangku; } public String getCangku() { return cangku; }
public void setCangku(String cangku) { this.cangku = cangku; } public void setCangku(String cangku) { this.cangku = cangku; }
public List<String> getIsChukuList() { return isChukuList; }
public void setIsChukuList(List<String> isChukuList) { this.isChukuList = isChukuList; }
public String getRkTypeName() { return rkTypeName; } public String getRkTypeName() { return rkTypeName; }
public void setRkTypeName(String rkTypeName) { this.rkTypeName = rkTypeName; } public void setRkTypeName(String rkTypeName) { this.rkTypeName = rkTypeName; }
public String getWlTypeName() { return wlTypeName; } public String getWlTypeName() { return wlTypeName; }
public void setWlTypeName(String wlTypeName) { this.wlTypeName = wlTypeName; } public void setWlTypeName(String wlTypeName) { this.wlTypeName = wlTypeName; }
public String getCangkuName() { return cangkuName; } public String getCangkuName() { return cangkuName; }
public void setCangkuName(String cangkuName) { this.cangkuName = cangkuName; } public void setCangkuName(String cangkuName) { this.cangkuName = cangkuName; }
public String getParentWarehouseCode() { return parentWarehouseCode; }
public void setParentWarehouseCode(String parentWarehouseCode) { this.parentWarehouseCode = parentWarehouseCode; }
public String getParentWarehouseName() { return parentWarehouseName; }
public void setParentWarehouseName(String parentWarehouseName) { this.parentWarehouseName = parentWarehouseName; }
public String getWarehouseCode() { return warehouseCode; }
public void setWarehouseCode(String warehouseCode) { this.warehouseCode = warehouseCode; }
public String getWarehouseName() { return warehouseName; }
public void setWarehouseName(String warehouseName) { this.warehouseName = warehouseName; }
public Date getRkTime() { return rkTime; } public Date getRkTime() { return rkTime; }
public void setRkTime(Date rkTime) { this.rkTime = rkTime; } public void setRkTime(Date rkTime) { this.rkTime = rkTime; }
public Date getBorrowTime() {
return borrowTime;
}
public void setBorrowTime(Date borrowTime) {
this.borrowTime = borrowTime;
}
public Date getReturnTime() { public Date getBorrowTime() { return borrowTime; }
return returnTime; public void setBorrowTime(Date borrowTime) { this.borrowTime = borrowTime; }
}
public void setReturnTime(Date returnTime) { public Date getReturnTime() { return returnTime; }
this.returnTime = returnTime; public void setReturnTime(Date returnTime) { this.returnTime = returnTime; }
}
public String getLihuoY() { return lihuoY; } public String getLihuoY() { return lihuoY; }
public void setLihuoY(String lihuoY) { this.lihuoY = lihuoY; } public void setLihuoY(String lihuoY) { this.lihuoY = lihuoY; }
@@ -326,199 +353,158 @@ public class RkInfo extends BaseEntity
public String getLihuoYName() { return lihuoYName; } public String getLihuoYName() { return lihuoYName; }
public void setLihuoYName(String lihuoYName) { this.lihuoYName = lihuoYName; } public void setLihuoYName(String lihuoYName) { this.lihuoYName = lihuoYName; }
public List<String> getIsChukuList() {
return isChukuList;
}
public void setIsChukuList(List<String> isChukuList) {
this.isChukuList = isChukuList;
}
public String getIsChuku() { return isChuku; } public String getIsChuku() { return isChuku; }
public void setIsChuku(String isChuku) { this.isChuku = isChuku; } public void setIsChuku(String isChuku) { this.isChuku = isChuku; }
public String getBillNo() { return billNo; } public String getBillNo() { return billNo; }
public void setBillNo(String billNo) { this.billNo = billNo; } public void setBillNo(String billNo) { this.billNo = billNo; }
public String getBillNoCk() { return billNoCk; } public String getBillNoCk() { return billNoCk; }
public void setBillNoCk(String billNoCk) { this.billNoCk = billNoCk; } public void setBillNoCk(String billNoCk) { this.billNoCk = billNoCk; }
public String getIsDelivery() { return isDelivery; }
public void setIsDelivery(String isDelivery) { this.isDelivery = isDelivery; }
public String getXj() { return xj; } public String getXj() { return xj; }
public void setXj(String xj) { this.xj = xj; } public void setXj(String xj) { this.xj = xj; }
public String getXmNo() { return xmNo; } public String getXmNo() { return xmNo; }
public void setXmNo(String xmNo) { this.xmNo = xmNo; } public void setXmNo(String xmNo) { this.xmNo = xmNo; }
public String getXmMs() { return xmMs; } public String getXmMs() { return xmMs; }
public void setXmMs(String xmMs) { this.xmMs = xmMs; } public void setXmMs(String xmMs) { this.xmMs = xmMs; }
public String getXmNoCk() { return xmNoCk; }
public void setXmNoCk(String xmNoCk) { this.xmNoCk = xmNoCk; }
public String getXmMsCk() { return xmMsCk; }
public void setXmMsCk(String xmMsCk) { this.xmMsCk = xmMsCk; }
public String getWlNo() { return wlNo; } public String getWlNo() { return wlNo; }
public void setWlNo(String wlNo) { this.wlNo = wlNo; } public void setWlNo(String wlNo) { this.wlNo = wlNo; }
public String getWlMs() { return wlMs; } public String getWlMs() { return wlMs; }
public void setWlMs(String wlMs) { this.wlMs = wlMs; } public void setWlMs(String wlMs) { this.wlMs = wlMs; }
public String getGysNo() { return gysNo; } public String getGysNo() { return gysNo; }
public void setGysNo(String gysNo) { this.gysNo = gysNo; } public void setGysNo(String gysNo) { this.gysNo = gysNo; }
public String getGysMc() { return gysMc; } public String getGysMc() { return gysMc; }
public void setGysMc(String gysMc) { this.gysMc = gysMc; } public void setGysMc(String gysMc) { this.gysMc = gysMc; }
public BigDecimal getJhAmt() { return jhAmt; } public BigDecimal getJhAmt() { return jhAmt; }
public void setJhAmt(BigDecimal jhAmt) { this.jhAmt = jhAmt; } public void setJhAmt(BigDecimal jhAmt) { this.jhAmt = jhAmt; }
public BigDecimal getHtDj() { return htDj; } public BigDecimal getHtDj() { return htDj; }
public void setHtDj(BigDecimal htDj) { this.htDj = htDj; } public void setHtDj(BigDecimal htDj) { this.htDj = htDj; }
public String getSapNo() { return sapNo; } public String getSapNo() { return sapNo; }
public void setSapNo(String sapNo) { this.sapNo = sapNo; } public void setSapNo(String sapNo) { this.sapNo = sapNo; }
public String getXh() { return xh; } public String getXh() { return xh; }
public void setXh(String xh) { this.xh = xh; } public void setXh(String xh) { this.xh = xh; }
public Long getJhQty() { return jhQty; } public Long getJhQty() { return jhQty; }
public void setJhQty(Long jhQty) { this.jhQty = jhQty; } public void setJhQty(Long jhQty) { this.jhQty = jhQty; }
public Long getHtQty() { return htQty; } public Long getHtQty() { return htQty; }
public void setHtQty(Long htQty) { this.htQty = htQty; } public void setHtQty(Long htQty) { this.htQty = htQty; }
public String getDw() { return dw; } public String getDw() { return dw; }
public void setDw(String dw) { this.dw = dw; } public void setDw(String dw) { this.dw = dw; }
public BigDecimal getRealQty() { return realQty; } public BigDecimal getRealQty() { return realQty; }
public void setRealQty(BigDecimal realQty) { this.realQty = realQty; } public void setRealQty(BigDecimal realQty) { this.realQty = realQty; }
public String getPcode() { return pcode; } public String getPcode() { return pcode; }
public void setPcode(String pcode) { this.pcode = pcode; } public void setPcode(String pcode) { this.pcode = pcode; }
public String getPcodeId() { return pcodeId; } public String getPcodeId() { return pcodeId; }
public void setPcodeId(String pcodeId) { this.pcodeId = pcodeId; } public void setPcodeId(String pcodeId) { this.pcodeId = pcodeId; }
public String getTrayCode() { return trayCode; } public String getTrayCode() { return trayCode; }
public void setTrayCode(String trayCode) { this.trayCode = trayCode; } public void setTrayCode(String trayCode) { this.trayCode = trayCode; }
public String getEntityId() { return entityId; } public String getEntityId() { return entityId; }
public void setEntityId(String entityId) { this.entityId = entityId; } public void setEntityId(String entityId) { this.entityId = entityId; }
public String getPhotoUrl() {
return photoUrl;
}
public void setPhotoUrl(String photoUrl) { public String getPhotoUrl() { return photoUrl; }
this.photoUrl = photoUrl; public void setPhotoUrl(String photoUrl) { this.photoUrl = photoUrl; }
}
public String getCkLihuoY() { return ckLihuoY; } public String getCkLihuoY() { return ckLihuoY; }
public void setCkLihuoY(String ckLihuoY) { this.ckLihuoY = ckLihuoY; } public void setCkLihuoY(String ckLihuoY) { this.ckLihuoY = ckLihuoY; }
public String getCkType() { return ckType; } public String getCkType() { return ckType; }
public void setCkType(String ckType) { this.ckType = ckType; } public void setCkType(String ckType) { this.ckType = ckType; }
public String getCkTypeName() { return ckTypeName; } public String getCkTypeName() { return ckTypeName; }
public void setCkTypeName(String ckTypeName) { this.ckTypeName = ckTypeName; } public void setCkTypeName(String ckTypeName) { this.ckTypeName = ckTypeName; }
public String getTeamCode() { return teamCode; } public String getTeamCode() { return teamCode; }
public void setTeamCode(String teamCode) { this.teamCode = teamCode; } public void setTeamCode(String teamCode) { this.teamCode = teamCode; }
public String getTeamName() { return teamName; } public String getTeamName() { return teamName; }
public void setTeamName(String teamName) { this.teamName = teamName; } public void setTeamName(String teamName) { this.teamName = teamName; }
public Date getLyTime() { return lyTime; } public Date getLyTime() { return lyTime; }
public void setLyTime(Date lyTime) { this.lyTime = lyTime; } public void setLyTime(Date lyTime) { this.lyTime = lyTime; }
public String getCkRemark() { return ckRemark; } public String getCkRemark() { return ckRemark; }
public void setCkRemark(String ckRemark) { this.ckRemark = ckRemark; } public void setCkRemark(String ckRemark) { this.ckRemark = ckRemark; }
public String getStatus() { return status; } public String getStatus() { return status; }
public void setStatus(String status) { this.status = status; } public void setStatus(String status) { this.status = status; }
public String getHasMoved() { return hasMoved; } public String getHasMoved() { return hasMoved; }
public void setHasMoved(String hasMoved) { this.hasMoved = hasMoved; } public void setHasMoved(String hasMoved) { this.hasMoved = hasMoved; }
public String getXmNoCk() {
return xmNoCk;
}
public void setXmNoCk(String xmNoCk) { public String getIsBorrowed() { return isBorrowed; }
this.xmNoCk = xmNoCk; public void setIsBorrowed(String isBorrowed) { this.isBorrowed = isBorrowed; }
}
public String getXmMsCk() { public String getSignImageUrl() { return signImageUrl; }
return xmMsCk; public void setSignImageUrl(String signImageUrl) { this.signImageUrl = signImageUrl; }
}
public void setXmMsCk(String xmMsCk) { public String getScenePhotoUrl() { return scenePhotoUrl; }
this.xmMsCk = xmMsCk; public void setScenePhotoUrl(String scenePhotoUrl) { this.scenePhotoUrl = scenePhotoUrl; }
}
public Date getStartTime() { public String getAuditResult() { return auditResult; }
return startTime; public void setAuditResult(String auditResult) { this.auditResult = auditResult; }
}
public void setStartTime(Date startTime) { public Date getStartTime() { return startTime; }
this.startTime = startTime; public void setStartTime(Date startTime) { this.startTime = startTime; }
}
public Date getEndTime() { public Date getEndTime() { return endTime; }
return endTime; public void setEndTime(Date endTime) { this.endTime = endTime; }
}
public void setEndTime(Date endTime) { public Date getLyStartTime() { return lyStartTime; }
this.endTime = endTime; public void setLyStartTime(Date lyStartTime) { this.lyStartTime = lyStartTime; }
}
public Date getLyStartTime() { public Date getLyEndTime() { return lyEndTime; }
return lyStartTime; public void setLyEndTime(Date lyEndTime) { this.lyEndTime = lyEndTime; }
}
public void setLyStartTime(Date lyStartTime) { public String getFycde1() { return fycde1; }
this.lyStartTime = lyStartTime; public void setFycde1(String fycde1) { this.fycde1 = fycde1; }
}
public Date getLyEndTime() { public String getFycde2() { return fycde2; }
return lyEndTime; public void setFycde2(String fycde2) { this.fycde2 = fycde2; }
}
public void setLyEndTime(Date lyEndTime) {
this.lyEndTime = lyEndTime;
}
public String getIsBorrowed() {
return isBorrowed;
}
public void setIsBorrowed(String isBorrowed) {
this.isBorrowed = isBorrowed;
}
public String getSignImageUrl() {
return signImageUrl;
}
public void setSignImageUrl(String signImageUrl) {
this.signImageUrl = signImageUrl;
}
public String getScenePhotoUrl() {
return scenePhotoUrl;
}
public void setScenePhotoUrl(String scenePhotoUrl) {
this.scenePhotoUrl = scenePhotoUrl;
}
public String getAuditResult() {
return auditResult;
}
public void setAuditResult(String auditResult) {
this.auditResult = auditResult;
}
public String getFycde1() {
return fycde1;
}
public void setFycde1(String fycde1) {
this.fycde1 = fycde1;
}
public String getFycde2() {
return fycde2;
}
public void setFycde2(String fycde2) {
this.fycde2 = fycde2;
}
public String getIsDelete() { return isDelete; } public String getIsDelete() { return isDelete; }
public void setIsDelete(String isDelete) { this.isDelete = isDelete; } public void setIsDelete(String isDelete) { this.isDelete = isDelete; }
public String getIsDelivery() {
return isDelivery;
}
public void setIsDelivery(String isDelivery) {
this.isDelivery = isDelivery;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("gysJhId", getGysJhId()) .append("gysJhId", getGysJhId())
.append("approverId", getApproverId()) .append("approverId", getApproverId())
.append("rkType", getRkType()) .append("rkType", getRkType())
.append("wlType", getWlType()) .append("wlType", getWlType())
.append("cangku", getCangku()) .append("cangku", getCangku())
.append("cangkuName", getCangkuName())
.append("parentWarehouseCode", getParentWarehouseCode())
.append("parentWarehouseName", getParentWarehouseName())
.append("warehouseCode", getWarehouseCode())
.append("warehouseName", getWarehouseName())
.append("rkTime", getRkTime()) .append("rkTime", getRkTime())
.append("borrowTime", getBorrowTime()) .append("borrowTime", getBorrowTime())
.append("returnTime", getReturnTime()) .append("returnTime", getReturnTime())

View File

@@ -11,6 +11,7 @@ import java.util.List;
@Data @Data
public class PcRkInfoBatchDTO { public class PcRkInfoBatchDTO {
/** 要追加到的入库单据号(必填) */ /** 要追加到的入库单据号(必填) */
private String billNo; private String billNo;
@@ -26,8 +27,17 @@ public class PcRkInfoBatchDTO {
/** 理货员 */ /** 理货员 */
private String lihuoY; private String lihuoY;
/** 所属库 */ /** 所属大仓编码(父仓,对应 warehouse_info.parent_warehouse_code——只用于选择不直接落库 */
private String cangku; private String parentWarehouseCode;
/** 所属大仓名称(冗余展示,可选) */
private String parentWarehouseName;
/** 所属小仓编码(真正落到 rk_info.cangku 的字段) */
private String warehouseCode;
/** 所属小仓名称(冗余展示,可选) */
private String warehouseName;
/** 入库记录列表(每条为完整入库项) */ /** 入库记录列表(每条为完整入库项) */
private List<PcRkInfoItemDTO> rkList; private List<PcRkInfoItemDTO> rkList;
@@ -37,6 +47,5 @@ public class PcRkInfoBatchDTO {
// zhangjinbo 根据玉田需求 添加入库时间 // zhangjinbo 根据玉田需求 添加入库时间
private Date rkTime; private Date rkTime;
} }

View File

@@ -21,6 +21,19 @@ public class RkInfoBatchDTO {
/** 所属仓库 */ /** 所属仓库 */
private String cangku; private String cangku;
/** 大仓编码 */
private String parentWarehouseCode;
/** 大仓名称(前端展示用,不落表) */
private String parentWarehouseName;
/** 小仓编码warehouse_info.warehouse_code——真正落到 rk_info.cangku 的值 */
private String warehouseCode;
/** 小仓名称(前端展示用,不落表) */
private String warehouseName;
/** 入库物料列表 */ /** 入库物料列表 */
private List<RkInfoItemDTO> rkList; private List<RkInfoItemDTO> rkList;

View File

@@ -20,10 +20,10 @@ public class RkInfoQueryDTO extends RkInfo {
private Integer pageSize; private Integer pageSize;
/** 开始时间 */ /** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date statDate; private Date statDate;
/** 结束时间 */ /** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date endDate; private Date endDate;
} }

View File

@@ -2,11 +2,10 @@ package com.zg.project.wisdom.mapper;
import java.util.List; import java.util.List;
import com.zg.project.Inventory.domain.vo.PcdeCntVO; import com.zg.project.inventory.domain.vo.PcdeCntVO;
import com.zg.project.Inventory.domain.vo.RkInfoMatchVO; import com.zg.project.inventory.domain.vo.RkInfoMatchVO;
import com.zg.project.wisdom.domain.RkInfo; import com.zg.project.wisdom.domain.RkInfo;
import com.zg.project.wisdom.domain.dto.RkInfoQueryDTO; import com.zg.project.wisdom.domain.dto.RkInfoQueryDTO;
import com.zg.project.wisdom.domain.vo.PcodeQtyVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
@@ -245,4 +244,12 @@ public interface RkInfoMapper
* 查询出库单据 * 查询出库单据
*/ */
List<RkInfo> selectDeliveryCkList(@Param("q") RkInfo query); List<RkInfo> selectDeliveryCkList(@Param("q") RkInfo query);
/**
* 借料 / 还料专用列表查询
*/
List<RkInfo> selectBorrowAndReturnList(RkInfo rkInfo);
RkInfo selectHeaderByBillNo(String billNo);
} }

View File

@@ -1,14 +1,12 @@
package com.zg.project.wisdom.service; package com.zg.project.wisdom.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.zg.project.Inventory.domain.dto.QueryDTO; import com.zg.project.inventory.domain.dto.QueryDTO;
import com.zg.project.Inventory.domain.vo.ChartDataVO; import com.zg.project.inventory.domain.vo.ChartDataVO;
import com.zg.project.wisdom.domain.RkInfo; import com.zg.project.wisdom.domain.RkInfo;
import com.zg.project.wisdom.domain.dto.*; import com.zg.project.wisdom.domain.dto.*;
import com.zg.project.wisdom.domain.vo.DeliveryBillVO; import com.zg.project.wisdom.domain.vo.DeliveryBillVO;
import com.zg.project.wisdom.domain.vo.PcodeQtyVO;
/** /**
* 库存单据主Service接口 * 库存单据主Service接口
@@ -187,4 +185,12 @@ public interface IRkInfoService
* @return * @return
*/ */
List<DeliveryBillVO> selectDeliveryBillList(RkInfo query); List<DeliveryBillVO> selectDeliveryBillList(RkInfo query);
List<RkInfo> selectBorrowAndReturnList(RkInfoQueryDTO query);
/**
* 根据入库单号查询单据头公共信息
*/
RkInfo selectHeaderByBillNo(String billNo);
} }

View File

@@ -9,6 +9,8 @@ import com.zg.common.exception.ServiceException;
import com.zg.common.utils.DateUtils; import com.zg.common.utils.DateUtils;
import com.zg.common.utils.EntityFillUtils; import com.zg.common.utils.EntityFillUtils;
import com.zg.common.utils.SecurityUtils; import com.zg.common.utils.SecurityUtils;
import com.zg.project.information.domain.PcdeDetail;
import com.zg.project.information.mapper.PcdeDetailMapper;
import com.zg.project.wisdom.domain.RkInfo; import com.zg.project.wisdom.domain.RkInfo;
import com.zg.project.wisdom.domain.dto.MoveRequestDTO; import com.zg.project.wisdom.domain.dto.MoveRequestDTO;
import com.zg.project.wisdom.domain.dto.MoveTargetItem; import com.zg.project.wisdom.domain.dto.MoveTargetItem;
@@ -36,6 +38,8 @@ public class MoveRecordServiceImpl implements IMoveRecordService
@Autowired @Autowired
private RkInfoMapper rkInfoMapper; private RkInfoMapper rkInfoMapper;
@Autowired
private PcdeDetailMapper pcdeDetailMapper;
/** /**
* 查询移库记录 * 查询移库记录
* *
@@ -111,18 +115,32 @@ public class MoveRecordServiceImpl implements IMoveRecordService
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void processMove(MoveRequestDTO dto) { public void processMove(MoveRequestDTO dto) {
// 查询原始库存记录
// 0. 基本校验
if (dto == null || dto.getFromRkId() == null) {
throw new ServiceException("原库存ID不能为空");
}
if (dto.getTargets() == null || dto.getTargets().isEmpty()) {
throw new ServiceException("目标位置列表不能为空");
}
// 0.1 校验每个目标库位与仓库关系
for (MoveTargetItem target : dto.getTargets()) {
validatePcodeWarehouseRelation(target.getToPcode(), target.getToCangku());
}
// 1. 查询原始库存记录
RkInfo original = rkInfoMapper.selectRkInfoById(dto.getFromRkId()); RkInfo original = rkInfoMapper.selectRkInfoById(dto.getFromRkId());
if (original == null || "1".equals(original.getIsDelete())) { if (original == null || "1".equals(original.getIsDelete())) {
throw new ServiceException("原库存不存在或已删除"); throw new ServiceException("原库存不存在或已删除");
} }
// 计算目标总数量 // 2. 计算目标总数量
BigDecimal totalQty = dto.getTargets().stream() BigDecimal totalQty = dto.getTargets().stream()
.map(MoveTargetItem::getRealQty) .map(MoveTargetItem::getRealQty)
.reduce(BigDecimal.ZERO, BigDecimal::add); .reduce(BigDecimal.ZERO, BigDecimal::add);
// 原始库存数量 // 3. 原始库存数量
BigDecimal realQty = original.getRealQty(); BigDecimal realQty = original.getRealQty();
if (realQty == null) { if (realQty == null) {
throw new ServiceException("原库存数量为空,无法进行比较"); throw new ServiceException("原库存数量为空,无法进行比较");
@@ -132,18 +150,20 @@ public class MoveRecordServiceImpl implements IMoveRecordService
throw new ServiceException("拆分总数量不能大于原库存数量"); throw new ServiceException("拆分总数量不能大于原库存数量");
} }
// 操作信息 // 4. 操作信息
String username = dto.getMovedBy(); String username = dto.getMovedBy();
Date now = DateUtils.parseDate(dto.getMovedAt()); Date now = DateUtils.parseDate(dto.getMovedAt());
// 情况一:整库移库(目标总数量 = 原库存,且仅一个目标) // ===== 情况一:整库移库(目标总数量 = 原库存,且仅一个目标)=====
if (dto.getTargets().size() == 1 && totalQty.compareTo(realQty) == 0) { if (dto.getTargets().size() == 1 && totalQty.compareTo(realQty) == 0) {
MoveTargetItem target = dto.getTargets().get(0); MoveTargetItem target = dto.getTargets().get(0);
// 这里 info 用于记录移库前的快照
RkInfo info = new RkInfo(); RkInfo info = new RkInfo();
BeanUtils.copyProperties(original, info); BeanUtils.copyProperties(original, info);
original.setCangku(target.getToCangku()); // 更新原库存到新位置
original.setWarehouseCode(target.getToCangku());
original.setPcode(target.getToPcode()); original.setPcode(target.getToPcode());
original.setTrayCode(target.getToTrayCode()); original.setTrayCode(target.getToTrayCode());
original.setHasMoved("1"); original.setHasMoved("1");
@@ -151,17 +171,16 @@ public class MoveRecordServiceImpl implements IMoveRecordService
original.setUpdateTime(now); original.setUpdateTime(now);
rkInfoMapper.updateRkInfo(original); rkInfoMapper.updateRkInfo(original);
// 记录移库日志 // 记录移库日志(从 info → target
moveRecordMapper.insertMoveRecord(createMoveRecord(info, target, dto)); moveRecordMapper.insertMoveRecord(createMoveRecord(info, target, dto));
return; return;
} }
// 情况二 & 三:需要新建多条库存记录 // ===== 情况二 & 三:需要新建多条库存记录 =====
List<RkInfo> insertList = new ArrayList<>(); List<RkInfo> insertList = new ArrayList<>();
// 情况三:部分移库(目标总量 < 原库存) // 情况三:部分移库(目标总量 < 原库存) → 原库存数量减少
if (totalQty.compareTo(realQty) < 0) { if (totalQty.compareTo(realQty) < 0) {
// 原库存数量减少
original.setRealQty(realQty.subtract(totalQty)); original.setRealQty(realQty.subtract(totalQty));
original.setUpdateBy(username); original.setUpdateBy(username);
original.setUpdateTime(now); original.setUpdateTime(now);
@@ -174,6 +193,7 @@ public class MoveRecordServiceImpl implements IMoveRecordService
// 新增多条目标库存 // 新增多条目标库存
for (MoveTargetItem target : dto.getTargets()) { for (MoveTargetItem target : dto.getTargets()) {
RkInfo newInfo = new RkInfo(); RkInfo newInfo = new RkInfo();
// 注意:这里以 original 为模板(注意上面是否已修改过数量)
BeanUtils.copyProperties(original, newInfo, "id"); BeanUtils.copyProperties(original, newInfo, "id");
newInfo.setCangku(target.getToCangku()); newInfo.setCangku(target.getToCangku());
@@ -189,7 +209,7 @@ public class MoveRecordServiceImpl implements IMoveRecordService
insertList.add(newInfo); insertList.add(newInfo);
// 移库记录 // 移库记录:从原库存 original → 每个 target
moveRecordMapper.insertMoveRecord(createMoveRecord(original, target, dto)); moveRecordMapper.insertMoveRecord(createMoveRecord(original, target, dto));
} }
@@ -198,6 +218,30 @@ public class MoveRecordServiceImpl implements IMoveRecordService
} }
} }
/**
* 校验库位与仓库(小仓)关系:
* - 库位必须存在
* - 库位所属小仓 warehouse_code == 目标仓库编码 toCangku
*/
private void validatePcodeWarehouseRelation(String pcode, String warehouseCode) {
if (org.apache.commons.lang3.StringUtils.isBlank(pcode)) {
throw new ServiceException("目标库位不能为空");
}
if (org.apache.commons.lang3.StringUtils.isBlank(warehouseCode)) {
throw new ServiceException("目标仓库不能为空");
}
PcdeDetail detail = pcdeDetailMapper.selectByPcode(pcode);
if (detail == null) {
throw new ServiceException("目标库位不存在:" + pcode);
}
//
if (!warehouseCode.equals(detail.getWarehouseCode())) {
throw new ServiceException("目标库位【" + pcode + "】不属于仓库【" + warehouseCode + "】,请检查移库目标设置");
}
}
/** /**
* 构建移库记录对象 * 构建移库记录对象
* *

View File

@@ -12,12 +12,12 @@ import com.zg.common.exception.ServiceException;
import com.zg.common.utils.DateUtils; import com.zg.common.utils.DateUtils;
import com.zg.common.utils.SecurityUtils; import com.zg.common.utils.SecurityUtils;
import com.zg.common.utils.StringUtils; import com.zg.common.utils.StringUtils;
import com.zg.project.Inventory.AutoInventory.mapper.InventoryMatchScanMapper; import com.zg.project.inventory.AutoInventory.mapper.InventoryMatchScanMapper;
import com.zg.project.Inventory.Task.mapper.InventoryTaskMapper; import com.zg.project.inventory.Task.mapper.InventoryTaskMapper;
import com.zg.project.Inventory.domain.dto.QueryDTO; import com.zg.project.inventory.domain.dto.QueryDTO;
import com.zg.project.Inventory.domain.entity.InventoryMatchScan; import com.zg.project.inventory.domain.entity.InventoryMatchScan;
import com.zg.project.Inventory.domain.vo.ChartDataVO; import com.zg.project.inventory.domain.vo.ChartDataVO;
import com.zg.project.Inventory.domain.vo.PcdeCntVO; import com.zg.project.inventory.domain.vo.PcdeCntVO;
import com.zg.project.information.mapper.PcdeDetailMapper; import com.zg.project.information.mapper.PcdeDetailMapper;
import com.zg.project.system.service.ISysConfigService; import com.zg.project.system.service.ISysConfigService;
import com.zg.project.wisdom.domain.AuditSignature; import com.zg.project.wisdom.domain.AuditSignature;
@@ -133,6 +133,48 @@ public class RkInfoServiceImpl implements IRkInfoService
return list; return list;
} }
@Override
public List<RkInfo> selectBorrowAndReturnList(RkInfoQueryDTO query) {
boolean needAudit = "1".equals(configService.selectConfigByKey("rk.audit.enabled"));
List<RkInfo> list = rkInfoMapper.selectBorrowAndReturnList(query);
LocalDate today = LocalDate.now();
for (RkInfo info : list) {
// 计算库龄:这里也可以按 rk_time 算,你之前逻辑一样就行
if (info.getRkTime() != null) {
LocalDate rkDate = info.getRkTime().toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDate();
long days = ChronoUnit.DAYS.between(rkDate, today);
info.setStockAge(days);
}
// 查询现场图片 + 审核结果(同原 list
AuditSignature signature = auditSignatureMapper.selectPhotoUrlByRkId(info.getId());
if (signature != null) {
info.setScenePhotoUrl(signature.getSignUrl());
info.setAuditResult(signature.getAuditResult());
info.setApproverId(signature.getApproverId());
} else {
info.setScenePhotoUrl(null);
info.setAuditResult(null);
info.setApproverId(null);
}
}
if (needAudit) {
list = list.stream()
.filter(info ->
info.getApproverId() == null ||
"1".equals(info.getAuditResult())
)
.collect(Collectors.toList());
}
return list;
}
@Override @Override
public List<RkInfo> selectGroupedByBill(RkInfoQueryDTO query) { public List<RkInfo> selectGroupedByBill(RkInfoQueryDTO query) {
// 读取审核开关1=开启;其它=关闭) // 读取审核开关1=开启;其它=关闭)
@@ -141,17 +183,53 @@ public class RkInfoServiceImpl implements IRkInfoService
return rkInfoMapper.selectGroupedByBill(query, needAudit ? 1 : 0); return rkInfoMapper.selectGroupedByBill(query, needAudit ? 1 : 0);
} }
@Override
public RkInfo selectHeaderByBillNo(String billNo) {
if (StringUtils.isBlank(billNo)) {
return null;
}
return rkInfoMapper.selectHeaderByBillNo(billNo);
}
/** /**
* 修改库存单据主 * 修改库存单据主
* *
* @param rkInfo 库存单据主 * @param rkInfo 库存单据主
* @return 结果 * @return 结果
*/ */
@Override
public int updateRkInfo(RkInfo rkInfo) public int updateRkInfo(RkInfo rkInfo)
{ {
// 通用审计字段
rkInfo.setUpdateTime(DateUtils.getNowDate()); rkInfo.setUpdateTime(DateUtils.getNowDate());
rkInfo.setUpdateBy(SecurityUtils.getUserId().toString()); rkInfo.setUpdateBy(SecurityUtils.getUserId().toString());
// 小仓编码:优先用前端传来的 warehouseCode没有的话用 cangku
String warehouseCode = rkInfo.getWarehouseCode();
if (StringUtils.isBlank(warehouseCode)) {
warehouseCode = rkInfo.getCangku();
}
// 库位编码
String pcode = rkInfo.getPcode();
// 只有当小仓 + 库位都有的时候才做这层校验
if (StringUtils.isNotBlank(warehouseCode) && StringUtils.isNotBlank(pcode)) {
// 临时组装一个 PcRkInfoBatchDTO专门给 validateWarehouseAndPcode 用
PcRkInfoBatchDTO tmpDto = new PcRkInfoBatchDTO();
tmpDto.setWarehouseCode(warehouseCode);
List<PcRkInfoItemDTO> rkList = new ArrayList<>();
PcRkInfoItemDTO item = new PcRkInfoItemDTO();
item.setPcode(pcode);
rkList.add(item);
tmpDto.setRkList(rkList);
validateWarehouseAndPcode(tmpDto);
}
// ====== 校验通过再更新 ======
return rkInfoMapper.updateRkInfo(rkInfo); return rkInfoMapper.updateRkInfo(rkInfo);
} }
@@ -276,6 +354,7 @@ public class RkInfoServiceImpl implements IRkInfoService
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void batchInsert(PcRkInfoBatchDTO dto) { public void batchInsert(PcRkInfoBatchDTO dto) {
String billNo = BillNoUtil.generateTodayBillNo("RK"); String billNo = BillNoUtil.generateTodayBillNo("RK");
List<PcRkInfoItemDTO> list = dto.getRkList(); List<PcRkInfoItemDTO> list = dto.getRkList();
List<RkInfo> rkInfos = new ArrayList<>(); List<RkInfo> rkInfos = new ArrayList<>();
@@ -285,7 +364,10 @@ public class RkInfoServiceImpl implements IRkInfoService
String userId = SecurityUtils.getUserId().toString(); String userId = SecurityUtils.getUserId().toString();
Date now = DateUtils.getNowDate(); Date now = DateUtils.getNowDate();
// ✅ 第1步构建 gysJhId -> realQty 映射 // 🚩 0. 校验库位是否属于当前小仓
validateWarehouseAndPcode(dto);
// ✅ 1. 供应计划扣减映射
Map<Long, BigDecimal> realQtyMap = list.stream() Map<Long, BigDecimal> realQtyMap = list.stream()
.filter(item -> item.getGysJhId() != null && item.getRealQty() != null) .filter(item -> item.getGysJhId() != null && item.getRealQty() != null)
.collect(Collectors.toMap( .collect(Collectors.toMap(
@@ -294,64 +376,72 @@ public class RkInfoServiceImpl implements IRkInfoService
(a, b) -> b (a, b) -> b
)); ));
// ✅ 2-4若包含供应计划ID则处理计划扣减状态更新 // ✅ 2-4. 供应计划扣减&状态更新(保留你原来的逻辑)
if (!realQtyMap.isEmpty()) { if (!realQtyMap.isEmpty()) {
// ✅ 查询对应供应计划
List<GysJh> jhList = gysJhMapper.selectByIds(new ArrayList<>(realQtyMap.keySet())); List<GysJh> jhList = gysJhMapper.selectByIds(new ArrayList<>(realQtyMap.keySet()));
Set<Long> idsToUpdateStatus = new HashSet<>(); Set<Long> idsToUpdateStatus = new HashSet<>();
// ✅ 更新 jh_qty 和 status根据是否开启审核判断逻辑
for (GysJh jh : jhList) { for (GysJh jh : jhList) {
Long jhId = jh.getId(); Long jhId = jh.getId();
BigDecimal planQty = BigDecimal.valueOf(jh.getJhQty()); BigDecimal planQty = BigDecimal.valueOf(jh.getJhQty());
BigDecimal realQty = realQtyMap.get(jhId); BigDecimal realQty = realQtyMap.get(jhId);
if (realQty == null) continue; if (realQty == null) {
continue;
}
boolean isEqual = realQty.compareTo(planQty) == 0; boolean isEqual = realQty.compareTo(planQty) == 0;
if (!isEqual) { if (!isEqual) {
// 实到数量小于计划数量,执行扣减 + 设为部分入库2 // 部分入库:扣减计划数量
gysJhMapper.decreaseJhQtyById(jhId, realQty); gysJhMapper.decreaseJhQtyById(jhId, realQty);
if (!needAudit) { if (!needAudit) {
gysJhMapper.updateStatusById(jhId, "2"); // 2 = 部分入库 gysJhMapper.updateStatusById(jhId, "2"); // 2 = 部分入库
} }
} else { } else {
// 实到数量等于计划数量状态设为全部入库1不做扣减 // 全部入库:状态=1
if (!needAudit) { if (!needAudit) {
gysJhMapper.updateStatusById(jhId, "1"); // 1 = 全部入库 gysJhMapper.updateStatusById(jhId, "1"); // 1 = 全部入库
} }
} }
} }
// ✅ 批量更新 status = 2
if (!idsToUpdateStatus.isEmpty()) { if (!idsToUpdateStatus.isEmpty()) {
gysJhMapper.batchUpdateStatusByIds(idsToUpdateStatus); gysJhMapper.batchUpdateStatusByIds(idsToUpdateStatus);
} }
} }
// ✅ 第5步构建 RkInfo 入库记录 // ✅ 5. 构建 RkInfo 入库记录(注意:小仓 = dto.getWarehouseCode()
for (PcRkInfoItemDTO item : list) { for (PcRkInfoItemDTO item : list) {
RkInfo rk = new RkInfo(); RkInfo rk = new RkInfo();
// 物料、项目、供应商、xj县局、数量等等从 item 拷贝
BeanUtils.copyProperties(item, rk); BeanUtils.copyProperties(item, rk);
String encodedId = pcdeDetailMapper.selectEncodedIdByPcode(item.getPcode());
rk.setPcodeId(encodedId);
rk.setBillNo(billNo); rk.setBillNo(billNo);
rk.setRkType(dto.getRkType()); rk.setRkType(dto.getRkType());
rk.setWlType(dto.getWlType()); rk.setWlType(dto.getWlType());
rk.setLihuoY(dto.getLihuoY()); rk.setLihuoY(dto.getLihuoY());
// rk.setRkTime(now);
rk.setRkTime(dto.getRkTime()); //zhangjinbo 2025-11-03根据玉田需求进行修改 // 🚩 所属小仓:页面选的小仓编码
rk.setCangku(dto.getCangku()); rk.setCangku(dto.getWarehouseCode());
// 🚩 入库时间:页面传,若为空则使用当前时间
rk.setRkTime(dto.getRkTime() != null ? dto.getRkTime() : DateUtils.getNowDate());
// 库位 encodedId
String encodedId = pcdeDetailMapper.selectEncodedIdByPcode(item.getPcode());
rk.setPcodeId(encodedId);
rk.setCreateBy(userId); rk.setCreateBy(userId);
rk.setCreateTime(now); rk.setCreateTime(now);
rk.setIsDelete("0"); rk.setIsDelete("0");
rk.setGysJhId(item.getGysJhId()); rk.setGysJhId(item.getGysJhId());
rk.setFycde1(item.getFycde1()); rk.setFycde1(item.getFycde1());
rk.setFycde2(item.getFycde2()); rk.setFycde2(item.getFycde2());
if (needAudit) { if (needAudit) {
rk.setStatus("0"); // 待审核 rk.setStatus("0"); // 待审核
rk.setIsChuku("2"); // 待入库 rk.setIsChuku("2"); // 待入库(审核中)
} else { } else {
rk.setStatus("1"); // 审核通过 rk.setStatus("1"); // 审核通过
rk.setIsChuku("0"); // 已入库 rk.setIsChuku("0"); // 已入库
@@ -360,23 +450,24 @@ public class RkInfoServiceImpl implements IRkInfoService
rkInfos.add(rk); rkInfos.add(rk);
} }
// ✅ 第6步保存入库记录 // ✅ 6. 批量插入 rk_info
rkInfoMapper.batchInsertRkInfo(rkInfos); rkInfoMapper.batchInsertRkInfo(rkInfos);
// ✅ 第7步照片记录(审核开启时) // ✅ 7. 一货一图(现场照片记录(审核开启时)
if (needAudit) {
for (int i = 0; i < rkInfos.size(); i++) { for (int i = 0; i < rkInfos.size(); i++) {
RkInfo rk = rkInfos.get(i); RkInfo rk = rkInfos.get(i);
PcRkInfoItemDTO item = list.get(i); PcRkInfoItemDTO item = list.get(i);
if (needAudit && StringUtils.isNotBlank(item.getPhotoUrl())) { if (StringUtils.isNotBlank(item.getPhotoUrl())) {
AuditSignature photo = new AuditSignature(); AuditSignature photo = new AuditSignature();
photo.setRkId(rk.getId()); photo.setRkId(rk.getId());
photo.setBillNo(billNo); photo.setBillNo(billNo);
photo.setBillType("0"); photo.setBillType("0"); // 入库
photo.setAuditResult("2"); photo.setAuditResult("2"); // 待审核
photo.setSignerId(userId); photo.setSignerId(userId);
photo.setSignerRole("2"); photo.setSignerRole("2"); // 现场照片
photo.setImageType("1"); photo.setImageType("1"); // photo
photo.setSignUrl(item.getPhotoUrl()); photo.setSignUrl(item.getPhotoUrl());
photo.setSignTime(now); photo.setSignTime(now);
photo.setPcode(item.getPcode()); photo.setPcode(item.getPcode());
@@ -389,8 +480,9 @@ public class RkInfoServiceImpl implements IRkInfoService
records.add(photo); records.add(photo);
} }
} }
}
// ✅ 第8步发起人签字记录(审核开启时) // ✅ 8. 发起人签字记录(审核开启时)
if (needAudit) { if (needAudit) {
boolean hasOldSign = auditSignatureMapper.existsCurrentSigner(billNo, "0"); boolean hasOldSign = auditSignatureMapper.existsCurrentSigner(billNo, "0");
if (hasOldSign) { if (hasOldSign) {
@@ -399,33 +491,132 @@ public class RkInfoServiceImpl implements IRkInfoService
AuditSignature mainSign = new AuditSignature(); AuditSignature mainSign = new AuditSignature();
mainSign.setBillNo(billNo); mainSign.setBillNo(billNo);
mainSign.setBillType("0"); mainSign.setBillType("0"); // 入库
mainSign.setSignerId(userId); mainSign.setSignerId(userId);
mainSign.setSignerRole("0"); mainSign.setSignerRole("0"); // 发起人
mainSign.setApproverId(dto.getApproverId()); mainSign.setApproverId(dto.getApproverId());
mainSign.setSignUrl(dto.getSignatureUrl()); mainSign.setSignUrl(dto.getSignatureUrl());
mainSign.setImageType("0"); mainSign.setImageType("0"); // sign
mainSign.setSignTime(now); mainSign.setSignTime(now);
mainSign.setIsCurrent("1"); mainSign.setIsCurrent("1");
mainSign.setAuditResult("2"); mainSign.setAuditResult("2"); // 待审核
mainSign.setIsDelete("0"); mainSign.setIsDelete("0");
mainSign.setCreateBy(userId); mainSign.setCreateBy(userId);
mainSign.setCreateTime(now); mainSign.setCreateTime(now);
records.add(mainSign); records.add(mainSign);
}
if (needAudit && !records.isEmpty()) {
auditSignatureMapper.batchInsert(records); auditSignatureMapper.batchInsert(records);
} }
} }
/**
* 校验:前端传入的小仓编码与库位所属小仓是否一致
*
* 规则:
* 1. dto.warehouseCode 不能为空
* 2. 每一条 rkList 里的 pcode 不能为空
* 3. 根据 pcode 查询 pcde_detail 表中的 warehouse_code
* - 如果查不到:提示“库位编码 xxx 不存在”
* - 如果与 dto.warehouseCode 不一致:提示“库位编码 xxx 不属于小仓 yyy”
*/
private void validateWarehouseAndPcode(PcRkInfoBatchDTO dto) {
String warehouseCode = dto.getWarehouseCode();
if (StringUtils.isBlank(warehouseCode)) {
throw new ServiceException("所属小仓编码不能为空");
}
List<PcRkInfoItemDTO> rkList = dto.getRkList();
if (rkList == null || rkList.isEmpty()) {
throw new ServiceException("入库明细不能为空");
}
for (PcRkInfoItemDTO item : rkList) {
String pcode = item.getPcode();
if (StringUtils.isBlank(pcode)) {
throw new ServiceException("库位编码不能为空");
}
// 根据库位码查询所属小仓
String dbWarehouseCode = pcdeDetailMapper.selectWarehouseCodeByPcode(pcode);
if (StringUtils.isBlank(dbWarehouseCode)) {
throw new ServiceException("库位编码【" + pcode + "】不存在或未配置所属小仓");
}
if (!warehouseCode.equals(dbWarehouseCode)) {
throw new ServiceException("库位编码【" + pcode + "】不属于小仓【" + warehouseCode + "】,请检查入库数据");
}
}
}
/**
* APP 入库校验:
* 校验:前端传入的小仓编码与库位所属小仓是否一致
*
* 规则:
* 1. dto.warehouseCode 不能为空
* 2. 每一条 rkList 不为空,且每个 scan 中的 pcode 不能为空
* 3. 根据 pcode 查询 pcde_detail 表中的 warehouse_code
* - 如果查不到:提示“库位编码 xxx 不存在”
* - 如果与 dto.warehouseCode 不一致:提示“库位编码 xxx 不属于小仓 yyy”
*/
private void validateWarehouseAndPcode(RkInfoBatchDTO dto) {
// 1) 小仓编码必填
String warehouseCode = dto.getWarehouseCode();
if (StringUtils.isBlank(warehouseCode)) {
throw new ServiceException("所属小仓编码不能为空");
}
// 2) rkList 必须有数据
List<RkInfoItemDTO> rkList = dto.getRkList();
if (rkList == null || rkList.isEmpty()) {
throw new ServiceException("rkList 入库明细列表不能为空");
}
// 3) 遍历所有 item.scanList逐个校验 pcode
for (RkInfoItemDTO item : rkList) {
if (item.getScanList() == null || item.getScanList().isEmpty()) {
throw new ServiceException("物料【" + item.getWlNo() + "】未传入任何扫码明细scanList 为空)");
}
for (RkInfoScanDTO scan : item.getScanList()) {
String pcode = scan.getPcode();
if (StringUtils.isBlank(pcode)) {
throw new ServiceException("库位编码不能为空");
}
// 根据库位码查询所属小仓
String dbWarehouseCode = pcdeDetailMapper.selectWarehouseCodeByPcode(pcode);
if (StringUtils.isBlank(dbWarehouseCode)) {
throw new ServiceException("库位编码【" + pcode + "】不存在或未配置所属小仓");
}
if (!warehouseCode.equals(dbWarehouseCode)) {
throw new ServiceException("库位编码【" + pcode + "】不属于小仓【" + warehouseCode + "】,请检查入库数据");
}
}
}
}
// ================== APP 入库 ==================
/** /**
* 新增入库单据APP * 新增入库单据APP
* @param dto * @param dto 入库批次 DTO
* @return * @return 实际入库明细条数
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int batchInsertApp(RkInfoBatchDTO dto) { public int batchInsertApp(RkInfoBatchDTO dto) {
// ✅ 0. 小仓 + 库位一致性校验(统一用 warehouseCode
validateWarehouseAndPcode(dto);
List<RkInfo> saveList = new ArrayList<>(); List<RkInfo> saveList = new ArrayList<>();
String userId = SecurityUtils.getUserId().toString(); String userId = SecurityUtils.getUserId().toString();
Date now = DateUtils.getNowDate(); Date now = DateUtils.getNowDate();
@@ -440,27 +631,30 @@ public class RkInfoServiceImpl implements IRkInfoService
// ✅ 第1步构造 gysJhId → realQty 的映射(从 scanList 中提取) // ✅ 第1步构造 gysJhId → realQty 的映射(从 scanList 中提取)
Map<Long, BigDecimal> realQtyMap = new HashMap<>(); Map<Long, BigDecimal> realQtyMap = new HashMap<>();
for (RkInfoItemDTO item : dto.getRkList()) { for (RkInfoItemDTO item : dto.getRkList()) {
if (item.getScanList() == null) continue; if (item.getScanList() == null) {
continue;
}
for (RkInfoScanDTO scan : item.getScanList()) { for (RkInfoScanDTO scan : item.getScanList()) {
Long jhId = scan.getGysJhId(); Long jhId = scan.getGysJhId();
BigDecimal realQty = scan.getRealQty(); BigDecimal realQty = scan.getRealQty();
if (jhId != null && realQty != null) { if (jhId != null && realQty != null) {
realQtyMap.put(jhId, realQty); // 一物一图场景,每个 jhId 只有一条 scan 数据 // 一物一图场景,每个 jhId 只有一条 scan 数据
realQtyMap.put(jhId, realQty);
} }
} }
} }
// ✅ 第2步更新 gys_jh 的 jh_qty 与 status // ✅ 第2步更新 gys_jh 的 jh_qty 与 status
Set<Long> idsToUpdateStatus = new HashSet<>(); if (!realQtyMap.isEmpty()) {
List<Long> allJhIds = new ArrayList<>(realQtyMap.keySet()); List<Long> allJhIds = new ArrayList<>(realQtyMap.keySet());
if (!allJhIds.isEmpty()) {
List<GysJh> jhList = gysJhMapper.selectByIds(allJhIds); List<GysJh> jhList = gysJhMapper.selectByIds(allJhIds);
for (GysJh jh : jhList) { for (GysJh jh : jhList) {
Long jhId = jh.getId(); Long jhId = jh.getId();
BigDecimal planQty = BigDecimal.valueOf(jh.getJhQty()); BigDecimal planQty = BigDecimal.valueOf(jh.getJhQty());
BigDecimal realQty = realQtyMap.get(jhId); BigDecimal realQty = realQtyMap.get(jhId);
if (realQty == null) continue; if (realQty == null) {
continue;
}
boolean isEqual = realQty.compareTo(planQty) == 0; boolean isEqual = realQty.compareTo(planQty) == 0;
@@ -479,21 +673,30 @@ public class RkInfoServiceImpl implements IRkInfoService
} }
} }
if (!idsToUpdateStatus.isEmpty()) { // ✅ 统一确定小仓编码:只允许从 warehouseCode 获取,不再兼容 cangku
gysJhMapper.batchUpdateStatusByIds(idsToUpdateStatus); String warehouseCode = dto.getWarehouseCode();
if (StringUtils.isEmpty(warehouseCode)) {
throw new ServiceException("所属小仓编码不能为空");
} }
// ✅ 第3步构建 RkInfo 入库实体 // ✅ 第3步构建 RkInfo 入库实体
for (RkInfoItemDTO item : dto.getRkList()) { for (RkInfoItemDTO item : dto.getRkList()) {
if (item.getScanList() == null) continue; if (item.getScanList() == null) {
continue;
}
for (RkInfoScanDTO scan : item.getScanList()) { for (RkInfoScanDTO scan : item.getScanList()) {
RkInfo entity = new RkInfo(); RkInfo entity = new RkInfo();
entity.setRkType(dto.getRkType()); entity.setRkType(dto.getRkType());
entity.setWlType(dto.getWlType()); entity.setWlType(dto.getWlType());
entity.setCangku(dto.getCangku());
// 🚩 仓库rk_info.cangku 只存小仓编码warehouse_code
entity.setCangku(warehouseCode);
entity.setLihuoY(dto.getLihuoY()); entity.setLihuoY(dto.getLihuoY());
entity.setBillNo(billNo); entity.setBillNo(billNo);
entity.setXj(item.getXj()); entity.setXj(item.getXj());
entity.setXmMs(item.getXmMs()); entity.setXmMs(item.getXmMs());
entity.setXmNo(item.getXmNo()); entity.setXmNo(item.getXmNo());
@@ -507,6 +710,7 @@ public class RkInfoServiceImpl implements IRkInfoService
entity.setWlMs(item.getWlMs()); entity.setWlMs(item.getWlMs());
entity.setGysNo(item.getGysNo()); entity.setGysNo(item.getGysNo());
entity.setGysMc(item.getGysMc()); entity.setGysMc(item.getGysMc());
entity.setPcode(scan.getPcode()); entity.setPcode(scan.getPcode());
entity.setPcodeId(CodeConvertUtil.stringToHex(scan.getPcode())); entity.setPcodeId(CodeConvertUtil.stringToHex(scan.getPcode()));
entity.setTrayCode(scan.getTrayCode()); entity.setTrayCode(scan.getTrayCode());
@@ -514,6 +718,7 @@ public class RkInfoServiceImpl implements IRkInfoService
entity.setEntityId(scan.getEntityId()); entity.setEntityId(scan.getEntityId());
entity.setRemark(scan.getRemark()); entity.setRemark(scan.getRemark());
entity.setGysJhId(scan.getGysJhId()); entity.setGysJhId(scan.getGysJhId());
entity.setIsDelete("0"); entity.setIsDelete("0");
entity.setRkTime(now); entity.setRkTime(now);
entity.setCreateBy(userId); entity.setCreateBy(userId);
@@ -563,10 +768,12 @@ public class RkInfoServiceImpl implements IRkInfoService
mainSign.setCreateTime(now); mainSign.setCreateTime(now);
recordList.add(mainSign); recordList.add(mainSign);
// 现场照片记录 // 现场照片记录(一物一图,按 rkId 绑定)
int index = 0; int index = 0;
for (RkInfoItemDTO item : dto.getRkList()) { for (RkInfoItemDTO item : dto.getRkList()) {
if (item.getScanList() == null) continue; if (item.getScanList() == null) {
continue;
}
for (RkInfoScanDTO scan : item.getScanList()) { for (RkInfoScanDTO scan : item.getScanList()) {
RkInfo rk = saveList.get(index++); RkInfo rk = saveList.get(index++);
if (StringUtils.isNotBlank(scan.getPhotoUrl())) { if (StringUtils.isNotBlank(scan.getPhotoUrl())) {
@@ -600,6 +807,7 @@ public class RkInfoServiceImpl implements IRkInfoService
return saveList.size(); return saveList.size();
} }
@Transactional @Transactional
public void deleteByBillNo(String billNo) { public void deleteByBillNo(String billNo) {
// 1. 查询 sap_no // 1. 查询 sap_no
@@ -1044,7 +1252,7 @@ public class RkInfoServiceImpl implements IRkInfoService
e.setBillNo(dto.getBillNo()); e.setBillNo(dto.getBillNo());
e.setRkType(dto.getRkType()); e.setRkType(dto.getRkType());
e.setWlType(dto.getWlType()); e.setWlType(dto.getWlType());
e.setCangku(dto.getCangku()); e.setWarehouseCode(dto.getWarehouseCode());
e.setLihuoY(dto.getLihuoY()); e.setLihuoY(dto.getLihuoY());
e.setRkTime(rkTime); e.setRkTime(rkTime);

View File

@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zg.project.Inventory.AutoInventory.mapper.InventoryMatchScanMapper"> <mapper namespace="com.zg.project.inventory.AutoInventory.mapper.InventoryMatchScanMapper">
<insert id="insertBatch"> <insert id="insertBatch">
INSERT INTO inventory_match_scan (task_id, device_id, pcode, tme, scan_type, status) INSERT INTO inventory_match_scan (task_id, device_id, pcode, tme, scan_type, status)
@@ -12,17 +12,17 @@
</foreach> </foreach>
</insert> </insert>
<select id="getAll" resultType="com.zg.project.Inventory.domain.entity.InventoryMatchScan"> <select id="getAll" resultType="com.zg.project.inventory.domain.entity.InventoryMatchScan">
SELECT * FROM inventory_match_scan SELECT * FROM inventory_match_scan
</select> </select>
<select id="getAllSod" resultType="com.zg.project.Inventory.domain.entity.Sod"> <select id="getAllSod" resultType="com.zg.project.inventory.domain.entity.Sod">
SELECT * FROM inventory_match_scan i SELECT * FROM inventory_match_scan i
LEFT JOIN sod s ON i.pcde = s.fycde_1 LEFT JOIN sod s ON i.pcde = s.fycde_1
WHERE s.rmn > 0 WHERE s.rmn > 0
</select> </select>
<select id="getPcdeCountByTask" resultType="com.zg.project.Inventory.domain.vo.PcdeCountVO"> <select id="getPcdeCountByTask" resultType="com.zg.project.inventory.domain.vo.PcdeCountVO">
SELECT SELECT
s.pcde, s.pcde,
COUNT(*) AS count COUNT(*) AS count
@@ -43,7 +43,7 @@
GROUP BY s.pcde GROUP BY s.pcde
</select> </select>
<select id="getGroupedHistoryList" resultType="com.zg.project.Inventory.domain.vo.InventoryMatchScanSimpleVO"> <select id="getGroupedHistoryList" resultType="com.zg.project.inventory.domain.vo.InventoryMatchScanSimpleVO">
SELECT SELECT
task_name AS taskName, task_name AS taskName,
MAX(tme) AS tme, MAX(tme) AS tme,
@@ -101,7 +101,7 @@
</where> </where>
</select> </select>
<select id="getByTaskName" resultType="com.zg.project.Inventory.domain.vo.InventoryMatchScanVO"> <select id="getByTaskName" resultType="com.zg.project.inventory.domain.vo.InventoryMatchScanVO">
SELECT SELECT
i.id, i.id,
i.device_id AS deviceId, i.device_id AS deviceId,
@@ -133,8 +133,8 @@
</select> </select>
<select id="selectInventoryMatchScanList" <select id="selectInventoryMatchScanList"
resultType="com.zg.project.Inventory.domain.entity.InventoryMatchScan" resultType="com.zg.project.inventory.domain.entity.InventoryMatchScan"
parameterType="com.zg.project.Inventory.domain.entity.InventoryMatchScan"> parameterType="com.zg.project.inventory.domain.entity.InventoryMatchScan">
SELECT SELECT
i.id AS id, i.id AS id,
i.task_id AS taskId, i.task_id AS taskId,
@@ -173,7 +173,7 @@
<select id="selectOnlyFromMatchScan" <select id="selectOnlyFromMatchScan"
parameterType="InventoryMatchScan" parameterType="InventoryMatchScan"
resultType="com.zg.project.Inventory.domain.vo.RkInfoMatchVO"> resultType="com.zg.project.inventory.domain.vo.RkInfoMatchVO">
SELECT SELECT
i.pcode AS rkPcode, i.pcode AS rkPcode,
NULL AS realQty NULL AS realQty
@@ -194,7 +194,7 @@
<select id="selectJoinRkInfo" <select id="selectJoinRkInfo"
parameterType="InventoryMatchScan" parameterType="InventoryMatchScan"
resultType="com.zg.project.Inventory.domain.vo.RkInfoMatchVO"> resultType="com.zg.project.inventory.domain.vo.RkInfoMatchVO">
SELECT SELECT
r.pcode AS rkPcode, r.pcode AS rkPcode,
COALESCE(SUM(r.real_qty), 0) AS realQty COALESCE(SUM(r.real_qty), 0) AS realQty

View File

@@ -2,9 +2,9 @@
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zg.project.Inventory.AutoInventory.mapper.PrintRfidMapper"> <mapper namespace="com.zg.project.inventory.AutoInventory.mapper.PrintRfidMapper">
<resultMap type="PrintRfid" id="PrintRfidResult"> <resultMap type="com.zg.project.inventory.AutoInventory.domain.entity.PrintRfid" id="PrintRfidResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="pcde" column="pcde" /> <result property="pcde" column="pcde" />
<result property="rfid" column="rfid" /> <result property="rfid" column="rfid" />

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zg.project.Inventory.AutoInventory.mapper.SodMapper"> <mapper namespace="com.zg.project.inventory.AutoInventory.mapper.SodMapper">
<resultMap id="SodResultMap" type="com.zg.project.Inventory.domain.entity.Sod"> <resultMap id="SodResultMap" type="com.zg.project.inventory.domain.entity.Sod">
<id column="Id" property="Id" /> <id column="Id" property="Id" />
<result column="mid" property="mid"/> <result column="mid" property="mid"/>
<result column="des_mat" property="desMat"/> <result column="des_mat" property="desMat"/>
@@ -43,7 +43,7 @@
<result column="uptim" property="uptim"/> <result column="uptim" property="uptim"/>
</resultMap> </resultMap>
<select id="selectByPcdeList" resultType="com.zg.project.Inventory.domain.vo.SodVO"> <select id="selectByPcdeList" resultType="com.zg.project.inventory.domain.vo.SodVO">
SELECT SELECT
pcde, pcde,
des_mat AS desMat, des_mat AS desMat,

View File

@@ -2,12 +2,13 @@
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zg.project.Inventory.Task.mapper.InventoryTaskMapper"> <mapper namespace="com.zg.project.inventory.Task.mapper.InventoryTaskMapper">
<!-- ========== 映射对象 ========== -->
<resultMap type="InventoryTask" id="InventoryTaskResult"> <resultMap type="InventoryTask" id="InventoryTaskResult">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="taskName" column="task_name"/> <result property="taskName" column="task_name"/>
<result property="warehouseId" column="warehouse_id"/> <result property="warehouseCode" column="warehouse_code"/>
<result property="warehouseName" column="warehouse_name"/> <result property="warehouseName" column="warehouse_name"/>
<result property="sceneId" column="scene_id"/> <result property="sceneId" column="scene_id"/>
<result property="sceneName" column="scene_name"/> <result property="sceneName" column="scene_name"/>
@@ -24,11 +25,12 @@
<result property="isDelete" column="is_delete"/> <result property="isDelete" column="is_delete"/>
</resultMap> </resultMap>
<!-- ========== 公共 SELECT 语句 ========== -->
<sql id="selectInventoryTaskVo"> <sql id="selectInventoryTaskVo">
SELECT SELECT
t.id, t.id,
t.task_name, t.task_name,
t.warehouse_id, t.warehouse_code,
w.warehouse_name AS warehouse_name, w.warehouse_name AS warehouse_name,
t.scene_id, t.scene_id,
s.scene_name AS scene_name, s.scene_name AS scene_name,
@@ -44,49 +46,79 @@
t.updated_at, t.updated_at,
t.is_delete t.is_delete
FROM inventory_task t FROM inventory_task t
LEFT JOIN warehouse_info w ON t.warehouse_id = w.warehouse_code LEFT JOIN warehouse_info w ON t.warehouse_code = w.warehouse_code
LEFT JOIN scene_mapping s ON t.scene_id = s.scene_code LEFT JOIN scene_mapping s ON t.scene_id = s.scene_code
LEFT JOIN sys_user u ON t.user_id = u.user_id LEFT JOIN sys_user u ON t.user_id = u.user_id
</sql> </sql>
<!-- ========== 列表查询 ========== -->
<select id="selectInventoryTaskList" parameterType="InventoryTask" resultMap="InventoryTaskResult"> <select id="selectInventoryTaskList" parameterType="InventoryTask" resultMap="InventoryTaskResult">
<include refid="selectInventoryTaskVo"/> <include refid="selectInventoryTaskVo"/>
<where> <where>
<if test="taskName != null and taskName != ''"> AND t.task_name LIKE concat('%', #{taskName}, '%')</if> <if test="taskName != null and taskName != ''">
<if test="warehouseId != null"> AND t.warehouse_id = #{warehouseId}</if> AND t.task_name LIKE concat('%', #{taskName}, '%')
<if test="sceneId != null"> AND t.scene_id = #{sceneId}</if> </if>
<if test="userId != null"> AND t.user_id = #{userId}</if> <if test="warehouseCode != null and warehouseCode != ''">
<if test="requireTime != null and requireTime != ''"> AND t.require_time = #{requireTime}</if> AND t.warehouse_code = #{warehouseCode}
<if test="status != null and status != ''"> AND t.status = #{status}</if> </if>
<if test="taskType != null and taskType != ''"> AND t.task_type = #{taskType}</if> <if test="sceneId != null and sceneId != ''">
<if test="createdBy != null and createdBy != ''"> AND t.created_by = #{createdBy}</if> AND t.scene_id = #{sceneId}
<if test="createdAt != null and createdAt != ''"> AND t.created_at = #{createdAt}</if> </if>
<if test="updatedBy != null and updatedBy != ''"> AND t.updated_by = #{updatedBy}</if> <if test="userId != null">
<if test="updatedAt != null and updatedAt != ''"> AND t.updated_at = #{updatedAt}</if> AND t.user_id = #{userId}
<if test="isDelete != null and isDelete != ''"> AND t.is_delete = #{isDelete}</if> </if>
<if test="requireTime != null and requireTime != ''">
AND t.require_time = #{requireTime}
</if>
<if test="status != null and status != ''">
AND t.status = #{status}
</if>
<if test="taskType != null and taskType != ''">
AND t.task_type = #{taskType}
</if>
<if test="createdBy != null and createdBy != ''">
AND t.created_by = #{createdBy}
</if>
<if test="createdAt != null and createdAt != ''">
AND t.created_at = #{createdAt}
</if>
<if test="updatedBy != null and updatedBy != ''">
AND t.updated_by = #{updatedBy}
</if>
<if test="updatedAt != null and updatedAt != ''">
AND t.updated_at = #{updatedAt}
</if>
<if test="isDelete != null and isDelete != ''">
AND t.is_delete = #{isDelete}
</if>
</where> </where>
order by t.created_at desc ORDER BY t.created_at DESC
</select> </select>
<!-- ========== 根据 ID 查询 ========== -->
<select id="selectInventoryTaskById" parameterType="Long" resultMap="InventoryTaskResult"> <select id="selectInventoryTaskById" parameterType="Long" resultMap="InventoryTaskResult">
<include refid="selectInventoryTaskVo"/> <include refid="selectInventoryTaskVo"/>
WHERE t.id = #{id} WHERE t.id = #{id}
</select> </select>
<!-- ========== 查询用户未完成任务数量 ========== -->
<select id="countPendingTaskByUserId" resultType="java.lang.Integer" parameterType="java.lang.Long"> <select id="countPendingTaskByUserId" resultType="java.lang.Integer" parameterType="java.lang.Long">
select count(*) from inventory_task SELECT COUNT(*)
where user_id = #{userId} FROM inventory_task
and status = '0' WHERE user_id = #{userId}
and is_delete = '0' AND status = '0'
AND is_delete = '0'
</select> </select>
<!-- ========== 根据任务 ID 获取仓库(小仓编码) ========== -->
<select id="getWhByTaskId" resultType="java.lang.String" parameterType="java.lang.String"> <select id="getWhByTaskId" resultType="java.lang.String" parameterType="java.lang.String">
select warehouse_id from inventory_task SELECT warehouse_code
where id = #{taskId} FROM inventory_task
WHERE id = #{taskId}
</select> </select>
<select id="getSceneByTaskId" <!-- ========== 根据任务 ID 获取场景编码 ========== -->
resultType="java.lang.String" parameterType="java.lang.String"> <select id="getSceneByTaskId" resultType="java.lang.String" parameterType="java.lang.String">
SELECT scene_id SELECT scene_id
FROM inventory_task FROM inventory_task
WHERE id = #{taskId} WHERE id = #{taskId}
@@ -100,60 +132,63 @@
LIMIT 1 LIMIT 1
</select> </select>
<!-- ========== 新增 ========== -->
<insert id="insertInventoryTask" parameterType="InventoryTask" useGeneratedKeys="true" keyProperty="id"> <insert id="insertInventoryTask" parameterType="InventoryTask" useGeneratedKeys="true" keyProperty="id">
insert into inventory_task INSERT INTO inventory_task
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskName != null and taskName != ''">task_name,</if> <if test="taskName != null and taskName != ''">task_name,</if>
<if test="warehouseId != null">warehouse_id,</if> <if test="warehouseCode != null and warehouseCode != ''">warehouse_code,</if>
<if test="sceneId != null">scene_id,</if> <if test="sceneId != null and sceneId != ''">scene_id,</if>
<if test="userId != null">user_id,</if> <if test="userId != null">user_id,</if>
<if test="requireTime != null and requireTime != ''">require_time,</if> <if test="requireTime != null and requireTime != ''">require_time,</if>
<if test="status != null">status,</if> <if test="status != null and status != ''">status,</if>
<if test="taskType != null and taskType != ''">task_type,</if> <if test="taskType != null and taskType != ''">task_type,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="createdBy != null">created_by,</if> <if test="createdBy != null and createdBy != ''">created_by,</if>
<if test="createdAt != null">created_at,</if> <if test="createdAt != null and createdAt != ''">created_at,</if>
<if test="updatedBy != null">updated_by,</if> <if test="updatedBy != null and updatedBy != ''">updated_by,</if>
<if test="updatedAt != null">updated_at,</if> <if test="updatedAt != null and updatedAt != ''">updated_at,</if>
<if test="isDelete != null">is_delete,</if> <if test="isDelete != null and isDelete != ''">is_delete,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="taskName != null and taskName != ''">#{taskName},</if> <if test="taskName != null and taskName != ''">#{taskName},</if>
<if test="warehouseId != null">#{warehouseId},</if> <if test="warehouseCode != null and warehouseCode != ''">#{warehouseCode},</if>
<if test="sceneId != null">#{sceneId},</if> <if test="sceneId != null and sceneId != ''">#{sceneId},</if>
<if test="userId != null">#{userId},</if> <if test="userId != null">#{userId},</if>
<if test="requireTime != null and requireTime != ''">#{requireTime},</if> <if test="requireTime != null and requireTime != ''">#{requireTime},</if>
<if test="status != null">#{status},</if> <if test="status != null and status != ''">#{status},</if>
<if test="taskType != null and taskType != ''">#{taskType},</if> <if test="taskType != null and taskType != ''">#{taskType},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="createdBy != null">#{createdBy},</if> <if test="createdBy != null and createdBy != ''">#{createdBy},</if>
<if test="createdAt != null">#{createdAt},</if> <if test="createdAt != null and createdAt != ''">#{createdAt},</if>
<if test="updatedBy != null">#{updatedBy},</if> <if test="updatedBy != null and updatedBy != ''">#{updatedBy},</if>
<if test="updatedAt != null">#{updatedAt},</if> <if test="updatedAt != null and updatedAt != ''">#{updatedAt},</if>
<if test="isDelete != null">#{isDelete},</if> <if test="isDelete != null and isDelete != ''">#{isDelete},</if>
</trim> </trim>
</insert> </insert>
<!-- ========== 修改 ========== -->
<update id="updateInventoryTask" parameterType="InventoryTask"> <update id="updateInventoryTask" parameterType="InventoryTask">
update inventory_task UPDATE inventory_task
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="taskName != null and taskName != ''">task_name = #{taskName},</if> <if test="taskName != null and taskName != ''">task_name = #{taskName},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if> <if test="warehouseCode != null and warehouseCode != ''">warehouse_code = #{warehouseCode},</if>
<if test="sceneId != null">scene_id = #{sceneId},</if> <if test="sceneId != null and sceneId != ''">scene_id = #{sceneId},</if>
<if test="userId != null">user_id = #{userId},</if> <if test="userId != null">user_id = #{userId},</if>
<if test="requireTime != null and requireTime != ''">require_time = #{requireTime},</if> <if test="requireTime != null and requireTime != ''">require_time = #{requireTime},</if>
<if test="status != null">status = #{status},</if> <if test="status != null and status != ''">status = #{status},</if>
<if test="taskType != null and taskType != ''">task_type = #{taskType},</if> <if test="taskType != null and taskType != ''">task_type = #{taskType},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="createdBy != null">created_by = #{createdBy},</if> <if test="createdBy != null and createdBy != ''">created_by = #{createdBy},</if>
<if test="createdAt != null">created_at = #{createdAt},</if> <if test="createdAt != null and createdAt != ''">created_at = #{createdAt},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if> <if test="updatedBy != null and updatedBy != ''">updated_by = #{updatedBy},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if> <if test="updatedAt != null and updatedAt != ''">updated_at = #{updatedAt},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if> <if test="isDelete != null and isDelete != ''">is_delete = #{isDelete},</if>
</trim> </trim>
where id = #{id} WHERE id = #{id}
</update> </update>
<!-- ========== 更新状态 ========== -->
<update id="updateStatus" parameterType="map"> <update id="updateStatus" parameterType="map">
UPDATE inventory_task UPDATE inventory_task
SET status = #{status}, SET status = #{status},
@@ -161,14 +196,16 @@
WHERE id = #{taskId} WHERE id = #{taskId}
</update> </update>
<!-- ========== 删除 ========== -->
<delete id="deleteInventoryTaskById" parameterType="Long"> <delete id="deleteInventoryTaskById" parameterType="Long">
delete from inventory_task where id = #{id} DELETE FROM inventory_task WHERE id = #{id}
</delete> </delete>
<delete id="deleteInventoryTaskByIds" parameterType="String"> <delete id="deleteInventoryTaskByIds" parameterType="String">
delete from inventory_task where id in DELETE FROM inventory_task WHERE id IN
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

View File

@@ -4,13 +4,18 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zg.project.information.mapper.PcdeDetailMapper"> <mapper namespace="com.zg.project.information.mapper.PcdeDetailMapper">
<!-- ==================== 通用结果映射 ==================== -->
<resultMap type="PcdeDetail" id="PcdeDetailResult"> <resultMap type="PcdeDetail" id="PcdeDetailResult">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="pcode" column="pcode"/> <result property="pcode" column="pcode"/>
<result property="scene" column="scene"/> <result property="scene" column="scene"/>
<result property="sceneName" column="scene_name"/> <result property="sceneName" column="scene_name"/>
<result property="warehouse" column="warehouse"/>
<result property="parentWarehouseCode" column="parent_warehouse_code"/>
<result property="parentWarehouseName" column="parent_warehouse_name"/>
<result property="warehouseCode" column="warehouse_code"/>
<result property="warehouseName" column="warehouse_name"/> <result property="warehouseName" column="warehouse_name"/>
<result property="encodedId" column="encoded_id"/> <result property="encodedId" column="encoded_id"/>
<result property="tag" column="tag"/> <result property="tag" column="tag"/>
<result property="remark" column="remark"/> <result property="remark" column="remark"/>
@@ -21,36 +26,74 @@
<result property="updatedAt" column="updated_at"/> <result property="updatedAt" column="updated_at"/>
</resultMap> </resultMap>
<!-- 公共 SELECT 片段:带场景名称 -->
<sql id="selectPcdeDetailVo"> <sql id="selectPcdeDetailVo">
select d.id, d.pcode, d.scene, m.scene_name, d.warehouse, w.warehouse_name, SELECT
d.encoded_id, d.tag, d.remark, d.is_delete, d.id,
d.created_by, d.created_at, d.updated_by, d.updated_at d.pcode,
from pcde_detail d d.scene,
left join scene_mapping m on d.scene = m.scene_code m.scene_name,
left join warehouse_info w on d.warehouse = w.warehouse_code d.parent_warehouse_code,
d.parent_warehouse_name,
d.warehouse_code,
d.warehouse_name,
d.encoded_id,
d.tag,
d.remark,
d.is_delete,
d.created_by,
d.created_at,
d.updated_by,
d.updated_at
FROM pcde_detail d
LEFT JOIN scene_mapping m ON d.scene = m.scene_code
</sql> </sql>
<select id="selectPcdeDetailList" parameterType="PcdeDetail" resultMap="PcdeDetailResult"> <!-- 列表查询 -->
<select id="selectPcdeDetailList"
parameterType="PcdeDetail"
resultMap="PcdeDetailResult">
<include refid="selectPcdeDetailVo"/> <include refid="selectPcdeDetailVo"/>
<where> <where>
<if test="pcode != null and pcode != ''">and d.pcode = #{pcode}</if> <if test="pcode != null and pcode != ''">
<if test="scene != null and scene != ''">and d.scene = #{scene}</if> AND d.pcode = #{pcode}
</if>
<if test="scene != null and scene != ''">
AND d.scene = #{scene}
</if>
<!-- 按大仓 / 小仓过滤(可选) -->
<if test="parentWarehouseCode != null and parentWarehouseCode != ''">
AND d.parent_warehouse_code = #{parentWarehouseCode}
</if>
<if test="parentWarehouseName != null and parentWarehouseName != ''">
AND d.parent_warehouse_name LIKE concat('%', #{parentWarehouseName}, '%')
</if>
<if test="warehouseCode != null and warehouseCode != ''">
AND d.warehouse_code = #{warehouseCode}
</if>
<if test="warehouseName != null and warehouseName != ''"> <if test="warehouseName != null and warehouseName != ''">
and w.warehouse_name like concat('%', #{warehouseName}, '%') AND d.warehouse_name LIKE concat('%', #{warehouseName}, '%')
</if> </if>
<if test="warehouse != null and warehouse != ''"> <if test="encodedId != null and encodedId != ''">
and d.warehouse = #{warehouse} AND d.encoded_id = #{encodedId}
</if>
<if test="tag != null and tag != ''">
AND d.tag = #{tag}
</if>
<if test="isDelete != null">
AND d.is_delete = #{isDelete}
</if> </if>
<if test="encodedId != null and encodedId != ''">and d.encoded_id = #{encodedId}</if>
<if test="tag != null and tag != ''">and d.tag = #{tag}</if>
<if test="isDelete != null">and d.is_delete = #{isDelete}</if>
</where> </where>
</select> </select>
<select id="selectPcdeDetailListIds" parameterType="PcdeDetail" resultMap="PcdeDetailResult"> <!-- 根据 ID 列表查询 -->
<select id="selectPcdeDetailListIds"
parameterType="PcdeDetail"
resultMap="PcdeDetailResult">
<include refid="selectPcdeDetailVo"/> <include refid="selectPcdeDetailVo"/>
<where> <where>
<choose> <choose>
@@ -60,39 +103,108 @@
#{val} #{val}
</foreach> </foreach>
</when> </when>
</choose> </choose>
</where> </where>
</select> </select>
<select id="selectPcdeDetailById" parameterType="Long" resultMap="PcdeDetailResult"> <!-- 根据主键查询 -->
<select id="selectPcdeDetailById"
parameterType="Long"
resultMap="PcdeDetailResult">
<include refid="selectPcdeDetailVo"/> <include refid="selectPcdeDetailVo"/>
where d.id = #{id} WHERE d.id = #{id}
</select> </select>
<select id="selectByPcode" resultType="com.zg.project.information.domain.PcdeDetail" <!-- 根据库位编码查询(不联表,直接取表字段) -->
<select id="selectByPcode"
resultType="com.zg.project.information.domain.PcdeDetail"
parameterType="java.lang.String"> parameterType="java.lang.String">
select id, pcode, scene, warehouse, encoded_id, tag, is_delete, SELECT
created_by, created_at, updated_by, updated_at, remark id,
from pcde_detail pcode,
where pcode = #{pcode} scene,
parent_warehouse_code AS parentWarehouseCode,
parent_warehouse_name AS parentWarehouseName,
warehouse_code AS warehouseCode,
warehouse_name AS warehouseName,
encoded_id AS encodedId,
tag,
is_delete AS isDelete,
created_by AS createdBy,
created_at AS createdAt,
updated_by AS UpdatedBy,
updated_at AS updatedAt,
remark
FROM pcde_detail
WHERE pcode = #{pcode}
AND is_delete = '0' AND is_delete = '0'
</select> </select>
<select id="selectEncodedIdByPcode" resultType="java.lang.String" parameterType="java.lang.String"> <!-- 根据库位编码查编码后ID -->
select encoded_id <select id="selectEncodedIdByPcode"
from pcde_detail resultType="java.lang.String"
where pcode = #{pcode} parameterType="java.lang.String">
SELECT encoded_id
FROM pcde_detail
WHERE pcode = #{pcode}
AND is_delete = '0' AND is_delete = '0'
</select> </select>
<insert id="insertPcdeDetail" parameterType="PcdeDetail" useGeneratedKeys="true" keyProperty="id"> <select id="selectByWarehouseCode" parameterType="String" resultMap="PcdeDetailResult">
insert into pcde_detail SELECT
id,
pcode,
scene,
parent_warehouse_code,
parent_warehouse_name,
warehouse_code,
warehouse_name,
encoded_id,
tag,
remark,
is_delete,
created_by,
created_at,
updated_by,
updated_at
FROM pcde_detail
WHERE warehouse_code = #{warehouseCode}
AND is_delete = '0'
ORDER BY id ASC
</select>
<!-- 根据库位编码查所属小仓编码(小仓 warehouse_code -->
<select id="selectWarehouseCodeByPcode" parameterType="java.lang.String" resultType="java.lang.String">
SELECT warehouse_code
FROM pcde_detail
WHERE pcode = #{pcode}
AND is_delete = '0'
LIMIT 1
</select>
<!-- 单条插入 -->
<insert id="insertPcdeDetail"
parameterType="PcdeDetail"
useGeneratedKeys="true"
keyProperty="id">
INSERT INTO pcde_detail
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="pcode != null and pcode != ''">pcode,</if> <if test="pcode != null and pcode != ''">pcode,</if>
<if test="scene != null and scene != ''">scene,</if> <if test="scene != null and scene != ''">scene,</if>
<if test="warehouse != null and warehouse != ''">warehouse,</if>
<if test="parentWarehouseCode != null and parentWarehouseCode != ''">
parent_warehouse_code,
</if>
<if test="parentWarehouseName != null and parentWarehouseName != ''">
parent_warehouse_name,
</if>
<if test="warehouseCode != null and warehouseCode != ''">
warehouse_code,
</if>
<if test="warehouseName != null and warehouseName != ''">
warehouse_name,
</if>
<if test="encodedId != null">encoded_id,</if> <if test="encodedId != null">encoded_id,</if>
<if test="tag != null">tag,</if> <if test="tag != null">tag,</if>
<if test="remark != null and remark != ''">remark,</if> <if test="remark != null and remark != ''">remark,</if>
@@ -102,10 +214,23 @@
<if test="updatedBy != null">updated_by,</if> <if test="updatedBy != null">updated_by,</if>
<if test="updatedAt != null">updated_at,</if> <if test="updatedAt != null">updated_at,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="pcode != null and pcode != ''">#{pcode},</if> <if test="pcode != null and pcode != ''">#{pcode},</if>
<if test="scene != null and scene != ''">#{scene},</if> <if test="scene != null and scene != ''">#{scene},</if>
<if test="warehouse != null and warehouse != ''">#{warehouse},</if>
<if test="parentWarehouseCode != null and parentWarehouseCode != ''">
#{parentWarehouseCode},
</if>
<if test="parentWarehouseName != null and parentWarehouseName != ''">
#{parentWarehouseName},
</if>
<if test="warehouseCode != null and warehouseCode != ''">
#{warehouseCode},
</if>
<if test="warehouseName != null and warehouseName != ''">
#{warehouseName},
</if>
<if test="encodedId != null">#{encodedId},</if> <if test="encodedId != null">#{encodedId},</if>
<if test="tag != null">#{tag},</if> <if test="tag != null">#{tag},</if>
<if test="remark != null and remark != ''">#{remark},</if> <if test="remark != null and remark != ''">#{remark},</if>
@@ -117,36 +242,85 @@
</trim> </trim>
</insert> </insert>
<!-- 更新 -->
<update id="updatePcdeDetail" parameterType="PcdeDetail"> <update id="updatePcdeDetail" parameterType="PcdeDetail">
update pcde_detail UPDATE pcde_detail
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="pcode != null and pcode != ''">pcode = #{pcode},</if> <if test="pcode != null and pcode != ''">
<if test="scene != null and scene != ''">scene = #{scene},</if> pcode = #{pcode},
<if test="warehouse != null and warehouse != ''">warehouse = #{warehouse},</if> </if>
<if test="encodedId != null">encoded_id = #{encodedId},</if> <if test="scene != null and scene != ''">
<if test="tag != null">tag = #{tag},</if> scene = #{scene},
<if test="remark != null and remark != ''">remark = #{remark},</if> </if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="createdBy != null">created_by = #{createdBy},</if> <if test="parentWarehouseCode != null and parentWarehouseCode != ''">
<if test="createdAt != null">created_at = #{createdAt},</if> parent_warehouse_code = #{parentWarehouseCode},
<if test="updatedBy != null">updated_by = #{updatedBy},</if> </if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if> <if test="parentWarehouseName != null and parentWarehouseName != ''">
parent_warehouse_name = #{parentWarehouseName},
</if>
<if test="warehouseCode != null and warehouseCode != ''">
warehouse_code = #{warehouseCode},
</if>
<if test="warehouseName != null and warehouseName != ''">
warehouse_name = #{warehouseName},
</if>
<if test="encodedId != null">
encoded_id = #{encodedId},
</if>
<if test="tag != null">
tag = #{tag},
</if>
<if test="remark != null and remark != ''">
remark = #{remark},
</if>
<if test="isDelete != null">
is_delete = #{isDelete},
</if>
<if test="createdBy != null">
created_by = #{createdBy},
</if>
<if test="createdAt != null">
created_at = #{createdAt},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt},
</if>
</trim> </trim>
where id = #{id} WHERE id = #{id}
</update> </update>
<!-- 批量插入(存在则忽略),用于导入 -->
<insert id="batchInsertIgnore"> <insert id="batchInsertIgnore">
INSERT IGNORE INTO pcde_detail INSERT IGNORE INTO pcde_detail
(pcode, scene, scene_name, warehouse, warehouse_name, (pcode,
encoded_id, tag, remark, is_delete, scene,
created_by, created_at, updated_by, updated_at) scene_name,
parent_warehouse_code,
parent_warehouse_name,
warehouse_code,
warehouse_name,
encoded_id,
tag,
remark,
is_delete,
created_by,
created_at,
updated_by,
updated_at)
VALUES VALUES
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
( (
#{item.pcode}, #{item.pcode},
#{item.scene}, #{item.scene},
#{item.sceneName}, #{item.sceneName},
#{item.warehouse}, #{item.parentWarehouseCode},
#{item.parentWarehouseName},
#{item.warehouseCode},
#{item.warehouseName}, #{item.warehouseName},
#{item.encodedId}, #{item.encodedId},
#{item.tag}, #{item.tag},
@@ -160,12 +334,16 @@
</foreach> </foreach>
</insert> </insert>
<!-- 单条删除 -->
<delete id="deletePcdeDetailById" parameterType="Long"> <delete id="deletePcdeDetailById" parameterType="Long">
delete from pcde_detail where id = #{id} DELETE FROM pcde_detail
WHERE id = #{id}
</delete> </delete>
<!-- 批量删除 -->
<delete id="deletePcdeDetailByIds" parameterType="String"> <delete id="deletePcdeDetailByIds" parameterType="String">
delete from pcde_detail where id in DELETE FROM pcde_detail
WHERE id IN
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>

View File

@@ -18,6 +18,13 @@
<result property="rkTypeName" column="rk_type_name"/> <result property="rkTypeName" column="rk_type_name"/>
<result property="wlTypeName" column="wl_type_name"/> <result property="wlTypeName" column="wl_type_name"/>
<result property="cangkuName" column="cangku_name"/> <result property="cangkuName" column="cangku_name"/>
<!-- 新增:大仓/小仓编码和名称 -->
<result property="parentWarehouseCode" column="parent_warehouse_code"/>
<result property="parentWarehouseName" column="parent_warehouse_name"/>
<result property="warehouseCode" column="warehouse_code"/>
<result property="warehouseName" column="warehouse_name"/>
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="xj" column="xj" /> <result property="xj" column="xj" />
<result property="xmNo" column="xm_no" /> <result property="xmNo" column="xm_no" />
@@ -62,7 +69,7 @@
<result property="isDelivery" column="is_delivery"/> <result property="isDelivery" column="is_delivery"/>
</resultMap> </resultMap>
<!-- 明细查询SQL包含多表JOIN用于普通明<EFBFBD>?分页等) --> <!-- 明细查询SQL包含多表JOIN用于普通明分页等) -->
<sql id="selectRkInfoVo"> <sql id="selectRkInfoVo">
SELECT SELECT
ri.id, ri.id,
@@ -70,7 +77,16 @@
ri.bill_no_ck, ri.bill_no_ck,
ri.rk_type, st.type_name AS rk_type_name, ri.rk_type, st.type_name AS rk_type_name,
ri.wl_type, mt.type_name AS wl_type_name, ri.wl_type, mt.type_name AS wl_type_name,
ri.cangku, wh.warehouse_name AS cangku_name,
ri.cangku,
wh.warehouse_name AS cangku_name,
-- 新增:大仓/小仓编码和名称
wh.parent_warehouse_code AS parent_warehouse_code,
wh.parent_warehouse_name AS parent_warehouse_name,
wh.warehouse_code AS warehouse_code,
wh.warehouse_name AS warehouse_name,
ri.rk_time, ri.lihuo_y, ri.is_chuku, ri.is_borrowed, ri.is_delivery,ri.remark, ri.rk_time, ri.lihuo_y, ri.is_chuku, ri.is_borrowed, ri.is_delivery,ri.remark,
ri.ck_lihuo_y, ri.ck_type, sot.type_name AS ck_type_name, ri.ck_lihuo_y, ri.ck_type, sot.type_name AS ck_type_name,
ri.team_code, ct.team_name, ri.team_code, ct.team_name,
@@ -148,7 +164,8 @@
#{item.xmNoCk}, #{item.xmMsCk}, #{item.xj}, #{item.sapNo}, #{item.gysNo}, #{item.gysMc}, #{item.xmNoCk}, #{item.xmMsCk}, #{item.xj}, #{item.sapNo}, #{item.gysNo}, #{item.gysMc},
#{item.jhQty}, #{item.htQty}, #{item.jhAmt}, #{item.htDj}, #{item.dw}, #{item.jhQty}, #{item.htQty}, #{item.jhAmt}, #{item.htDj}, #{item.dw},
#{item.borrowTime}, #{item.returnTime}, #{item.status}, #{item.borrowTime}, #{item.returnTime}, #{item.status},
#{item.pcode}, #{item.pcodeId}, #{item.trayCode}, #{item.realQty}, #{item.entityId}, #{item.fycde1}, #{item.fycde2}, #{item.pcode}, #{item.pcodeId}, #{item.trayCode}, #{item.realQty}, #{item.entityId},
#{item.fycde1}, #{item.fycde2},
#{item.remark}, #{item.isChuku}, #{item.isBorrowed}, #{item.gysJhId}, #{item.remark}, #{item.isChuku}, #{item.isBorrowed}, #{item.gysJhId},
#{item.isDelete}, #{item.createBy}, #{item.createTime} #{item.isDelete}, #{item.createBy}, #{item.createTime}
) )
@@ -219,36 +236,36 @@
<!-- 关键字搜索 --> <!-- 关键字搜索 -->
<if test="keyword != null and keyword != ''"> <if test="keyword != null and keyword != ''">
AND ( AND (
ri.xm_no like concat('%', #{keyword}, '%') ri.xm_no LIKE concat('%', #{keyword}, '%')
or ri.xm_ms like concat('%', #{keyword}, '%') OR ri.xm_ms LIKE concat('%', #{keyword}, '%')
or ri.fycde_1 like concat('%', #{keyword}, '%') OR ri.fycde_1 LIKE concat('%', #{keyword}, '%')
or ri.fycde_2 like concat('%', #{keyword}, '%') OR ri.fycde_2 LIKE concat('%', #{keyword}, '%')
or ri.wl_no like concat('%', #{keyword}, '%') OR ri.wl_no LIKE concat('%', #{keyword}, '%')
or ri.wl_ms like concat('%', #{keyword}, '%') OR ri.wl_ms LIKE concat('%', #{keyword}, '%')
or ri.gys_no like concat('%', #{keyword}, '%') OR ri.gys_no LIKE concat('%', #{keyword}, '%')
or ri.gys_mc like concat('%', #{keyword}, '%') OR ri.gys_mc LIKE concat('%', #{keyword}, '%')
or ri.sap_no like concat('%', #{keyword}, '%') OR ri.sap_no LIKE concat('%', #{keyword}, '%')
or ri.bill_no like concat('%', #{keyword}, '%') OR ri.bill_no LIKE concat('%', #{keyword}, '%')
or ri.bill_no_ck like concat('%', #{keyword}, '%') OR ri.bill_no_ck LIKE concat('%', #{keyword}, '%')
or ri.ck_type like concat('%', #{keyword}, '%') OR ri.ck_type LIKE concat('%', #{keyword}, '%')
or ri.pcode like concat('%', #{keyword}, '%') OR ri.pcode LIKE concat('%', #{keyword}, '%')
) )
</if> </if>
<if test="rkType != null and rkType != ''"> <if test="rkType != null and rkType != ''">
AND ri.rk_type like concat('%', #{rkType}, '%') AND ri.rk_type LIKE concat('%', #{rkType}, '%')
</if> </if>
<if test="wlType != null and wlType != ''"> <if test="wlType != null and wlType != ''">
AND ri.wl_type like concat('%', #{wlType}, '%') AND ri.wl_type LIKE concat('%', #{wlType}, '%')
</if> </if>
<if test="cangku != null and cangku != ''"> <if test="cangku != null and cangku != ''">
AND ri.cangku like concat('%', #{cangku}, '%') AND ri.cangku LIKE concat('%', #{cangku}, '%')
</if> </if>
<if test="fycde1 != null and fycde1 != ''"> <if test="fycde1 != null and fycde1 != ''">
AND ri.fycde_1 like concat('%', #{fycde1}, '%') AND ri.fycde_1 LIKE concat('%', #{fycde1}, '%')
</if> </if>
<if test="fycde2 != null and fycde2 != ''"> <if test="fycde2 != null and fycde2 != ''">
AND ri.fycde_2 like concat('%', #{fycde2}, '%') AND ri.fycde_2 LIKE concat('%', #{fycde2}, '%')
</if> </if>
<if test="ids != null and ids.size > 0"> <if test="ids != null and ids.size > 0">
@@ -258,14 +275,6 @@
</foreach> </foreach>
</if> </if>
<!-- ★★ 先按是否借料过滤行0 否1 借料中2 已归还 ★★ -->
<if test="isBorrowed != null and isBorrowed != ''">
AND ri.is_borrowed = #{isBorrowed}
</if>
<!-- ★★ 时间范围逻辑 ★★ -->
<!-- 1普通库存isBorrowed 为空):按入库时间 rk_time -->
<if test="(isBorrowed == null or isBorrowed == '')">
<if test="startTime != null"> <if test="startTime != null">
<![CDATA[ <![CDATA[
AND ri.rk_time >= #{startTime} AND ri.rk_time >= #{startTime}
@@ -276,37 +285,7 @@
AND ri.rk_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY) AND ri.rk_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY)
]]> ]]>
</if> </if>
</if>
<!-- 2借料中按借用时间 borrow_time -->
<if test="isBorrowed == '1'">
<if test="startTime != null">
<![CDATA[
AND ri.borrow_time >= #{startTime}
]]>
</if>
<if test="endTime != null">
<![CDATA[
AND ri.borrow_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY)
]]>
</if>
</if>
<!-- 3已归还按归还时间 return_time -->
<if test="isBorrowed == '2'">
<if test="startTime != null">
<![CDATA[
AND ri.return_time >= #{startTime}
]]>
</if>
<if test="endTime != null">
<![CDATA[
AND ri.return_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY)
]]>
</if>
</if>
<!-- 领用时间范围(原有逻辑,保留) -->
<if test="lyStartTime != null"> <if test="lyStartTime != null">
<![CDATA[ AND ri.ly_time >= #{lyStartTime} ]]> <![CDATA[ AND ri.ly_time >= #{lyStartTime} ]]>
</if> </if>
@@ -315,34 +294,34 @@
</if> </if>
<if test="lihuoY != null and lihuoY != ''"> <if test="lihuoY != null and lihuoY != ''">
AND ri.lihuo_y like concat('%', #{lihuoY}, '%') AND ri.lihuo_y LIKE concat('%', #{lihuoY}, '%')
</if> </if>
<if test="xj != null and xj != ''"> <if test="xj != null and xj != ''">
AND ri.xj like concat('%', #{xj}, '%') AND ri.xj LIKE concat('%', #{xj}, '%')
</if> </if>
<if test="billNo != null and billNo != ''"> <if test="billNo != null and billNo != ''">
AND ri.bill_no like concat('%', #{billNo}, '%') AND ri.bill_no LIKE concat('%', #{billNo}, '%')
</if> </if>
<if test="billNoCk != null and billNoCk != ''"> <if test="billNoCk != null and billNoCk != ''">
AND ri.bill_no_ck like concat('%', #{billNoCk}, '%') AND ri.bill_no_ck LIKE concat('%', #{billNoCk}, '%')
</if> </if>
<if test="xmNo != null and xmNo != ''"> <if test="xmNo != null and xmNo != ''">
AND ri.xm_no like concat('%', #{xmNo}, '%') AND ri.xm_no LIKE concat('%', #{xmNo}, '%')
</if> </if>
<if test="xmMs != null and xmMs != ''"> <if test="xmMs != null and xmMs != ''">
AND ri.xm_ms like concat('%', #{xmMs}, '%') AND ri.xm_ms LIKE concat('%', #{xmMs}, '%')
</if> </if>
<if test="wlNo != null and wlNo != ''"> <if test="wlNo != null and wlNo != ''">
AND ri.wl_no like concat('%', #{wlNo}, '%') AND ri.wl_no LIKE concat('%', #{wlNo}, '%')
</if> </if>
<if test="wlMs != null and wlMs != ''"> <if test="wlMs != null and wlMs != ''">
AND ri.wl_ms like concat('%', #{wlMs}, '%') AND ri.wl_ms LIKE concat('%', #{wlMs}, '%')
</if> </if>
<if test="gysNo != null and gysNo != ''"> <if test="gysNo != null and gysNo != ''">
AND ri.gys_no like concat('%', #{gysNo}, '%') AND ri.gys_no LIKE concat('%', #{gysNo}, '%')
</if> </if>
<if test="gysMc != null and gysMc != ''"> <if test="gysMc != null and gysMc != ''">
AND ri.gys_mc like concat('%', #{gysMc}, '%') AND ri.gys_mc LIKE concat('%', #{gysMc}, '%')
</if> </if>
<if test="jhAmt != null"> <if test="jhAmt != null">
@@ -353,10 +332,10 @@
</if> </if>
<if test="sapNo != null and sapNo != ''"> <if test="sapNo != null and sapNo != ''">
AND ri.sap_no like concat('%', #{sapNo}, '%') AND ri.sap_no LIKE concat('%', #{sapNo}, '%')
</if> </if>
<if test="xh != null and xh != ''"> <if test="xh != null and xh != ''">
AND ri.xh like concat('%', #{xh}, '%') AND ri.xh LIKE concat('%', #{xh}, '%')
</if> </if>
<if test="jhQty != null"> <if test="jhQty != null">
AND ri.jh_qty = #{jhQty} AND ri.jh_qty = #{jhQty}
@@ -365,14 +344,14 @@
AND ri.ht_qty = #{htQty} AND ri.ht_qty = #{htQty}
</if> </if>
<if test="dw != null and dw != ''"> <if test="dw != null and dw != ''">
AND ri.dw like concat('%', #{dw}, '%') AND ri.dw LIKE concat('%', #{dw}, '%')
</if> </if>
<if test="realQty != null"> <if test="realQty != null">
AND ri.real_qty = #{realQty} AND ri.real_qty = #{realQty}
</if> </if>
<if test="pcode != null and pcode != ''"> <if test="pcode != null and pcode != ''">
AND ri.pcode like concat('%', #{pcode}, '%') AND ri.pcode LIKE concat('%', #{pcode}, '%')
</if> </if>
<if test="lyTime != null"> <if test="lyTime != null">
AND ri.ly_time = #{lyTime} AND ri.ly_time = #{lyTime}
@@ -381,13 +360,13 @@
AND ri.return_time = #{returnTime} AND ri.return_time = #{returnTime}
</if> </if>
<if test="trayCode != null and trayCode != ''"> <if test="trayCode != null and trayCode != ''">
AND ri.tray_code like concat('%', #{trayCode}, '%') AND ri.tray_code LIKE concat('%', #{trayCode}, '%')
</if> </if>
<if test="entityId != null and entityId != ''"> <if test="entityId != null and entityId != ''">
AND ri.entity_id like concat('%', #{entityId}, '%') AND ri.entity_id LIKE concat('%', #{entityId}, '%')
</if> </if>
<if test="ckType != null and ckType != ''"> <if test="ckType != null and ckType != ''">
AND ri.ck_type like concat('%', #{ckType}, '%') AND ri.ck_type LIKE concat('%', #{ckType}, '%')
</if> </if>
<choose> <choose>
@@ -402,8 +381,88 @@
ORDER BY ri.rk_time DESC ORDER BY ri.rk_time DESC
</select> </select>
<select id="selectBorrowAndReturnList"
parameterType="RkInfo"
resultMap="RkInfoResult">
<include refid="selectRkInfoVo"/>
<where>
<!-- 只查未删除 -->
<choose>
<when test="isDelete != null and isDelete != ''">
AND ri.is_delete = #{isDelete}
</when>
<otherwise>
AND ri.is_delete = 0
</otherwise>
</choose>
<!-- 借料/还料状态0 否1 借料中2 已归还 -->
<choose>
<when test="isBorrowed != null and isBorrowed != ''">
AND ri.is_borrowed = #{isBorrowed}
</when>
<otherwise>
AND ri.is_borrowed IN ('1','2')
</otherwise>
</choose>
<!-- 时间范围:根据 isBorrowed 选择 borrow_time / return_time -->
<!-- 先添加通用时间条件如果isBorrowed为1或2时使用对应的时间字段 -->
<if test="startTime != null">
<choose>
<when test="isBorrowed != null and (isBorrowed == '1' or isBorrowed == 1)">
<![CDATA[
AND ri.borrow_time >= #{startTime}
]]>
</when>
<when test="isBorrowed != null and (isBorrowed == '2' or isBorrowed == 2)">
<![CDATA[
AND ri.return_time >= #{startTime}
]]>
</when>
<otherwise>
<![CDATA[
AND ri.rk_time >= #{startTime}
]]>
</otherwise>
</choose>
</if>
<if test="endTime != null">
<choose>
<when test="isBorrowed != null and (isBorrowed == '1' or isBorrowed == 1)">
<![CDATA[
AND ri.borrow_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY)
]]>
</when>
<when test="isBorrowed != null and (isBorrowed == '2' or isBorrowed == 2)">
<![CDATA[
AND ri.return_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY)
]]>
</when>
<otherwise>
<![CDATA[
AND ri.rk_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY)
]]>
</otherwise>
</choose>
</if>
<if test="xmNo != null and xmNo != ''">
AND ri.xm_no LIKE concat('%', #{xmNo}, '%')
</if>
<if test="sapNo != null and sapNo != ''">
AND ri.sap_no LIKE concat('%', #{sapNo}, '%')
</if>
<if test="billNo != null and billNo != ''">
AND ri.bill_no LIKE concat('%', #{billNo}, '%')
</if>
</where>
ORDER BY ri.borrow_time DESC, ri.return_time DESC, ri.id DESC
</select>
<!-- ================== 这里是已优化的按单据分组查询替换旧版本<E78988>?================== -->
<select id="selectGroupedByBill" resultMap="RkInfoResult" parameterType="map"> <select id="selectGroupedByBill" resultMap="RkInfoResult" parameterType="map">
SELECT SELECT
a.id, a.id,
@@ -559,7 +618,7 @@
AND t.is_delivery = #{q.isDelivery} AND t.is_delivery = #{q.isDelivery}
</if> </if>
<!-- 出库才要<EFBFBD>?bill_no_ck 非空 --> <!-- 出库才要 bill_no_ck 非空 -->
<if test="(q.isChuku != null and q.isChuku == '1') <if test="(q.isChuku != null and q.isChuku == '1')
or (q.isChukuList != null and q.isChukuList.size > 0 and q.isChukuList.contains('1'))"> or (q.isChukuList != null and q.isChukuList.size > 0 and q.isChukuList.contains('1'))">
AND t.bill_no_ck IS NOT NULL AND t.bill_no_ck IS NOT NULL
@@ -589,7 +648,7 @@
ORDER BY a.rk_time DESC ORDER BY a.rk_time DESC
</select> </select>
<!-- ================== /按单据分组查<EFBFBD>?================== --> <!-- ================== /按单据分组查================== -->
<select id="selectRkInfoById" parameterType="Long" resultMap="RkInfoResult"> <select id="selectRkInfoById" parameterType="Long" resultMap="RkInfoResult">
<include refid="selectRkInfoVo"/> <include refid="selectRkInfoVo"/>
@@ -636,7 +695,7 @@
WHERE bill_no = #{billNo} AND sap_no IS NOT NULL WHERE bill_no = #{billNo} AND sap_no IS NOT NULL
</select> </select>
<!-- 正常数据:扫描到的库位(限定场景<EFBFBD>?--> <!-- 正常数据:扫描到的库位(限定场景 -->
<select id="getByPcodeIdList" parameterType="map" resultMap="RkInfoResult"> <select id="getByPcodeIdList" parameterType="map" resultMap="RkInfoResult">
SELECT SELECT
ri.id, ri.rk_type, ri.wl_type, ri.cangku, ri.rk_time, ri.lihuo_y, ri.id, ri.rk_type, ri.wl_type, ri.cangku, ri.rk_time, ri.lihuo_y,
@@ -659,7 +718,7 @@
</foreach> </foreach>
</select> </select>
<!-- 未扫描到的数据(限定场景<EFBFBD>?--> <!-- 未扫描到的数据(限定场景 -->
<select id="getMissedPcodeIds" parameterType="map" resultMap="RkInfoResult"> <select id="getMissedPcodeIds" parameterType="map" resultMap="RkInfoResult">
SELECT SELECT
ri.id, ri.rk_type, ri.wl_type, ri.cangku, ri.rk_time, ri.lihuo_y, ri.id, ri.rk_type, ri.wl_type, ri.cangku, ri.rk_time, ri.lihuo_y,
@@ -704,7 +763,7 @@
</select> </select>
<select id="getUnscannedPcodeByScene" <select id="getUnscannedPcodeByScene"
resultType="com.zg.project.Inventory.domain.vo.RkInfoMatchVO"> resultType="com.zg.project.inventory.domain.vo.RkInfoMatchVO">
SELECT SELECT
r.pcode AS rkPcode, r.pcode AS rkPcode,
COALESCE(SUM(r.real_qty), 0) AS realQty COALESCE(SUM(r.real_qty), 0) AS realQty
@@ -724,7 +783,7 @@
ORDER BY MAX(r.create_time) DESC ORDER BY MAX(r.create_time) DESC
</select> </select>
<select id="selectPcdeCntFromRkInfo" resultType="com.zg.project.Inventory.domain.vo.PcdeCntVO"> <select id="selectPcdeCntFromRkInfo" resultType="com.zg.project.inventory.domain.vo.PcdeCntVO">
SELECT pcode AS pcde, SELECT pcode AS pcde,
COUNT(*) AS cnt COUNT(*) AS cnt
FROM rk_info FROM rk_info
@@ -742,6 +801,13 @@
MAX(u.user_name) AS lihuoYName, MAX(u.user_name) AS lihuoYName,
MAX(rkType.type_name) AS rkTypeName, MAX(rkType.type_name) AS rkTypeName,
MAX(cangku.warehouse_name) AS cangkuName, MAX(cangku.warehouse_name) AS cangkuName,
-- 新增:大仓/小仓编码和名称
MAX(cangku.parent_warehouse_code) AS parentWarehouseCode,
MAX(cangku.parent_warehouse_name) AS parentWarehouseName,
MAX(cangku.warehouse_code) AS warehouseCode,
MAX(cangku.warehouse_name) AS warehouseName,
MAX(wlType.type_name) AS wlTypeName, MAX(wlType.type_name) AS wlTypeName,
MAX(ckType.type_name) AS ckTypeName, MAX(ckType.type_name) AS ckTypeName,
MAX(team.team_name) AS teamName MAX(team.team_name) AS teamName
@@ -797,7 +863,9 @@
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="rkType != null">rk_type = #{rkType},</if> <if test="rkType != null">rk_type = #{rkType},</if>
<if test="wlType != null">wl_type = #{wlType},</if> <if test="wlType != null">wl_type = #{wlType},</if>
<if test="cangku != null">cangku = #{cangku},</if> <if test="warehouseCode != null and warehouseCode != ''">
cangku = #{warehouseCode},
</if>
<if test="rkTime != null">rk_time = #{rkTime},</if> <if test="rkTime != null">rk_time = #{rkTime},</if>
<if test="lihuoY != null">lihuo_y = #{lihuoY},</if> <if test="lihuoY != null">lihuo_y = #{lihuoY},</if>
<if test="isChuku != null">is_chuku = #{isChuku},</if> <if test="isChuku != null">is_chuku = #{isChuku},</if>
@@ -954,7 +1022,13 @@
resultMap="RkInfoResult"> resultMap="RkInfoResult">
SELECT SELECT
t.*, t.*,
wh.warehouse_name AS cangku_name wh.warehouse_name AS cangku_name,
-- 新增:大仓/小仓编码和名称
wh.parent_warehouse_code AS parent_warehouse_code,
wh.parent_warehouse_name AS parent_warehouse_name,
wh.warehouse_code AS warehouse_code,
wh.warehouse_name AS warehouse_name
FROM rk_info t FROM rk_info t
LEFT JOIN warehouse_info wh LEFT JOIN warehouse_info wh
ON wh.warehouse_code = t.cangku ON wh.warehouse_code = t.cangku
@@ -975,20 +1049,20 @@
AND ri.is_chuku = #{isChuku} AND ri.is_chuku = #{isChuku}
</if> </if>
<if test="cangku != null and cangku != ''"> <if test="warehouseCode != null and warehouseCode != ''">
AND ri.cangku = #{cangku} AND ri.cangku = #{warehouseCode}
</if> </if>
<if test="startTime != null"> <if test="startTime != null and startTime != ''">
AND ri.rk_time <![CDATA[ >= ]]> #{startTime} AND ri.rk_time <![CDATA[ >= ]]> #{startTime}
</if> </if>
<if test="endTime != null"> <if test="endTime != null and endTime != ''">
AND ri.rk_time <![CDATA[ <= ]]> #{endTime} AND ri.rk_time <![CDATA[ <= ]]> #{endTime}
</if> </if>
<if test="statDate != null"> <if test="statDate != null and statDate != ''">
AND ri.return_time <![CDATA[ >= ]]> #{statDate} AND ri.return_time <![CDATA[ >= ]]> #{statDate}
</if> </if>
<if test="endDate != null"> <if test="endDate != null and endDate != ''">
AND ri.return_time <![CDATA[ <= ]]> #{endDate} AND ri.return_time <![CDATA[ <= ]]> #{endDate}
</if> </if>
<if test="rkType != null and rkType != ''"> <if test="rkType != null and rkType != ''">
@@ -997,10 +1071,10 @@
<if test="wlType != null and wlType != ''"> <if test="wlType != null and wlType != ''">
AND ri.wl_type = #{wlType} AND ri.wl_type = #{wlType}
</if> </if>
<if test="lyStartTime != null"> <if test="lyStartTime != null and lyStartTime != ''">
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime} AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
</if> </if>
<if test="lyEndTime != null"> <if test="lyEndTime != null and lyEndTime != ''">
AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime} AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime}
</if> </if>
@@ -1070,10 +1144,10 @@
AND ri.rk_time <![CDATA[ <= ]]> #{endTime} AND ri.rk_time <![CDATA[ <= ]]> #{endTime}
</if> </if>
<if test="lyStartTime != null"> <if test="lyStartTime != null and lyStartTime != ''">
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime} AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
</if> </if>
<if test="lyEndTime != null"> <if test="lyEndTime != null and lyEndTime != ''">
AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime} AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime}
</if> </if>
@@ -1140,10 +1214,10 @@
AND ri.rk_time <![CDATA[ <= ]]> #{endTime} AND ri.rk_time <![CDATA[ <= ]]> #{endTime}
</if> </if>
<if test="lyStartTime != null"> <if test="lyStartTime != null and lyStartTime != ''">
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime} AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
</if> </if>
<if test="lyEndTime != null"> <if test="lyEndTime != null and lyEndTime != ''">
AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime} AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime}
</if> </if>
@@ -1247,7 +1321,6 @@
AND is_chuku = '1' AND is_chuku = '1'
AND is_delivery = '1' AND is_delivery = '1'
<!-- 可选过滤:比如你以后想限定县局、项目等 -->
<if test="q.xj != null and q.xj != ''"> <if test="q.xj != null and q.xj != ''">
AND xj = #{q.xj} AND xj = #{q.xj}
</if> </if>
@@ -1267,13 +1340,59 @@
ORDER BY bill_no_ck, ly_time, id ORDER BY bill_no_ck, ly_time, id
</select> </select>
<!-- 根据入库单号查询单据头公共信息 -->
<select id="selectHeaderByBillNo"
parameterType="java.lang.String"
resultMap="RkInfoResult">
SELECT
ri.id,
ri.bill_no,
ri.bill_no_ck,
ri.is_chuku,
ri.rk_type,
st.type_name AS rk_type_name,
ri.wl_type,
mt.type_name AS wl_type_name,
ri.rk_time,
ri.ly_time,
ri.lihuo_y,
u.user_name AS lihuo_y_name,
ri.cangku,
wh.warehouse_name AS cangku_name,
wh.parent_warehouse_code AS parent_warehouse_code,
wh.parent_warehouse_name AS parent_warehouse_name,
wh.warehouse_code AS warehouse_code,
wh.warehouse_name AS warehouse_name
FROM rk_info ri
LEFT JOIN stock_in_type st ON ri.rk_type = st.type_code
LEFT JOIN material_type mt ON ri.wl_type = mt.type_code
LEFT JOIN warehouse_info wh ON ri.cangku = wh.warehouse_code
LEFT JOIN sys_user u ON ri.lihuo_y = u.user_id
WHERE ri.is_delete = '0'
AND ri.bill_no = #{billNo}
ORDER BY ri.rk_time ASC, ri.id ASC
LIMIT 1
</select>
<update id="updateBillInfo" parameterType="com.zg.project.wisdom.domain.RkInfo"> <update id="updateBillInfo" parameterType="com.zg.project.wisdom.domain.RkInfo">
UPDATE rk_info UPDATE rk_info
<set> <set>
<if test="rkType != null">rk_type = #{rkType},</if> <if test="rkType != null">
<if test="wlType != null">wl_type = #{wlType},</if> rk_type = #{rkType},
<if test="cangku != null">cangku = #{cangku},</if> </if>
<if test="rkTime != null">rk_time = #{rkTime},</if> <if test="wlType != null">
wl_type = #{wlType},
</if>
<if test="warehouseCode != null and warehouseCode != ''">
cangku = #{warehouseCode},
</if>
<if test="rkTime != null">
rk_time = #{rkTime},
</if>
</set> </set>
WHERE bill_no = #{billNo} WHERE bill_no = #{billNo}
</update> </update>

View File

@@ -11,7 +11,8 @@
</resultMap> </resultMap>
<select id="selectEnabledWarehouses" resultMap="WarehouseLiteMap"> <select id="selectEnabledWarehouses" resultMap="WarehouseLiteMap">
SELECT wi.warehouse_code, wi.warehouse_name SELECT wi.warehouse_code,
wi.warehouse_name
FROM warehouse_info wi FROM warehouse_info wi
WHERE wi.status = 1 WHERE wi.status = 1
ORDER BY wi.warehouse_code ORDER BY wi.warehouse_code
@@ -36,15 +37,17 @@
ON pd.scene = sm.scene_code ON pd.scene = sm.scene_code
LEFT JOIN rk_info ri LEFT JOIN rk_info ri
ON pd.pcode = ri.pcode ON pd.pcode = ri.pcode
WHERE pd.warehouse = #{warehouseCode} WHERE pd.warehouse_code = #{warehouseCode}
AND (pd.is_delete IS NULL OR pd.is_delete = 0) AND (pd.is_delete IS NULL OR pd.is_delete = '0')
GROUP BY sm.scene_code, sm.scene_name GROUP BY sm.scene_code, sm.scene_name
ORDER BY sm.scene_code ORDER BY sm.scene_code
</select> </select>
<!-- 3) 启用仓库总数 --> <!-- 3) 启用仓库总数 -->
<select id="countEnabledWarehouses" resultType="int"> <select id="countEnabledWarehouses" resultType="int">
SELECT COUNT(*) FROM warehouse_info wi WHERE wi.status = 1 SELECT COUNT(*)
FROM warehouse_info wi
WHERE wi.status = 1
</select> </select>
</mapper> </mapper>