Commit 887e590d by yubin

Merge remote-tracking branch 'origin/master'

parents e135875d 6a53a6d4
......@@ -101,6 +101,19 @@
/>
</el-select>
</el-form-item>
<el-form-item label="入库日期" prop="inboundDateRange">
<el-date-picker
v-model="inboundDateRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
</page-wrapper-search>
<!-- 表格区域 -->
......@@ -110,7 +123,7 @@
height="100%"
:data="inboundList"
@selection-change="handleSelectionChange"
:row-key="(row) => row.materialId + '_' + row.orderId + '_' + row.warehousesName + '_' + row.locationName"
:row-key="(row) => row.materialId + '_' + row.batchId +'_' + row.orderId + '_' + row.warehousesName + '_' + row.locationName"
>
<el-table-column label="物料SAPNO" align="center" prop="sapNo" min-width="200"/>
<el-table-column label="物料名称" align="center" prop="materialName" min-width="200"/>
......@@ -184,6 +197,8 @@ export default {
},
data() {
return {
// 入库日期选择数组
inboundDateRange: null,
// 仓库选择相关
warehouseSelectorVisible: false,
queryWarehouseName: null,
......@@ -212,7 +227,9 @@ export default {
batchId: null,
warehouseId: null,
locationId: null,
labelColor: null
labelColor: null,
inboundDateStart: null,
inboundDateEnd: null
}
}
},
......@@ -247,6 +264,14 @@ export default {
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
if (Array.isArray(this.inboundDateRange) && this.inboundDateRange.length === 2) {
this.queryParams.inboundDateStart = this.inboundDateRange[0];
this.queryParams.inboundDateEnd = this.inboundDateRange[1];
} else {
// 清空开始/结束日期(避免残留旧值)
this.queryParams.inboundDateStart = "";
this.queryParams.inboundDateEnd = "";
}
this.getList()
},
......@@ -261,10 +286,13 @@ export default {
batchId: null,
warehouseId: null,
locationId: null,
labelColor: null
labelColor: null,
inboundDateStart: null,
inboundDateStart: null
}
this.queryWarehouseName = null
this.queryLocationName = null
this.inboundDateRange = null
this.handleQuery()
},
......
......@@ -33,7 +33,7 @@
>删除</el-button>
<el-button
type="warning"
type="success"
plain
icon="el-icon-upload"
size="medium"
......@@ -953,7 +953,7 @@ export default {
await batchAddInventory(row.inboundOrderItemsList)
// 第四步:操作成功提示
this.$modal.msgSuccess("确认成功")
// this.$modal.msgSuccess("确认成功")
this.$message.success('确认入库成功')
row.orderStatus = 2
updateInbound(row).then(() => {
......@@ -1009,7 +1009,7 @@ export default {
...item,
orderId: this.form.orderId, // 确保明细项有主表ID
batchId: this.form.batchId,
inboundOrderId: this.form.id || null
inboundOrderId: this.form.id || null,
}))
}
if (this.form.id != null) {
......
......@@ -84,7 +84,7 @@
</el-col>
<!-- <el-col :span="1.5" v-if="isEditable">
<el-button
type="warning"
type="success"
plain
icon="el-icon-download"
size="mini"
......@@ -150,7 +150,7 @@
>
<template slot-scope="scope">
<!-- 可编辑模式 -->
<template v-if="scope.row.editable && column.editable !== false">
<template v-if="scope.row.editable && column.editable !== false && isEditable !==false">
<!-- 仓库选择 -->
<template v-if="column.prop === 'warehousesName'">
<el-input
......@@ -364,6 +364,7 @@ export default {
{ prop: 'voucherNumber', label: '凭证号', width: '150', editable: true },
{ prop: 'unitPrice', label: '单价', width: '100', type: 'number', editable: true },
{ prop: 'receivedBy', label: '收货人', width: '150', editable: true },
{ prop: 'labelQuantity', label: '贴标数量', width: '150',type: 'number', editable: true },
{ prop: 'remark', label: '备注', minWidth: '150', editable: true },
]
},
......@@ -605,8 +606,8 @@ export default {
remark: null,
editable: true,
inboundOrderId: null,
labelQuantity: 0,
tempId: Date.now() + Math.random()
}
this.displayData.push(newItem)
const totalPages = Math.ceil(this.displayData.length / this.queryParams.pageSize)
......
......@@ -28,6 +28,14 @@
@click="handleDelete"
v-hasPermi="['inventory:locations:remove']"
>删除</el-button>
<el-button
type="success"
plain
icon="el-icon-upload"
size="medium"
@click="handleImport"
v-hasPermi="['inventory:locations:add']"
>导入</el-button>
<el-button
type="warning"
plain
......@@ -36,14 +44,6 @@
@click="handleExport"
v-hasPermi="['inventory:locations:export']"
>导出</el-button>
<el-button
type="info"
plain
icon="el-icon-upload2"
size="medium"
@click="handleImport"
v-hasPermi="['inventory:locations:add']"
>导入</el-button>
</template>
</PageTitle>
......
......@@ -34,7 +34,7 @@
<el-button
type="success"
plain
icon="el-icon-upload2"
icon="el-icon-upload"
size="medium"
@click="handleImport"
v-hasPermi="['inventory:materials:import']"
......@@ -146,7 +146,7 @@
<el-table-column label="物料名称" align="center" prop="materialName" width="150"/>
<el-table-column label="物料英文名称" align="center" prop="materialEname" width="150"/>
<el-table-column label="TS Code" align="center" prop="tsCode" width="150"/>
<el-table-column label="物料分类" align="center" prop="categoryCode" >
<el-table-column label="物料分类" align="center" prop="categoryCode" width="150" >
<template slot-scope="scope">
{{ scope.row.displayCategory || categoryMap[scope.row.categoryCode] || scope.row.categoryCode }}
</template>
......
......@@ -33,7 +33,7 @@
>删除</el-button>
<el-button
type="warning"
type="success"
plain
icon="el-icon-upload"
size="medium"
......
......@@ -34,6 +34,15 @@
>删除</el-button>
<el-button
type="success"
plain
icon="el-icon-upload"
size="medium"
@click="handleImport"
v-hasPermi="['inventory:owners:add']"
>导入</el-button>
<el-button
type="warning"
plain
icon="el-icon-download"
......@@ -42,15 +51,7 @@
v-hasPermi="['inventory:owners:export']"
>导出</el-button>
<el-button
type="info"
plain
icon="el-icon-upload2"
size="medium"
@click="handleImport"
v-hasPermi="['inventory:owners:add']"
>导入</el-button>
</template>
</PageTitle>
......
......@@ -36,7 +36,15 @@
v-hasPermi="['system:role:remove']"
>删除</el-button>
<el-button
type="success"
plain
icon="el-icon-upload"
size="medium"
@click="handleImport"
v-hasPermi="['system:role:import']"
>导入</el-button>
<el-button
type="warning"
plain
......@@ -45,16 +53,7 @@
@click="handleExport"
v-hasPermi="['system:role:export']"
>导出</el-button>
<el-button
type="info"
plain
icon="el-icon-upload2"
size="medium"
@click="handleImport"
v-hasPermi="['system:role:import']"
>导入</el-button>
</template>
</PageTitle>
......
......@@ -9,7 +9,7 @@
<el-button type="danger" plain icon="el-icon-delete" size="medium" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:user:remove']">删除</el-button>
<el-button type="info" plain icon="el-icon-upload2" size="medium" @click="handleImport" v-hasPermi="['system:user:import']">导入</el-button>
<el-button type="success" plain icon="el-icon-upload" size="medium" @click="handleImport" v-hasPermi="['system:user:import']">导入</el-button>
<el-button type="warning" plain icon="el-icon-download" size="medium" @click="handleExport" v-hasPermi="['system:user:export']">导出</el-button>
</template>
......
......@@ -2,10 +2,8 @@ package com.ruoyi.web.controller.inventory;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
......@@ -14,6 +12,7 @@ import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.exception.ExcelAnalysisException;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.uuid.UUID;
import javax.servlet.http.HttpServletResponse;
......@@ -24,6 +23,7 @@ import com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO;
import com.ruoyi.inventory.domain.vo.inboundVO.InboundTRDCTemplateVO;
import com.ruoyi.inventory.domain.vo.inboundVO.InboundTemplateVO;
import com.ruoyi.inventory.service.impl.InboundOrdersServiceImpl;
import com.ruoyi.system.service.ISysDictDataService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.prepost.PreAuthorize;
......@@ -52,6 +52,8 @@ public class InboundOrdersController extends BaseController
{
@Autowired
private IInboundOrdersService inboundOrdersService;
@Autowired
private ISysDictDataService iSysDictDataService;
private static final Logger log = LoggerFactory.getLogger(InboundOrdersServiceImpl.class);
/**
* 查询入库单主列表
......@@ -64,7 +66,14 @@ public class InboundOrdersController extends BaseController
List<InboundOrders> list = inboundOrdersService.selectInboundOrdersList(inboundOrders);
return getDataTable(list);
}
private Map<Object, Object> getDictMap(String dictType) {
List<SysDictData> dictList = iSysDictDataService.selectDictDataByType(dictType);
Map<Object, Object> dictMap = new HashMap<>();
for (SysDictData dictData : dictList) {
dictMap.put(dictData.getDictValue(), dictData.getDictLabel());
}
return dictMap;
}
/**
* 导出入库单主列表
*/
......@@ -73,21 +82,30 @@ public class InboundOrdersController extends BaseController
@PostMapping("/export")
public void export(HttpServletResponse response, InboundOrders inboundOrders)
{
List<InboundOrders> list = inboundOrdersService.selectInboundOrdersList(inboundOrders);
// for (InboundOrders inboundItem : list) {
// if (inboundOrders.getOrderStatus() == 1) {
// InboundItemsTO inboundItemsTO = new InboundItemsTO();
// inboundItemsTO.setRelocationId(inboundItem.getL)
// }else if (inboundOrders.getOrderStatus() == 2) {
//
// }else if (inboundOrders.getOrderStatus() == 3) {
//
// }else{
//
// }
// }
List<InboundItemsTO> list = inboundOrdersService.selectInboundOrdersAndItems(inboundOrders);
Map<Object, Object> colorDictMap = getDictMap("label_color");
for (InboundItemsTO inboundItem : list) {
if (inboundItem != null) {
inboundItem.setPackageWeight(inboundItem.getWeight() * (inboundItem.getActualQuantity() / inboundItem.getActualPackages()));
inboundItem.setUnitWeight(inboundItem.getWeight() * (inboundItem.getActualQuantity() / inboundItem.getActualPackages()));
inboundItem.setLabelColorName((String) colorDictMap.get(inboundItem.getLabelColor()+""));
switch (inboundItem.getOrderTypeId()) {
case "1":
inboundItem.setRelocation(inboundItem.getRemark());
break;
case "2":
inboundItem.setFinishedLocation(inboundItem.getRemark());
break;
case "3":
inboundItem.setRemarkTrdc(inboundItem.getRemark());
inboundItem.setFinishedSystemNo(inboundItem.getSystemNo());
inboundItem.setFinishedOrderId(inboundItem.getOrderId());
break;
}
}
}
ExcelUtil<InboundOrders> util = new ExcelUtil<InboundOrders>(InboundOrders.class);
ExcelUtil<InboundItemsTO> util = new ExcelUtil<InboundItemsTO>(InboundItemsTO.class);
util.exportExcel(response, list, "入库单导出数据");
}
......@@ -180,7 +198,7 @@ public class InboundOrdersController extends BaseController
// 防护3:校验orderType非空且合法
if (orderType == null || !Arrays.asList(1, 2, 3).contains(orderType)) {
return error("导入类型不能为空,仅支持1/2/3!");
return error("导入类型不能为空,当前仅支持1/2/3!");
}
// 2. 解析Excel表头(适配EasyExcel 2.x,无interrupt、无readRowNumber)
......@@ -242,40 +260,62 @@ public class InboundOrdersController extends BaseController
default: throw new ServiceException("不支持的导入类型,请联系管理员" + orderType);
}
}
private static final Map<Class<?>, List<String>> REQUIRED_HEADS_CACHE = new ConcurrentHashMap<>();
/**
* 通用导入逻辑(泛型适配不同VO)
*/
private <T> String handleImport(Class<T> clazz, MultipartFile file, List<String> headerList,
Integer updateSupport, String operName, Integer orderType) throws Exception {
// 反射读取VO中@Excel注解的必填表头
List<String> requiredExcelHeads = new ArrayList<>();
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
if (field.isAnnotationPresent(Excel.class)) {
requiredExcelHeads.add(field.getAnnotation(Excel.class).name().trim());
// 1. 获取必填表头
List<String> requiredExcelHeads = REQUIRED_HEADS_CACHE.computeIfAbsent(clazz, cls -> {
List<String> heads = new ArrayList<>();
for (Field field : cls.getDeclaredFields()) {
if (field.isAnnotationPresent(Excel.class)) {
heads.add(cleanHeader(field.getAnnotation(Excel.class).name()));
}
}
}
return Collections.unmodifiableList(heads);
});
// 2. 安全清洗表头
final List<String> finalHeaderList =
(headerList != null ? headerList : Collections.<String>emptyList()).stream()
.map(this::cleanHeader)
.collect(Collectors.toList());
// 校验表头是否包含所有必填项
if (!headerList.containsAll(requiredExcelHeads)) {
// 3. 校验表头
if (!finalHeaderList.containsAll(requiredExcelHeads)) {
List<String> missingHeads = requiredExcelHeads.stream()
.filter(head -> !headerList.contains(head))
.filter(head -> !finalHeaderList.contains(head))
.collect(Collectors.toList());
return "导入数据字段与目标模板不一致,请检查!缺失字段:" + String.join("、", missingHeads);
}
// 解析Excel数据(若依ExcelUtil适配2.x,无需修改)
// 4. 可选:检查字段顺序(如果需要)
// checkColumnOrder(requiredExcelHeads, finalHeaderList);
// 5. 解析Excel
ExcelUtil<T> util = new ExcelUtil<>(clazz);
List<T> dataList = util.importExcel(file.getInputStream());
if (CollectionUtils.isEmpty(dataList)) {
return "Excel中未解析到有效数据,请检查模板是否正确!";
}
// 调用Service导入(需确保Service支持泛型列表,或强转Object)
// 6. 导入数据
return inboundOrdersService.importInboundOrders(dataList, updateSupport, operName, orderType);
}
// 清洗
private String cleanHeader(String header) {
if (header == null) return "";
return header
.replace(" ", " ") // 全角空格转半角
.replace("\u00A0", " ") // 不换行空格(&nbsp;)
.replace("\u2007", " ") // 数字空格
.replace("\u202F", " ") // 窄空格
.replaceAll("\\s+", " ") // 合并多个连续空格为单个
.trim();
}
// 辅助方法:获取缺失的列名(备用)
private String getMissingColumns(List<String> template, List<String> excel) {
return template.stream()
......
......@@ -24,11 +24,11 @@ public class MaterialsCategory extends BaseEntity
private String id;
/** 物料编码 检索条件 */
@Excel(name = "物料编码 检索条件")
@Excel(name = "物料编码")
private String categoryCode;
/** 物料名称 检索条件 */
@Excel(name = "物料名称 检索条件")
@Excel(name = "物料名称")
private String categoryName;
/** 排序 */
......
......@@ -275,7 +275,7 @@ public class InventoryController extends BaseController
inventory.setLocationId(location.getId());
inventory.setQuantity(qty == null ? 0 : qty.longValue());
inventory.setLockedQuantity(0L);
inventory.setUnitWeight(unitWeight == null ? null : Math.round(unitWeight));
inventory.setUnitWeight(unitWeight);
inventory.setTotalWeight(totalWeight == null ? null : Math.round(totalWeight));
inventory.setInventoryStatus(1L);
inventory.setIsUsed(1L);
......
......@@ -74,7 +74,7 @@ public class InboundOrderItems extends BaseEntity
/** 单价 */
@Excel(name = "单价")
private Long unitPrice;
private Double unitPrice;
/** 状态1-待收货 2-部分收货 3-已完成 暂无用 */
// @Excel(name = "状态")
......@@ -106,6 +106,10 @@ public class InboundOrderItems extends BaseEntity
/** 排序号 */
// @Excel(name = "排序号")
private String updateUserCode;
/** 单件重量 */
private Double packageWeight;
/** 单位重量 */
private Double unitWeight;
public void setId(String id)
{
......@@ -237,14 +241,12 @@ public class InboundOrderItems extends BaseEntity
return voucherNumber;
}
public void setUnitPrice(Long unitPrice)
{
this.unitPrice = unitPrice;
public Double getUnitPrice() {
return unitPrice;
}
public Long getUnitPrice()
{
return unitPrice;
public void setUnitPrice(Double unitPrice) {
this.unitPrice = unitPrice;
}
public void setItemStatus(Long itemStatus)
......@@ -341,6 +343,22 @@ public class InboundOrderItems extends BaseEntity
this.labelQuantity = labelQuantity;
}
public Double getUnitWeight() {
return unitWeight;
}
public void setUnitWeight(Double unitWeight) {
this.unitWeight = unitWeight;
}
public Double getPackageWeight() {
return packageWeight;
}
public void setPackageWeight(Double packageWeight) {
this.packageWeight = packageWeight;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -60,7 +60,7 @@ public class InboundOrders extends BaseEntity
@JsonFormat(pattern = "yyyy-MM-dd")
private Date inboundDateStart;
/** 结束日期 只做查询 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date inboundDateEnd;
......@@ -101,6 +101,9 @@ public class InboundOrders extends BaseEntity
@Excel(name = "排序号")
private String updateUserCode;
/** 是否为导入数据 1-是 0-否 */
private Integer isImport;
/** 入库单明细信息 */
private List<InboundOrderItems> inboundOrderItemsList;
......@@ -326,32 +329,41 @@ public class InboundOrders extends BaseEntity
this.inboundDateEnd = inboundDateEnd;
}
public Integer getIsImport() {
return isImport;
}
public void setIsImport(Integer isImport) {
this.isImport = isImport;
}
@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", getBatchId())
.append("warehouseId", getWarehouseId())
.append("ownerId", getOwnerId())
.append("orderStatus", getOrderStatus())
.append("inboundDate", getInboundDate())
.append("orderType", getOrderType())
.append("totalPlannedQuantity", getTotalPlannedQuantity())
.append("totalActualQuantity", getTotalActualQuantity())
.append("totalPackages", getTotalPackages())
.append("remark", getRemark())
.append("opUserName", getOpUserName())
.append("isUsed", getIsUsed())
.append("sortNo", getSortNo())
.append("createTime", getCreateTime())
.append("createUserCode", getCreateUserCode())
.append("updateTime", getUpdateTime())
.append("updateUserCode", getUpdateUserCode())
.append("inboundOrderItemsList", getInboundOrderItemsList())
.append("ownerName", getOwnerName())
.toString();
.append("id", getId())
.append("orderId", getOrderId())
.append("systemNo", getSystemNo())
.append("orderTypeId", getOrderTypeId())
.append("batchCode", getBatchId())
.append("warehouseId", getWarehouseId())
.append("ownerId", getOwnerId())
.append("orderStatus", getOrderStatus())
.append("inboundDate", getInboundDate())
.append("orderType", getOrderType())
.append("totalPlannedQuantity", getTotalPlannedQuantity())
.append("totalActualQuantity", getTotalActualQuantity())
.append("totalPackages", getTotalPackages())
.append("remark", getRemark())
.append("opUserName", getOpUserName())
.append("isUsed", getIsUsed())
.append("sortNo", getSortNo())
.append("createTime", getCreateTime())
.append("createUserCode", getCreateUserCode())
.append("updateTime", getUpdateTime())
.append("updateUserCode", getUpdateUserCode())
.append("inboundOrderItemsList", getInboundOrderItemsList())
.append("ownerName", getOwnerName())
.append("isImport", getIsImport())
.toString();
}
}
......@@ -72,7 +72,7 @@ public class Inventory extends BaseEntity
/** 单位重量 */
@Excel(name = "单位重量")
private Long unitWeight;
private Double unitWeight;
/** 总重量 暂无用 */
@Excel(name = "总重量 暂无用")
......@@ -181,4 +181,23 @@ public class Inventory extends BaseEntity
private Double unitPrice;
private String inboundOrderId;
public Inventory() {
}
/**
* 入库导入批量新增库存映射字段
* */
public Inventory(Long inventoryType, String orderId,String materialId, String batchId, String warehousesId, String locationId, String ownerId, Long quantity, Double unitWeight, Long inventoryStatus, Double unitPrice) {
this.inventoryType = inventoryType;
this.orderId = orderId;
this.materialId = materialId;
this.batchId = batchId;
this.warehousesId = warehousesId;
this.locationId = locationId;
this.ownerId = ownerId;
this.quantity = quantity;
this.unitWeight = unitWeight;
this.inventoryStatus = inventoryStatus;
this.unitPrice = unitPrice;
}
}
......@@ -63,15 +63,15 @@ public class InboundItemsTO extends BaseEntity {
/** 库位 */
@Excel(name = "库位")
private String locationId;
private String locationName;
/** 仓库 */
@Excel(name = "仓库")
private String warehouseId;
/** 库位(成品) */
@Excel(name = "库位(成品)")
private String finishedLocationId;
@Excel(name = "目标库位(成品)")
private String finishedLocation;
/** 备注(TRDC) */
@Excel(name = "备注(TRDC)")
......@@ -79,11 +79,11 @@ public class InboundItemsTO extends BaseEntity {
/** 收货库位(正常) */
@Excel(name = "收货库位(正常)")
private String relocationId;
private String relocation;
/** 标签颜色 */
@Excel(name = "标签颜色")
private Long labelColor;
private String labelColorName;
/** 凭证号 */
@Excel(name = "凭证号")
......@@ -107,11 +107,11 @@ public class InboundItemsTO extends BaseEntity {
/** 智观(客户订单号) */
@Excel(name = "智观(客户订单号)")
private String finishedSystemNo;
private String finishedOrderId;
/** 客户订单号/PO号 */
@Excel(name = "客户订单号/PO号")
private String finishedOrderId;
private String finishedSystemNo;
/** 货主 */
@Excel(name = "货主")
......@@ -143,9 +143,10 @@ public class InboundItemsTO extends BaseEntity {
/** 仓库名称 */
private String warehousesName;
/** 库位名称 */
private String locationName;
/** 库位ID */
private String locationId;
private Long labelColor;
/** 计划件数 暂无用 */
private Long plannedPackages;
......@@ -184,4 +185,8 @@ public class InboundItemsTO extends BaseEntity {
/** 更新人编码 */
private String updateUserCode;
private Integer orderStatus;
private String orderTypeId;
}
\ No newline at end of file
......@@ -53,6 +53,9 @@ public class InboundDetailsVO {
@Excel(name = "入库时间")
private Date inboundDate;
// 开始入库日期结束日库日期,仅作查询
private Date inboundDateStart;
private Date inboundDateEnd;
public String getMaterialId() {
return materialId;
......@@ -182,6 +185,22 @@ public class InboundDetailsVO {
this.sapNo = sapNo;
}
public Date getInboundDateStart() {
return inboundDateStart;
}
public void setInboundDateStart(Date inboundDateStart) {
this.inboundDateStart = inboundDateStart;
}
public Date getInboundDateEnd() {
return inboundDateEnd;
}
public void setInboundDateEnd(Date inboundDateEnd) {
this.inboundDateEnd = inboundDateEnd;
}
@Override
public String toString() {
return "InboundDetailsVO{" +
......
......@@ -3,6 +3,7 @@ package com.ruoyi.inventory.mapper;
import java.util.List;
import com.ruoyi.inventory.domain.InboundOrders;
import com.ruoyi.inventory.domain.InboundOrderItems;
import com.ruoyi.inventory.domain.TO.InboundItemsTO;
import com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO;
/**
......@@ -83,7 +84,6 @@ public interface InboundOrdersMapper
* @return 结果
*/
public int batchInboundOrderItems(List<InboundOrderItems> inboundOrderItemsList);
/**
* 通过入库单主主键删除入库单明细信息
......@@ -94,6 +94,14 @@ public interface InboundOrdersMapper
public int deleteInboundOrderItemsByOrderId(String id);
/**
* 导出查询
*
* @param inboundOrders 入库单主ID
* @return 结果
*/
public List<InboundItemsTO> selectInboundOrdersAndItems(InboundOrders inboundOrders);
/**
* 统计本月入库次数
* @param monthParam yy-MM
* @return 结果
......
......@@ -3,6 +3,7 @@ package com.ruoyi.inventory.service;
import java.util.List;
import com.ruoyi.inventory.domain.InboundOrders;
import com.ruoyi.inventory.domain.TO.InboundItemsTO;
import com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO;
......@@ -31,6 +32,14 @@ public interface IInboundOrdersService
public List<InboundOrders> selectInboundOrdersList(InboundOrders inboundOrders);
/**
* 查询入库单和明细平铺信息
*
* @param inboundOrders 入库单主
* @return 入库单主集合
*/
public List<InboundItemsTO> selectInboundOrdersAndItems(InboundOrders inboundOrders);
/**
* 新增入库单主
*
* @param inboundOrders 入库单主
......
......@@ -9,8 +9,10 @@ import java.util.stream.Collectors;
import com.ruoyi.common.config.WarehouseConfig;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.inventory.domain.*;
import com.ruoyi.inventory.domain.TO.InboundItemsTO;
import com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO;
import com.ruoyi.inventory.mapper.*;
import com.ruoyi.inventory.service.IInventoryService;
import org.apache.commons.lang3.SystemUtils;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.CollectionUtils;
......@@ -47,7 +49,8 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
private WarehousesMapper warehousesMapper;
@Autowired
private StorageLocationsMapper storageLocationsMapper;
@Autowired
private IInventoryService iInventoryService;
private static final Logger log = LoggerFactory.getLogger(InboundOrdersServiceImpl.class);
/**
......@@ -74,6 +77,11 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
return inboundOrdersMapper.selectInboundOrdersList(inboundOrders);
}
@Override
public List<InboundItemsTO> selectInboundOrdersAndItems(InboundOrders inboundOrders) {
return inboundOrdersMapper.selectInboundOrdersAndItems(inboundOrders);
}
/**
* 新增入库单主
*
......@@ -87,6 +95,8 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
inboundOrders.setCreateTime(DateUtils.getNowDate());
inboundOrders.setCreateUserCode(SystemUtils.getUserName());
inboundOrders.setCreateBy(SystemUtils.getUserName());
inboundOrders.setIsImport(0);
inboundOrders.setIsUsed(1L);
int rows = inboundOrdersMapper.insertInboundOrders(inboundOrders);
insertInboundOrderItems(inboundOrders);
return rows;
......@@ -159,7 +169,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
inboundOrderItems.setId(UUID.randomUUID().toString());
inboundOrderItems.setOrderId(orderId);
inboundOrderItems.setInboundOrderId(inboundOrders.getId());
inboundOrderItems.setIsUsed(1L);
list.add(inboundOrderItems);
}
if (list.size() > 0)
......@@ -238,6 +248,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
Method getOrderIdMethod = vo.getClass().getMethod("getOrderId");
String orderId = Optional.ofNullable(getOrderIdMethod.invoke(vo))
.map(Object::toString)
.map(String::trim)
.orElse("");
return StringUtils.isNotBlank(orderId);
} catch (Exception e) {
......@@ -252,10 +263,12 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
Method getBatchIdMethod = vo.getClass().getMethod("getBatchId");
return Optional.ofNullable(getOrderIdMethod.invoke(vo))
.map(Object::toString)
.map(String::trim)
.orElse("")
+ "--" +
Optional.ofNullable(getBatchIdMethod.invoke(vo))
.map(Object::toString)
.map(String::trim)
.orElse("");
} catch (Exception e) {
throw new ServiceException("分组获取orderId失败" + e);
......@@ -272,12 +285,18 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
// 4. 遍历每个入库单分组处理
for (Map.Entry<String, List<T>> entry : orderGroupMap.entrySet()) {
String orderKey = entry.getKey();
String orderId = orderKey.split("--")[0];
String batchId = orderKey.split("--")[1];
String orderId = "";
String batchId = "";
try{
orderId = orderKey.split("--")[0];
batchId = orderKey.split("--")[1];
}catch (IndexOutOfBoundsException e){
throw new ServiceException("请检查表头单号和批次号是否正确?");
}
List<T> voList = entry.getValue();
InboundOrders mainDO = null;
List<InboundOrderItems> itemDOList = new ArrayList<>();
List<Inventory> inventoryList = new ArrayList<>();
try {
// 4.1 处理主表(每个入库单号只处理一次主表)
T firstVO = voList.get(0); // 取第一条VO的主表信息
......@@ -321,13 +340,15 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
mainDO.setCreateBy(operId);
mainDO.setCreateTime(now);
mainDO.setCreateUserCode(operId);
mainDO.setIsImport(1);
mainDO.setIsUsed(1L);
mainDO.setOrderTypeId(Optional.ofNullable(orderType).map(String::valueOf).orElse(""));
// 设置默认值
if (mainDO.getSortNo() == null) {
mainDO.setSortNo(0L);
}
if (mainDO.getOrderStatus() == null) {
mainDO.setOrderStatus(1L); // 默认草稿状态
mainDO.setOrderStatus(2L); // 默认草稿状态
}
// ========== 货主查询(反射获取ownerId) ==========
......@@ -359,6 +380,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
for (T vo : voList) {
try {
InboundOrderItems itemDO = new InboundOrderItems();
// 反射复制子表字段(物料相关)
BeanUtils.copyProperties(vo, itemDO,
"orderId", "systemNo", "orderTypeId", "batchId"); // 排除主表字段
......@@ -368,7 +390,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
itemDO.setCreateTime(now);
itemDO.setCreateUserCode(operId);
itemDO.setOrderId(orderId); // 关联入库单号
itemDO.setIsUsed(1L);
// 反射获取batchId并设置
try {
Method getBatchIdMethod = vo.getClass().getMethod("getBatchId");
......@@ -453,6 +475,20 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
itemDO.setLocationId(locationId);
}
itemDOList.add(itemDO);
Inventory inventoryDO = new Inventory(
Long.parseLong(mainDO.getOrderTypeId()),
orderId,
itemDO.getMaterialId(),
batchId,
itemDO.getWarehouseId(),
itemDO.getLocationId(),
mainDO.getOwnerId(),
itemDO.getActualQuantity(),
itemDO.getPackageWeight() / itemDO.getActualPackages(),
1L,
itemDO.getUnitPrice()
);
inventoryList.add(inventoryDO);
} catch (Exception e) {
// 单个明细失败:仅统计,不影响整单
totalItemFailure++;
......@@ -475,10 +511,12 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
// 4.3 批量插入明细
if (!CollectionUtils.isEmpty(itemDOList)) {
int itemSuccess = inboundOrdersMapper.batchInboundOrderItems(itemDOList);
if (itemSuccess != itemDOList.size()) {
int inventorySuccess = iInventoryService.insertInventoryList(inventoryList);
if (itemSuccess != itemDOList.size() && itemSuccess != inventorySuccess) {
// 批量插入部分失败,主动回滚事务
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
throw new ServiceException("明细批量插入失败,成功" + itemSuccess + "条,总" + itemDOList.size() + "条");
}
totalItemSuccess += itemSuccess;
successMsg.append(String.format("入库单号【%s】成功导入%d条物料明细;\n", orderId, itemSuccess));
......@@ -490,7 +528,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
totalItemFailure += voList.size();
failureMsg.append(String.format("入库单号【%s】处理失败:%s;\n", orderId, e.getMessage()));
// 打印异常栈,方便调试
log.error("导入入库单【{}】失败", orderId, e);
log.error("导入【{}】批次的入库单【{}】失败", orderId, batchId, e);
// 整单失败回滚
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
......
......@@ -94,7 +94,7 @@ public class InventoryServiceImpl implements IInventoryService
}
/**
* 批量库存
* 批量新增库存
*
* @param inventoryList 库存
* @return 结果
......@@ -108,6 +108,7 @@ public class InventoryServiceImpl implements IInventoryService
inventory.setId(UUID.randomUUID().toString());
inventory.setCreateBy(SystemUtils.getUserName());
inventory.setCreateUserCode(SystemUtils.getUserName());
inventory.setIsUsed(1L);
createInventoryInboundLog(inventory,inventory.getQuantity(),inventory.getCreateUserCode(),inventory.getCreateTime());
count = inventoryMapper.insertInventory(inventory);
}
......@@ -224,10 +225,17 @@ public class InventoryServiceImpl implements IInventoryService
// 新建实体,查看该物料在库存中数量,避免其他条件干扰
Inventory inventoryBefore = new Inventory();
inventoryBefore.setMaterialId(inventory.getMaterialId());
inventoryBefore = inventoryMapper.selectInventory(inventoryBefore);
if (inventoryBefore == null) {
List<Inventory> inventoryList = inventoryMapper.selectInventoryList(inventoryBefore);
if (inventoryList == null) {
inventoryBefore = new Inventory();
inventoryBefore.setQuantity(0L);
}else{
Long quantity = 0L;
for (Inventory inventoryItem : inventoryList) {
quantity += inventoryItem.getQuantity();
}
inventoryBefore.setQuantity(quantity);
}
transactions.setQuantityBefore(inventoryBefore.getQuantity());
transactions.setQuantityAfter(inventory.getQuantity() + addQty);
......
......@@ -22,6 +22,7 @@
<result property="itemStatus" column="item_status" />
<result property="receivedAt" column="received_at" />
<result property="receivedBy" column="received_by" />
<result property="labelQuantity" column="label_quantity"/>
<result property="remark" column="remark" />
<result property="isUsed" column="is_used" />
<result property="sortNo" column="sort_no" />
......@@ -35,7 +36,7 @@
<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,inbound_order_id 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, label_quantity, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code,inbound_order_id from inbound_order_items
</sql>
<select id="selectInboundOrderItemsList" parameterType="com.ruoyi.inventory.domain.InboundOrderItems" resultMap="InboundOrderItemsResult">
......@@ -84,6 +85,7 @@
<result property="locationId" column="location_id" />
<result property="locationName" column="location_name" />
<result property="plannedQuantity" column="planned_quantity" />
<result property="labelQuantity" column="label_quantity"/>
<result property="actualQuantity" column="actual_quantity" />
<result property="plannedPackages" column="planned_packages" />
<result property="actualPackages" column="actual_packages" />
......@@ -131,6 +133,7 @@
ii.item_status,
ii.received_at,
ii.received_by,
ii.label_quantity,
ii.remark,
ii.is_used,
ii.sort_no,
......@@ -197,6 +200,9 @@
<if test="receivedBy != null and receivedBy != ''">
and received_by = #{receivedBy}
</if>
<if test="labelQuantity != null and labelQuantity != ''">
and label_quantity = #{labelQuantity}
</if>
<if test="isUsed != null">
and is_used = #{isUsed}
</if>
......@@ -212,7 +218,7 @@
</where>
</select>
<!-- 添加入库明细sql 暂无用,新增明细的方法目前在主表的batchInboundOrderItems-->
<insert id="insertInboundOrderItems" parameterType="com.ruoyi.inventory.domain.InboundOrderItems">
insert into inbound_order_items
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -233,6 +239,7 @@
<if test="itemStatus != null">item_status,</if>
<if test="receivedAt != null">received_at,</if>
<if test="receivedBy != null">received_by,</if>
<if test="labelQuantity != null">label_quantity,</if>
<if test="remark != null">remark,</if>
<if test="isUsed != null">is_used,</if>
<if test="sortNo != null">sort_no,</if>
......@@ -260,6 +267,7 @@
<if test="itemStatus != null">#{itemStatus},</if>
<if test="receivedAt != null">#{receivedAt},</if>
<if test="receivedBy != null">#{receivedBy},</if>
<if test="labelQuantity != null">#{labelQuantity},</if>
<if test="remark != null">#{remark},</if>
<if test="isUsed != null">#{isUsed},</if>
<if test="sortNo != null">#{sortNo},</if>
......@@ -270,7 +278,7 @@
<if test="inboundOrderId != null">#{inboundOrderId},</if>
</trim>
</insert>
<!-- 修改明细,暂无用-->
<update id="updateInboundOrderItems" parameterType="com.ruoyi.inventory.domain.InboundOrderItems">
update inbound_order_items
<trim prefix="SET" suffixOverrides=",">
......@@ -290,6 +298,7 @@
<if test="itemStatus != null">item_status = #{itemStatus},</if>
<if test="receivedAt != null">received_at = #{receivedAt},</if>
<if test="receivedBy != null">received_by = #{receivedBy},</if>
<if test="labelQuantity != null">label_quantity = #{labelQuantity},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="isUsed != null">is_used = #{isUsed},</if>
<if test="sortNo != null">sort_no = #{sortNo},</if>
......@@ -313,7 +322,7 @@
</foreach>
</delete>
<!-- 入库统计的表格查询sql和映射字段 -->
<resultMap id="InboundDetailsResultMap" type="com.ruoyi.inventory.domain.vo.InboundDetailsVO">
<!-- 基础字段映射 -->
<result column="material_id" property="materialId" jdbcType="VARCHAR" />
......@@ -367,7 +376,13 @@
left join warehouses w on ioi.warehouse_id = w.id
left join storage_locations sl on ioi.location_id = sl.id
<where>
io.order_status = 2
io.order_status = 2
<if test="inboundDateStart != null">
AND DATE(io.inbound_date) &gt;= #{inboundDateStart}
</if>
<if test="inboundDateEnd != null">
AND DATE(io.inbound_date) &lt;= #{inboundDateEnd}
</if>
<if test="sapNo != null and sapNo != ''">
AND ms.sap_no = #{sapNo}
</if>
......@@ -401,6 +416,6 @@
ioi.unit_price,
ioi.remark,
io.inbound_date
order by inbound_date desc,ioi.order_id asc,ioi.material_id asc
order by date(inbound_date) desc,ioi.order_id asc,ioi.material_id asc
</select>
</mapper>
\ No newline at end of file
......@@ -84,10 +84,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderStatus != null "> and order_status = #{orderStatus}</if>
<!-- 新增按照日期范围查询-->
<if test="inboundDateStart != null">
AND inbound_date &gt;= #{inboundDateStart}
AND date(inbound_date) &gt;= #{inboundDateStart}
</if>
<if test="inboundDateEnd != null">
AND inbound_date &lt;= #{inboundDateEnd}
AND date(inbound_date) &lt;= #{inboundDateEnd}
</if>
<if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
<if test="totalPlannedQuantity != null "> and total_planned_quantity = #{totalPlannedQuantity}</if>
......@@ -99,7 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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>
order by inbound_date desc,create_time desc
order by date(inbound_date) desc,create_time desc
</select>
<select id="selectInboundOrdersById" parameterType="String" resultMap="InboundOrdersInboundOrderItemsResult">
......@@ -155,6 +155,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createUserCode != null">create_user_code,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateUserCode != null">update_user_code,</if>
<if test="isImport != null">is_import,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
......@@ -178,6 +179,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createUserCode != null">#{createUserCode},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateUserCode != null">#{updateUserCode},</if>
<if test="isImport != null">#{isImport},</if>
</trim>
</insert>
......@@ -231,9 +233,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<insert id="batchInboundOrderItems">
insert into inbound_order_items( 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, inbound_order_id) values
insert into inbound_order_items( 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, label_quantity, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code, inbound_order_id) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.id}, #{item.orderId}, #{item.materialId}, #{item.batchId}, #{item.warehouseId}, #{item.locationId}, #{item.plannedQuantity}, #{item.actualQuantity}, #{item.plannedPackages}, #{item.actualPackages}, #{item.divisor}, #{item.labelColor}, #{item.voucherNumber}, #{item.unitPrice}, #{item.itemStatus}, #{item.receivedAt}, #{item.receivedBy}, #{item.remark}, #{item.isUsed}, #{item.sortNo}, #{item.createTime}, #{item.createUserCode}, #{item.updateTime}, #{item.updateUserCode}, #{item.inboundOrderId})
( #{item.id}, #{item.orderId}, #{item.materialId}, #{item.batchId}, #{item.warehouseId}, #{item.locationId}, #{item.plannedQuantity}, #{item.actualQuantity}, #{item.plannedPackages}, #{item.actualPackages}, #{item.divisor}, #{item.labelColor}, #{item.voucherNumber}, #{item.unitPrice}, #{item.itemStatus}, #{item.receivedAt}, #{item.receivedBy}, #{item.labelQuantity}, #{item.remark}, #{item.isUsed}, #{item.sortNo}, #{item.createTime}, #{item.createUserCode}, #{item.updateTime}, #{item.updateUserCode}, #{item.inboundOrderId})
</foreach>
</insert>
......@@ -251,36 +253,110 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result column="total_money" property="totalMoney" jdbcType="DECIMAL"/>
</resultMap>
<select id="countInboundMaterialQuantity" resultMap="InboundMaterialTotalResultMap" parameterType="String">
SELECT t.material_name, t.total_quantity
FROM (
SELECT m.material_name,
COALESCE(SUM(ioi.actual_quantity), 0) as total_quantity
FROM materials as m
LEFT JOIN inbound_order_items as ioi ON m.id = ioi.material_id
LEFT JOIN inbound_orders as io ON io.id = ioi.inbound_order_id AND io.order_status = 2
WHERE m.is_used = 1 AND m.is_active = 1
GROUP BY m.id, m.material_name
ORDER BY total_quantity DESC
LIMIT 10
) t
ORDER BY t.total_quantity ASC;
select t.material_name,t.total_quantity from (
SELECT
m.material_name,
COALESCE(SUM(ioi.actual_quantity), 0) AS total_quantity
FROM materials AS m
LEFT JOIN (
SELECT ioi.material_id, ioi.actual_quantity
FROM
inbound_order_items AS ioi
INNER JOIN
inbound_orders AS io
ON
io.id = ioi.inbound_order_id
AND
io.order_status = 2
) AS ioi ON m.id = ioi.material_id
WHERE
m.is_used = 1
AND
m.is_active = 1
GROUP BY
m.id, m.material_name
ORDER BY
total_quantity DESC
) as t
order by total_quantity asc
</select>
<select id="countInboundMaterialMoney" resultMap="InboundMaterialTotalResultMap" parameterType="String">
select t.material_name,t.total_money
from(
select m.material_name,
COALESCE(sum(ioi.actual_quantity * ioi.unit_price), 0) as total_money
from materials as m
left join inbound_order_items as ioi
on m.id = ioi.material_id
left join inbound_orders as io
on io.id = ioi.inbound_order_id
and io.order_status = 2
where m.is_used = 1 and m.is_active = 1
group by m.id
order by total_money desc
limit 10
) t
SELECT
m.material_name,
COALESCE(SUM(ioi.actual_quantity * ioi.unit_price), 0) AS total_money
FROM materials AS m
LEFT JOIN (
SELECT ioi.material_id, ioi.actual_quantity,ioi.unit_price
FROM
inbound_order_items AS ioi
INNER JOIN
inbound_orders AS io
ON
io.id = ioi.inbound_order_id
AND
io.order_status = 2
) AS ioi ON m.id = ioi.material_id
WHERE
m.is_used = 1
AND
m.is_active = 1
GROUP BY
m.id, m.material_name
ORDER BY
total_money DESC
) as t
order by total_money asc
</select>
<!--导出-->
<select id="selectInboundOrdersAndItems" resultMap="InboundOrderAndItemsMap" parameterType="com.ruoyi.inventory.domain.InboundOrders">
select io.inbound_date, m.sap_no, m.material_name,
m.ts_code, io.batch_id, ioi.planned_quantity,
ioi.divisor, ioi.actual_packages, ioi.actual_quantity,
m.total_weight, sl.location_name, ioi.warehouse_id,
ioi.label_color, ioi.voucher_number, m.storage_temperature,
m.hazard_id, io.order_id, io.system_no, io.owner_id,
ioi.label_quantity, io.order_type, io.order_type_id, ioi.remark
from materials as m
inner join inbound_order_items as ioi on ioi.material_id = m.id
inner join inbound_orders as io on ioi.inbound_order_id = io.id
inner join storage_locations as sl on ioi.location_id = sl.id
</select>
<resultMap id="InboundOrderAndItemsMap" type="com.ruoyi.inventory.domain.TO.InboundItemsTO">
<!-- 基础字段映射:SQL字段名 -> Java实体类字段名 -->
<result column="inbound_date" property="inboundDate" />
<result column="sap_no" property="sapNo" />
<result column="material_name" property="materialName" />
<result column="ts_code" property="tsCode" />
<result column="batch_id" property="batchId" />
<result column="planned_quantity" property="plannedQuantity" />
<result column="remark" property="remark" />
<result column="divisor" property="divisor" />
<result column="actual_packages" property="actualPackages" />
<result column="actual_quantity" property="actualQuantity" />
<!-- 重量(成品):映射total_weight到weight -->
<result column="total_weight" property="weight" />
<result column="location_name" property="locationName" />
<result column="warehouse_id" property="warehouseId" />
<result column="label_color" property="labelColor" />
<result column="voucher_number" property="voucherNumber" />
<!-- 保温:映射storage_temperature到keepWarm -->
<result column="storage_temperature" property="keepWarm" />
<result column="hazard_id" property="hazardId" />
<result column="order_id" property="orderId" />
<result column="system_no" property="systemNo" />
<result column="owner_id" property="ownerId" />
<result column="label_quantity" property="labelQuantity" />
<result column="order_type" property="orderType" />
<result column="order_type_id" property="orderTypeId"/>
</resultMap>
</mapper>
\ No newline at end of file
......@@ -321,7 +321,7 @@
left join materials m on i.material_id = m.id
left join warehouses w on i.warehouses_id = w.id
left join storage_locations sl on i.location_id = sl.id
left join owners o on i.owner_id = o.owner_code
left join owners o on i.owner_id = o.id
</sql>
<select id="selectInventoryDetailList" parameterType="Inventory" resultMap="InventoryResult">
<include refid="selectInventoryDetailVo"/>
......
......@@ -17,7 +17,13 @@ public interface ISysDictDataService
* @return 字典数据集合信息
*/
public List<SysDictData> selectDictDataList(SysDictData dictData);
/**
* 根据字典类型查询字典数据
*
* @param dictType 字典数据信息
* @return 字典数据集合信息
*/
public List<SysDictData> selectDictDataByType(String dictType);
/**
* 根据字典类型和字典键值查询字典数据信息
*
......
......@@ -32,6 +32,15 @@ public class SysDictDataServiceImpl implements ISysDictDataService
}
/**
* 根据字典类型查询字典数据
*
* @param dictType 字典数据信息
* @return 字典数据集合信息
*/
public List<SysDictData> selectDictDataByType(String dictType){
return dictDataMapper.selectDictDataByType(dictType);
}
/**
* 根据字典类型和字典键值查询字典数据信息
*
* @param dictType 字典类型
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论