Commit feeecb39 by yubin

出库

parent 36733eb3
......@@ -60,12 +60,14 @@ export function delInventoryByIds(ids) {
})
}
// 根据物料ID查询库存
export function listInventoryByMaterialId(materialId) {
export function listInventoryByMaterialId(params) {
return request({
url: '/inventory/inventory/listByMaterialId',
method: 'get',
params: { materialId: materialId }
method: 'post',
// 改为data传递JSON对象,适配后端实体类接收
data: params
// 若后端仍要求用params(URL参数)传递,保留下面这行,注释上面的data
// params: params
})
}
......
import request from '@/utils/request'
// 查询出库单明细列表
export function listItems(query) {
return request({
url: '/inventory/items/list',
method: 'get',
params: query
})
}
export function getStatistics(query) {
return request({
url: '/inventory/items/getStatistics',
method: 'get',
params: query
})
}
// 查询出库单明细详细
export function getItems(id) {
return request({
url: '/inventory/items/' + id,
method: 'get'
})
}
// 新增出库单明细
export function addItems(data) {
return request({
url: '/inventory/items',
method: 'post',
data: data
})
}
// 修改出库单明细
export function updateItems(data) {
return request({
url: '/inventory/items',
method: 'put',
data: data
})
}
// 删除出库单明细
export function delItems(id) {
return request({
url: '/inventory/items/' + id,
method: 'delete'
})
}
......@@ -385,7 +385,23 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.queryParams={
pageNum: 1,
pageSize: 10,
ownerCode: null,
ownerName: null,
ownerType: null,
contactPerson: null,
contactPhone: null,
email: null,
address: null,
taxNumber: null,
bankAccount: null,
isActive: null,
sortNo: null,
createUserCode: null,
updateUserCode: null
},
this.handleQuery()
},
// 多选框选中数据
......
......@@ -71,15 +71,16 @@ public class InventoryController extends BaseController
List<Inventory> list = inventoryService.selectInventoryDetailList(inventory);
return getDataTable(list);
}
/**
* 查询库存列表
*/
@PreAuthorize("@ss.hasPermi('inventory:inventory:list')")
@GetMapping("/listByMaterialId")
public TableDataInfo listByMaterialId(String materialId)
@PostMapping("/listByMaterialId")
public TableDataInfo listByMaterialId(@RequestBody Inventory inventory)
{
startPage();
List<Inventory> list = inventoryService.listByMatreialId(materialId);
List<Inventory> list = inventoryService.listByMatreialId(inventory);
return getDataTable(list);
}
/**
......
......@@ -2,6 +2,8 @@ package com.ruoyi.inventory.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.inventory.domain.TO.OutboundOrderItemsStatisticsVO;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -46,6 +48,17 @@ public class OutboundOrderItemsController extends BaseController
List<OutboundOrderItems> list = outboundOrderItemsService.selectOutboundOrderItemsList(outboundOrderItems);
return getDataTable(list);
}
/**
* 查询出库单明细列表
*/
@PreAuthorize("@ss.hasPermi('inventory:items:list')")
@GetMapping("/getStatistics")
public TableDataInfo getStatistics(OutboundOrderItemsStatisticsVO outboundOrderItems)
{
startPage();
List<OutboundOrderItems> list = outboundOrderItemsService.selectOutboundOrderItemsStatistics(outboundOrderItems);
return getDataTable(list);
}
/**
* 导出出库单明细列表
......
......@@ -28,6 +28,10 @@ public class OutboundOrderItems extends BaseEntity
@Excel(name = "货物ID 字典,检索条件")
private String materialId;
/** 货物ID 字典,检索条件 */
@Excel(name = "ID 字典,检索条件")
private String locationId;
/** 批次ID 检索条件 */
@Excel(name = "批次ID 检索条件")
private String batchCode;
......@@ -36,14 +40,17 @@ public class OutboundOrderItems extends BaseEntity
@Excel(name = "仓库ID 检索条件")
private String warehouseId;
/** 库位ID 检索条件 */
@Excel(name = "库位ID 检索条件")
private String locationId;
/** 库存ID */
private String inventoryId;
/** 出库单ID */
private String outboundOrderId;
/** 单价 */
@Excel(name = "单价")
private Long unitPrice;
/** 计划数量 */
@Excel(name = "计划数量")
private Long plannedQuantity;
......@@ -101,6 +108,23 @@ public class OutboundOrderItems extends BaseEntity
this.inventoryId = inventoryId;
}
public String getOutboundOrderId() {
return outboundOrderId;
}
public void setOutboundOrderId(String outboundOrderId) {
this.outboundOrderId = outboundOrderId;
}
public Long getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(Long unitPrice) {
this.unitPrice = unitPrice;
}
public void setId(String id)
{
this.id = id;
......@@ -290,6 +314,9 @@ public class OutboundOrderItems extends BaseEntity
.append("batchCode", getBatchCode())
.append("warehouseId", getWarehouseId())
.append("locationId", getLocationId())
.append("inventoryId", getInventoryId())
.append("outboundOrderId", getOutboundOrderId())
.append("unitPrice", getUnitPrice())
.append("plannedQuantity", getPlannedQuantity())
.append("actualQuantity", getActualQuantity())
.append("divisor", getDivisor())
......@@ -304,7 +331,6 @@ public class OutboundOrderItems extends BaseEntity
.append("createTime", getCreateTime())
.append("createUserCode", getCreateUserCode())
.append("updateTime", getUpdateTime())
.append("inventoryId", getInventoryId())
.append("updateUserCode", getUpdateUserCode())
.toString();
}
......
package com.ruoyi.inventory.domain.TO;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 出库单明细对象 outbound_order_items
*
* @author ruoyi
* @date 2025-12-03
*/
public class OutboundOrderItemsStatisticsVO extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 编号 */
private String id;
/** 出库单号 检索条件 */
@Excel(name = "出库单号 检索条件")
private String orderId;
/** 货物ID 字典,检索条件 */
@Excel(name = "货物ID 字典,检索条件")
private String materialId;
/** 货物ID 字典,检索条件 */
@Excel(name = "ID 字典,检索条件")
private String locationId;
/** 批次ID 检索条件 */
@Excel(name = "批次ID 检索条件")
private String batchCode;
/** 仓库ID 检索条件 */
@Excel(name = "仓库ID 检索条件")
private String warehouseId;
/** 库存ID */
private String inventoryId;
/** 出库单ID */
private String outboundOrderId;
/** 单价 */
@Excel(name = "单价")
private Long unitPrice;
/**
* amount(对应SQL:(unit_price*actual_quantity) AS amount)
*/
private String amount;
/** 计划数量 */
@Excel(name = "计划数量")
private Long plannedQuantity;
/** 实际数量 */
@Excel(name = "实际数量")
private Long actualQuantity;
/** 约数 */
@Excel(name = "约数")
private Long divisor;
/** 标签颜色 字典,检索条件 */
@Excel(name = "标签颜色 字典,检索条件")
private Long labelColor;
/** 凭证号 检索条件 */
@Excel(name = "凭证号 检索条件")
private String voucherNumber;
/** 状态1-待发货 2-部分发货 3-已完成 字典,检索条件 */
@Excel(name = "状态1-待发货 2-部分发货 3-已完成 字典,检索条件")
private Long itemStatus;
/** 发货时间 暂无用 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "发货时间 暂无用", width = 30, dateFormat = "yyyy-MM-dd")
private Date shippedAt;
private Date startDate;
private Date endDate;
/** 发货方 暂无用 */
@Excel(name = "发货方 暂无用")
private String shippedBy;
/** 应用数据1使用0删除 删除用 */
@Excel(name = "应用数据1使用0删除 删除用")
private Long isUsed;
/** 排序 */
@Excel(name = "排序")
private Long sortNo;
/** 创建日期 */
@Excel(name = "创建日期")
private String createUserCode;
/** 排序号 */
@Excel(name = "排序号")
private String updateUserCode;
public String getInventoryId() {
return inventoryId;
}
public void setInventoryId(String inventoryId) {
this.inventoryId = inventoryId;
}
public String getOutboundOrderId() {
return outboundOrderId;
}
public void setOutboundOrderId(String outboundOrderId) {
this.outboundOrderId = outboundOrderId;
}
public Long getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(Long unitPrice) {
this.unitPrice = unitPrice;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setOrderId(String orderId)
{
this.orderId = orderId;
}
public String getOrderId()
{
return orderId;
}
public void setMaterialId(String materialId)
{
this.materialId = materialId;
}
public String getMaterialId()
{
return materialId;
}
public void setBatchCode(String batchCode)
{
this.batchCode = batchCode;
}
public String getBatchCode()
{
return batchCode;
}
public void setWarehouseId(String warehouseId)
{
this.warehouseId = warehouseId;
}
public String getWarehouseId()
{
return warehouseId;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public void setLocationId(String locationId)
{
this.locationId = locationId;
}
public String getLocationId()
{
return locationId;
}
public void setPlannedQuantity(Long plannedQuantity)
{
this.plannedQuantity = plannedQuantity;
}
public Long getPlannedQuantity()
{
return plannedQuantity;
}
public void setActualQuantity(Long actualQuantity)
{
this.actualQuantity = actualQuantity;
}
public Long getActualQuantity()
{
return actualQuantity;
}
public void setDivisor(Long divisor)
{
this.divisor = divisor;
}
public Long getDivisor()
{
return divisor;
}
public void setLabelColor(Long labelColor)
{
this.labelColor = labelColor;
}
public Long getLabelColor()
{
return labelColor;
}
public void setVoucherNumber(String voucherNumber)
{
this.voucherNumber = voucherNumber;
}
public String getVoucherNumber()
{
return voucherNumber;
}
public void setItemStatus(Long itemStatus)
{
this.itemStatus = itemStatus;
}
public Long getItemStatus()
{
return itemStatus;
}
public void setShippedAt(Date shippedAt)
{
this.shippedAt = shippedAt;
}
public Date getShippedAt()
{
return shippedAt;
}
public void setShippedBy(String shippedBy)
{
this.shippedBy = shippedBy;
}
public String getShippedBy()
{
return shippedBy;
}
public void setIsUsed(Long isUsed)
{
this.isUsed = isUsed;
}
public Long getIsUsed()
{
return isUsed;
}
public void setSortNo(Long sortNo)
{
this.sortNo = sortNo;
}
public Long getSortNo()
{
return sortNo;
}
public void setCreateUserCode(String createUserCode)
{
this.createUserCode = createUserCode;
}
public String getCreateUserCode()
{
return createUserCode;
}
public void setUpdateUserCode(String updateUserCode)
{
this.updateUserCode = updateUserCode;
}
public String getUpdateUserCode()
{
return updateUserCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("orderId", getOrderId())
.append("materialId", getMaterialId())
.append("batchCode", getBatchCode())
.append("warehouseId", getWarehouseId())
.append("locationId", getLocationId())
.append("inventoryId", getInventoryId())
.append("outboundOrderId", getOutboundOrderId())
.append("unitPrice", getUnitPrice())
.append("plannedQuantity", getPlannedQuantity())
.append("actualQuantity", getActualQuantity())
.append("divisor", getDivisor())
.append("amount", getAmount())
.append("labelColor", getLabelColor())
.append("voucherNumber", getVoucherNumber())
.append("itemStatus", getItemStatus())
.append("shippedAt", getShippedAt())
.append("shippedBy", getShippedBy())
.append("remark", getRemark())
.append("endDate", getEndDate())
.append("startDate", getStartDate())
.append("sortNo", getSortNo())
.append("createTime", getCreateTime())
.append("createUserCode", getCreateUserCode())
.append("updateTime", getUpdateTime())
.append("updateUserCode", getUpdateUserCode())
.toString();
}
}
......@@ -30,7 +30,7 @@ public interface MaterialsMapper
* @param id 物料主键
* @return 物料
*/
public Materials selectMaterialsByMaterialsCode(String id);
public List<Materials> selectMaterialsByMaterialsCode(String id);
/**
* 查询物料列表
......
......@@ -2,6 +2,7 @@ package com.ruoyi.inventory.mapper;
import java.util.List;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.TO.OutboundOrderItemsStatisticsVO;
/**
* 出库单明细Mapper接口
......@@ -28,6 +29,13 @@ public interface OutboundOrderItemsMapper
public List<OutboundOrderItems> selectOutboundOrderItemsList(OutboundOrderItems outboundOrderItems);
/**
* 查询出库单明细统计
*
* @param outboundOrderItems 出库单明细
* @return 出库单明细集合
*/
public List<OutboundOrderItems> selectOutboundOrderItemsStatistics(OutboundOrderItemsStatisticsVO outboundOrderItems);
/**
* 新增出库单明细
*
* @param outboundOrderItems 出库单明细
......
......@@ -34,13 +34,21 @@ public interface OutboundOrderLogMapper
/**
* 查询出库明细子(仅用于锁定数量统计)列表
*
* @param outboundOrderLog 出库明细子(仅用于锁定数量统计)
* @param id 出库明细子(仅用于锁定数量统计)
* @return 出库明细子(仅用于锁定数量统计)集合
*/
public Long selectLockedQuantityByInventory(String id);
/**
* 批量删除出库单明细
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteOutboundOrderLogByOrdersIds(String[] ids);
/**
* 新增出库明细子(仅用于锁定数量统计)
*
* @param outboundOrderLog 出库明细子(仅用于锁定数量统计)
......
......@@ -81,7 +81,7 @@ public interface IInventoryService
*/
public int deleteInventoryById(String id);
public List<Inventory> listByMatreialId(String materialId);
public List<Inventory> listByMatreialId(Inventory inventory);
/**
* @description: 获取库存盘点详细信息
* @author cs
......
......@@ -3,6 +3,7 @@ package com.ruoyi.inventory.service;
import java.util.List;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.TO.OutboundOrderItemsStatisticsVO;
/**
* 出库单明细Service接口
......@@ -27,7 +28,13 @@ public interface IOutboundOrderItemsService
* @return 出库单明细集合
*/
public List<OutboundOrderItems> selectOutboundOrderItemsList(OutboundOrderItems outboundOrderItems);
/**
* 查询出库单明细统计
*
* @param outboundOrderItems 出库单明细
* @return 出库单明细集合
*/
public List<OutboundOrderItems> selectOutboundOrderItemsStatistics(OutboundOrderItemsStatisticsVO outboundOrderItems);
/**
* 新增出库单明细
*
......
package com.ruoyi.inventory.service.impl;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.*;
import java.util.stream.Collectors;
import com.ruoyi.common.annotation.SerialExecution;
import com.ruoyi.common.core.domain.entity.Materials;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.OutboundOrderLog;
import com.ruoyi.inventory.domain.StocktakeItems;
import com.ruoyi.inventory.domain.vo.InventorySummaryVO;
import com.ruoyi.inventory.mapper.OutboundOrderItemsMapper;
import com.ruoyi.inventory.mapper.OutboundOrderLogMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.SystemUtils;
......@@ -31,7 +32,10 @@ public class InventoryServiceImpl implements IInventoryService
@Autowired
private InventoryMapper inventoryMapper;
@Autowired
private OutboundOrderLogMapper outboundOrderLogMapper;
private OutboundOrderLogMapper outboundOrderLogMapper;;
@Autowired
private OutboundOrderItemsMapper outboundOrderItemsMapper;
/**
* 查询库存
......@@ -185,16 +189,43 @@ public class InventoryServiceImpl implements IInventoryService
@SerialExecution(group = "inventoryRefresh", fair = true)
@Override
public List<Inventory> listByMatreialId(String materialId) {
Inventory inventory = new Inventory();
inventory.setMaterialId(materialId);
public List<Inventory> listByMatreialId(Inventory inventory) {
String materialId = inventory.getMaterialId();
List<String> inventoryIds = CollectionUtils.isEmpty(inventoryMapper.listByMaterialId(materialId))
? Collections.emptyList() // 空时返回空列表,避免后续NPE
: inventoryMapper.listByMaterialId(materialId).stream()
.map(inventory2 -> inventory2.getId()) // 提取ID(核心修正)
.collect(Collectors.toList());
RefreshInventory(inventoryIds);
return inventoryMapper.listByMaterialId(materialId);
return MyQuantity(inventory);
}
public List<Inventory> MyQuantity(Inventory inventory){
String materialId = inventory.getMaterialId();
List<Inventory> inventoryList = inventoryMapper.listByMaterialId(materialId);
OutboundOrderItems outboundOrderItem = new OutboundOrderItems();
outboundOrderItem.setOutboundOrderId(inventory.getOrderId());
List<OutboundOrderItems> outboundOrderItems = outboundOrderItemsMapper.selectOutboundOrderItemsList(outboundOrderItem);
inventoryList.forEach(inventory2 -> {
long deductQuantity = 0;
if (inventory.getOrderId()!=null){
deductQuantity = outboundOrderItems.stream()
.filter(item -> item.getInventoryId().equals(inventory2.getId()))
.mapToLong(OutboundOrderItems::getActualQuantity)
.sum();
}
inventory2.setLockedQuantity(inventory2.getLockedQuantity() - deductQuantity);
});
// 过滤掉满足条件的元素,返回新集合
return inventoryList.stream()
.filter(inventory2 -> inventory2.getQuantity() > inventory2.getLockedQuantity())
.collect(Collectors.toList());
}
/**
* @description: 获取库存盘点详细信息
......@@ -213,7 +244,7 @@ public class InventoryServiceImpl implements IInventoryService
* @return 库存汇总统计集合
*/
@Override
public List<com.ruoyi.inventory.domain.vo.InventorySummaryVO> selectInventorySummaryList(Inventory inventory)
public List<InventorySummaryVO> selectInventorySummaryList(Inventory inventory)
{
return inventoryMapper.selectInventorySummaryList(inventory);
}
......
......@@ -2,6 +2,7 @@ package com.ruoyi.inventory.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.inventory.domain.TO.OutboundOrderItemsStatisticsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.OutboundOrderItemsMapper;
......@@ -49,6 +50,12 @@ public class OutboundOrderItemsServiceImpl implements IOutboundOrderItemsService
return outboundOrderItemsMapper.selectOutboundOrderItemsList(outboundOrderItems);
}
@Override
public List<OutboundOrderItems> selectOutboundOrderItemsStatistics(OutboundOrderItemsStatisticsVO outboundOrderItems) {
List<OutboundOrderItems> list = outboundOrderItemsMapper.selectOutboundOrderItemsStatistics(outboundOrderItems);
return list;
}
@Override
public int insertOutboundOrderItems(OutboundOrderItems outboundOrderItems)
......
......@@ -113,6 +113,7 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService
public int deleteOutboundOrdersByIds(String[] ids)
{
outboundOrdersMapper.deleteOutboundOrderItemsByOrderIds(ids);
outboundOrderLogMapper.deleteOutboundOrderLogByOrdersIds(ids);
return outboundOrdersMapper.deleteOutboundOrdersByIds(ids);
}
......@@ -151,7 +152,7 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService
outboundOrders.setId(outboundOrders.getId());
outboundOrders.setOrderStatus(3l);
outboundOrders.setOrderStatus(2l);
outboundOrders.setUpdateTime(DateUtils.getNowDate());
outboundOrders.setUpdateBy(SystemUtils.getUserName());
outboundOrdersMapper.updateOutboundOrders(outboundOrders);
......@@ -181,7 +182,7 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService
// 2. 为明细设置订单ID和主键ID
for (OutboundOrderItems items : outboundOrderItemsList) {
items.setOrderId(id);
items.setOutboundOrderId(id);
// 生成无横线的UUID作为主键
items.setId(UUID.randomUUID().toString().replace("-", ""));
}
......
......@@ -76,14 +76,17 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
String[] AllowedCategoryIds = storageLocations2.getAllowedCategoryIds().split(",");
for (String AllowedCategoryId : AllowedCategoryIds) {
Materials materials = materialsMapper.selectMaterialsByMaterialsCode(AllowedCategoryId);
if (materials != null && materials.getMaterialName() != null) {
String categoryName = materials.getMaterialName().trim(); // 去除首尾空格
List<Materials> materials = materialsMapper.selectMaterialsByMaterialsCode(AllowedCategoryId);
if (materials != null && !materials.isEmpty()) {
Materials materials1 = materials.get(0);
if (materials1 != null && materials1.getMaterialName() != null) {
String categoryName = materials1.getMaterialName().trim(); // 去除首尾空格
if (AllowedCategoryName != "") {
AllowedCategoryName += ",";
}
AllowedCategoryName += categoryName;
}
} }
}
}
storageLocations2.setAllowedCategoryNames(AllowedCategoryName);
......@@ -117,8 +120,11 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
storageLocationsCategory.setCategoryId(categoryId);
storageLocationsCategory.setCreateTime(DateUtils.getNowDate());
storageLocationsCategory.setCreateUserCode(String.valueOf(SecurityUtils.getUserId()));
Materials materials = materialsMapper.selectMaterialsByMaterialsCode(categoryId);
storageLocationsCategory.setCategoryName(materials.getMaterialName());
List<Materials> materials = materialsMapper.selectMaterialsByMaterialsCode(categoryId);
if (materials != null && !materials.isEmpty()) {
Materials materials1 = materials.get(0);
storageLocationsCategory.setCategoryName(materials1.getMaterialName());
}
storageLocationsCategoryMapper.insertStorageLocationsCategory(storageLocationsCategory);
}
}
......@@ -153,8 +159,11 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
storageLocationsCategory.setCategoryId(categoryId);
storageLocationsCategory.setUpdateTime(DateUtils.getNowDate());
storageLocationsCategory.setUpdateUserCode(String.valueOf(SecurityUtils.getUserId()));
Materials materials = materialsMapper.selectMaterialsByMaterialsCode(categoryId);
storageLocationsCategory.setCategoryName(materials.getMaterialName());
List<Materials> materials = materialsMapper.selectMaterialsByMaterialsCode(categoryId);
if (materials != null && !materials.isEmpty()) {
Materials materials1 = materials.get(0);
storageLocationsCategory.setCategoryName(materials1.getMaterialName());
}
storageLocationsCategoryMapper.insertStorageLocationsCategory(storageLocationsCategory);
}
}
......@@ -190,7 +199,7 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
@Override
public int updateLocationsCategoryStatus(String id)
{
storageLocationsCategoryMapper.updateStorageLocationsCategoryStatus(id);
return storageLocationsMapper.updateStorageLocationsStatus(id);
}
......
......@@ -70,6 +70,8 @@
where id = #{id}
</select>
<select id="selectInboundOrderItemsListAndMaterialName"
parameterType="InboundOrderItems"
resultMap="InboundOrderItemsAndMnameResult">
......
......@@ -207,7 +207,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<![CDATA[
and inventory_status = '1'
and quantity > locked_quantity
]]>
</select>
<insert id="insertInventory" parameterType="Inventory">
......
......@@ -12,6 +12,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="warehouseId" column="warehouse_id" />
<result property="locationId" column="location_id" />
<result property="inventoryId" column="inventory_id" />
<result property="outboundOrderId" column="outbound_order_id" />
<result property="unitPrice" column="unit_price" />
<result property="plannedQuantity" column="planned_quantity" />
<result property="actualQuantity" column="actual_quantity" />
<result property="divisor" column="divisor" />
......@@ -29,8 +31,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateUserCode" column="update_user_code" />
</resultMap>
<resultMap type="OutboundOrderItemsStatisticsVo" id="OutboundOrderItemsStatisticsVoResult">
<result property="id" column="id" />
<result property="orderId" column="order_id" />
<result property="materialId" column="material_id" />
<result property="batchCode" column="batch_code" />
<result property="warehouseId" column="warehouse_id" />
<result property="locationId" column="location_id" />
<result property="inventoryId" column="inventory_id" />
<result property="outboundOrderId" column="outbound_order_id" />
<result property="unitPrice" column="unit_price" />
<result property="plannedQuantity" column="planned_quantity" />
<result property="actualQuantity" column="actual_quantity" />
<result property="divisor" column="divisor" />
<result property="labelColor" column="label_color" />
<result property="voucherNumber" column="voucher_number" />
<result property="itemStatus" column="item_status" />
<result property="shippedAt" column="shipped_at" />
<result property="shippedBy" column="shipped_by" />
<result property="amount" column="amount" />
<result property="remark" column="remark" />
<result property="isUsed" column="is_used" />
<result property="sortNo" column="sort_no" />
<result property="createTime" column="create_time" />
<result property="createUserCode" column="create_user_code" />
<result property="updateTime" column="update_time" />
<result property="updateUserCode" column="update_user_code" />
</resultMap>
<sql id="selectOutboundOrderItemsVo">
select id, order_id, material_id, batch_code, warehouse_id, location_id, inventory_id, planned_quantity, actual_quantity, divisor, label_color, voucher_number, item_status, shipped_at, shipped_by, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from outbound_order_items
select id, order_id, material_id, batch_code, warehouse_id, location_id, inventory_id, outbound_order_id, unit_price, planned_quantity, actual_quantity, divisor, label_color, voucher_number, item_status, shipped_at, shipped_by, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from outbound_order_items
</sql>
<select id="selectOutboundOrderItemsList" parameterType="OutboundOrderItems" resultMap="OutboundOrderItemsResult">
......@@ -72,6 +101,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="warehouseId != null">warehouse_id,</if>
<if test="locationId != null">location_id,</if>
<if test="inventoryId != null">inventory_id,</if>
<if test="outboundOrderId != null">outbound_order_id,</if>
<if test="unitPrice != null">unit_price,</if>
<if test="plannedQuantity != null">planned_quantity,</if>
<if test="actualQuantity != null">actual_quantity,</if>
<if test="divisor != null">divisor,</if>
......@@ -96,6 +127,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="warehouseId != null">#{warehouseId},</if>
<if test="locationId != null">#{locationId},</if>
<if test="inventoryId != null">#{inventoryId},</if>
<if test="outboundOrderId != null">#{outboundOrderId},</if>
<if test="unitPrice != null">#{unitPrice},</if>
<if test="plannedQuantity != null">#{plannedQuantity},</if>
<if test="actualQuantity != null">#{actualQuantity},</if>
<if test="divisor != null">#{divisor},</if>
......@@ -123,6 +156,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="locationId != null">location_id = #{locationId},</if>
<if test="inventoryId != null">inventory_id = #{inventoryId},</if>
<if test="outboundOrderId != null">outbound_order_id = #{outboundOrderId},</if>
<if test="unitPrice != null">unit_price = #{unitPrice},</if>
<if test="plannedQuantity != null">planned_quantity = #{plannedQuantity},</if>
<if test="actualQuantity != null">actual_quantity = #{actualQuantity},</if>
<if test="divisor != null">divisor = #{divisor},</if>
......@@ -146,6 +181,60 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from outbound_order_items where id = #{id}
</delete>
<select id="selectOutboundOrderItemsStatistics"
parameterType="OutboundOrderItemsStatisticsVO"
resultMap="OutboundOrderItemsStatisticsVoResult">
SELECT
oi.id,
o.order_id,
oi.material_id,
oi.batch_code,
oi.warehouse_id,
oi.inventory_id,
oi.location_id,
oi.planned_quantity,
oi.actual_quantity,
oi.divisor,
oi.label_color,
oi.voucher_number,
oi.unit_price,
oi.unit_price*oi.actual_quantity AS amount,
oi.item_status,
o.inbound_date AS shipped_at,
oi.shipped_by,
oi.remark,
oi.is_used,
oi.sort_no,
oi.create_time,
oi.create_user_code,
oi.update_time,
oi.update_user_code
FROM outbound_order_items oi
LEFT JOIN outbound_orders o ON oi.outbound_order_id = o.id
WHERE oi.is_used = 1
<if test="orderId != null and orderId != ''">
AND o.order_id LIKE CONCAT('%', #{orderId}, '%')
</if>
<if test="startDate != null">
AND o.inbound_date >= #{startDate}
</if>
<if test="endDate != null">
AND o.inbound_date &lt;= DATE_ADD(#{endDate}, INTERVAL 1 DAY)
</if>
<if test="materialId != null and materialId != ''">
AND oi.material_id LIKE CONCAT('%', #{materialId}, '%')
</if>
<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="itemStatus != null and itemStatus != ''">
AND oi.item_status = #{itemStatus}
</if>
ORDER BY oi.create_time DESC
</select>
<delete id="deleteOutboundOrderItemsByIds" parameterType="String">
delete from outbound_order_items where id in
......
......@@ -113,6 +113,13 @@
delete from outbound_order_log where order_id = #{id}
</delete>
<delete id="deleteOutboundOrderLogByOrdersIds" parameterType="String">
delete from outbound_order_log where order_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!-- 批量插入补充inventory_id -->
<insert id="batchOutboundOrderLog">
......
......@@ -39,8 +39,10 @@
<result property="batchCode" column="batch_code" />
<result property="warehouseId" column="warehouse_id" />
<result property="locationId" column="location_id" />
<result property="plannedQuantity" column="planned_quantity" />
<result property="inventoryId" column="inventory_id" />
<result property="outboundOrderId" column="outbound_order_id" />
<result property="unitPrice" column="unit_price" />
<result property="plannedQuantity" column="planned_quantity" />
<result property="actualQuantity" column="actual_quantity" />
<result property="divisor" column="divisor" />
<result property="labelColor" column="label_color" />
......@@ -55,6 +57,7 @@
<result property="createUserCode" column="create_user_code" />
<result property="updateTime" column="update_time" />
<result property="updateUserCode" column="update_user_code" />
<result property="InboundOrderId" column="inbound_order_id" />
</resultMap>
......@@ -92,7 +95,7 @@
<!-- 仅保留子表查询逻辑,字段完整且映射正确 -->
<select id="selectOutboundOrderItemsList" parameterType="String" resultMap="OutboundOrderItemsResult">
select id, order_id, material_id, batch_code, warehouse_id, location_id, planned_quantity, actual_quantity, divisor, label_color, voucher_number, item_status, shipped_at, shipped_by, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code , inventory_id
select id, order_id, material_id, batch_code, warehouse_id, location_id, inventory_id, outbound_order_id, unit_price, planned_quantity, actual_quantity, divisor, label_color, voucher_number, item_status, shipped_at, shipped_by, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code
from outbound_order_items
where order_id = #{id}
</select>
......@@ -183,30 +186,30 @@
</delete>
<delete id="deleteOutboundOrderItemsByOrderIds" parameterType="String">
delete from outbound_order_items where order_id in
delete from outbound_order_items where outbound_order_id in
<foreach item="orderId" collection="array" open="(" separator="," close=")">
#{orderId}
</foreach>
</delete>
<delete id="deleteOutboundOrderItemsByOrderId" parameterType="String">
delete from outbound_order_items where order_id = #{orderId}
delete from outbound_order_items where outbound_order_id = #{orderId}
</delete>
<insert id="batchOutboundOrderItems">
insert into outbound_order_items(
id, order_id, material_id, batch_code, warehouse_id, location_id,
planned_quantity, actual_quantity, divisor, label_color, voucher_number,
inventory_id, outbound_order_id, unit_price, planned_quantity, actual_quantity, divisor, label_color, voucher_number,
item_status, shipped_at, shipped_by, remark, is_used, sort_no,
create_time, create_user_code, update_time, update_user_code,inventory_id
create_time, create_user_code, update_time, update_user_code
) values
<foreach item="item" index="index" collection="list" separator=",">
(
#{item.id}, #{item.orderId}, #{item.materialId}, #{item.batchCode}, #{item.warehouseId},
#{item.locationId}, #{item.plannedQuantity}, #{item.actualQuantity}, #{item.divisor},
#{item.locationId}, #{item.inventoryId}, #{item.outboundOrderId}, #{item.unitPrice}, #{item.plannedQuantity}, #{item.actualQuantity}, #{item.divisor},
#{item.labelColor}, #{item.voucherNumber}, #{item.itemStatus}, #{item.shippedAt},
#{item.shippedBy}, #{item.remark}, #{item.isUsed}, #{item.sortNo}, #{item.createTime},
#{item.createUserCode}, #{item.updateTime}, #{item.updateUserCode},#{item.inventoryId}
#{item.createUserCode}, #{item.updateTime}, #{item.updateUserCode}
)
</foreach>
</insert>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论