Commit b9c85d55 by yubin

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	ruoyi-inventory/src/main/java/com/ruoyi/inventory/domain/Inventory.java
#	ruoyi-inventory/src/main/java/com/ruoyi/inventory/mapper/StorageLocationsMapper.java
#	ruoyi-inventory/src/main/resources/mapper/inventory/InventoryMapper.xml
parents 19bd4ddb 835ab1b5
import request from '@/utils/request' import request from '@/utils/request'
// 查询库存列表 // 查询库存列表
export function listInventoryCount(query) {
return request({
url: '/inventory/inventory/listCount',
method: 'get',
params: query
})
}
// 查询库存列表
export function listInventory(query) { export function listInventory(query) {
return request({ return request({
url: '/inventory/inventory/list', url: '/inventory/inventory/list',
...@@ -65,7 +74,7 @@ export function listInventoryByMaterialId(params) { ...@@ -65,7 +74,7 @@ export function listInventoryByMaterialId(params) {
url: '/inventory/inventory/listByMaterialId', url: '/inventory/inventory/listByMaterialId',
method: 'post', method: 'post',
// 改为data传递JSON对象,适配后端实体类接收 // 改为data传递JSON对象,适配后端实体类接收
data: params data: params
// 若后端仍要求用params(URL参数)传递,保留下面这行,注释上面的data // 若后端仍要求用params(URL参数)传递,保留下面这行,注释上面的data
// params: params // params: params
}) })
......
...@@ -83,7 +83,6 @@ ...@@ -83,7 +83,6 @@
<div class="table-container"> <div class="table-container">
<el-table v-loading="loading" :data="statisticsList" border height="100%"> <el-table v-loading="loading" :data="statisticsList" border height="100%">
<el-table-column type="index" label="序号" width="60" align="center" /> <el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column label="物料ID" align="center" prop="materialId" width="150" />
<el-table-column label="物料名称" align="center" prop="materialName" min-width="150" show-overflow-tooltip /> <el-table-column label="物料名称" align="center" prop="materialName" min-width="150" show-overflow-tooltip />
<el-table-column label="入库次数" align="center" prop="inboundCount" width="100" /> <el-table-column label="入库次数" align="center" prop="inboundCount" width="100" />
<el-table-column label="出库次数" align="center" prop="outboundCount" width="100" /> <el-table-column label="出库次数" align="center" prop="outboundCount" width="100" />
...@@ -200,7 +199,7 @@ export default { ...@@ -200,7 +199,7 @@ export default {
params.endDate = params.dateRange[1] params.endDate = params.dateRange[1]
} }
delete params.dateRange delete params.dateRange
listInboundOutboundStatistics(params).then(response => { listInboundOutboundStatistics(params).then(response => {
this.statisticsList = response.rows || [] this.statisticsList = response.rows || []
this.total = response.total || 0 this.total = response.total || 0
...@@ -295,7 +294,7 @@ export default { ...@@ -295,7 +294,7 @@ export default {
delete params.dateRange delete params.dateRange
delete params.pageNum delete params.pageNum
delete params.pageSize delete params.pageSize
this.download('inventory/statistics/inboundOutbound/export', { this.download('inventory/statistics/inboundOutbound/export', {
...params ...params
}, `出入库统计数据_${new Date().getTime()}.xlsx`) }, `出入库统计数据_${new Date().getTime()}.xlsx`)
......
package com.ruoyi.inventory.controller;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.inventory.domain.vo.InboundOutboundStatisticsVO;
import com.ruoyi.inventory.service.IInventoryStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 出入库统计
*/
@RestController
@RequestMapping("/inventory/statistics")
public class InventoryStatisticsController extends BaseController {
@Autowired
private IInventoryStatisticsService inventoryStatisticsService;
/**
* 出入库统计列表
*/
@PreAuthorize("@ss.hasPermi('inventory:statistics:list')")
@GetMapping("/inboundOutbound")
public TableDataInfo list(InboundOutboundStatisticsVO query) {
startPage();
List<InboundOutboundStatisticsVO> list = inventoryStatisticsService.selectInboundOutboundStatistics(query);
return getDataTable(list);
}
/**
* 导出出入库统计
*/
@PreAuthorize("@ss.hasPermi('inventory:statistics:export')")
@Log(title = "出入库统计", businessType = BusinessType.EXPORT)
@PostMapping("/inboundOutbound/export")
public void export(HttpServletResponse response, InboundOutboundStatisticsVO query) {
List<InboundOutboundStatisticsVO> list = inventoryStatisticsService.selectInboundOutboundStatistics(query);
ExcelUtil<InboundOutboundStatisticsVO> util = new ExcelUtil<>(InboundOutboundStatisticsVO.class);
util.exportExcel(response, list, "出入库统计数据");
}
}
package com.ruoyi.inventory.domain; package com.ruoyi.inventory.domain;
import java.util.Date; import java.util.Date;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
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 com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
...@@ -13,6 +16,7 @@ import com.ruoyi.common.core.domain.BaseEntity; ...@@ -13,6 +16,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
* @author ruoyi * @author ruoyi
* @date 2025-12-03 * @date 2025-12-03
*/ */
@Data
public class Inventory extends BaseEntity public class Inventory extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -121,54 +125,6 @@ public class Inventory extends BaseEntity ...@@ -121,54 +125,6 @@ public class Inventory extends BaseEntity
/** 预警类型 */ /** 预警类型 */
private String alertType; private String alertType;
public String getOrderName() {
return orderName;
}
public void setOrderName(String orderName) {
this.orderName = orderName;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getWarehousesName() {
return warehousesName;
}
public void setWarehousesName(String warehousesName) {
this.warehousesName = warehousesName;
}
public String getLocationName() {
return locationName;
}
public void setLocationName(String locationName) {
this.locationName = locationName;
}
public String getWarehousesCode() {
return warehousesCode;
}
public void setWarehousesCode(String warehousesCode) {
this.warehousesCode = warehousesCode;
}
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
public String getWarehousesId() { public String getWarehousesId() {
return warehousesId; return warehousesId;
} }
...@@ -177,70 +133,55 @@ public class Inventory extends BaseEntity ...@@ -177,70 +133,55 @@ public class Inventory extends BaseEntity
this.warehousesId = warehousesId; this.warehousesId = warehousesId;
} }
public void setId(String id) /** 最低库存 */
{ private Long minStockLevel;
this.id = id; /** 最高库存 */
} private Long maxStockLevel;
public String getId() /** SAP物料号 */
{ @Excel(name = "SAP物料号")
return id; private String sapNo;
}
public void setInventoryType(Long inventoryType) /** TS Code */
{ @Excel(name = "TS Code")
this.inventoryType = inventoryType; private String tsCode;
}
public Long getInventoryType() /** 危险类别 */
{ private String hazardId;
return inventoryType;
}
public void setOrderId(String orderId) /** 危险类别 */
{ @Excel(name = "危险类别")
this.orderId = orderId; private String hazard;
}
public String getOrderId() /** 规格型号 */
{ @Excel(name = "规格型号")
return orderId; private String specification;
}
public void setMaterialId(String materialId) /** 计量单位 */
{ @Excel(name = "计量单位")
this.materialId = materialId; private String materialUnit;
}
public String getMaterialId() /** 包装重量 */
{ // @Excel(name = "包装重量")
return materialId; private Double packageWeight;
}
public void setBatchId(String batchId) /** 体积 */
{ private Double volume;
this.batchId = batchId;
}
public String getBatchId() /** 保质期天数 */
{ private Integer shelfLifeDays;
return batchId;
}
public void setLocationId(String locationId) /** 存储温度要求 */
{ // @Excel(name = "存储温度要求")
this.locationId = locationId; private String storageTemperature;
}
public String getLocationId() /** 特殊存储要求 */
{ // @Excel(name = "特殊存储要求")
return locationId; private String specialRequirements;
}
public void setOwnerId(String ownerId) private String warehousesName;
{ private String locationName;
this.ownerId = ownerId; private String ownerName;
}
public String getOwnerId() public String getOwnerId()
{ {
...@@ -387,6 +328,16 @@ public class Inventory extends BaseEntity ...@@ -387,6 +328,16 @@ public class Inventory extends BaseEntity
return updateUserCode; return updateUserCode;
} }
public void setWarehousesCode(String warehousesCode)
{
this.warehousesCode = warehousesCode;
}
public String getWarehousesCode()
{
return warehousesCode;
}
public void setAlertType(String alertType) public void setAlertType(String alertType)
{ {
this.alertType = alertType; this.alertType = alertType;
...@@ -400,37 +351,29 @@ public class Inventory extends BaseEntity ...@@ -400,37 +351,29 @@ public class Inventory extends BaseEntity
@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("inventoryType", getInventoryType()) .append("inventoryType", getInventoryType())
.append("orderId", getOrderId()) .append("orderId", getOrderId())
.append("orderName", getOrderName()) .append("materialId", getMaterialId())
.append("materialId", getMaterialId()) .append("batchId", getBatchId())
.append("materialName", getMaterialName()) .append("locationId", getLocationId())
.append("batchId", getBatchId()) .append("ownerId", getOwnerId())
.append("warehousesId", getWarehousesId()) .append("quantity", getQuantity())
.append("warehousesName", getWarehousesName()) .append("lockedQuantity", getLockedQuantity())
.append("warehousesCode", getWarehousesCode()) .append("unitWeight", getUnitWeight())
.append("locationId", getLocationId()) .append("totalWeight", getTotalWeight())
.append("locationName", getLocationName()) .append("totalVolume", getTotalVolume())
.append("ownerId", getOwnerId()) .append("productionDate", getProductionDate())
.append("ownerName", getOwnerName()) .append("expirationDate", getExpirationDate())
.append("quantity", getQuantity()) .append("inventoryStatus", getInventoryStatus())
.append("lockedQuantity", getLockedQuantity()) .append("lastInboundTime", getLastInboundTime())
.append("unitWeight", getUnitWeight()) .append("lastOutboundTime", getLastOutboundTime())
.append("totalWeight", getTotalWeight()) .append("isUsed", getIsUsed())
.append("totalVolume", getTotalVolume()) .append("sortNo", getSortNo())
.append("productionDate", getProductionDate()) .append("createTime", getCreateTime())
.append("expirationDate", getExpirationDate()) .append("createUserCode", getCreateUserCode())
.append("inventoryStatus", getInventoryStatus()) .append("updateTime", getUpdateTime())
.append("lastInboundTime", getLastInboundTime()) .append("updateUserCode", getUpdateUserCode())
.append("lastOutboundTime", getLastOutboundTime()) .toString();
.append("isUsed", getIsUsed())
.append("sortNo", getSortNo())
.append("createTime", getCreateTime())
.append("createUserCode", getCreateUserCode())
.append("updateTime", getUpdateTime())
.append("updateUserCode", getUpdateUserCode())
.append("alertType", getAlertType())
.toString();
} }
} }
package com.ruoyi.inventory.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 出入库统计视图对象
* 按物料汇总入库/出库次数、数量及金额
*/
@Data
public class InboundOutboundStatisticsVO extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 物料ID */
// @Excel(name = "物料ID")
private String materialId;
/** 物料名称 */
@Excel(name = "物料名称")
private String materialName;
/** 入库次数 */
@Excel(name = "入库次数")
private Integer inboundCount;
/** 出库次数 */
@Excel(name = "出库次数")
private Integer outboundCount;
/** 入库数量 */
@Excel(name = "入库数量")
private BigDecimal inboundQuantity;
/** 出库数量 */
@Excel(name = "出库数量")
private BigDecimal outboundQuantity;
/** 入库总额 */
@Excel(name = "入库总额")
private BigDecimal inboundAmount;
/** 出库总额 */
@Excel(name = "出库总额")
private BigDecimal outboundAmount;
/** 金额差(入库-出库) */
@Excel(name = "总额差")
private BigDecimal amountDiff;
/** 开始日期(主表日期过滤) */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startDate;
/** 结束日期(主表日期过滤) */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endDate;
/** 仓库ID */
private String warehouseId;
/** 仓库编码(支持模糊) */
private String warehousesCode;
/** 库位ID */
private String locationId;
/** 物料编码/ID查询 */
private String materialCode;
}
...@@ -5,6 +5,7 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth; ...@@ -5,6 +5,7 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadFontStyle; import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadStyle; import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.alibaba.excel.enums.poi.FillPatternTypeEnum; import com.alibaba.excel.enums.poi.FillPatternTypeEnum;
import com.ruoyi.common.annotation.Excel;
import lombok.Data; import lombok.Data;
//import org.apache.poi.ss.usermodel.FillPatternType; //import org.apache.poi.ss.usermodel.FillPatternType;
...@@ -32,176 +33,72 @@ public class InventorySummaryVO implements Serializable ...@@ -32,176 +33,72 @@ public class InventorySummaryVO implements Serializable
@ExcelProperty(value = "物料名称", index = 1) @ExcelProperty(value = "物料名称", index = 1)
private String materialName; private String materialName;
/** 库存类别 */ /** 最低库存 */
@ExcelProperty(value = "库存类别", index = 2) private Long minStockLevel;
private String inventoryTypeName; /** 最高库存 */
private Long maxStockLevel;
/** 仓库编码 */ /** SAP物料号 */
@ExcelProperty(value = "仓库编码", index = 3) @Excel(name = "SAP物料号")
private String warehousesCode; private String sapNo;
/** 仓库名称 */ /** TS Code */
@ExcelProperty(value = "仓库名称", index = 4) @Excel(name = "TS Code")
private String warehouseName; private String tsCode;
/** 库位ID */ /** 危险类别 */
@ExcelProperty(value = "库位ID", index = 5) private String hazardId;
private String locationId;
/** 库位名称 */ /** 危险类别 */
@ExcelProperty(value = "库位名称", index = 6) @Excel(name = "危险类别")
private String locationName; private String hazard;
/** 货主ID */ /** 规格型号 */
@ExcelProperty(value = "货主ID", index = 7) @Excel(name = "规格型号")
private String ownerId; private String specification;
/** 货主名称 */ /** 计量单位 */
@ExcelProperty(value = "货主名称", index = 8) @Excel(name = "计量单位")
private String ownerName; private String materialUnit;
/** 总库存数量 */ /** 单位重量 */
@ExcelProperty(value = "总库存数量", index = 9) @Excel(name = "单位重量")
private Long totalQuantity; private Double unitWeight;
/** 总锁定数量 */ /** 包装重量 */
@ExcelProperty(value = "总锁定数量", index = 10) // @Excel(name = "包装重量")
private Long totalLockedQuantity; private Double packageWeight;
/** 总可用数量 */
@ExcelProperty(value = "总可用数量", index = 11)
private Long totalAvailableQuantity;
/** 总重量 */ /** 总重量 */
@ExcelProperty(value = "总重量", index = 12)
private Double totalWeight; private Double totalWeight;
/** 总体积 */ /** 体积 */
@ExcelProperty(value = "总体积", index = 13) private Double volume;
private Double totalVolume;
/** 库存状态 */
@ExcelProperty(value = "库存状态", index = 14)
private String inventoryStatusName;
public String getMaterialId() {
return materialId;
}
public void setMaterialId(String materialId) {
this.materialId = materialId;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getInventoryTypeName() {
return inventoryTypeName;
}
public void setInventoryTypeName(String inventoryTypeName) {
this.inventoryTypeName = inventoryTypeName;
}
public String getWarehousesCode() {
return warehousesCode;
}
public void setWarehousesCode(String warehousesCode) {
this.warehousesCode = warehousesCode;
}
public String getWarehouseName() {
return warehouseName;
}
public void setWarehouseName(String warehouseName) {
this.warehouseName = warehouseName;
}
public String getLocationId() { /** 保质期天数 */
return locationId; private Integer shelfLifeDays;
}
public void setLocationId(String locationId) { /** 存储温度要求 */
this.locationId = locationId; // @Excel(name = "存储温度要求")
} private String storageTemperature;
public String getLocationName() { /** 特殊存储要求 */
return locationName; // @Excel(name = "特殊存储要求")
} private String specialRequirements;
public void setLocationName(String locationName) { /** 总库存数量 */
this.locationName = locationName; @ExcelProperty(value = "总库存数量", index = 9)
} private Long totalQuantity;
public String getOwnerId() {
return ownerId;
}
public void setOwnerId(String ownerId) {
this.ownerId = ownerId;
}
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
public Long getTotalQuantity() {
return totalQuantity;
}
public void setTotalQuantity(Long totalQuantity) {
this.totalQuantity = totalQuantity;
}
public Long getTotalLockedQuantity() {
return totalLockedQuantity;
}
public void setTotalLockedQuantity(Long totalLockedQuantity) {
this.totalLockedQuantity = totalLockedQuantity;
}
public Long getTotalAvailableQuantity() {
return totalAvailableQuantity;
}
public void setTotalAvailableQuantity(Long totalAvailableQuantity) {
this.totalAvailableQuantity = totalAvailableQuantity;
}
public Double getTotalWeight() {
return totalWeight;
}
public void setTotalWeight(Double totalWeight) {
this.totalWeight = totalWeight;
}
public Double getTotalVolume() { /** 总锁定数量 */
return totalVolume; @ExcelProperty(value = "总锁定数量", index = 10)
} private Long totalLockedQuantity;
public void setTotalVolume(Double totalVolume) { /** 总可用数量 */
this.totalVolume = totalVolume; @ExcelProperty(value = "总可用数量", index = 11)
} private Long totalAvailableQuantity;
public String getInventoryStatusName() { private String alterType;
return inventoryStatusName;
}
public void setInventoryStatusName(String inventoryStatusName) {
this.inventoryStatusName = inventoryStatusName;
}
} }
package com.ruoyi.inventory.domain.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 库存对象 inventory
*
* @author cy
* @date 2025-12-03
*/
@Data
public class InventoryVo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 编号 */
private String id;
/** 库存类别1普通2退库 */
// @Excel(name = "库存类别")
private Long inventoryType;
/** 入库单号 */
// @Excel(name = "入库单号")
private String orderId;
/** 物料ID 检索条件 */
// @Excel(name = "物料ID 检索条件")
private String materialId;
/** SAP物料号 */
@Excel(name = "SAP物料号")
private String sapNo;
/** TS Code */
@Excel(name = "TS Code")
private String tsCode;
/** 物料名称 */
@Excel(name = "物料名称")
private String materialName;
/** 批次ID 检索条件 */
@Excel(name = "批次")
private String batchId;
/** 批次ID 检索条件 */
// @Excel(name = "仓库ID ")
private String warehousesId;
/** 仓库编码 检索条件 */
private String warehousesCode;
@Excel(name = "仓库 ")
private String warehousesName;
/** 库位ID 检索条件 */
private String locationId;
@Excel(name = "库位")
private String locationName;
@Excel(name = "货主")
private String ownerName;
/** 货主ID 检索条件 */
private String ownerId;
/** 库存数量 */
@Excel(name = "库存数量")
private Long quantity;
/** 锁定数量 */
@Excel(name = "锁定数量")
private Long lockedQuantity;
/** 单位重量 */
// @Excel(name = "单位重量")
private Long unitWeight;
/** 总重量 暂无用 */
// @Excel(name = "总重量")
private Long totalWeight;
/** 总体积 暂无用 */
// @Excel(name = "总体积")
private Long totalVolume;
/** 生产日期 暂无用 */
// @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date productionDate;
/** 失效日期 */
// @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "失效日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date expirationDate;
/** 库存状态 0-已出库 1-正常 字典,检索条件 */
// @Excel(name = "库存状态 0-已出库 1-正常 字典,检索条件")
private Long inventoryStatus;
/** 最后入库时间 */
// @JsonFormat(pattern = "yyyy-MM-dd")
// @Excel(name = "最后入库时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date lastInboundTime;
/** 最后出库时间 */
// @JsonFormat(pattern = "yyyy-MM-dd")
// @Excel(name = "最后出库时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date lastOutboundTime;
/** 应用数据1使用0删除 删除用 */
private Long isUsed;
/** 排序 */
private Long sortNo;
/** 创建日期 */
private String createUserCode;
/** 排序号 */
private String updateUserCode;
/** 预警类型 */
private String alertType;
/** 最低库存 */
private Long minStockLevel;
/** 最高库存 */
private Long maxStockLevel;
/** 危险类别 */
private String hazardId;
/** 危险类别 */
// @Excel(name = "危险类别")
private String hazard;
/** 规格型号 */
// @Excel(name = "规格型号")
private String specification;
/** 计量单位 */
// @Excel(name = "计量单位")
private String materialUnit;
/** 包装重量 */
// @Excel(name = "包装重量")
private Double packageWeight;
/** 体积 */
private Double volume;
/** 保质期天数 */
private Integer shelfLifeDays;
/** 存储温度要求 */
// @Excel(name = "存储温度要求")
private String storageTemperature;
/** 特殊存储要求 */
// @Excel(name = "特殊存储要求")
private String specialRequirements;
}
package com.ruoyi.inventory.mapper; package com.ruoyi.inventory.mapper;
import java.util.List;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.inventory.domain.Inventory; import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.domain.StocktakeItems;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo; import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import com.ruoyi.inventory.domain.vo.InventoryExceedWarnVO; import com.ruoyi.inventory.domain.vo.InventoryExceedWarnVO;
import com.ruoyi.inventory.domain.vo.InventoryVo;
import java.util.List;
/** /**
* 库存Mapper接口 * 库存Mapper接口
...@@ -100,6 +100,14 @@ public interface InventoryMapper ...@@ -100,6 +100,14 @@ public interface InventoryMapper
public List<Inventory> selectInventoryDetailList(Inventory inventory); public List<Inventory> selectInventoryDetailList(Inventory inventory);
/** /**
* 查询库存明细列表(根据物料标识及检索条件)
*
* @param inventory 库存查询条件
* @return 库存明细集合
*/
public List<InventoryVo> selectInventoryVoList(Inventory inventory);
/**
* 统计物料库存超出预警库存数量 * 统计物料库存超出预警库存数量
* *
* @return 超出预警值物料信息集合 * @return 超出预警值物料信息集合
......
package com.ruoyi.inventory.mapper;
import com.ruoyi.inventory.domain.vo.InboundOutboundStatisticsVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 出入库统计Mapper
*/
@Mapper
public interface InventoryStatisticsMapper {
/**
* 按物料汇总出入库统计
*
* @param query 查询条件
* @return 汇总结果
*/
List<InboundOutboundStatisticsVO> selectInboundOutboundStatistics(InboundOutboundStatisticsVO query);
}
...@@ -100,4 +100,13 @@ public interface StorageLocationsMapper ...@@ -100,4 +100,13 @@ public interface StorageLocationsMapper
int batchInsertStorageLocations(List<StorageLocations> storageLocations); int batchInsertStorageLocations(List<StorageLocations> storageLocations);
/**
* 根据库位名称和仓库ID精确查询(is_used=1)
* @param locationName 库位名
* @param warehouseId 仓库ID
* @return 库位
*/
StorageLocations selectStorageLocationsByNameAndWarehouse(@Param("locationName") String locationName,
@Param("warehouseId") String warehouseId);
} }
...@@ -79,4 +79,11 @@ public interface WarehousesMapper ...@@ -79,4 +79,11 @@ public interface WarehousesMapper
*/ */
public List<Map<String, Object>> getMapList(); public List<Map<String, Object>> getMapList();
/**
* 根据仓库名称精确查询(仅is_used=1)
* @param name 仓库名称
* @return 仓库
*/
Warehouses selectWarehousesByName(String name);
} }
...@@ -10,6 +10,7 @@ import com.ruoyi.inventory.domain.OutboundOrderItems; ...@@ -10,6 +10,7 @@ import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.StocktakeItems; import com.ruoyi.inventory.domain.StocktakeItems;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo; import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import com.ruoyi.inventory.domain.vo.InventoryExceedWarnVO; import com.ruoyi.inventory.domain.vo.InventoryExceedWarnVO;
import com.ruoyi.inventory.domain.vo.InventoryVo;
/** /**
* 库存Service接口 * 库存Service接口
...@@ -109,6 +110,7 @@ public interface IInventoryService ...@@ -109,6 +110,7 @@ public interface IInventoryService
*/ */
public List<Inventory> selectInventoryDetailList(Inventory inventory); public List<Inventory> selectInventoryDetailList(Inventory inventory);
public List<InventoryVo> selectInventoryVoList(Inventory inventory);
/** /**
* 统计库存物料超出预警值 * 统计库存物料超出预警值
......
package com.ruoyi.inventory.service;
import com.ruoyi.inventory.domain.vo.InboundOutboundStatisticsVO;
import java.util.List;
/**
* 出入库统计 Service
*/
public interface IInventoryStatisticsService {
/**
* 按物料汇总出入库统计
*
* @param query 查询条件
* @return 统计列表
*/
List<InboundOutboundStatisticsVO> selectInboundOutboundStatistics(InboundOutboundStatisticsVO query);
}
...@@ -12,6 +12,7 @@ import com.ruoyi.inventory.domain.OutboundOrderLog; ...@@ -12,6 +12,7 @@ import com.ruoyi.inventory.domain.OutboundOrderLog;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo; import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import com.ruoyi.inventory.domain.vo.InventoryExceedWarnVO; import com.ruoyi.inventory.domain.vo.InventoryExceedWarnVO;
import com.ruoyi.inventory.domain.vo.InventorySummaryVO; import com.ruoyi.inventory.domain.vo.InventorySummaryVO;
import com.ruoyi.inventory.domain.vo.InventoryVo;
import com.ruoyi.inventory.mapper.OutboundOrderItemsMapper; import com.ruoyi.inventory.mapper.OutboundOrderItemsMapper;
import com.ruoyi.inventory.mapper.OutboundOrderLogMapper; import com.ruoyi.inventory.mapper.OutboundOrderLogMapper;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
...@@ -274,6 +275,12 @@ public class InventoryServiceImpl implements IInventoryService ...@@ -274,6 +275,12 @@ public class InventoryServiceImpl implements IInventoryService
} }
@Override @Override
public List<InventoryVo> selectInventoryVoList(Inventory inventory)
{
return inventoryMapper.selectInventoryVoList(inventory);
}
@Override
public List<InventoryExceedWarnVO> selectInventoryExceedWarnList() { public List<InventoryExceedWarnVO> selectInventoryExceedWarnList() {
return inventoryMapper.selectInventoryExceedWarnList(); return inventoryMapper.selectInventoryExceedWarnList();
} }
......
package com.ruoyi.inventory.service.impl;
import com.ruoyi.inventory.domain.vo.InboundOutboundStatisticsVO;
import com.ruoyi.inventory.mapper.InventoryStatisticsMapper;
import com.ruoyi.inventory.service.IInventoryStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 出入库统计 Service实现
*/
@Service
public class InventoryStatisticsServiceImpl implements IInventoryStatisticsService {
@Autowired
private InventoryStatisticsMapper inventoryStatisticsMapper;
@Override
public List<InboundOutboundStatisticsVO> selectInboundOutboundStatistics(InboundOutboundStatisticsVO query) {
return inventoryStatisticsMapper.selectInboundOutboundStatistics(query);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.inventory.mapper.InventoryStatisticsMapper">
<resultMap id="InboundOutboundStatisticsResult" type="com.ruoyi.inventory.domain.vo.InboundOutboundStatisticsVO">
<result column="material_id" property="materialId"/>
<result column="material_name" property="materialName"/>
<result column="inbound_count" property="inboundCount"/>
<result column="outbound_count" property="outboundCount"/>
<result column="inbound_quantity" property="inboundQuantity"/>
<result column="outbound_quantity" property="outboundQuantity"/>
<result column="inbound_amount" property="inboundAmount"/>
<result column="outbound_amount" property="outboundAmount"/>
<result column="amount_diff" property="amountDiff"/>
</resultMap>
<select id="selectInboundOutboundStatistics"
parameterType="com.ruoyi.inventory.domain.vo.InboundOutboundStatisticsVO"
resultMap="InboundOutboundStatisticsResult">
SELECT
t.material_id,
IFNULL(m.material_name, t.material_id) AS material_name,
SUM(t.inbound_count) AS inbound_count,
SUM(t.outbound_count) AS outbound_count,
SUM(t.inbound_quantity) AS inbound_quantity,
SUM(t.outbound_quantity) AS outbound_quantity,
SUM(t.inbound_amount) AS inbound_amount,
SUM(t.outbound_amount) AS outbound_amount,
SUM(t.inbound_amount) - SUM(t.outbound_amount) AS amount_diff
FROM (
SELECT
i.material_id,
COUNT(DISTINCT o.id) AS inbound_count,
0 AS outbound_count,
IFNULL(SUM(IFNULL(i.actual_quantity, 0)),0) AS inbound_quantity,
0 AS outbound_quantity,
IFNULL(SUM(IFNULL(i.unit_price, 0) * IFNULL(i.actual_quantity, 0)),0) AS inbound_amount,
0 AS outbound_amount
FROM inbound_order_items i
LEFT JOIN inbound_orders o ON i.inbound_order_id = o.id
LEFT JOIN warehouses w ON w.id = i.warehouse_id
LEFT JOIN materials m1 ON m1.id = i.material_id
<where>
i.is_used = 1
<if test="warehouseId != null and warehouseId != ''">
AND i.warehouse_id = #{warehouseId}
</if>
<if test="locationId != null and locationId != ''">
AND i.location_id = #{locationId}
</if>
<if test="materialId != null and materialId != ''">
AND (i.material_id = #{materialId}
OR m1.material_code LIKE CONCAT('%', #{materialId}, '%')
OR m1.material_name LIKE CONCAT('%', #{materialId}, '%'))
</if>
<if test="warehousesCode != null and warehousesCode != ''">
AND w.warehouses_code LIKE CONCAT('%', #{warehousesCode}, '%')
</if>
<if test="startDate != null">
AND o.inbound_date &gt;= #{startDate}
</if>
<if test="endDate != null">
AND o.inbound_date &lt; DATE_ADD(#{endDate}, INTERVAL 1 DAY)
</if>
</where>
GROUP BY i.material_id
UNION ALL
SELECT
oi.material_id,
0 AS inbound_count,
COUNT(DISTINCT oo.id) AS outbound_count,
0 AS inbound_quantity,
IFNULL(SUM(IFNULL(oi.actual_quantity, 0)),0) AS outbound_quantity,
0 AS inbound_amount,
IFNULL(SUM(IFNULL(oi.unit_price, 0) * IFNULL(oi.actual_quantity, 0)),0) AS outbound_amount
FROM outbound_order_items oi
LEFT JOIN outbound_orders oo ON oi.outbound_order_id = oo.id
LEFT JOIN warehouses w2 ON w2.id = oi.warehouse_id
LEFT JOIN materials m2 ON m2.id = oi.material_id
<where>
oi.is_used = 1
<if test="warehouseId != null and warehouseId != ''">
AND oi.warehouse_id = #{warehouseId}
</if>
<if test="locationId != null and locationId != ''">
AND oi.location_id = #{locationId}
</if>
<if test="materialId != null and materialId != ''">
AND (oi.material_id = #{materialId}
OR m2.material_code LIKE CONCAT('%', #{materialId}, '%')
OR m2.material_name LIKE CONCAT('%', #{materialId}, '%'))
</if>
<if test="warehousesCode != null and warehousesCode != ''">
AND w2.warehouses_code LIKE CONCAT('%', #{warehousesCode}, '%')
</if>
<if test="startDate != null">
AND oo.inbound_date &gt;= #{startDate}
</if>
<if test="endDate != null">
AND oo.inbound_date &lt; DATE_ADD(#{endDate}, INTERVAL 1 DAY)
</if>
</where>
GROUP BY oi.material_id
) t
LEFT JOIN materials m ON t.material_id = m.id
GROUP BY t.material_id, m.material_name
ORDER BY m.material_name ASC
</select>
</mapper>
...@@ -146,6 +146,19 @@ ...@@ -146,6 +146,19 @@
where sl.id = #{id} where sl.id = #{id}
</select> </select>
<select id="selectStorageLocationsByNameAndWarehouse" resultMap="StorageLocationsResult">
select sl.id, sl.location_code, sl.location_name, sl.warehouses_code, sl.location_type,
sl.zone_code, sl.row_code, sl.column_code, sl.layer_code, sl.capacity,
sl.volume_capacity, sl.allowed_hazard_levels, sl.allowed_category_ids,
sl.temperature_zone, sl.is_enabled, sl.is_used, sl.sort_no,
sl.create_time, sl.create_user_code, sl.update_time, sl.update_user_code, sl.warehouses_id
from storage_locations sl
where sl.is_used = 1
and sl.location_name = #{locationName}
and sl.warehouses_id = #{warehouseId}
limit 1
</select>
<!-- 关联仓库表的ID查询 --> <!-- 关联仓库表的ID查询 -->
<select id="selectStorageLocationsByIdWithWarehouses" parameterType="String" resultMap="StorageLocationsWithWarehousesResult"> <select id="selectStorageLocationsByIdWithWarehouses" parameterType="String" resultMap="StorageLocationsWithWarehousesResult">
select sl.id, sl.location_code, sl.location_name, sl.warehouses_code, sl.location_type, select sl.id, sl.location_code, sl.location_name, sl.warehouses_code, sl.location_type,
......
...@@ -50,6 +50,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -50,6 +50,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectWarehousesVo"/> <include refid="selectWarehousesVo"/>
where id = #{id} where id = #{id}
</select> </select>
<select id="selectWarehousesByName" parameterType="String" resultMap="WarehousesResult">
<include refid="selectWarehousesVo"/>
where warehouses_name = #{name} and is_used = 1
limit 1
</select>
<!-- 获取仓库 的 warehouses_code 仓库编码 warehouses_name 做成字典--> <!-- 获取仓库 的 warehouses_code 仓库编码 warehouses_name 做成字典-->
<select id="getMapList" resultType="java.util.Map"> <select id="getMapList" resultType="java.util.Map">
select id, IFNULL(warehouses_name, '') as warehouses_name from warehouses where is_used = 1; select id, IFNULL(warehouses_name, '') as warehouses_name from warehouses where is_used = 1;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论