Commit a014954c by zhangtw

SapId替代materialCode

batchCode更换为batchId
页面bug修复
materialCode替换为materialId
新增inventory增删改查api
新增批量添加inventory
修改页面
新增入库明细联查物料名称api
parent 4f51b614
...@@ -8,7 +8,14 @@ export function listInbound_items(query) { ...@@ -8,7 +8,14 @@ export function listInbound_items(query) {
params: query params: query
}) })
} }
// 查询入库单明细列表联查materialname
export function listInbound_itemsAndMname(query) {
return request({
url: '/inventory/inbound_items/listAndMname',
method: 'get',
params: query
})
}
// 查询入库单明细详细 // 查询入库单明细详细
export function getInbound_items(id) { export function getInbound_items(id) {
return request({ return request({
......
import request from '@/utils/request'
// 查询库存列表
export function listInventory(query) {
return request({
url: '/inventory/inventory/list',
method: 'get',
params: query
})
}
// 查询库存详细
export function getInventory(id) {
return request({
url: '/inventory/inventory/' + id,
method: 'get'
})
}
// 新增库存
export function addInventory(data) {
return request({
url: '/inventory/inventory',
method: 'post',
data: data
})
}
// 批量新增库存
export function batchAddInventory(data){
return request({
url: '/inventory/inventory/batchAdd',
method: 'post',
data: data
})
}
// 修改库存
export function updateInventory(data) {
return request({
url: '/inventory/inventory',
method: 'put',
data: data
})
}
// 删除库存
export function delInventory(id) {
return request({
url: '/inventory/inventory/' + id,
method: 'delete'
})
}
...@@ -20,32 +20,32 @@ ...@@ -20,32 +20,32 @@
</template> </template>
</TreeComponent> </TreeComponent>
</pane> </pane>
<!-- 右侧物料列表(仅展示和查询) --> <!-- 右侧物料列表(仅展示和查询) -->
<pane size="84" style="overflow: auto;"> <pane size="84" style="overflow: auto;">
<div style="padding: 10px; display: flex; flex-direction: column;"> <div style="padding: 10px; display: flex; flex-direction: column;">
<!-- 查询表单 --> <!-- 查询表单 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="88px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="88px">
<el-form-item label="物料编码" prop="materialCode"> <!-- <el-form-item label="物料编码" prop="materialCode">
<el-input <el-input
v-model="queryParams.materialCode" v-model="queryParams.materialCode"
placeholder="请输入物料编码" placeholder="请输入物料编码"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item> -->
<el-form-item label="物料名称" prop="materialName"> <el-form-item label="SAP物料号" prop="sapNo">
<el-input <el-input
v-model="queryParams.materialName" v-model="queryParams.sapNo"
placeholder="请输入物料名称" placeholder="请输入SAP物料号"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="SAP物料号" prop="sapNo"> <el-form-item label="物料名称" prop="materialName">
<el-input <el-input
v-model="queryParams.sapNo" v-model="queryParams.materialName"
placeholder="请输入SAP物料号" placeholder="请输入物料名称"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
...@@ -65,20 +65,20 @@ ...@@ -65,20 +65,20 @@
</el-form> </el-form>
<!-- 物料表格(隐藏操作列,保留选择功能) --> <!-- 物料表格(隐藏操作列,保留选择功能) -->
<el-table <el-table
ref="materialTable" ref="materialTable"
v-loading="loading" v-loading="loading"
:data="materialsList" :data="materialsList"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
:scroll-x="true" :scroll-x="true"
:row-key="row => row.id" :row-key="row => row.id"
@row-click="handleRowClick" @row-click="handleRowClick"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" align="center"/> <el-table-column type="index" label="序号" align="center"/>
<el-table-column label="物料编码" align="center" prop="materialCode" width="120"/> <!-- <el-table-column label="物料编码" align="center" prop="materialCode" width="120"/> -->
<el-table-column label="物料名称" align="center" prop="materialName" width="150"/>
<el-table-column label="SAP物料号" align="center" prop="sapNo" /> <el-table-column label="SAP物料号" align="center" prop="sapNo" />
<el-table-column label="物料名称" align="center" prop="materialName" width="150"/>
<el-table-column label="TS Code" align="center" prop="tsCode" /> <el-table-column label="TS Code" align="center" prop="tsCode" />
<el-table-column label="物料分类" align="center" prop="categoryCode" > <el-table-column label="物料分类" align="center" prop="categoryCode" >
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -91,11 +91,11 @@ ...@@ -91,11 +91,11 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag :type="scope.row.isBatchManaged === 1 ? 'success' : 'info'" size="mini"> <el-tag :type="scope.row.isBatchManaged === 1 ? 'success' : 'info'" size="mini">
{{ scope.row.isBatchManaged === 1 ? '是' : '否' }} {{ scope.row.isBatchManaged === 1 ? '是' : '否' }}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 分页 --> <!-- 分页 -->
<pagination <pagination
v-show="total>0" v-show="total>0"
...@@ -144,9 +144,9 @@ export default { ...@@ -144,9 +144,9 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
materialCode: null, // materialCode: null,
materialName: null,
sapNo: null, sapNo: null,
materialName: null,
tsCode: null, tsCode: null,
categoryCode: null, categoryCode: null,
categoryNameInput: null, categoryNameInput: null,
...@@ -224,16 +224,16 @@ export default { ...@@ -224,16 +224,16 @@ export default {
}, },
buildTreeData(list, parentId = null) { buildTreeData(list, parentId = null) {
return list return list
.filter(item => parentId === null .filter(item => parentId === null
? (!item.parentId || item.parentId === 0 || item.parentId === '0') ? (!item.parentId || item.parentId === 0 || item.parentId === '0')
: item.parentId == parentId : item.parentId == parentId
) )
.map(item => ({ .map(item => ({
...item, ...item,
sid: String(item.id), sid: String(item.id),
label: item.categoryName, label: item.categoryName,
children: this.buildTreeData(list, item.id).length children: this.buildTreeData(list, item.id).length
? this.buildTreeData(list, item.id) ? this.buildTreeData(list, item.id)
: undefined : undefined
})); }));
}, },
...@@ -280,9 +280,9 @@ export default { ...@@ -280,9 +280,9 @@ export default {
this.queryParams = { this.queryParams = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
materialCode: null, // materialCode: null,
materialName: null,
sapNo: null, sapNo: null,
materialName: null,
tsCode: null, tsCode: null,
categoryCode: null, categoryCode: null,
categoryNameInput: null, categoryNameInput: null,
...@@ -298,7 +298,7 @@ export default { ...@@ -298,7 +298,7 @@ export default {
this.selectedRows = selection; this.selectedRows = selection;
const selectedData = selection.map(item => ({ const selectedData = selection.map(item => ({
id: item.id, id: item.id,
materialCode: item.materialCode, sapNo: item.sapNo,
materialName: item.materialName, materialName: item.materialName,
// specification: item.specification, // 可选:规格型号 // specification: item.specification, // 可选:规格型号
// materialUnit: item.materialUnit // 可选:计量单位 // materialUnit: item.materialUnit // 可选:计量单位
...@@ -340,4 +340,4 @@ export default { ...@@ -340,4 +340,4 @@ export default {
.custom-tree-node { .custom-tree-node {
font-size: 14px; font-size: 14px;
} }
</style> </style>
\ No newline at end of file
...@@ -3,6 +3,8 @@ package com.ruoyi.web.controller.inventory; ...@@ -3,6 +3,8 @@ package com.ruoyi.web.controller.inventory;
import java.util.List; 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.Materials;
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;
...@@ -21,6 +23,7 @@ import com.ruoyi.inventory.domain.InboundOrderItems; ...@@ -21,6 +23,7 @@ import com.ruoyi.inventory.domain.InboundOrderItems;
import com.ruoyi.inventory.service.IInboundOrderItemsService; import com.ruoyi.inventory.service.IInboundOrderItemsService;
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;
import org.springframework.web.multipart.MultipartFile;
/** /**
* 入库单明细Controller * 入库单明细Controller
...@@ -46,6 +49,17 @@ public class InboundOrderItemsController extends BaseController ...@@ -46,6 +49,17 @@ public class InboundOrderItemsController extends BaseController
List<InboundOrderItems> list = inboundOrderItemsService.selectInboundOrderItemsList(inboundOrderItems); List<InboundOrderItems> list = inboundOrderItemsService.selectInboundOrderItemsList(inboundOrderItems);
return getDataTable(list); return getDataTable(list);
} }
/**
* 查询入库单明细列表
*/
@PreAuthorize("@ss.hasPermi('inventory:inbound_items:list')")
@GetMapping("/listAndMname")
public TableDataInfo listAndMname(InboundOrderItems inboundOrderItems)
{
startPage();
List<InboundOrderItems> list = inboundOrderItemsService.selectInboundOrderItemsListAndMaterialName(inboundOrderItems);
return getDataTable(list);
}
/** /**
* 导出入库单明细列表 * 导出入库单明细列表
...@@ -79,7 +93,6 @@ public class InboundOrderItemsController extends BaseController ...@@ -79,7 +93,6 @@ public class InboundOrderItemsController extends BaseController
public AjaxResult add(@RequestBody InboundOrderItems inboundOrderItems) public AjaxResult add(@RequestBody InboundOrderItems inboundOrderItems)
{ {
inboundOrderItems.setId(UUID.randomUUID().toString()); inboundOrderItems.setId(UUID.randomUUID().toString());
System.out.println(inboundOrderItems.toString());
return toAjax(inboundOrderItemsService.insertInboundOrderItems(inboundOrderItems)); return toAjax(inboundOrderItemsService.insertInboundOrderItems(inboundOrderItems));
} }
...@@ -104,4 +117,18 @@ public class InboundOrderItemsController extends BaseController ...@@ -104,4 +117,18 @@ public class InboundOrderItemsController extends BaseController
{ {
return toAjax(inboundOrderItemsService.deleteInboundOrderItemsByIds(ids)); return toAjax(inboundOrderItemsService.deleteInboundOrderItemsByIds(ids));
} }
/**
* 导入入库单物料明细
*/
@PreAuthorize("@ss.hasPermi('inventory:inbound_items:import')")
@Log(title = "物料信息导入", businessType = BusinessType.IMPORT)
@PostMapping("/import")
public AjaxResult importTemplate(MultipartFile file , boolean updateSupport) throws Exception
{
ExcelUtil<InboundOrderItems> util = new ExcelUtil<InboundOrderItems>(InboundOrderItems.class);
List<InboundOrderItems> inboundOrderItems = util.importExcel(file.getInputStream());
String operName = getUsername();
String message = inboundOrderItemsService.importInboundOrderItems(inboundOrderItems, updateSupport, operName);
return success(message);
}
} }
...@@ -122,7 +122,9 @@ public class MaterialsController extends BaseController ...@@ -122,7 +122,9 @@ public class MaterialsController extends BaseController
ExcelUtil<Materials> util = new ExcelUtil<Materials>(Materials.class); ExcelUtil<Materials> util = new ExcelUtil<Materials>(Materials.class);
util.importTemplateExcel(response, "物料信息"); util.importTemplateExcel(response, "物料信息");
} }
/**
* 导入物料
*/
@PreAuthorize("@ss.hasPermi('inventory:materials:import')") @PreAuthorize("@ss.hasPermi('inventory:materials:import')")
@Log(title = "物料信息导入", businessType = BusinessType.IMPORT) @Log(title = "物料信息导入", businessType = BusinessType.IMPORT)
@PostMapping("/import") @PostMapping("/import")
......
package com.ruoyi.inventory.controller; package com.ruoyi.inventory.controller;
import java.util.List; import java.util.List;
import java.util.UUID;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
...@@ -77,6 +79,7 @@ public class InventoryController extends BaseController ...@@ -77,6 +79,7 @@ public class InventoryController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody Inventory inventory) public AjaxResult add(@RequestBody Inventory inventory)
{ {
inventory.setId(UUID.randomUUID().toString());
return toAjax(inventoryService.insertInventory(inventory)); return toAjax(inventoryService.insertInventory(inventory));
} }
...@@ -101,4 +104,15 @@ public class InventoryController extends BaseController ...@@ -101,4 +104,15 @@ public class InventoryController extends BaseController
{ {
return toAjax(inventoryService.deleteInventoryByIds(ids)); return toAjax(inventoryService.deleteInventoryByIds(ids));
} }
/**
* 批量新增库存
*/
@PreAuthorize("@ss.hasPermi('inventory:inventory:add')")
@Log(title = "库存", businessType = BusinessType.INSERT)
@PostMapping("/batchAdd")
public AjaxResult batchAdd(@Validated @RequestBody List<Inventory> inventoryList)
{
return toAjax(inventoryService.insertInventoryList(inventoryList));
}
} }
...@@ -55,7 +55,7 @@ public class InboundOrderItems extends BaseEntity ...@@ -55,7 +55,7 @@ public class InboundOrderItems extends BaseEntity
private Long actualPackages; private Long actualPackages;
/** 约数 */ /** 约数 */
@Excel(name = "约数") // @Excel(name = "约数")
private Long divisor; private Long divisor;
/** 标签颜色 字典,检索条件 */ /** 标签颜色 字典,检索条件 */
...@@ -71,7 +71,7 @@ public class InboundOrderItems extends BaseEntity ...@@ -71,7 +71,7 @@ public class InboundOrderItems extends BaseEntity
private Long unitPrice; private Long unitPrice;
/** 状态1-待收货 2-部分收货 3-已完成 暂无用 */ /** 状态1-待收货 2-部分收货 3-已完成 暂无用 */
@Excel(name = "状态") // @Excel(name = "状态")
private Long itemStatus; private Long itemStatus;
/** 收货时间 暂无用 */ /** 收货时间 暂无用 */
...@@ -83,19 +83,19 @@ public class InboundOrderItems extends BaseEntity ...@@ -83,19 +83,19 @@ public class InboundOrderItems extends BaseEntity
private String receivedBy; private String receivedBy;
/** 应用数据1使用0删除 删除用 */ /** 应用数据1使用0删除 删除用 */
@Excel(name = "应用数据") // @Excel(name = "应用数据")
private Long isUsed; private Long isUsed;
/** 排序 */ /** 排序 */
@Excel(name = "排序") // @Excel(name = "排序")
private Long sortNo; private Long sortNo;
/** 创建日期 */ /** 创建日期 */
@Excel(name = "创建日期") // @Excel(name = "创建日期")
private String createUserCode; private String createUserCode;
/** 排序号 */ /** 排序号 */
@Excel(name = "排序号") // @Excel(name = "排序号")
private String updateUserCode; private String updateUserCode;
public void setId(String id) public void setId(String id)
......
...@@ -35,7 +35,7 @@ public class InboundOrders extends BaseEntity ...@@ -35,7 +35,7 @@ public class InboundOrders extends BaseEntity
/** 批次ID 检索条件 */ /** 批次ID 检索条件 */
@Excel(name = "批次ID 检索条件") @Excel(name = "批次ID 检索条件")
private String batchCode; private String batchId;
/** 仓库ID 暂无用 */ /** 仓库ID 暂无用 */
@Excel(name = "仓库ID 暂无用") @Excel(name = "仓库ID 暂无用")
...@@ -133,14 +133,14 @@ public class InboundOrders extends BaseEntity ...@@ -133,14 +133,14 @@ public class InboundOrders extends BaseEntity
return orderTypeId; return orderTypeId;
} }
public void setBatchCode(String batchCode) public void setBatchId(String batchId)
{ {
this.batchCode = batchCode; this.batchId = batchId;
} }
public String getBatchCode() public String getBatchId()
{ {
return batchCode; return batchId;
} }
public void setWarehouseId(String warehouseId) public void setWarehouseId(String warehouseId)
...@@ -290,7 +290,7 @@ public class InboundOrders extends BaseEntity ...@@ -290,7 +290,7 @@ public class InboundOrders extends BaseEntity
.append("orderId", getOrderId()) .append("orderId", getOrderId())
.append("systemNo", getSystemNo()) .append("systemNo", getSystemNo())
.append("orderTypeId", getOrderTypeId()) .append("orderTypeId", getOrderTypeId())
.append("batchCode", getBatchCode()) .append("batchCode", getBatchId())
.append("warehouseId", getWarehouseId()) .append("warehouseId", getWarehouseId())
.append("ownerId", getOwnerId()) .append("ownerId", getOwnerId())
.append("orderStatus", getOrderStatus()) .append("orderStatus", getOrderStatus())
......
package com.ruoyi.inventory.domain.TO;
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;
/**
* 入库单明细对象 inbound_order_items
*
* @author ruoyi
* @date 2025-12-02
*/
public class InboundItemsAndMaterialName 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 batchId;
/** 仓库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 plannedPackages;
/** 实际件数 */
@Excel(name = "实际件数")
private Long actualPackages;
/** 约数 */
// @Excel(name = "约数")
private Long divisor;
/** 标签颜色 字典,检索条件 */
@Excel(name = "标签颜色")
private Long labelColor;
/** 凭证号 检索条件 */
@Excel(name = "凭证号")
private String voucherNumber;
/** 单价 */
@Excel(name = "单价")
private Long unitPrice;
/** 状态1-待收货 2-部分收货 3-已完成 暂无用 */
// @Excel(name = "状态")
private Long itemStatus;
/** 收货时间 暂无用 */
@Excel(name = "收货时间")
private Long receivedAt;
/** 收货人 */
@Excel(name = "收货人")
private String receivedBy;
/** 应用数据1使用0删除 删除用 */
// @Excel(name = "应用数据")
private Long isUsed;
/** 排序 */
// @Excel(name = "排序")
private Long sortNo;
/** 创建日期 */
// @Excel(name = "创建日期")
private String createUserCode;
/** 排序号 */
// @Excel(name = "排序号")
private String updateUserCode;
private String materialName;
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 setBatchId(String batchId)
{
this.batchId = batchId;
}
public String getBatchId()
{
return batchId;
}
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 setPlannedPackages(Long plannedPackages)
{
this.plannedPackages = plannedPackages;
}
public Long getPlannedPackages()
{
return plannedPackages;
}
public void setActualPackages(Long actualPackages)
{
this.actualPackages = actualPackages;
}
public Long getActualPackages()
{
return actualPackages;
}
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 setUnitPrice(Long unitPrice)
{
this.unitPrice = unitPrice;
}
public Long getUnitPrice()
{
return unitPrice;
}
public void setItemStatus(Long itemStatus)
{
this.itemStatus = itemStatus;
}
public Long getItemStatus()
{
return itemStatus;
}
public void setReceivedAt(Long receivedAt)
{
this.receivedAt = receivedAt;
}
public Long getReceivedAt()
{
return receivedAt;
}
public void setReceivedBy(String receivedBy)
{
this.receivedBy = receivedBy;
}
public String getReceivedBy()
{
return receivedBy;
}
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 String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("orderId", getOrderId())
.append("materialId", getMaterialId())
.append("batchId", getBatchId())
.append("warehouseId", getWarehouseId())
.append("locationId", getLocationId())
.append("plannedQuantity", getPlannedQuantity())
.append("actualQuantity", getActualQuantity())
.append("plannedPackages", getPlannedPackages())
.append("actualPackages", getActualPackages())
.append("divisor", getDivisor())
.append("labelColor", getLabelColor())
.append("voucherNumber", getVoucherNumber())
.append("unitPrice", getUnitPrice())
.append("itemStatus", getItemStatus())
.append("receivedAt", getReceivedAt())
.append("receivedBy", getReceivedBy())
.append("remark", getRemark())
.append("isUsed", getIsUsed())
.append("sortNo", getSortNo())
.append("createTime", getCreateTime())
.append("createUserCode", getCreateUserCode())
.append("updateTime", getUpdateTime())
.append("updateUserCode", getUpdateUserCode())
.append("materialName", getMaterialName())
.toString();
}
}
...@@ -28,6 +28,14 @@ public interface InboundOrderItemsMapper ...@@ -28,6 +28,14 @@ public interface InboundOrderItemsMapper
public List<InboundOrderItems> selectInboundOrderItemsList(InboundOrderItems inboundOrderItems); public List<InboundOrderItems> selectInboundOrderItemsList(InboundOrderItems inboundOrderItems);
/** /**
* 查询入库单明细列表联查materialName
*
* @param inboundOrderItems 入库单明细
* @return 入库单明细集合
*/
public List<InboundOrderItems> selectInboundOrderItemsListAndMaterialName(InboundOrderItems inboundOrderItems);
/**
* 新增入库单明细 * 新增入库单明细
* *
* @param inboundOrderItems 入库单明细 * @param inboundOrderItems 入库单明细
......
package com.ruoyi.inventory.service; package com.ruoyi.inventory.service;
import java.util.List; import java.util.List;
import com.ruoyi.common.core.domain.entity.Materials;
import com.ruoyi.inventory.domain.InboundOrderItems; import com.ruoyi.inventory.domain.InboundOrderItems;
/** /**
...@@ -26,7 +28,7 @@ public interface IInboundOrderItemsService ...@@ -26,7 +28,7 @@ public interface IInboundOrderItemsService
* @return 入库单明细集合 * @return 入库单明细集合
*/ */
public List<InboundOrderItems> selectInboundOrderItemsList(InboundOrderItems inboundOrderItems); public List<InboundOrderItems> selectInboundOrderItemsList(InboundOrderItems inboundOrderItems);
public List<InboundOrderItems> selectInboundOrderItemsListAndMaterialName(InboundOrderItems inboundOrderItems);
/** /**
* 新增入库单明细 * 新增入库单明细
* *
...@@ -58,4 +60,12 @@ public interface IInboundOrderItemsService ...@@ -58,4 +60,12 @@ public interface IInboundOrderItemsService
* @return 结果 * @return 结果
*/ */
public int deleteInboundOrderItemsById(String id); public int deleteInboundOrderItemsById(String id);
/**
* 导入入库单明细信息
*
* @param inboundOrderItems,isUpdateSupport,operName 入库单数据信息
* @return 结果
*/
public String importInboundOrderItems(List<InboundOrderItems> inboundOrderItems, Boolean isUpdateSupport, String operName);
} }
...@@ -38,6 +38,13 @@ public interface IInventoryService ...@@ -38,6 +38,13 @@ public interface IInventoryService
public int insertInventory(Inventory inventory); public int insertInventory(Inventory inventory);
/** /**
* 批量新增库存
*
* @param inventoryList 库存
* @return 结果
*/
public int insertInventoryList(List<Inventory> inventoryList);
/**
* 修改库存 * 修改库存
* *
* @param inventory 库存 * @param inventory 库存
......
package com.ruoyi.inventory.service.impl; package com.ruoyi.inventory.service.impl;
import java.util.Collections;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.UUID;
import com.ruoyi.common.core.domain.entity.Materials;
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.StringUtils;
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.InboundOrderItemsMapper; import com.ruoyi.inventory.mapper.InboundOrderItemsMapper;
...@@ -44,6 +52,11 @@ public class InboundOrderItemsServiceImpl implements IInboundOrderItemsService ...@@ -44,6 +52,11 @@ public class InboundOrderItemsServiceImpl implements IInboundOrderItemsService
return inboundOrderItemsMapper.selectInboundOrderItemsList(inboundOrderItems); return inboundOrderItemsMapper.selectInboundOrderItemsList(inboundOrderItems);
} }
@Override
public List<InboundOrderItems> selectInboundOrderItemsListAndMaterialName(InboundOrderItems inboundOrderItems) {
return inboundOrderItemsMapper.selectInboundOrderItemsListAndMaterialName(inboundOrderItems);
}
/** /**
* 新增入库单明细 * 新增入库单明细
* *
...@@ -93,4 +106,71 @@ public class InboundOrderItemsServiceImpl implements IInboundOrderItemsService ...@@ -93,4 +106,71 @@ public class InboundOrderItemsServiceImpl implements IInboundOrderItemsService
{ {
return inboundOrderItemsMapper.deleteInboundOrderItemsById(id); return inboundOrderItemsMapper.deleteInboundOrderItemsById(id);
} }
/**
* 导入入库单明细信息
*
* @param inboundOrderItemsList,isUpdateSupport,operName 入库单数据信息
* @return 结果
*/
@Override
public String importInboundOrderItems(List<InboundOrderItems> inboundOrderItemsList, Boolean isUpdateSupport, String operName)
{
if (StringUtils.isNull(inboundOrderItemsList) || inboundOrderItemsList.size() == 0)
{
throw new ServiceException("导入用户数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
Date now = DateUtils.getNowDate();
Long userId = SecurityUtils.getUserId();
String operId = userId.toString();
for (InboundOrderItems inboundOrderItems : inboundOrderItemsList)
{
try
{
inboundOrderItems.setId(UUID.randomUUID().toString());
// 填充创建人、创建时间、修改人、修改时间
inboundOrderItems.setCreateBy(operId);
inboundOrderItems.setCreateTime(now);
// 填充创建用户编码和更新用户编码
inboundOrderItems.setCreateUserCode(operId);
// 设置默认值
if (inboundOrderItems.getItemStatus() == null)
{
inboundOrderItems.setItemStatus(1L); // 默认激活
}
if (inboundOrderItems.getIsUsed() == null)
{
inboundOrderItems.setIsUsed(1L); // 默认未删除
}
if (inboundOrderItems.getSortNo() == null)
{
inboundOrderItems.setSortNo(0L); // 默认排序号
}
inboundOrderItemsMapper.insertInboundOrderItems(inboundOrderItems);
successNum++;
successMsg.append("<br/>" + inboundOrderItems.getOrderId() + "入库单的" + successNum + "条入库单物料 " + inboundOrderItems.getMaterialId() + " 导入成功");
}
catch (Exception e)
{
failureNum++;
String msg = "<br/>" + inboundOrderItems.getOrderId() + "入库单的" + failureNum + "条物料 " + inboundOrderItems.getMaterialId() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
}
}
if (failureNum > 0)
{
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确");
throw new ServiceException(failureMsg.toString());
}
else
{
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
} }
package com.ruoyi.inventory.service.impl; package com.ruoyi.inventory.service.impl;
import java.util.List; import java.util.List;
import java.util.UUID;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.inventory.domain.OutboundOrderLog; import com.ruoyi.inventory.domain.OutboundOrderLog;
import com.ruoyi.inventory.mapper.OutboundOrderLogMapper; import com.ruoyi.inventory.mapper.OutboundOrderLogMapper;
...@@ -72,6 +74,17 @@ public class InventoryServiceImpl implements IInventoryService ...@@ -72,6 +74,17 @@ public class InventoryServiceImpl implements IInventoryService
return inventoryMapper.insertInventory(inventory); return inventoryMapper.insertInventory(inventory);
} }
@Override
public int insertInventoryList(List<Inventory> inventoryList) {
int count = 0;
for (Inventory inventory : inventoryList) {
inventory.setCreateTime(DateUtils.getNowDate());
inventory.setId(UUID.randomUUID().toString());
count = inventoryMapper.insertInventory(inventory);
}
return count;
}
/** /**
* 修改库存 * 修改库存
* *
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
<result property="updateUserCode" column="update_user_code" /> <result property="updateUserCode" column="update_user_code" />
</resultMap> </resultMap>
<sql id="selectInboundOrderItemsVo"> <sql id="selectInboundOrderItemsVo">
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 inbound_order_items 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 inbound_order_items
</sql> </sql>
...@@ -66,6 +68,102 @@ ...@@ -66,6 +68,102 @@
where id = #{id} where id = #{id}
</select> </select>
<select id="selectInboundOrderItemsListAndMaterialName"
parameterType="InboundOrderItems"
resultMap="InboundOrderItemsAndMnameResult">
SELECT
ii.id,
ii.order_id,
ii.material_id,
ii.batch_id,
ii.warehouse_id,
ii.location_id,
ii.planned_quantity,
ii.actual_quantity,
ii.planned_packages,
ii.actual_packages,
ii.divisor,
ii.label_color,
ii.voucher_number,
ii.unit_price,
ii.item_status,
ii.received_at,
ii.received_by,
ii.remark,
ii.is_used,
ii.sort_no,
ii.create_time,
ii.create_user_code,
ii.update_time,
ii.update_user_code,
m.material_name
FROM inbound_order_items ii
LEFT JOIN materials m ON ii.material_id = m.sap_no
<where>
<!-- 移除条件前的and,<where>标签会自动处理首个条件的and/or -->
<if test="orderId != null and orderId != ''">
order_id = #{orderId}
</if>
<if test="materialId != null and materialId != ''">
and material_id = #{materialId}
</if>
<if test="batchId != null and batchId != ''">
and batch_id = #{batchId}
</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="plannedPackages != null">
and planned_packages = #{plannedPackages}
</if>
<if test="actualPackages != null">
and actual_packages = #{actualPackages}
</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="unitPrice != null">
and unit_price = #{unitPrice}
</if>
<if test="itemStatus != null">
and item_status = #{itemStatus}
</if>
<if test="receivedAt != null">
and received_at = #{receivedAt}
</if>
<if test="receivedBy != null and receivedBy != ''">
and received_by = #{receivedBy}
</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>
<insert id="insertInboundOrderItems" parameterType="InboundOrderItems"> <insert id="insertInboundOrderItems" parameterType="InboundOrderItems">
insert into inbound_order_items insert into inbound_order_items
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
...@@ -162,4 +260,32 @@ ...@@ -162,4 +260,32 @@
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<resultMap type="com.ruoyi.inventory.domain.TO.InboundItemsAndMaterialName" id="InboundOrderItemsAndMnameResult">
<result property="id" column="id" />
<result property="orderId" column="order_id" />
<result property="materialId" column="material_id" />
<result property="batchId" column="batch_id" />
<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="plannedPackages" column="planned_packages" />
<result property="actualPackages" column="actual_packages" />
<result property="divisor" column="divisor" />
<result property="labelColor" column="label_color" />
<result property="voucherNumber" column="voucher_number" />
<result property="unitPrice" column="unit_price" />
<result property="itemStatus" column="item_status" />
<result property="receivedAt" column="received_at" />
<result property="receivedBy" column="received_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" />
<result property="materialName" column="material_name" />
</resultMap>
</mapper> </mapper>
\ No newline at end of file
...@@ -9,7 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -9,7 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="orderId" column="order_id" /> <result property="orderId" column="order_id" />
<result property="systemNo" column="system_no" /> <result property="systemNo" column="system_no" />
<result property="orderTypeId" column="order_type_id" /> <result property="orderTypeId" column="order_type_id" />
<result property="batchCode" column="batch_code" /> <result property="batchId" column="batch_id" />
<result property="warehouseId" column="warehouse_id" /> <result property="warehouseId" column="warehouse_id" />
<result property="ownerId" column="owner_id" /> <result property="ownerId" column="owner_id" />
<result property="orderStatus" column="order_status" /> <result property="orderStatus" column="order_status" />
...@@ -60,7 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -60,7 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectInboundOrdersVo"> <sql id="selectInboundOrdersVo">
select id, order_id, system_no, order_type_id, batch_code, warehouse_id, owner_id, order_status, inbound_date, order_type, total_planned_quantity, total_actual_quantity, total_packages, remark, op_user_name, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from inbound_orders select id, order_id, system_no, order_type_id, batch_id, warehouse_id, owner_id, order_status, inbound_date, order_type, total_planned_quantity, total_actual_quantity, total_packages, remark, op_user_name, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from inbound_orders
</sql> </sql>
<select id="selectInboundOrdersList" parameterType="InboundOrders" resultMap="InboundOrdersResult"> <select id="selectInboundOrdersList" parameterType="InboundOrders" resultMap="InboundOrdersResult">
...@@ -69,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -69,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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="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="batchId != null and batchId != ''"> and batch_id = #{batchId}</if>
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if> <if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
<if test="ownerId != null and ownerId != ''"> and owner_id = #{ownerId}</if> <if test="ownerId != null and ownerId != ''"> and owner_id = #{ownerId}</if>
<if test="orderStatus != null "> and order_status = #{orderStatus}</if> <if test="orderStatus != null "> and order_status = #{orderStatus}</if>
...@@ -87,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -87,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectInboundOrdersById" parameterType="String" resultMap="InboundOrdersInboundOrderItemsResult"> <select id="selectInboundOrdersById" parameterType="String" resultMap="InboundOrdersInboundOrderItemsResult">
select id, order_id, system_no, order_type_id, batch_code, warehouse_id, owner_id, order_status, inbound_date, order_type, total_planned_quantity, total_actual_quantity, total_packages, remark, op_user_name, is_used, sort_no, create_time, create_user_code, update_time, update_user_code select id, order_id, system_no, order_type_id, batch_id, warehouse_id, owner_id, order_status, inbound_date, order_type, total_planned_quantity, total_actual_quantity, total_packages, remark, op_user_name, is_used, sort_no, create_time, create_user_code, update_time, update_user_code
from inbound_orders from inbound_orders
where id = #{id} where id = #{id}
</select> </select>
...@@ -105,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -105,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderId != null">order_id,</if> <if test="orderId != null">order_id,</if>
<if test="systemNo != null">system_no,</if> <if test="systemNo != null">system_no,</if>
<if test="orderTypeId != null">order_type_id,</if> <if test="orderTypeId != null">order_type_id,</if>
<if test="batchCode != null">batch_code,</if> <if test="batchId != null">batch_id,</if>
<if test="warehouseId != null">warehouse_id,</if> <if test="warehouseId != null">warehouse_id,</if>
<if test="ownerId != null">owner_id,</if> <if test="ownerId != null">owner_id,</if>
<if test="orderStatus != null">order_status,</if> <if test="orderStatus != null">order_status,</if>
...@@ -128,7 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -128,7 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderId != null">#{orderId},</if> <if test="orderId != null">#{orderId},</if>
<if test="systemNo != null">#{systemNo},</if> <if test="systemNo != null">#{systemNo},</if>
<if test="orderTypeId != null">#{orderTypeId},</if> <if test="orderTypeId != null">#{orderTypeId},</if>
<if test="batchCode != null">#{batchCode},</if> <if test="batchId != null">#{batchId},</if>
<if test="warehouseId != null">#{warehouseId},</if> <if test="warehouseId != null">#{warehouseId},</if>
<if test="ownerId != null">#{ownerId},</if> <if test="ownerId != null">#{ownerId},</if>
<if test="orderStatus != null">#{orderStatus},</if> <if test="orderStatus != null">#{orderStatus},</if>
...@@ -154,7 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -154,7 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderId != null">order_id = #{orderId},</if> <if test="orderId != null">order_id = #{orderId},</if>
<if test="systemNo != null">system_no = #{systemNo},</if> <if test="systemNo != null">system_no = #{systemNo},</if>
<if test="orderTypeId != null">order_type_id = #{orderTypeId},</if> <if test="orderTypeId != null">order_type_id = #{orderTypeId},</if>
<if test="batchCode != null">batch_code = #{batchCode},</if> <if test="batchId != null">batch_id = #{batchId},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if> <if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="ownerId != null">owner_id = #{ownerId},</if> <if test="ownerId != null">owner_id = #{ownerId},</if>
<if test="orderStatus != null">order_status = #{orderStatus},</if> <if test="orderStatus != null">order_status = #{orderStatus},</if>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论