Commit c5a04317 by yubin

inventory

parent 2ae44490
<template>
<div class="material-select-component">
<el-dialog :title="title" :visible.sync="visible" width="900px" append-to-body>
<!-- 左右分栏布局 -->
<div class="split-layout">
<!-- 左侧分类树 -->
<div class="left-panel">
<TreeComponent
ref="treeComponent"
:tree-data="categoryTreeData"
:tree-props="treeProps"
:node-key="nodeKey"
:show-search="true"
search-placeholder="请输入分类名称"
:default-expand-all="true"
:highlight-current="true"
:loading="loadingTree"
@node-click="handleCategoryChange"
>
<!-- 自定义节点内容插槽 -->
<template #node-content="{ node, data }">
<span class="custom-tree-node">
<span>{{ node.label }}</span>
</span>
</template>
</TreeComponent>
</div>
<!-- 右侧物料列表 -->
<div class="right-panel">
<!-- 物料列表 -->
<el-table v-loading="loading" :data="materialsList" @selection-change="handleSelectionChange" :scroll-x="true">
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" align="center" />
<el-table-column label="物料编码" align="center" prop="materialCode" />
<el-table-column label="物料名称" align="center" prop="materialName" />
<el-table-column label="SAP物料号" align="center" prop="sapNo" />
<el-table-column label="规格型号" align="center" prop="specification" />
<el-table-column label="计量单位" align="center" prop="materialUnit" />
</el-table>
<!-- 分页 -->
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</div>
<!-- 底部按钮 -->
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取 消</el-button>
<el-button type="primary" @click="confirmSelection">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listMaterials } from "@/api/inventory/materials"
import { listMaterials_category } from "@/api/inventory/materials_category"
import Pagination from "@/components/Pagination"
import TreeComponent from './treeComponent.vue'
export default {
name: "MaterialSelectComponent",
components: {
Pagination,
TreeComponent
},
props: {
// 对话框标题
title: {
type: String,
default: "选择物料"
},
// 是否显示对话框
visible: {
type: Boolean,
default: false
}
},
data() {
return {
// 树相关数据
categoryTreeData: [],
treeProps: {
children: 'children',
label: 'label',
value: 'sid'
},
nodeKey: 'sid',
loadingTree: false,
// 分类映射
categoryMap: {},
// 选中的分类
selectedCategory: null,
// 加载状态
loading: false,
// 总条数
total: 0,
// 物料列表
materialsList: [],
// 选中的物料
selectedMaterials: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
categoryCode: null
}
}
},
watch: {
// 监听对话框显示状态,当显示时加载物料列表和分类树
visible(newVal) {
if (newVal) {
this.getCategoryTreeData()
this.getList()
}
}
},
methods: {
/** 获取分类树数据 */
async getCategoryTreeData() {
this.loadingTree = true
try {
// 调用物料分类列表API获取所有分类
const response = await listMaterials_category({
pageNum: 1,
pageSize: 1000 // 获取足够多的数据
})
if (response.rows && response.rows.length > 0) {
// 过滤掉已禁用的分类
const activeCategories = response.rows.filter(item =>
item.isUsed !== 0 && item.isUsed !== '0'
)
// 构建树形结构
this.categoryTreeData = this.buildTreeData(activeCategories)
// 构建分类映射
this.buildCategoryMap(activeCategories)
}
} catch (error) {
console.error('获取分类树数据失败:', error)
} finally {
this.loadingTree = false
}
},
/** 构建树形结构 */
buildTreeData(list, parentId = null) {
const result = list
.filter(item => {
if (parentId === null) {
// 根节点:parentId为null、0或空
return !item.parentId || item.parentId === 0 || item.parentId === '0'
} else {
// 子节点:parentId匹配
return item.parentId == parentId
}
})
.map(item => {
const children = this.buildTreeData(list, item.id)
return {
...item,
sid: String(item.id),
label: item.categoryName,
children: children.length > 0 ? children : undefined
}
})
return result
},
/** 构建分类映射 */
buildCategoryMap(categories) {
this.categoryMap = {}
categories.forEach(item => {
this.categoryMap[item.id] = item.categoryName
})
},
/** 处理分类选择变化 */
handleCategoryChange(data) {
this.selectedCategory = data
// 更新查询参数,按选中的分类筛选物料
this.queryParams.categoryCode = data ? data.categoryCode : null
this.queryParams.pageNum = 1
this.getList()
},
/** 获取物料列表 */
async getList() {
this.loading = true
try {
const response = await listMaterials(this.queryParams)
this.materialsList = response.rows
this.total = response.total
} catch (error) {
console.error('获取物料列表失败:', error)
} finally {
this.loading = false
}
},
/** 处理选择变化 */
handleSelectionChange(selection) {
this.selectedMaterials = selection
},
/** 确认选择 */
confirmSelection() {
// 提取选中物料的uuid和名称,用逗号隔开
const uuids = this.selectedMaterials
.map(item => item.uuid || item.id) // 兼容uuid和id字段
.join(',')
const names = this.selectedMaterials
.map(item => item.materialName) // 提取物料名称
.join(',')
// 触发选择确认事件,将选中的uuid和名称传递给父组件
this.$emit('selection-confirm', uuids, names)
// 关闭对话框
this.$emit('update:visible', false)
},
/** 取消选择 */
cancel() {
// 清空选择
this.selectedMaterials = []
this.selectedCategory = null
this.queryParams.categoryCode = null
// 触发取消事件
this.$emit('selection-cancel')
// 关闭对话框
this.$emit('update:visible', false)
}
}
}
</script>
<style scoped>
.material-select-component {
.dialog-footer {
text-align: right;
}
.split-layout {
display: flex;
height: 500px;
gap: 10px;
.left-panel {
width: 250px;
border: 1px solid #e4e7ed;
border-radius: 4px;
overflow: hidden;
.tree-container {
height: 100%;
}
}
.right-panel {
flex: 1;
display: flex;
flex-direction: column;
.el-table {
flex: 1;
overflow: auto;
}
.pagination {
margin-top: 10px;
}
}
}
}
</style>
\ No newline at end of file
<template>
<div class="tree-container" :style="containerStyle">
<!-- 搜索框 -->
<div class="tree-header" v-if="showSearch">
<el-input
v-model="searchText"
:placeholder="searchPlaceholder"
clearable
size="small"
prefix-icon="el-icon-search"
@input="handleSearch"
style="width: 100%; margin-bottom: 10px;"
/>
</div>
<!-- 树组件 -->
<div class="tree-body" :style="treeBodyStyle">
<el-tree
v-if="treeData && treeData.length > 0"
ref="treeRef"
:data="filteredTreeData"
:props="treeProps"
:node-key="nodeKey"
:default-expand-all="defaultExpandAll"
:expand-on-click-node="expandOnClickNode"
:highlight-current="highlightCurrent"
:filter-node-method="filterNodeMethod"
:empty-text="emptyText"
:style="treeStyle"
@node-click="handleNodeClick"
@node-expand="handleNodeExpand"
@node-collapse="handleNodeCollapse"
@current-change="handleCurrentChange"
>
<!-- 自定义节点内容插槽 -->
<template #default="{ node, data }">
<slot name="node-content" :node="node" :data="data">
<span class="custom-tree-node">
<span>{{ node.label }}</span>
</span>
</slot>
</template>
</el-tree>
<!-- 空状态 -->
<div v-else class="tree-empty">
<slot name="empty">
<div style="padding: 20px; text-align: center; color: #999;">
{{ loading ? '加载中...' : '暂无数据' }}
</div>
</slot>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'TreeComponent',
props: {
// 树数据
treeData: {
type: Array,
default: () => []
},
// 树配置
treeProps: {
type: Object,
default: () => ({
children: 'children',
label: 'label',
value: 'sid'
})
},
// 节点key
nodeKey: {
type: String,
default: 'sid'
},
// 是否显示搜索框
showSearch: {
type: Boolean,
default: true
},
// 搜索框占位符
searchPlaceholder: {
type: String,
default: '请输入搜索内容'
},
// 是否默认展开所有节点
defaultExpandAll: {
type: Boolean,
default: true
},
// 是否点击节点时展开
expandOnClickNode: {
type: Boolean,
default: false
},
// 是否高亮当前选中节点
highlightCurrent: {
type: Boolean,
default: true
},
// 容器样式
containerStyle: {
type: Object,
default: () => ({
height: '100%',
padding: '10px'
})
},
// 树容器样式
treeBodyStyle: {
type: Object,
default: () => ({
height: 'calc(100% - 50px)',
overflow: 'auto'
})
},
// 树样式
treeStyle: {
type: Object,
default: () => ({})
},
// 空状态文本
emptyText: {
type: String,
default: '暂无数据'
},
// 加载状态
loading: {
type: Boolean,
default: false
},
// 初始选中的节点key
defaultSelectedKey: {
type: [String, Number],
default: null
}
},
data() {
return {
searchText: '',
filteredTreeData: [],
selectedNode: null
}
},
watch: {
treeData: {
immediate: true,
handler(newData) {
this.filteredTreeData = newData
this.$nextTick(() => {
if (this.defaultSelectedKey && this.$refs.treeRef) {
this.$refs.treeRef.setCurrentKey(this.defaultSelectedKey)
}
})
}
},
defaultSelectedKey: {
immediate: true,
handler(newKey) {
if (newKey && this.$refs.treeRef) {
this.$refs.treeRef.setCurrentKey(newKey)
}
}
}
},
methods: {
/**
* 过滤节点方法
*/
filterNodeMethod(value, data, node) {
if (!value) return true
const label = data[this.treeProps.label] || ''
return label.toLowerCase().includes(value.toLowerCase())
},
/**
* 处理搜索
*/
handleSearch(value) {
this.$refs.treeRef.filter(value)
},
/**
* 节点点击事件
*/
handleNodeClick(data, node, component) {
this.selectedNode = { data, node, component }
this.$emit('node-click', data, node, component)
},
/**
* 节点展开事件
*/
handleNodeExpand(data, node, component) {
this.$emit('node-expand', data, node, component)
},
/**
* 节点折叠事件
*/
handleNodeCollapse(data, node, component) {
this.$emit('node-collapse', data, node, component)
},
/**
* 当前节点变化事件
*/
handleCurrentChange(data, node) {
this.$emit('current-change', data, node)
},
/**
* 重置树结构
*/
resetTree() {
// 修复:使用正确的 ref 名称 treeRef
if (this.$refs.treeRef) {
this.$refs.treeRef.setCurrentKey(null);
this.searchText = '';
this.$refs.treeRef.filter(''); // 清空搜索
}
},
/**
* 设置当前选中的节点
*/
setCurrentNode(node) {
this.$refs.treeRef.setCurrentNode(node)
},
/**
* 设置当前选中的节点key
*/
setCurrentKey(key) {
this.$refs.treeRef.setCurrentKey(key)
},
/**
* 获取当前选中的节点
*/
getCurrentNode() {
return this.$refs.treeRef.getCurrentNode()
},
/**
* 获取当前选中的节点key
*/
getCurrentKey() {
return this.$refs.treeRef.getCurrentKey()
},
/**
* 展开指定节点
*/
expandNode(node) {
this.$refs.treeRef.expandNode(node)
},
/**
* 折叠指定节点
*/
collapseNode(node) {
this.$refs.treeRef.collapseNode(node)
},
/**
* 展开所有节点
*/
expandAll() {
this.$refs.treeRef.expandAll()
},
/**
* 折叠所有节点
*/
collapseAll() {
this.$refs.treeRef.collapseAll()
},
/**
* 更新节点数据
*/
updateKeyChildren(key, data) {
this.$refs.treeRef.updateKeyChildren(key, data)
},
/**
* 获取节点信息
*/
getNode(key) {
return this.$refs.treeRef.getNode(key)
},
/**
* 移除节点
*/
remove(key) {
this.$refs.treeRef.remove(key)
},
/**
* 追加节点数据
*/
append(data, parentNode) {
this.$refs.treeRef.append(data, parentNode)
},
/**
* 插入节点数据
*/
insertBefore(data, refNode) {
this.$refs.treeRef.insertBefore(data, refNode)
},
/**
* 插入节点数据后
*/
insertAfter(data, refNode) {
this.$refs.treeRef.insertAfter(data, refNode)
}
}
}
</script>
<style scoped>
.tree-container {
height: 100%;
display: flex;
flex-direction: column;
}
.tree-header {
flex-shrink: 0;
}
.tree-body {
flex: 1;
overflow: auto;
}
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-right: 8px;
}
.tree-empty {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
color: #999;
}
</style>
\ No newline at end of file
......@@ -45,7 +45,17 @@ public class InventoryController extends BaseController
List<Inventory> list = inventoryService.selectInventoryList(inventory);
return getDataTable(list);
}
/**
* 查询库存列表
*/
@PreAuthorize("@ss.hasPermi('inventory:inventory:list')")
@GetMapping("/listByMaterialId")
public TableDataInfo listByMaterialId(String materialId)
{
startPage();
List<Inventory> list = inventoryService.listByMatreialId(materialId);
return getDataTable(list);
}
/**
* 导出库存列表
*/
......
......@@ -17,7 +17,7 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.OutboundOrderItemsInventory;
import com.ruoyi.inventory.service.IOutboundOrderItemsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
......@@ -43,7 +43,7 @@ public class OutboundOrderItemsController extends BaseController
public TableDataInfo list(OutboundOrderItems outboundOrderItems)
{
startPage();
List<OutboundOrderItemsInventory> list = outboundOrderItemsService.selectOutboundOrderItemsList(outboundOrderItems);
List<OutboundOrderItems> list = outboundOrderItemsService.selectOutboundOrderItemsList(outboundOrderItems);
return getDataTable(list);
}
......@@ -55,8 +55,8 @@ public class OutboundOrderItemsController extends BaseController
@PostMapping("/export")
public void export(HttpServletResponse response, OutboundOrderItems outboundOrderItems)
{
List<OutboundOrderItemsInventory> list = outboundOrderItemsService.selectOutboundOrderItemsList(outboundOrderItems);
ExcelUtil<OutboundOrderItemsInventory> util = new ExcelUtil<OutboundOrderItemsInventory>(OutboundOrderItemsInventory.class);
List<OutboundOrderItems> list = outboundOrderItemsService.selectOutboundOrderItemsList(outboundOrderItems);
ExcelUtil<OutboundOrderItems> util = new ExcelUtil<OutboundOrderItems>(OutboundOrderItems.class);
util.exportExcel(response, list, "出库单明细数据");
}
......
package com.ruoyi.inventory.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 出库单明细库存DTO对象 outbound_order_items_inventory
*
* @author ruoyi
* @date 2025-12-03
*/
public class OutboundOrderItemsInventory
{
private static final long serialVersionUID = 1L;
/** 出库单明细 */
private OutboundOrderItems outboundOrderItems;
/** 库存信息 */
private Inventory inventory;
public OutboundOrderItems getOutboundOrderItems()
{
return outboundOrderItems;
}
public void setOutboundOrderItems(OutboundOrderItems outboundOrderItems)
{
this.outboundOrderItems = outboundOrderItems;
}
public Inventory getInventory()
{
return inventory;
}
public void setInventory(Inventory inventory)
{
this.inventory = inventory;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("outboundOrderItems", getOutboundOrderItems())
.append("inventory", getInventory())
.toString();
}
}
\ No newline at end of file
......@@ -19,7 +19,7 @@ public class OutboundOrderLog extends BaseEntity
private String id;
/** 货物ID */
@Excel(name = "货物ID")
@Excel(name = "出货单号ID")
private String orderId;
/** 货物ID */
......
package com.ruoyi.inventory.mapper;
import java.util.List;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.inventory.domain.Inventory;
/**
......@@ -65,4 +67,6 @@ public interface InventoryMapper
* @return 结果
*/
public int deleteInventoryByIds(String[] ids);
public List<Inventory> listByMatreialId(String materialId);
}
......@@ -19,6 +19,13 @@ public interface MaterialsCategoryMapper
*/
public MaterialsCategory selectMaterialsCategoryById(String id);
/**
* 查询物料分类
*
* @param id 物料分类主键
* @return 物料分类
*/
public MaterialsCategory selectMaterialsCategoryByMaterialsCode(String id);
/**
* 查询物料分类列表
*
* @param materialsCategory 物料分类
......
......@@ -23,6 +23,14 @@ public interface MaterialsMapper
public Materials selectMaterialsById(String id);
/**
* 查询物料
*
* @param id 物料主键
* @return 物料
*/
public Materials selectMaterialsByMaterialsCode(String id);
/**
* 查询物料列表
*
* @param materials 物料
......
package com.ruoyi.inventory.service;
import java.util.List;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.inventory.domain.Inventory;
/**
......@@ -60,4 +62,6 @@ public interface IInventoryService
* @return 结果
*/
public int deleteInventoryById(String id);
public List<Inventory> listByMatreialId(String materialId);
}
......@@ -2,7 +2,7 @@ package com.ruoyi.inventory.service;
import java.util.List;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.OutboundOrderItemsInventory;
import com.ruoyi.inventory.domain.OutboundOrderItems;
/**
* 出库单明细Service接口
......@@ -10,7 +10,7 @@ import com.ruoyi.inventory.domain.OutboundOrderItemsInventory;
* @author ruoyi
* @date 2025-12-03
*/
public interface IOutboundOrderItemsService
public interface IOutboundOrderItemsService
{
/**
* 查询出库单明细
......@@ -18,7 +18,7 @@ public interface IOutboundOrderItemsService
* @param id 出库单明细主键
* @return 出库单明细
*/
public OutboundOrderItemsInventory selectOutboundOrderItemsById(String id);
public OutboundOrderItems selectOutboundOrderItemsById(String id);
/**
* 查询出库单明细列表
......@@ -26,7 +26,7 @@ public interface IOutboundOrderItemsService
* @param outboundOrderItems 出库单明细
* @return 出库单明细集合
*/
public List<OutboundOrderItemsInventory> selectOutboundOrderItemsList(OutboundOrderItems outboundOrderItems);
public List<OutboundOrderItems> selectOutboundOrderItemsList(OutboundOrderItems outboundOrderItems);
/**
* 新增出库单明细
......
......@@ -35,6 +35,8 @@ public interface IOutboundOrderLogService
*/
public int insertOutboundOrderLog(OutboundOrderLog outboundOrderLog);
Long selectLockedQuantity(OutboundOrderLog outboundOrderLog);
/**
* 修改出库明细子(仅用于锁定数量统计)
*
......
......@@ -19,7 +19,6 @@ public class InboundOrderItemsServiceImpl implements IInboundOrderItemsService
{
@Autowired
private InboundOrderItemsMapper inboundOrderItemsMapper;
/**
* 查询入库单明细
*
......@@ -54,6 +53,7 @@ public class InboundOrderItemsServiceImpl implements IInboundOrderItemsService
public int insertInboundOrderItems(InboundOrderItems inboundOrderItems)
{
inboundOrderItems.setCreateTime(DateUtils.getNowDate());
return inboundOrderItemsMapper.insertInboundOrderItems(inboundOrderItems);
}
......
......@@ -85,6 +85,8 @@ public class InventoryServiceImpl implements IInventoryService
return inventoryMapper.updateInventory(inventory);
}
/**
* 批量删除库存
*
......@@ -108,4 +110,9 @@ public class InventoryServiceImpl implements IInventoryService
{
return inventoryMapper.deleteInventoryById(id);
}
@Override
public List<Inventory> listByMatreialId(String materialId) {
return inventoryMapper.listByMatreialId(materialId);
}
}
......@@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.domain.OutboundOrderItemsInventory;
import com.ruoyi.inventory.domain.OutboundOrderLog;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -26,6 +26,9 @@ public class OutboundOrderItemsServiceImpl implements IOutboundOrderItemsService
@Autowired
private InventoryServiceImpl inventoryService;
@Autowired
private OutboundOrderLogServiceImpl outboundOrderLogService;
/**
* 查询出库单明细
*
......@@ -33,16 +36,9 @@ public class OutboundOrderItemsServiceImpl implements IOutboundOrderItemsService
* @return 出库单明细
*/
@Override
public OutboundOrderItemsInventory selectOutboundOrderItemsById(String id)
public OutboundOrderItems selectOutboundOrderItemsById(String id)
{
OutboundOrderItems outboundOrderItems = outboundOrderItemsMapper.selectOutboundOrderItemsById(id);
Inventory inventory = new Inventory();
BeanUtils.copyProperties(outboundOrderItems, inventory);
Inventory inventory1 = inventoryService.selectInventory(inventory);
OutboundOrderItemsInventory outboundOrderItemsInventory = new OutboundOrderItemsInventory();
outboundOrderItemsInventory.setOutboundOrderItems(outboundOrderItems);
outboundOrderItemsInventory.setInventory(inventory1);
return outboundOrderItemsInventory;
return outboundOrderItemsMapper.selectOutboundOrderItemsById(id);
}
/**
......@@ -52,26 +48,15 @@ public class OutboundOrderItemsServiceImpl implements IOutboundOrderItemsService
* @return 出库单明细
*/
@Override
public List<OutboundOrderItemsInventory> selectOutboundOrderItemsList(OutboundOrderItems outboundOrderItems)
public List<OutboundOrderItems> selectOutboundOrderItemsList(OutboundOrderItems outboundOrderItems)
{
List<OutboundOrderItems> itemsList = outboundOrderItemsMapper.selectOutboundOrderItemsList(outboundOrderItems);
List<OutboundOrderItemsInventory> resultList = new ArrayList<>();
for (OutboundOrderItems item : itemsList) {
Inventory inventory = new Inventory();
BeanUtils.copyProperties(item, inventory);
Inventory inventory1 = inventoryService.selectInventory(inventory);
OutboundOrderItemsInventory outboundOrderItemsInventory = new OutboundOrderItemsInventory();
outboundOrderItemsInventory.setOutboundOrderItems(item);
outboundOrderItemsInventory.setInventory(inventory1);
resultList.add(outboundOrderItemsInventory);
}
return resultList;
return outboundOrderItemsMapper.selectOutboundOrderItemsList(outboundOrderItems);
}
/**
* 新增出库单明细
*
* @param outboundOrderItems 出库单明细
* @param outboundOrderItemsInventory 出库单明细库存DTO
* @return 结果
*/
@Override
......@@ -84,7 +69,7 @@ public class OutboundOrderItemsServiceImpl implements IOutboundOrderItemsService
/**
* 修改出库单明细
*
* @param outboundOrderItems 出库单明细
* @param outboundOrderItemsInventory 出库单明细库存DTO
* @return 结果
*/
@Override
......
......@@ -54,7 +54,10 @@ public class OutboundOrderLogServiceImpl implements IOutboundOrderLogService
{
return outboundOrderLogMapper.insertOutboundOrderLog(outboundOrderLog);
}
@Override
public Long selectLockedQuantity(OutboundOrderLog outboundOrderLog){
return outboundOrderLogMapper.selectLockedQuantity(outboundOrderLog);
}
/**
* 修改出库明细子(仅用于锁定数量统计)
*
......
......@@ -120,15 +120,13 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService
String id = outboundOrders.getId();
if (StringUtils.isNotNull(outboundOrderItemsList))
{
List<OutboundOrderItems> list = new ArrayList<OutboundOrderItems>();
for (OutboundOrderItems outboundOrderItems : outboundOrderItemsList)
{
outboundOrderItems.setOrderId(id);
list.add(outboundOrderItems);
}
if (list.size() > 0)
if (outboundOrderItemsList.size() > 0)
{
outboundOrdersMapper.batchOutboundOrderItems(list);
outboundOrdersMapper.batchOutboundOrderItems(outboundOrderItemsList);
}
}
}
......
......@@ -2,6 +2,7 @@ package com.ruoyi.inventory.service.impl;
import java.util.List;
import com.ruoyi.common.core.domain.entity.Materials;
import com.ruoyi.common.core.domain.entity.MaterialsCategory;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
......@@ -9,6 +10,7 @@ import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.inventory.domain.StorageLocationsCategory;
import com.ruoyi.inventory.mapper.MaterialsCategoryMapper;
import com.ruoyi.inventory.mapper.MaterialsMapper;
import com.ruoyi.inventory.mapper.StorageLocationsCategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -30,7 +32,7 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
@Autowired
private StorageLocationsCategoryMapper storageLocationsCategoryMapper;
@Autowired
private MaterialsCategoryMapper materialsCategoryMapper;
private MaterialsMapper materialsMapper;
/**
* 查询库位
......@@ -69,9 +71,10 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
if (storageLocations2.getAllowedCategoryIds() != null && !storageLocations2.getAllowedCategoryIds().isEmpty()){
String[] AllowedCategoryIds = storageLocations2.getAllowedCategoryIds().split(",");
for (String AllowedCategoryId : AllowedCategoryIds) {
MaterialsCategory materialsCategory = materialsCategoryMapper.selectMaterialsCategoryById(AllowedCategoryId);
if (materialsCategory != null && materialsCategory.getCategoryName() != null) {
String categoryName = materialsCategory.getCategoryName().trim(); // 去除首尾空格
Materials materials = materialsMapper.selectMaterialsByMaterialsCode(AllowedCategoryId);
if (materials != null && materials.getMaterialName() != null) {
String categoryName = materials.getMaterialName().trim(); // 去除首尾空格
if (AllowedCategoryName != "") {
AllowedCategoryName += ",";
}
......@@ -110,8 +113,8 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
storageLocationsCategory.setCategoryId(categoryId);
storageLocationsCategory.setCreateTime(DateUtils.getNowDate());
storageLocationsCategory.setCreateUserCode(String.valueOf(SecurityUtils.getUserId()));
MaterialsCategory materialsCategory = materialsCategoryMapper.selectMaterialsCategoryById(categoryId);
storageLocationsCategory.setCategoryName(materialsCategory.getCategoryName());
Materials materials = materialsMapper.selectMaterialsByMaterialsCode(categoryId);
storageLocationsCategory.setCategoryName(materials.getMaterialName());
storageLocationsCategoryMapper.insertStorageLocationsCategory(storageLocationsCategory);
}
}
......@@ -146,8 +149,8 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
storageLocationsCategory.setCategoryId(categoryId);
storageLocationsCategory.setUpdateTime(DateUtils.getNowDate());
storageLocationsCategory.setUpdateUserCode(String.valueOf(SecurityUtils.getUserId()));
MaterialsCategory materialsCategory = materialsCategoryMapper.selectMaterialsCategoryById(categoryId);
storageLocationsCategory.setCategoryName(materialsCategory.getCategoryName());
Materials materials = materialsMapper.selectMaterialsByMaterialsCode(categoryId);
storageLocationsCategory.setCategoryName(materials.getMaterialName());
storageLocationsCategoryMapper.insertStorageLocationsCategory(storageLocationsCategory);
}
}
......
......@@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectInboundOrdersList" parameterType="InboundOrders" resultMap="InboundOrdersResult">
<include refid="selectInboundOrdersVo"/>
<where>
<if test="id != null and id != ''"> and id = #{id}</if>
<if test="id != null and Id != ''"> and id = #{Id}</if>
<if test="systemNo != null and systemNo != ''"> and system_no = #{systemNo}</if>
<if test="orderTypeId != null and orderTypeId != ''"> and order_type_id = #{orderTypeId}</if>
<if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if>
......
......@@ -90,7 +90,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectInventoryVo"/>
where id = #{id}
</select>
<select id="listByMatreialId" parameterType="String" resultMap="InventoryResult">
<include refid="selectInventoryVo"/>
where material_id = #{materialId}
</select>
<insert id="insertInventory" parameterType="Inventory">
insert into inventory
<trim prefix="(" suffix=")" suffixOverrides=",">
......
......@@ -40,7 +40,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
order by sort_no asc
</select>
<insert id="insertMaterialsCategory" parameterType="MaterialsCategory">
insert into materials_category
<trim prefix="(" suffix=")" suffixOverrides=",">
......
......@@ -76,6 +76,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
order by sort_no asc
</select>
<select id="selectMaterialsByMaterialsCode" parameterType="String" resultMap="MaterialsResult">
<include refid="selectMaterialsVo"/>
where material_code = #{id}
order by sort_no asc
</select>
<select id="selectMaterialsByCategory" parameterType="String" resultMap="MaterialsResult">
<include refid="selectMaterialsVo"/>
where category_code = #{id}
......
......@@ -37,13 +37,9 @@
select ifnull(sum(actual_quantity), 0)
from outbound_order_log
<where>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="materialId != null and materialId != ''"> and material_id = #{materialId}</if>
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
<if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if>
<if test="actualQuantity != null "> and actual_quantity = #{actualQuantity}</if>
<if test="itemStatus != null "> and item_status = #{itemStatus}</if>
<if test="isUsed != null "> and is_used = #{isUsed}</if>
</where>
</select>
......
......@@ -91,8 +91,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectOutboundOrderItemsList" parameterType="String" resultMap="OutboundOrderItemsResult">
select id, order_id, material_id, batch_id, warehouse_id, location_id, planned_quantity, actual_quantity, planned_packages, actual_packages, divisor, label_color, voucher_number, unit_price, item_status, received_at, received_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, 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>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论