Commit 0c8bf004 by yubin

inventory

parent d9ba64a8
...@@ -59,7 +59,7 @@ export default { ...@@ -59,7 +59,7 @@ export default {
unmatch() { unmatch() {
this.unmatchArray = [] this.unmatchArray = []
// 没有value不显示 // 没有value不显示
if (this.value === null || typeof this.value === 'undefined' || this.value === '' || this.options.length === 0) return false if (this.value === null || typeof this.value === 'undefined' || this.value === '' || !this.options || this.options.length === 0) return false
// 传入值为数组 // 传入值为数组
let unmatch = false // 添加一个标志来判断是否有未匹配项 let unmatch = false // 添加一个标志来判断是否有未匹配项
this.values.forEach(item => { this.values.forEach(item => {
......
...@@ -176,6 +176,15 @@ export const dynamicRoutes = [ ...@@ -176,6 +176,15 @@ export const dynamicRoutes = [
title: '物料管理', title: '物料管理',
permissions: ['inventory:materials:list'] permissions: ['inventory:materials:list']
} }
},
{
path: 'materials_category',
component: () => import('@/views/inventory/materials_category/index'),
name: 'MaterialsCategory',
meta: {
title: '物料分类管理',
permissions: ['inventory:materials_category:list']
}
} }
] ]
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
:default-expand-all="true" :default-expand-all="true"
:highlight-current="true" :highlight-current="true"
:loading="loadingTree" :loading="loadingTree"
@node-click="handleTreeClick" @selected-change="handleCategoryChange"
> >
<!-- 自定义节点内容插槽 --> <!-- 自定义节点内容插槽 -->
<template #node-content="{ node, data }"> <template #node-content="{ node, data }">
...@@ -341,6 +341,7 @@ import 'splitpanes/dist/splitpanes.css' ...@@ -341,6 +341,7 @@ import 'splitpanes/dist/splitpanes.css'
import Treeselect from "@riophae/vue-treeselect" import Treeselect from "@riophae/vue-treeselect"
import "@riophae/vue-treeselect/dist/vue-treeselect.css" import "@riophae/vue-treeselect/dist/vue-treeselect.css"
import ImportExcel from "@/components/ImportExcel/index" import ImportExcel from "@/components/ImportExcel/index"
import request from '@/utils/request'
export default { export default {
name: "Materials", name: "Materials",
...@@ -387,8 +388,8 @@ export default { ...@@ -387,8 +388,8 @@ export default {
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
// 当前选中的树节点ID // 当前选中的分类列表
currentNodeId: null, selectedCategories: [],
// 查询参数 // 查询参数
queryParams: { queryParams: {
...@@ -401,6 +402,7 @@ export default { ...@@ -401,6 +402,7 @@ export default {
categoryCode: null, categoryCode: null,
categoryNameInput: null, categoryNameInput: null,
specification: null, specification: null,
categoryCodes: []
}, },
// 表单参数 // 表单参数
...@@ -545,38 +547,85 @@ export default { ...@@ -545,38 +547,85 @@ export default {
return result return result
}, },
/** 处理树节点点击 */ /** 处理分类选择变化 */
handleTreeClick(data) { handleCategoryChange(selectedData) {
console.log('点击树节点:', data) console.log('选择分类变化:', selectedData)
this.currentNodeId = data.sid this.selectedCategories = selectedData;
// 更新查询参数,按选中的分类筛选物料 // 更新查询参数,按选中的分类筛选物料
this.queryParams.categoryCode = data.categoryCode if (selectedData.length > 0) {
this.queryParams.categoryNameInput = null // 清空名称输入 // 获取所有选中分类的编码
this.queryParams.pageNum = 1 this.queryParams.categoryCodes = selectedData.map(item => item.categoryCode);
this.getList() // 清空单个分类编码和名称输入
this.queryParams.categoryCode = null;
this.queryParams.categoryNameInput = null;
} else {
// 未选中任何分类,清空所有分类相关参数
this.queryParams.categoryCodes = [];
this.queryParams.categoryCode = null;
}
this.queryParams.pageNum = 1;
this.getList();
}, },
/** 查询物料列表 */ /** 查询物料列表 */
getList() { async getList() {
this.loading = true this.loading = true
listMaterials(this.queryParams).then(response => { try {
let materialsList = [];
let total = 0;
// 检查是否有多个分类编码
if (this.queryParams.categoryCodes && this.queryParams.categoryCodes.length > 0) {
// 使用getMaterial接口并行获取每个分类的物料
const promises = this.queryParams.categoryCodes.map(categoryCode =>
request({
url: `/inventory/materials/getMaterial/${categoryCode}`,
method: 'get'
})
);
const results = await Promise.all(promises);
// 合并所有物料并去重
const materialMap = new Map();
results.forEach(result => {
if (result && result.data) {
const materials = Array.isArray(result.data) ? result.data : [result.data];
materials.forEach(material => {
if (!materialMap.has(material.id)) {
materialMap.set(material.id, material);
materialsList.push(material);
}
});
}
});
total = materialsList.length;
} else {
// 单分类或无分类查询,使用原接口
const response = await listMaterials(this.queryParams);
materialsList = response.rows;
total = response.total;
}
// 对物料列表中的分类字段做映射处理 // 对物料列表中的分类字段做映射处理
this.materialsList = response.rows this.materialsList = materialsList
.filter(item => item.isUsed !== 0 && item.isUsed !== '0') .filter(item => item.isUsed !== 0 && item.isUsed !== '0')
.map(item => ({ .map(item => ({
...item, ...item,
// 兜底:如果映射表中没有,显示原始code并标注 // 兜底:如果映射表中没有,显示原始code并标注
displayCategory: this.categoryMap[item.categoryCode] || `${item.categoryCode}(未匹配分类)` displayCategory: this.categoryMap[item.categoryCode] || `${item.categoryCode}(未匹配分类)`
})); }));
this.total = response.total; this.total = total;
}).catch(() => { } catch (error) {
this.loading = false; console.error('获取物料列表失败:', error);
}).finally(() => { this.materialsList = [];
this.total = 0;
} finally {
this.loading = false; this.loading = false;
}) }
}, },
// 取消按钮 // 取消按钮
...@@ -659,12 +708,14 @@ export default { ...@@ -659,12 +708,14 @@ export default {
categoryCode: null, categoryCode: null,
categoryNameInput: null, categoryNameInput: null,
specification: null, specification: null,
categoryCodes: []
}; };
this.currentNodeId = null; this.selectedCategories = [];
// 修复树形高亮重置:直接操作 TreeComponent 内部的 el-tree // 修复树形高亮重置:直接操作 TreeComponent 内部的 el-tree
if (this.$refs.treeComponent && this.$refs.treeComponent.$refs.tree) { if (this.$refs.treeComponent && this.$refs.treeComponent.$refs.tree) {
this.$refs.treeComponent.$refs.tree.setCurrentKey(null); // 清空选中 this.$refs.treeComponent.$refs.tree.setCurrentKey(null); // 清空选中
this.$refs.treeComponent.$refs.tree.setCheckedKeys([]); // 清空勾选
} else if (this.$refs.treeComponent) { } else if (this.$refs.treeComponent) {
// 如果 TreeComponent 有自定义重置方法 // 如果 TreeComponent 有自定义重置方法
this.$refs.treeComponent.resetTree(); this.$refs.treeComponent.resetTree();
......
...@@ -92,10 +92,10 @@ ...@@ -92,10 +92,10 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="warehousesList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="warehousesList" @selection-change="handleSelectionChange" :scroll-x="true">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="仓库编码" align="center" prop="warehousesCode" /> <el-table-column label="仓库编码" align="center" prop="warehousesCode" width="120" />
<el-table-column label="仓库名称" align="center" prop="warehousesName" /> <el-table-column label="仓库名称" align="center" prop="warehousesName" width="150" />
<el-table-column label="仓库类型" align="center" prop="warehouseType"> <el-table-column label="仓库类型" align="center" prop="warehouseType">
<template slot-scope="scope"> <template slot-scope="scope">
{{ selectDictLabel(dict.type.warehouse_type, scope.row.warehouseType) }} {{ selectDictLabel(dict.type.warehouse_type, scope.row.warehouseType) }}
...@@ -106,14 +106,14 @@ ...@@ -106,14 +106,14 @@
<el-table-column label="仓库容量" align="center" prop="capacity" /> <el-table-column label="仓库容量" align="center" prop="capacity" />
<el-table-column label="仓库管理员" align="center" prop="manager" /> <el-table-column label="仓库管理员" align="center" prop="manager" />
<el-table-column label="联系电话" align="center" prop="contactPhone" /> <el-table-column label="联系电话" align="center" prop="contactPhone" />
<el-table-column label="应用状态" align="center" prop="isEnabled"> <el-table-column label="排序" align="center" prop="sortNo" width="80" />
<el-table-column label="应用状态" align="center" prop="isEnabled" width="100" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
{{ selectDictLabel(dict.type.sys_normal_disable, scope.row.isEnabled) }} {{ selectDictLabel(dict.type.sys_normal_disable, scope.row.isEnabled) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="排序" align="center" prop="sortNo" /> <el-table-column label="创建日期" align="center" prop="createTime" width="180" fixed="right" />
<el-table-column label="创建日期" align="center" prop="createTime" /> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150" fixed="right">
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
...@@ -194,21 +194,16 @@ ...@@ -194,21 +194,16 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="应用状态" prop="isEnabled"> <el-form-item label="应用状态" prop="isEnabled">
<el-select v-model="form.isEnabled" placeholder="请选择应用状态"> <el-radio-group v-model="form.isEnabled">
<el-option <el-radio :label="1"></el-radio>
v-for="dict in dict.type.sys_normal_disable" <el-radio :label="0"></el-radio>
:key="dict.value" </el-radio-group>
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="排序" prop="sortNo"> <el-form-item label="排序" prop="sortNo">
<el-input v-model="form.sortNo" placeholder="请输入排序" /> <el-input v-model="form.sortNo" placeholder="请输入排序" />
......
...@@ -3,7 +3,6 @@ package com.ruoyi.web.controller.inventory; ...@@ -3,7 +3,6 @@ package com.ruoyi.web.controller.inventory;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.utils.uuid.UUID; import com.ruoyi.common.utils.uuid.UUID;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -83,6 +82,15 @@ public class MaterialsCategoryController extends BaseController ...@@ -83,6 +82,15 @@ public class MaterialsCategoryController extends BaseController
} }
/** /**
* 获取物料树(带分类)结构
*/
@PreAuthorize("@ss.hasPermi('inventory:materials_category:list')")
@GetMapping("/materialsTree")
public AjaxResult materialsTree(MaterialsCategory materialsCategory)
{
return success(materialsCategoryService.selectMaterialsCategoryTreeList(materialsCategory));
}
/**
* 新增物料分类 * 新增物料分类
*/ */
@PreAuthorize("@ss.hasPermi('inventory:materials_category:add')") @PreAuthorize("@ss.hasPermi('inventory:materials_category:add')")
......
...@@ -4,8 +4,7 @@ import java.util.List; ...@@ -4,8 +4,7 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.Materials;
import com.ruoyi.inventory.domain.Owners;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -20,7 +19,6 @@ import com.ruoyi.common.annotation.Log; ...@@ -20,7 +19,6 @@ import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.inventory.domain.Materials;
import com.ruoyi.inventory.service.IMaterialsService; import com.ruoyi.inventory.service.IMaterialsService;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
...@@ -75,6 +73,16 @@ public class MaterialsController extends BaseController ...@@ -75,6 +73,16 @@ public class MaterialsController extends BaseController
} }
/** /**
* 获取物料详细信息
*/
@PreAuthorize("@ss.hasPermi('inventory:materials:query')")
@GetMapping(value = "getMaterial/{id}")
public AjaxResult getMaterialByCategory(@PathVariable("id") String id)
{
return success(materialsService.selectMaterialsByCategory(id));
}
/**
* 新增物料 * 新增物料
*/ */
@PreAuthorize("@ss.hasPermi('inventory:materials:add')") @PreAuthorize("@ss.hasPermi('inventory:materials:add')")
......
...@@ -8,6 +8,7 @@ import com.ruoyi.common.constant.UserConstants; ...@@ -8,6 +8,7 @@ import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.MaterialsCategory; import com.ruoyi.common.core.domain.entity.MaterialsCategory;
import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.entity.Materials;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
/** /**
...@@ -33,6 +34,10 @@ public class TreeSelect implements Serializable ...@@ -33,6 +34,10 @@ public class TreeSelect implements Serializable
/** 子节点 */ /** 子节点 */
@JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> children; private List<TreeSelect> children;
/** 物料列表 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<Materials> materials;
public TreeSelect() public TreeSelect()
{ {
...@@ -58,6 +63,17 @@ public class TreeSelect implements Serializable ...@@ -58,6 +63,17 @@ public class TreeSelect implements Serializable
this.label = menu.getMenuName(); this.label = menu.getMenuName();
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
} }
/**
* 带物料的构造函数
*/
public TreeSelect(MaterialsCategory materialsCategory, List<Materials> materialsList){
this.sid = materialsCategory.getId();
this.label = materialsCategory.getCategoryName();
this.disabled = StringUtils.equals(String.valueOf(0), String.valueOf(materialsCategory.getIsUsed()));
this.children = materialsCategory.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
this.materials = materialsList;
}
public String getId() public String getId()
{ {
...@@ -106,4 +122,12 @@ public class TreeSelect implements Serializable ...@@ -106,4 +122,12 @@ public class TreeSelect implements Serializable
public void setSid(String sid) { public void setSid(String sid) {
this.sid = sid; this.sid = sid;
} }
public List<Materials> getMaterials() {
return materials;
}
public void setMaterials(List<Materials> materials) {
this.materials = materials;
}
} }
package com.ruoyi.inventory.domain; package com.ruoyi.common.core.domain.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/** /**
* 物料对象 materials * 物料对象 materials
......
...@@ -4,6 +4,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder; ...@@ -4,6 +4,7 @@ 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;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.entity.Materials;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -43,6 +44,10 @@ public class MaterialsCategory extends BaseEntity ...@@ -43,6 +44,10 @@ public class MaterialsCategory extends BaseEntity
private String parentName; private String parentName;
private List<MaterialsCategory> children = new ArrayList<MaterialsCategory>(); private List<MaterialsCategory> children = new ArrayList<MaterialsCategory>();
/** 分类下的物料列表 */
private List<Materials> materialsList = new ArrayList<Materials>();
/** 创建日期 */ /** 创建日期 */
private String createUserCode; private String createUserCode;
...@@ -141,6 +146,14 @@ public class MaterialsCategory extends BaseEntity ...@@ -141,6 +146,14 @@ public class MaterialsCategory extends BaseEntity
this.children = children; this.children = children;
} }
public List<Materials> getMaterialsList() {
return materialsList;
}
public void setMaterialsList(List<Materials> materialsList) {
this.materialsList = materialsList;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
...@@ -156,6 +169,7 @@ public class MaterialsCategory extends BaseEntity ...@@ -156,6 +169,7 @@ public class MaterialsCategory extends BaseEntity
.append("isUsed", getIsUsed()) .append("isUsed", getIsUsed())
.append("parentName", getParentName()) .append("parentName", getParentName())
.append("children", getChildren()) .append("children", getChildren())
.append("materialsList", getMaterialsList())
.toString(); .toString();
} }
} }
package com.ruoyi.inventory.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
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;
/**
* 出库单明细Controller
*
* @author ruoyi
* @date 2025-12-03
*/
@RestController
@RequestMapping("/inventory/items")
public class OutboundOrderItemsController extends BaseController
{
@Autowired
private IOutboundOrderItemsService outboundOrderItemsService;
/**
* 查询出库单明细列表
*/
@PreAuthorize("@ss.hasPermi('inventory:items:list')")
@GetMapping("/list")
public TableDataInfo list(OutboundOrderItems outboundOrderItems)
{
startPage();
List<OutboundOrderItemsInventory> list = outboundOrderItemsService.selectOutboundOrderItemsList(outboundOrderItems);
return getDataTable(list);
}
/**
* 导出出库单明细列表
*/
@PreAuthorize("@ss.hasPermi('inventory:items:export')")
@Log(title = "出库单明细", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, OutboundOrderItems outboundOrderItems)
{
List<OutboundOrderItemsInventory> list = outboundOrderItemsService.selectOutboundOrderItemsList(outboundOrderItems);
ExcelUtil<OutboundOrderItemsInventory> util = new ExcelUtil<OutboundOrderItemsInventory>(OutboundOrderItemsInventory.class);
util.exportExcel(response, list, "出库单明细数据");
}
/**
* 获取出库单明细详细信息
*/
@PreAuthorize("@ss.hasPermi('inventory:items:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(outboundOrderItemsService.selectOutboundOrderItemsById(id));
}
/**
* 新增出库单明细
*/
@PreAuthorize("@ss.hasPermi('inventory:items:add')")
@Log(title = "出库单明细", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody OutboundOrderItems outboundOrderItems)
{
return toAjax(outboundOrderItemsService.insertOutboundOrderItems(outboundOrderItems));
}
/**
* 修改出库单明细
*/
@PreAuthorize("@ss.hasPermi('inventory:items:edit')")
@Log(title = "出库单明细", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody OutboundOrderItems outboundOrderItems)
{
return toAjax(outboundOrderItemsService.updateOutboundOrderItems(outboundOrderItems));
}
/**
* 删除出库单明细
*/
@PreAuthorize("@ss.hasPermi('inventory:items:remove')")
@Log(title = "出库单明细", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(outboundOrderItemsService.deleteOutboundOrderItemsByIds(ids));
}
}
package com.ruoyi.inventory.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
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.OutboundOrders;
import com.ruoyi.inventory.service.IOutboundOrdersService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 出库单主Controller
*
* @author ruoyi
* @date 2025-12-03
*/
@RestController
@RequestMapping("/inventory/orders")
public class OutboundOrdersController extends BaseController
{
@Autowired
private IOutboundOrdersService outboundOrdersService;
/**
* 查询出库单主列表
*/
@PreAuthorize("@ss.hasPermi('inventory:orders:list')")
@GetMapping("/list")
public TableDataInfo list(OutboundOrders outboundOrders)
{
startPage();
List<OutboundOrders> list = outboundOrdersService.selectOutboundOrdersList(outboundOrders);
return getDataTable(list);
}
/**
* 导出出库单主列表
*/
@PreAuthorize("@ss.hasPermi('inventory:orders:export')")
@Log(title = "出库单主", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, OutboundOrders outboundOrders)
{
List<OutboundOrders> list = outboundOrdersService.selectOutboundOrdersList(outboundOrders);
ExcelUtil<OutboundOrders> util = new ExcelUtil<OutboundOrders>(OutboundOrders.class);
util.exportExcel(response, list, "出库单主数据");
}
/**
* 获取出库单主详细信息
*/
@PreAuthorize("@ss.hasPermi('inventory:orders:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(outboundOrdersService.selectOutboundOrdersById(id));
}
/**
* 新增出库单主
*/
@PreAuthorize("@ss.hasPermi('inventory:orders:add')")
@Log(title = "出库单主", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody OutboundOrders outboundOrders)
{
return toAjax(outboundOrdersService.insertOutboundOrders(outboundOrders));
}
/**
* 修改出库单主
*/
@PreAuthorize("@ss.hasPermi('inventory:orders:edit')")
@Log(title = "出库单主", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody OutboundOrders outboundOrders)
{
return toAjax(outboundOrdersService.updateOutboundOrders(outboundOrders));
}
/**
* 删除出库单主
*/
@PreAuthorize("@ss.hasPermi('inventory:orders:remove')")
@Log(title = "出库单主", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(outboundOrdersService.deleteOutboundOrdersByIds(ids));
}
}
package com.ruoyi.inventory.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 出库单明细对象 outbound_order_items
*
* @author ruoyi
* @date 2025-12-03
*/
public class OutboundOrderItems 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 batchCode;
/** 仓库ID 检索条件 */
@Excel(name = "仓库ID 检索条件")
private String warehouseId;
/** 库位ID 检索条件 */
@Excel(name = "库位ID 检索条件")
private String locationId;
/** 计划数量 */
@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;
/** 发货方 暂无用 */
@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 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 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("plannedQuantity", getPlannedQuantity())
.append("actualQuantity", getActualQuantity())
.append("divisor", getDivisor())
.append("labelColor", getLabelColor())
.append("voucherNumber", getVoucherNumber())
.append("itemStatus", getItemStatus())
.append("shippedAt", getShippedAt())
.append("shippedBy", getShippedBy())
.append("remark", getRemark())
.append("isUsed", getIsUsed())
.append("sortNo", getSortNo())
.append("createTime", getCreateTime())
.append("createUserCode", getCreateUserCode())
.append("updateTime", getUpdateTime())
.append("updateUserCode", getUpdateUserCode())
.toString();
}
}
package com.ruoyi.inventory.domain;
import java.util.List;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 出库单主对象 outbound_orders
*
* @author ruoyi
* @date 2025-12-03
*/
public class OutboundOrders extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 编号 */
private String id;
/** 出库单号 检索条件 */
@Excel(name = "出库单号 检索条件")
private String orderId;
/** 系统编号 检索条件 */
@Excel(name = "系统编号 检索条件")
private String systemNo;
/** 入库类型 字典,检索条件 */
@Excel(name = "入库类型 字典,检索条件")
private String orderTypeId;
/** 批次ID 检索条件 */
@Excel(name = "批次ID 检索条件")
private String batchCode;
/** 仓库ID 暂无用 */
@Excel(name = "仓库ID 暂无用")
private String warehouseId;
/** 货主ID */
@Excel(name = "货主ID")
private String ownerId;
/** 出库单状态1-草稿 2-已完成 3-已取消 字典,检索条件 */
@Excel(name = "出库单状态1-草稿 2-已完成 3-已取消 字典,检索条件")
private Long orderStatus;
/** 出库日期 日期无时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出库日期 日期无时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date inboundDate;
/** 目的地 */
@Excel(name = "目的地")
private String destination;
/** 计划量 暂无用 */
@Excel(name = "计划量 暂无用")
private Long totalPlannedQuantity;
/** 实际量 暂无用 */
@Excel(name = "实际量 暂无用")
private Long totalActualQuantity;
/** 总件数 暂无用 */
@Excel(name = "总件数 暂无用")
private Long totalPackages;
/** 应用数据1使用0删除 删除用 */
@Excel(name = "应用数据1使用0删除 删除用")
private Long isUsed;
/** 排序 */
@Excel(name = "排序")
private Long sortNo;
/** 创建日期 */
@Excel(name = "创建日期")
private String createUserCode;
/** 排序号 */
@Excel(name = "排序号")
private String updateUserCode;
/** 出库单明细信息 */
private List<OutboundOrderItems> outboundOrderItemsList;
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 setSystemNo(String systemNo)
{
this.systemNo = systemNo;
}
public String getSystemNo()
{
return systemNo;
}
public void setOrderTypeId(String orderTypeId)
{
this.orderTypeId = orderTypeId;
}
public String getOrderTypeId()
{
return orderTypeId;
}
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 void setOwnerId(String ownerId)
{
this.ownerId = ownerId;
}
public String getOwnerId()
{
return ownerId;
}
public void setOrderStatus(Long orderStatus)
{
this.orderStatus = orderStatus;
}
public Long getOrderStatus()
{
return orderStatus;
}
public void setInboundDate(Date inboundDate)
{
this.inboundDate = inboundDate;
}
public Date getInboundDate()
{
return inboundDate;
}
public void setDestination(String destination)
{
this.destination = destination;
}
public String getDestination()
{
return destination;
}
public void setTotalPlannedQuantity(Long totalPlannedQuantity)
{
this.totalPlannedQuantity = totalPlannedQuantity;
}
public Long getTotalPlannedQuantity()
{
return totalPlannedQuantity;
}
public void setTotalActualQuantity(Long totalActualQuantity)
{
this.totalActualQuantity = totalActualQuantity;
}
public Long getTotalActualQuantity()
{
return totalActualQuantity;
}
public void setTotalPackages(Long totalPackages)
{
this.totalPackages = totalPackages;
}
public Long getTotalPackages()
{
return totalPackages;
}
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;
}
public List<OutboundOrderItems> getOutboundOrderItemsList()
{
return outboundOrderItemsList;
}
public void setOutboundOrderItemsList(List<OutboundOrderItems> outboundOrderItemsList)
{
this.outboundOrderItemsList = outboundOrderItemsList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("orderId", getOrderId())
.append("systemNo", getSystemNo())
.append("orderTypeId", getOrderTypeId())
.append("batchCode", getBatchCode())
.append("warehouseId", getWarehouseId())
.append("ownerId", getOwnerId())
.append("orderStatus", getOrderStatus())
.append("inboundDate", getInboundDate())
.append("destination", getDestination())
.append("totalPlannedQuantity", getTotalPlannedQuantity())
.append("totalActualQuantity", getTotalActualQuantity())
.append("totalPackages", getTotalPackages())
.append("remark", getRemark())
.append("isUsed", getIsUsed())
.append("sortNo", getSortNo())
.append("createTime", getCreateTime())
.append("createUserCode", getCreateUserCode())
.append("updateTime", getUpdateTime())
.append("updateUserCode", getUpdateUserCode())
.append("outboundOrderItemsList", getOutboundOrderItemsList())
.toString();
}
}
...@@ -66,6 +66,17 @@ public class StorageLocations extends BaseEntity ...@@ -66,6 +66,17 @@ public class StorageLocations extends BaseEntity
@Excel(name = "允许存放的分类ID", readConverterExp = "逗=号分隔") @Excel(name = "允许存放的分类ID", readConverterExp = "逗=号分隔")
private String allowedCategoryIds; private String allowedCategoryIds;
/** 允许存放的分类name(前端显示,逗号分隔) */
private String allowedCategoryNames;
public String getAllowedCategoryNames() {
return allowedCategoryNames;
}
public void setAllowedCategoryNames(String allowedCategoryNames) {
this.allowedCategoryNames = allowedCategoryNames;
}
/** 温区 */ /** 温区 */
@Excel(name = "温区") @Excel(name = "温区")
private String temperatureZone; private String temperatureZone;
......
package com.ruoyi.inventory.mapper; package com.ruoyi.inventory.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.inventory.domain.Materials;
import com.ruoyi.common.core.domain.entity.Materials;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* 物料Mapper接口 * 物料Mapper接口
...@@ -69,4 +69,12 @@ public interface MaterialsMapper ...@@ -69,4 +69,12 @@ public interface MaterialsMapper
*/ */
public int updateMaterialsIsUsedByIds(String[] ids); public int updateMaterialsIsUsedByIds(String[] ids);
/**
* 批量删除,修改物料的使用状态
*
* @param id 需要删除的数据主键集合
* @return 结果
*/
public List<Materials> selectMaterialsByCategory(String id);
} }
package com.ruoyi.inventory.mapper;
import java.util.List;
import com.ruoyi.inventory.domain.OutboundOrderItems;
/**
* 出库单明细Mapper接口
*
* @author ruoyi
* @date 2025-12-03
*/
public interface OutboundOrderItemsMapper
{
/**
* 查询出库单明细
*
* @param id 出库单明细主键
* @return 出库单明细
*/
public OutboundOrderItems selectOutboundOrderItemsById(String id);
/**
* 查询出库单明细列表
*
* @param outboundOrderItems 出库单明细
* @return 出库单明细集合
*/
public List<OutboundOrderItems> selectOutboundOrderItemsList(OutboundOrderItems outboundOrderItems);
/**
* 新增出库单明细
*
* @param outboundOrderItems 出库单明细
* @return 结果
*/
public int insertOutboundOrderItems(OutboundOrderItems outboundOrderItems);
/**
* 修改出库单明细
*
* @param outboundOrderItems 出库单明细
* @return 结果
*/
public int updateOutboundOrderItems(OutboundOrderItems outboundOrderItems);
/**
* 删除出库单明细
*
* @param id 出库单明细主键
* @return 结果
*/
public int deleteOutboundOrderItemsById(String id);
/**
* 批量删除出库单明细
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteOutboundOrderItemsByIds(String[] ids);
}
package com.ruoyi.inventory.mapper;
import java.util.List;
import com.ruoyi.inventory.domain.OutboundOrders;
import com.ruoyi.inventory.domain.OutboundOrderItems;
/**
* 出库单主Mapper接口
*
* @author ruoyi
* @date 2025-12-03
*/
public interface OutboundOrdersMapper
{
/**
* 查询出库单主
*
* @param id 出库单主主键
* @return 出库单主
*/
public OutboundOrders selectOutboundOrdersById(String id);
/**
* 查询出库单主列表
*
* @param outboundOrders 出库单主
* @return 出库单主集合
*/
public List<OutboundOrders> selectOutboundOrdersList(OutboundOrders outboundOrders);
/**
* 新增出库单主
*
* @param outboundOrders 出库单主
* @return 结果
*/
public int insertOutboundOrders(OutboundOrders outboundOrders);
/**
* 修改出库单主
*
* @param outboundOrders 出库单主
* @return 结果
*/
public int updateOutboundOrders(OutboundOrders outboundOrders);
/**
* 删除出库单主
*
* @param id 出库单主主键
* @return 结果
*/
public int deleteOutboundOrdersById(String id);
/**
* 批量删除出库单主
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteOutboundOrdersByIds(String[] ids);
/**
* 批量删除出库单明细
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteOutboundOrderItemsByOrderIds(String[] ids);
/**
* 批量新增出库单明细
*
* @param outboundOrderItemsList 出库单明细列表
* @return 结果
*/
public int batchOutboundOrderItems(List<OutboundOrderItems> outboundOrderItemsList);
/**
* 通过出库单主主键删除出库单明细信息
*
* @param id 出库单主ID
* @return 结果
*/
public int deleteOutboundOrderItemsByOrderId(String id);
}
...@@ -2,6 +2,7 @@ package com.ruoyi.inventory.mapper; ...@@ -2,6 +2,7 @@ package com.ruoyi.inventory.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.inventory.domain.StorageLocationsCategory; import com.ruoyi.inventory.domain.StorageLocationsCategory;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Update; import org.apache.ibatis.annotations.Update;
/** /**
...@@ -58,6 +59,7 @@ public interface StorageLocationsCategoryMapper ...@@ -58,6 +59,7 @@ public interface StorageLocationsCategoryMapper
* @param locationCode 库位存放分类主键 * @param locationCode 库位存放分类主键
* @return 结果 * @return 结果
*/ */
@Delete("delete from storage_locations_category where location_code = #{locationCode}")
public int deleteStorageLocationsCategoryByLocationCode(String locationCode); public int deleteStorageLocationsCategoryByLocationCode(String locationCode);
/** /**
* 批量删除库位存放分类 * 批量删除库位存放分类
......
package com.ruoyi.inventory.service; package com.ruoyi.inventory.service;
import com.ruoyi.common.core.domain.entity.Materials;
import java.util.List; import java.util.List;
import com.ruoyi.inventory.domain.Materials;
import com.ruoyi.inventory.domain.Owners;
/** /**
* 物料Service接口 * 物料Service接口
...@@ -60,6 +60,8 @@ public interface IMaterialsService ...@@ -60,6 +60,8 @@ public interface IMaterialsService
*/ */
public int deleteMaterialsById(String id); public int deleteMaterialsById(String id);
public List<Materials> selectMaterialsByCategory(String id);
public String importMaterials(List<Materials> materialsList, Boolean isUpdateSupport, String operName); public String importMaterials(List<Materials> materialsList, Boolean isUpdateSupport, String operName);
} }
package com.ruoyi.inventory.service;
import java.util.List;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.OutboundOrderItemsInventory;
/**
* 出库单明细Service接口
*
* @author ruoyi
* @date 2025-12-03
*/
public interface IOutboundOrderItemsService
{
/**
* 查询出库单明细
*
* @param id 出库单明细主键
* @return 出库单明细
*/
public OutboundOrderItemsInventory selectOutboundOrderItemsById(String id);
/**
* 查询出库单明细列表
*
* @param outboundOrderItems 出库单明细
* @return 出库单明细集合
*/
public List<OutboundOrderItemsInventory> selectOutboundOrderItemsList(OutboundOrderItems outboundOrderItems);
/**
* 新增出库单明细
*
* @param outboundOrderItems 出库单明细
* @return 结果
*/
public int insertOutboundOrderItems(OutboundOrderItems outboundOrderItems);
/**
* 修改出库单明细
*
* @param outboundOrderItems 出库单明细
* @return 结果
*/
public int updateOutboundOrderItems(OutboundOrderItems outboundOrderItems);
/**
* 批量删除出库单明细
*
* @param ids 需要删除的出库单明细主键集合
* @return 结果
*/
public int deleteOutboundOrderItemsByIds(String[] ids);
/**
* 删除出库单明细信息
*
* @param id 出库单明细主键
* @return 结果
*/
public int deleteOutboundOrderItemsById(String id);
}
package com.ruoyi.inventory.service;
import java.util.List;
import com.ruoyi.inventory.domain.OutboundOrders;
/**
* 出库单主Service接口
*
* @author ruoyi
* @date 2025-12-03
*/
public interface IOutboundOrdersService
{
/**
* 查询出库单主
*
* @param id 出库单主主键
* @return 出库单主
*/
public OutboundOrders selectOutboundOrdersById(String id);
/**
* 查询出库单主列表
*
* @param outboundOrders 出库单主
* @return 出库单主集合
*/
public List<OutboundOrders> selectOutboundOrdersList(OutboundOrders outboundOrders);
/**
* 新增出库单主
*
* @param outboundOrders 出库单主
* @return 结果
*/
public int insertOutboundOrders(OutboundOrders outboundOrders);
/**
* 修改出库单主
*
* @param outboundOrders 出库单主
* @return 结果
*/
public int updateOutboundOrders(OutboundOrders outboundOrders);
/**
* 批量删除出库单主
*
* @param ids 需要删除的出库单主主键集合
* @return 结果
*/
public int deleteOutboundOrdersByIds(String[] ids);
/**
* 删除出库单主信息
*
* @param id 出库单主主键
* @return 结果
*/
public int deleteOutboundOrdersById(String id);
}
...@@ -7,6 +7,7 @@ import java.util.List; ...@@ -7,6 +7,7 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.ruoyi.common.core.domain.TreeSelect; import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.Materials;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.common.utils.spring.SpringUtils;
...@@ -15,6 +16,7 @@ import org.springframework.stereotype.Service; ...@@ -15,6 +16,7 @@ import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.MaterialsCategoryMapper; import com.ruoyi.inventory.mapper.MaterialsCategoryMapper;
import com.ruoyi.common.core.domain.entity.MaterialsCategory; import com.ruoyi.common.core.domain.entity.MaterialsCategory;
import com.ruoyi.inventory.service.IMaterialsCategoryService; import com.ruoyi.inventory.service.IMaterialsCategoryService;
import com.ruoyi.inventory.service.IMaterialsService;
/** /**
* 物料分类Service业务层处理 * 物料分类Service业务层处理
...@@ -27,6 +29,9 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService ...@@ -27,6 +29,9 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService
{ {
@Autowired @Autowired
private MaterialsCategoryMapper materialsCategoryMapper; private MaterialsCategoryMapper materialsCategoryMapper;
@Autowired
private IMaterialsService materialsService;
/** /**
* 查询物料分类 * 查询物料分类
...@@ -92,6 +97,10 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService ...@@ -92,6 +97,10 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService
// 得到子节点列表 // 得到子节点列表
List<MaterialsCategory> childList = getChildList(materialsCategoryList, materialsCategory); List<MaterialsCategory> childList = getChildList(materialsCategoryList, materialsCategory);
materialsCategory.setChildren(childList); materialsCategory.setChildren(childList);
// 为当前分类添加物料列表
List<Materials> materialsList = materialsService.selectMaterialsByCategory(materialsCategory.getCategoryCode());
materialsCategory.setMaterialsList(materialsList);
// 如果有子节点,递归处理 // 如果有子节点,递归处理
if (!childList.isEmpty()) { if (!childList.isEmpty()) {
...@@ -129,7 +138,7 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService ...@@ -129,7 +138,7 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService
@Override @Override
public List<TreeSelect> buildTreeSelect(List<MaterialsCategory> materialsCategorys) { public List<TreeSelect> buildTreeSelect(List<MaterialsCategory> materialsCategorys) {
List<MaterialsCategory> materialsCategories = buildMaterialsCategoryTree(materialsCategorys); List<MaterialsCategory> materialsCategories = buildMaterialsCategoryTree(materialsCategorys);
return materialsCategories.stream().map(TreeSelect::new).collect(Collectors.toList()); return materialsCategories.stream().map(category -> new TreeSelect(category, category.getMaterialsList())).collect(Collectors.toList());
} }
/** /**
......
...@@ -4,15 +4,14 @@ import java.util.Date; ...@@ -4,15 +4,14 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import com.ruoyi.common.core.domain.entity.Materials;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.inventory.domain.Owners;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.MaterialsMapper; import com.ruoyi.inventory.mapper.MaterialsMapper;
import com.ruoyi.inventory.domain.Materials;
import com.ruoyi.inventory.service.IMaterialsService; import com.ruoyi.inventory.service.IMaterialsService;
/** /**
...@@ -45,7 +44,6 @@ public class MaterialsServiceImpl implements IMaterialsService ...@@ -45,7 +44,6 @@ public class MaterialsServiceImpl implements IMaterialsService
* @param materials 物料 * @param materials 物料
* @return 物料 * @return 物料
*/ */
@Override
public List<Materials> selectMaterialsList(Materials materials) public List<Materials> selectMaterialsList(Materials materials)
{ {
return materialsMapper.selectMaterialsList(materials); return materialsMapper.selectMaterialsList(materials);
...@@ -102,6 +100,11 @@ public class MaterialsServiceImpl implements IMaterialsService ...@@ -102,6 +100,11 @@ public class MaterialsServiceImpl implements IMaterialsService
} }
@Override @Override
public List<Materials> selectMaterialsByCategory(String id) {
return materialsMapper.selectMaterialsByCategory(id);
}
@Override
public String importMaterials(List<Materials> materialsList, Boolean isUpdateSupport, String operName) public String importMaterials(List<Materials> materialsList, Boolean isUpdateSupport, String operName)
{ {
if (StringUtils.isNull(materialsList) || materialsList.size() == 0) if (StringUtils.isNull(materialsList) || materialsList.size() == 0)
......
package com.ruoyi.inventory.service.impl;
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 org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.OutboundOrderItemsMapper;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.service.IOutboundOrderItemsService;
/**
* 出库单明细Service业务层处理
*
* @author ruoyi
* @date 2025-12-03
*/
@Service
public class OutboundOrderItemsServiceImpl implements IOutboundOrderItemsService
{
@Autowired
private OutboundOrderItemsMapper outboundOrderItemsMapper;
@Autowired
private InventoryServiceImpl inventoryService;
/**
* 查询出库单明细
*
* @param id 出库单明细主键
* @return 出库单明细
*/
@Override
public OutboundOrderItemsInventory 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;
}
/**
* 查询出库单明细列表
*
* @param outboundOrderItems 出库单明细
* @return 出库单明细
*/
@Override
public List<OutboundOrderItemsInventory> 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;
}
/**
* 新增出库单明细
*
* @param outboundOrderItems 出库单明细
* @return 结果
*/
@Override
public int insertOutboundOrderItems(OutboundOrderItems outboundOrderItems)
{
outboundOrderItems.setCreateTime(DateUtils.getNowDate());
return outboundOrderItemsMapper.insertOutboundOrderItems(outboundOrderItems);
}
/**
* 修改出库单明细
*
* @param outboundOrderItems 出库单明细
* @return 结果
*/
@Override
public int updateOutboundOrderItems(OutboundOrderItems outboundOrderItems)
{
outboundOrderItems.setUpdateTime(DateUtils.getNowDate());
return outboundOrderItemsMapper.updateOutboundOrderItems(outboundOrderItems);
}
/**
* 批量删除出库单明细
*
* @param ids 需要删除的出库单明细主键
* @return 结果
*/
@Override
public int deleteOutboundOrderItemsByIds(String[] ids)
{
return outboundOrderItemsMapper.deleteOutboundOrderItemsByIds(ids);
}
/**
* 删除出库单明细信息
*
* @param id 出库单明细主键
* @return 结果
*/
@Override
public int deleteOutboundOrderItemsById(String id)
{
return outboundOrderItemsMapper.deleteOutboundOrderItemsById(id);
}
}
package com.ruoyi.inventory.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.mapper.OutboundOrdersMapper;
import com.ruoyi.inventory.domain.OutboundOrders;
import com.ruoyi.inventory.service.IOutboundOrdersService;
/**
* 出库单主Service业务层处理
*
* @author ruoyi
* @date 2025-12-03
*/
@Service
public class OutboundOrdersServiceImpl implements IOutboundOrdersService
{
@Autowired
private OutboundOrdersMapper outboundOrdersMapper;
/**
* 查询出库单主
*
* @param id 出库单主主键
* @return 出库单主
*/
@Override
public OutboundOrders selectOutboundOrdersById(String id)
{
return outboundOrdersMapper.selectOutboundOrdersById(id);
}
/**
* 查询出库单主列表
*
* @param outboundOrders 出库单主
* @return 出库单主
*/
@Override
public List<OutboundOrders> selectOutboundOrdersList(OutboundOrders outboundOrders)
{
return outboundOrdersMapper.selectOutboundOrdersList(outboundOrders);
}
/**
* 新增出库单主
*
* @param outboundOrders 出库单主
* @return 结果
*/
@Transactional
@Override
public int insertOutboundOrders(OutboundOrders outboundOrders)
{
outboundOrders.setCreateTime(DateUtils.getNowDate());
int rows = outboundOrdersMapper.insertOutboundOrders(outboundOrders);
insertOutboundOrderItems(outboundOrders);
return rows;
}
/**
* 修改出库单主
*
* @param outboundOrders 出库单主
* @return 结果
*/
@Transactional
@Override
public int updateOutboundOrders(OutboundOrders outboundOrders)
{
outboundOrders.setUpdateTime(DateUtils.getNowDate());
outboundOrdersMapper.deleteOutboundOrderItemsByOrderId(outboundOrders.getId());
insertOutboundOrderItems(outboundOrders);
return outboundOrdersMapper.updateOutboundOrders(outboundOrders);
}
/**
* 批量删除出库单主
*
* @param ids 需要删除的出库单主主键
* @return 结果
*/
@Transactional
@Override
public int deleteOutboundOrdersByIds(String[] ids)
{
outboundOrdersMapper.deleteOutboundOrderItemsByOrderIds(ids);
return outboundOrdersMapper.deleteOutboundOrdersByIds(ids);
}
/**
* 删除出库单主信息
*
* @param id 出库单主主键
* @return 结果
*/
@Transactional
@Override
public int deleteOutboundOrdersById(String id)
{
outboundOrdersMapper.deleteOutboundOrderItemsByOrderId(id);
return outboundOrdersMapper.deleteOutboundOrdersById(id);
}
/**
* 新增出库单明细信息
*
* @param outboundOrders 出库单主对象
*/
public void insertOutboundOrderItems(OutboundOrders outboundOrders)
{
List<OutboundOrderItems> outboundOrderItemsList = outboundOrders.getOutboundOrderItemsList();
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)
{
outboundOrdersMapper.batchOutboundOrderItems(list);
}
}
}
}
package com.ruoyi.inventory.service.impl; package com.ruoyi.inventory.service.impl;
import java.util.List; import java.util.List;
import com.ruoyi.common.core.domain.entity.MaterialsCategory;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.uuid.UUID; import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.inventory.domain.MaterialsCategory;
import com.ruoyi.inventory.domain.StorageLocationsCategory; import com.ruoyi.inventory.domain.StorageLocationsCategory;
import com.ruoyi.inventory.mapper.MaterialsCategoryMapper; import com.ruoyi.inventory.mapper.MaterialsCategoryMapper;
import com.ruoyi.inventory.mapper.StorageLocationsCategoryMapper; import com.ruoyi.inventory.mapper.StorageLocationsCategoryMapper;
...@@ -62,7 +63,25 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService ...@@ -62,7 +63,25 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
@Override @Override
public List<StorageLocations> selectStorageLocationsList(StorageLocations storageLocations) public List<StorageLocations> selectStorageLocationsList(StorageLocations storageLocations)
{ {
return storageLocationsMapper.selectStorageLocationsList(storageLocations); List<StorageLocations> storageLocations1 = storageLocationsMapper.selectStorageLocationsList(storageLocations);
for (StorageLocations storageLocations2 : storageLocations1){
String AllowedCategoryName = "";
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(); // 去除首尾空格
if (AllowedCategoryName != "") {
AllowedCategoryName += ",";
}
AllowedCategoryName += categoryName;
}
}
}
storageLocations2.setAllowedCategoryNames(AllowedCategoryName);
}
return storageLocations1;
} }
/** /**
...@@ -77,22 +96,24 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService ...@@ -77,22 +96,24 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
storageLocations.setCreateTime(DateUtils.getNowDate()); storageLocations.setCreateTime(DateUtils.getNowDate());
StorageLocationsCategory storageLocationsCategory = new StorageLocationsCategory(); StorageLocationsCategory storageLocationsCategory = new StorageLocationsCategory();
BeanUtils.copyBeanProp(storageLocations,storageLocationsCategory); BeanUtils.copyBeanProp(storageLocationsCategory,storageLocations);
String LocationsID = UUID.randomUUID().toString(); String LocationsID = UUID.randomUUID().toString();
storageLocations.setId(LocationsID); storageLocations.setId(LocationsID);
storageLocations.setCreateTime(DateUtils.getNowDate()); storageLocations.setCreateTime(DateUtils.getNowDate());
storageLocations.setCreateUserCode(String.valueOf(SecurityUtils.getUserId())); storageLocations.setCreateUserCode(String.valueOf(SecurityUtils.getUserId()));
storageLocationsCategory.setLocationCode(LocationsID); storageLocationsCategory.setLocationCode(LocationsID);
String[] CategoryId = storageLocations.getAllowedCategoryIds().split(","); if (storageLocations.getAllowedCategoryIds() != null && !storageLocations.getAllowedCategoryIds().isEmpty()){
for (String categoryId : CategoryId) { String[] CategoryId = storageLocations.getAllowedCategoryIds().split(",");
storageLocationsCategory.setId(java.util.UUID.randomUUID().toString()); for (String categoryId : CategoryId) {
storageLocationsCategory.setCategoryId(categoryId); storageLocationsCategory.setId(java.util.UUID.randomUUID().toString());
storageLocationsCategory.setCreateTime(DateUtils.getNowDate()); storageLocationsCategory.setCategoryId(categoryId);
storageLocationsCategory.setCreateUserCode(String.valueOf(SecurityUtils.getUserId())); storageLocationsCategory.setCreateTime(DateUtils.getNowDate());
MaterialsCategory materialsCategory = materialsCategoryMapper.selectMaterialsCategoryById(categoryId); storageLocationsCategory.setCreateUserCode(String.valueOf(SecurityUtils.getUserId()));
storageLocationsCategory.setCategoryName(materialsCategory.getCategoryName()); MaterialsCategory materialsCategory = materialsCategoryMapper.selectMaterialsCategoryById(categoryId);
storageLocationsCategoryMapper.insertStorageLocationsCategory(storageLocationsCategory); storageLocationsCategory.setCategoryName(materialsCategory.getCategoryName());
storageLocationsCategoryMapper.insertStorageLocationsCategory(storageLocationsCategory);
}
} }
return storageLocationsMapper.insertStorageLocations(storageLocations); return storageLocationsMapper.insertStorageLocations(storageLocations);
} }
...@@ -117,11 +138,11 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService ...@@ -117,11 +138,11 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
String[] CategoryId = storageLocations.getAllowedCategoryIds().split(","); String[] CategoryId = storageLocations.getAllowedCategoryIds().split(",");
StorageLocationsCategory storageLocationsCategory = new StorageLocationsCategory(); StorageLocationsCategory storageLocationsCategory = new StorageLocationsCategory();
BeanUtils.copyBeanProp(storageLocations,storageLocationsCategory); BeanUtils.copyBeanProp(storageLocationsCategory,storageLocations);
storageLocationsCategory.setLocationCode(LocationsID); storageLocationsCategory.setLocationCode(LocationsCode);
for (String categoryId : CategoryId) { for (String categoryId : CategoryId) {
storageLocations.setId(java.util.UUID.randomUUID().toString()); storageLocationsCategory.setId(java.util.UUID.randomUUID().toString());
storageLocationsCategory.setCategoryId(categoryId); storageLocationsCategory.setCategoryId(categoryId);
storageLocationsCategory.setUpdateTime(DateUtils.getNowDate()); storageLocationsCategory.setUpdateTime(DateUtils.getNowDate());
storageLocationsCategory.setUpdateUserCode(String.valueOf(SecurityUtils.getUserId())); storageLocationsCategory.setUpdateUserCode(String.valueOf(SecurityUtils.getUserId()));
...@@ -143,7 +164,6 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService ...@@ -143,7 +164,6 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
@Override @Override
public int deleteStorageLocationsByIds(String[] ids) public int deleteStorageLocationsByIds(String[] ids)
{ {
storageLocationsCategoryMapper.deleteStorageLocationsCategoryByIds(ids);
return storageLocationsMapper.deleteStorageLocationsByIds(ids); return storageLocationsMapper.deleteStorageLocationsByIds(ids);
} }
......
...@@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectInboundOrdersList" parameterType="InboundOrders" resultMap="InboundOrdersResult"> <select id="selectInboundOrdersList" parameterType="InboundOrders" resultMap="InboundOrdersResult">
<include refid="selectInboundOrdersVo"/> <include refid="selectInboundOrdersVo"/>
<where> <where>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if> <if test="id != null and id != ''"> and id = #{id}</if>
<if test="systemNo != null and systemNo != ''"> and system_no = #{systemNo}</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="orderTypeId != null and orderTypeId != ''"> and order_type_id = #{orderTypeId}</if>
<if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if> <if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if>
......
...@@ -76,6 +76,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -76,6 +76,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
order by sort_no asc order by sort_no asc
</select> </select>
<select id="selectMaterialsByCategory" parameterType="String" resultMap="MaterialsResult">
<include refid="selectMaterialsVo"/>
where category_code = #{id}
order by sort_no asc
</select>
<insert id="insertMaterials" parameterType="Materials"> <insert id="insertMaterials" parameterType="Materials">
insert into materials insert into materials
......
<?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.OutboundOrderItemsMapper">
<resultMap type="OutboundOrderItems" id="OutboundOrderItemsResult">
<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="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="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, 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">
<include refid="selectOutboundOrderItemsVo"/>
<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="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if>
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
<if test="locationId != null and locationId != ''"> and location_id = #{locationId}</if>
<if test="plannedQuantity != null "> and planned_quantity = #{plannedQuantity}</if>
<if test="actualQuantity != null "> and actual_quantity = #{actualQuantity}</if>
<if test="divisor != null "> and divisor = #{divisor}</if>
<if test="labelColor != null "> and label_color = #{labelColor}</if>
<if test="voucherNumber != null and voucherNumber != ''"> and voucher_number = #{voucherNumber}</if>
<if test="itemStatus != null "> and item_status = #{itemStatus}</if>
<if test="shippedAt != null "> and shipped_at = #{shippedAt}</if>
<if test="shippedBy != null and shippedBy != ''"> and shipped_by = #{shippedBy}</if>
<if test="isUsed != null "> and is_used = #{isUsed}</if>
<if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="createUserCode != null and createUserCode != ''"> and create_user_code = #{createUserCode}</if>
<if test="updateUserCode != null and updateUserCode != ''"> and update_user_code = #{updateUserCode}</if>
</where>
</select>
<select id="selectOutboundOrderItemsById" parameterType="String" resultMap="OutboundOrderItemsResult">
<include refid="selectOutboundOrderItemsVo"/>
where id = #{id}
</select>
<insert id="insertOutboundOrderItems" parameterType="OutboundOrderItems">
insert into outbound_order_items
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="orderId != null">order_id,</if>
<if test="materialId != null">material_id,</if>
<if test="batchCode != null">batch_code,</if>
<if test="warehouseId != null">warehouse_id,</if>
<if test="locationId != null">location_id,</if>
<if test="plannedQuantity != null">planned_quantity,</if>
<if test="actualQuantity != null">actual_quantity,</if>
<if test="divisor != null">divisor,</if>
<if test="labelColor != null">label_color,</if>
<if test="voucherNumber != null">voucher_number,</if>
<if test="itemStatus != null">item_status,</if>
<if test="shippedAt != null">shipped_at,</if>
<if test="shippedBy != null">shipped_by,</if>
<if test="remark != null">remark,</if>
<if test="isUsed != null">is_used,</if>
<if test="sortNo != null">sort_no,</if>
<if test="createTime != null">create_time,</if>
<if test="createUserCode != null">create_user_code,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateUserCode != null">update_user_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="orderId != null">#{orderId},</if>
<if test="materialId != null">#{materialId},</if>
<if test="batchCode != null">#{batchCode},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="locationId != null">#{locationId},</if>
<if test="plannedQuantity != null">#{plannedQuantity},</if>
<if test="actualQuantity != null">#{actualQuantity},</if>
<if test="divisor != null">#{divisor},</if>
<if test="labelColor != null">#{labelColor},</if>
<if test="voucherNumber != null">#{voucherNumber},</if>
<if test="itemStatus != null">#{itemStatus},</if>
<if test="shippedAt != null">#{shippedAt},</if>
<if test="shippedBy != null">#{shippedBy},</if>
<if test="remark != null">#{remark},</if>
<if test="isUsed != null">#{isUsed},</if>
<if test="sortNo != null">#{sortNo},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createUserCode != null">#{createUserCode},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateUserCode != null">#{updateUserCode},</if>
</trim>
</insert>
<update id="updateOutboundOrderItems" parameterType="OutboundOrderItems">
update outbound_order_items
<trim prefix="SET" suffixOverrides=",">
<if test="orderId != null">order_id = #{orderId},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="batchCode != null">batch_code = #{batchCode},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="locationId != null">location_id = #{locationId},</if>
<if test="plannedQuantity != null">planned_quantity = #{plannedQuantity},</if>
<if test="actualQuantity != null">actual_quantity = #{actualQuantity},</if>
<if test="divisor != null">divisor = #{divisor},</if>
<if test="labelColor != null">label_color = #{labelColor},</if>
<if test="voucherNumber != null">voucher_number = #{voucherNumber},</if>
<if test="itemStatus != null">item_status = #{itemStatus},</if>
<if test="shippedAt != null">shipped_at = #{shippedAt},</if>
<if test="shippedBy != null">shipped_by = #{shippedBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="isUsed != null">is_used = #{isUsed},</if>
<if test="sortNo != null">sort_no = #{sortNo},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createUserCode != null">create_user_code = #{createUserCode},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateUserCode != null">update_user_code = #{updateUserCode},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteOutboundOrderItemsById" parameterType="String">
delete from outbound_order_items where id = #{id}
</delete>
<delete id="deleteOutboundOrderItemsByIds" parameterType="String">
delete from outbound_order_items where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
...@@ -84,7 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -84,7 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<delete id="deleteStorageLocationsCategoryById" parameterType="String"> <delete id="deleteStorageLocationsCategoryById" parameterType="String">
update storage_locations_category set is_used = 0 where id= #{id} update storage_locations_category set is_used = 0 where id = #{id}
</delete> </delete>
<delete id="deleteStorageLocationsCategoryByIds" parameterType="String"> <delete id="deleteStorageLocationsCategoryByIds" parameterType="String">
......
...@@ -34,7 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -34,7 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectStorageLocationsList" parameterType="StorageLocations" resultMap="StorageLocationsResult"> <select id="selectStorageLocationsList" parameterType="StorageLocations" resultMap="StorageLocationsResult">
<include refid="selectStorageLocationsVo"/> <include refid="selectStorageLocationsVo"/>
<where> where is_used=1
<if test="locationCode != null and locationCode != ''"> and location_code = #{locationCode}</if> <if test="locationCode != null and locationCode != ''"> and location_code = #{locationCode}</if>
<if test="locationName != null and locationName != ''"> and location_name like concat('%', #{locationName}, '%')</if> <if test="locationName != null and locationName != ''"> and location_name like concat('%', #{locationName}, '%')</if>
<if test="warehousesCode != null and warehousesCode != ''"> and warehouses_code = #{warehousesCode}</if> <if test="warehousesCode != null and warehousesCode != ''"> and warehouses_code = #{warehousesCode}</if>
...@@ -49,11 +49,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -49,11 +49,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="allowedCategoryIds != null and allowedCategoryIds != ''"> and allowed_category_ids = #{allowedCategoryIds}</if> <if test="allowedCategoryIds != null and allowedCategoryIds != ''"> and allowed_category_ids = #{allowedCategoryIds}</if>
<if test="temperatureZone != null and temperatureZone != ''"> and temperature_zone = #{temperatureZone}</if> <if test="temperatureZone != null and temperatureZone != ''"> and temperature_zone = #{temperatureZone}</if>
<if test="isEnabled != null "> and is_enabled = #{isEnabled}</if> <if test="isEnabled != null "> and is_enabled = #{isEnabled}</if>
<if test="isUsed != null "> and is_used = #{isUsed}</if>
<if test="sortNo != null "> and sort_no = #{sortNo}</if> <if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="createUserCode != null and createUserCode != ''"> and create_user_code = #{createUserCode}</if> <if test="createUserCode != null and createUserCode != ''"> and create_user_code = #{createUserCode}</if>
<if test="updateUserCode != null and updateUserCode != ''"> and update_user_code = #{updateUserCode}</if> <if test="updateUserCode != null and updateUserCode != ''"> and update_user_code = #{updateUserCode}</if>
</where>
</select> </select>
<select id="selectStorageLocationsById" parameterType="String" resultMap="StorageLocationsResult"> <select id="selectStorageLocationsById" parameterType="String" resultMap="StorageLocationsResult">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论