Commit ebf1004d by yubin

导入无库存插入-库存 加导入手动标识

parent 06bd89ab
......@@ -3,14 +3,15 @@
<!-- 页面标题和操作按钮 -->
<PageTitle>
<template #buttons>
<el-button
<el-button
type="primary"
plain
icon="el-icon-plus"
size="medium"
@click="handleAdd"
v-hasPermi="['inventory:orders:add']"
v-hasPermi="['inventory:inbound:add']"
>新增</el-button>
<el-button
type="success"
plain
......@@ -18,16 +19,9 @@
size="medium"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['inventory:orders:edit']"
v-hasPermi="['inventory:inbound:edit']"
>修改</el-button>
<el-button
type="success"
plain
icon="el-icon-edit"
size="medium"
@click="handleImport"
v-hasPermi="['inventory:orders:add']"
>导入</el-button>
<el-button
type="danger"
plain
......@@ -35,15 +29,25 @@
size="medium"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['inventory:orders:remove']"
v-hasPermi="['inventory:inbound:remove']"
>删除</el-button>
<el-button
type="warning"
plain
icon="el-icon-upload"
size="medium"
@click="handleImport"
v-hasPermi="['inventory:inbound:import']"
>导入</el-button>
<el-button
type="warning"
plain
icon="el-icon-download"
size="medium"
@click="handleExport"
v-hasPermi="['inventory:orders:export']"
v-hasPermi="['inventory:inbound:export']"
>导出</el-button>
</template>
</PageTitle>
......@@ -106,32 +110,16 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="货主" prop="ownerId">
<el-input
v-model="queryOwnerName"
placeholder="请选择货主"
readonly
@focus="openOwnerSelector('query')"
@click="openOwnerSelector('query')"
:suffix-icon="''"
clearable
>
<template v-if="queryOwnerName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearQueryOwner"
></i>
</template>
</el-input>
</el-form-item>
<el-form-item label="出库日期" prop="inboundDate">
<!-- 【核心修改1】出库日期改为时间段选择器 -->
<el-form-item label="时间段" prop="dateRange">
<el-date-picker
clearable
v-model="queryParams.inboundDate"
type="date"
v-model="queryParams.dateRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
placeholder="请选择出库日期"
style="width: 100%"
/>
</el-form-item>
......@@ -150,14 +138,7 @@
/>
</el-select>
</el-form-item>
<el-form-item label="目的地" prop="destination">
<el-input
v-model="queryParams.destination"
placeholder="请输入目的地"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="仓库" prop="warehouseId">
<el-input
v-model="queryWarehouseName"
......@@ -391,8 +372,6 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
......@@ -626,7 +605,7 @@ export default {
ownerId: false,
outboundOrderId: false
},
// 查询参数
// 【核心修改2】查询参数:替换inboundDate为dateRange,新增startDate/endDate
queryParams: {
pageNum: 1,
pageSize: 10,
......@@ -638,7 +617,9 @@ export default {
warehouseId: null,
ownerId: null,
orderStatus: null,
inboundDate: null,
dateRange: null, // 日期范围选择器绑定
startDate: null, // 开始日期
endDate: null, // 结束日期
destination: null,
totalPlannedQuantity: null,
totalActualQuantity: null,
......@@ -844,7 +825,8 @@ export default {
}).catch(() => {
// 取消确认时不执行任何操作
})
}, // 修复:获取要传递给子组件的初始化明细数据(按物料分组)
},
// 修复:获取要传递给子组件的初始化明细数据(按物料分组)
getInitDetails() {
// 编辑场景:传递当前物料分组的所有明细(确保子组件反显)
if (this.isEditDetail && this.currentMaterialId) {
......@@ -876,7 +858,6 @@ export default {
labelColor: Number(this.currentGroupData.items[0].labelColor) || 0,
unitPrice: Number(this.currentGroupData.items[0].unitPrice) || 0.00,
amount: Number(this.currentGroupData.items[0].amount) || 0.00,
itemStatus: Number(this.currentGroupData.items[0].itemStatus) || 1,
warehouseName: this.currentGroupData.items[0].warehouseName || '',
locationName: this.currentGroupData.items[0].locationName || ''
}
......@@ -1147,14 +1128,21 @@ export default {
this.tableKey += 1
})
},
/** 查询出库单主列表 */
/** 【核心修改3】查询出库单主列表 - 处理时间段参数 */
getList() {
this.loading = true
// 修改点1:查询时,将前端的orderId映射到后端的outboundOrderId参数
// 处理日期范围:将dateRange拆分为startDate/endDate
const { dateRange, ...restParams } = this.queryParams
const queryParams = {
...this.queryParams,
outboundOrderId: this.queryParams.orderId // 映射查询参数
...restParams,
outboundOrderId: this.queryParams.orderId, // 映射查询参数
// 拆分日期范围
startDate: dateRange ? dateRange[0] : null,
endDate: dateRange ? dateRange[1] : null
}
// 删除原inboundDate参数(如果存在)
delete queryParams.inboundDate
listOrders(queryParams).then(response => {
// 修改点2:将后端返回的outboundOrderId映射为前端的orderId显示
this.ordersList = (response.rows || []).map(item => ({
......@@ -1238,7 +1226,7 @@ export default {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
/** 【核心修改4】重置按钮操作 - 重置日期范围 */
resetQuery() {
// 检查ref存在性
if (this.$refs.queryForm) {
......@@ -1253,7 +1241,9 @@ export default {
warehouseId: null,
ownerId: null,
orderStatus: null,
inboundDate: null,
dateRange: null, // 重置日期范围
startDate: null,
endDate: null,
destination: null,
totalPlannedQuantity: null,
totalActualQuantity: null,
......@@ -1560,16 +1550,24 @@ export default {
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
/** 【核心修改5】导出按钮操作 - 传递时间段参数 */
handleExport() {
// 处理日期范围参数
const { dateRange, ...restParams } = this.queryParams
// 适配导出参数,将orderId映射到outboundOrderId
const exportParams = {
...this.queryParams,
...restParams,
outboundOrderId: this.queryParams.orderId, // 映射导出参数
orderType: this.queryParams.orderType, // 新增:导出订单类型参数
// 拆分日期范围
startDate: dateRange ? dateRange[0] : null,
endDate: dateRange ? dateRange[1] : null
}
// 删除原inboundDate参数
delete exportParams.inboundDate
this.download('inventory/orders/export', exportParams, `orders_${new Date().getTime()}.xlsx`)
}
}
}
</script>
</script>
\ No newline at end of file
......@@ -80,7 +80,7 @@ import com.ruoyi.common.utils.reflect.ReflectUtils;
/**
* Excel相关处理
*
*
* @author ruoyi
*/
public class ExcelUtil<T>
......@@ -256,35 +256,43 @@ public class ExcelUtil<T>
}
/**
* 彻底清理所有空白字符(包括空格、全角空格、不间断空格、零宽空格、换行、制表符等)
* @param str 待清理字符串
* @return 清理后的字符串
*/
private static String cleanBlankChars(String str) {
if (StringUtils.isBlank(str)) {
return "";
}
// 移除所有类型的空格(半角、全角、不间断空格),保留其他字符
return str.replaceAll("[\\s\u3000\u00A0]", "").trim();
}
/**
* 创建对象的子列表名称
*/
public void createSubHead()
{
if (isSubList())
{
public void createSubHead() {
if (isSubList()) {
Row subRow = sheet.createRow(rownum);
int column = 0;
int subFieldSize = subFields != null ? subFields.size() : 0;
for (Object[] objects : fields)
{
for (Object[] objects : fields) {
Field field = (Field) objects[0];
Excel attr = (Excel) objects[1];
if (Collection.class.isAssignableFrom(field.getType()))
{
// 子列表表头名称清理空白字符
String cleanAttrName = cleanBlankChars(attr.name());
if (Collection.class.isAssignableFrom(field.getType())) {
Cell cell = subRow.createCell(column);
cell.setCellValue(attr.name());
cell.setCellValue(cleanAttrName); // 使用清理后的名称
cell.setCellStyle(styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor())));
if (subFieldSize > 1)
{
if (subFieldSize > 1) {
CellRangeAddress cellAddress = new CellRangeAddress(rownum, rownum, column, column + subFieldSize - 1);
sheet.addMergedRegion(cellAddress);
}
column += subFieldSize;
}
else
{
} else {
Cell cell = subRow.createCell(column++);
cell.setCellValue(attr.name());
cell.setCellValue(cleanAttrName); // 使用清理后的名称
cell.setCellStyle(styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor())));
}
}
......@@ -294,7 +302,7 @@ public class ExcelUtil<T>
/**
* 对excel表单默认第一个索引名转换成list
*
*
* @param is 输入流
* @return 转换后集合
*/
......@@ -305,7 +313,7 @@ public class ExcelUtil<T>
/**
* 对excel表单默认第一个索引名转换成list
*
*
* @param is 输入流
* @param titleNum 标题占用行数
* @return 转换后集合
......@@ -331,7 +339,7 @@ public class ExcelUtil<T>
/**
* 对excel表单指定表格索引名转换成list
*
*
* @param sheetName 表格索引名
* @param titleNum 标题占用行数
* @param is 输入流
......@@ -362,33 +370,47 @@ public class ExcelUtil<T>
int rows = sheet.getLastRowNum();
if (rows > 0)
{
// 定义一个map用于存放excel列的序号和field.
Map<String, Integer> cellMap = new HashMap<String, Integer>();
// 获取表头
Row heard = sheet.getRow(titleNum);
for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++)
{
log.info("【导入调试】原始表头行单元格数量:{}", heard.getPhysicalNumberOfCells());
for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++) {
Cell cell = heard.getCell(i);
if (StringUtils.isNotNull(cell))
{
String value = this.getCellValue(heard, i).toString();
cellMap.put(value, i);
}
else
{
cellMap.put(null, i);
String originalValue = "";
String matchKey = "";
if (StringUtils.isNotNull(cell)) {
originalValue = this.getCellValue(heard, i).toString();
// 强制去空格(包括中间、开头、结尾的所有空格)
matchKey = originalValue.replaceAll("\\s+", "").replaceAll("[\u3000\u00A0]", "").trim();
cellMap.put(matchKey, i);
// 打印每一列的原始值和匹配key(关键调试日志)
log.info("【导入调试】列{}:原始值=[{}] → 匹配key=[{}]", i, originalValue, matchKey);
} else {
cellMap.put(matchKey, i);
log.info("【导入调试】列{}:空单元格 → 匹配key=[{}]", i, matchKey);
}
}
// 有数据时才处理 得到类的所有field.
// 有数据时才处理 得到类的所有field.
List<Object[]> fields = this.getFields();
Map<Integer, Object[]> fieldsMap = new HashMap<Integer, Object[]>();
for (Object[] objects : fields)
{
// 打印所有注解字段(调试)
log.info("【导入调试】注解字段总数:{}", fields.size());
for (Object[] objects : fields) {
Excel attr = (Excel) objects[1];
Integer column = cellMap.get(attr.name());
if (column != null)
{
String originalAttrName = attr.name();
// 注解名称强制去空格(和表头用相同规则)
String attrMatchKey = originalAttrName.replaceAll("\\s+", "").replaceAll("[\u3000\u00A0]", "").trim();
// 打印注解的原始名称和匹配key
log.info("【导入调试】注解字段:原始名=[{}] → 匹配key=[{}]", originalAttrName, attrMatchKey);
Integer column = cellMap.get(attrMatchKey);
if (column != null) {
fieldsMap.put(column, objects);
log.info("【导入调试】匹配成功:注解[{}] → Excel列{}", originalAttrName, column);
} else {
log.warn("【导入调试】匹配失败:注解[{}](匹配key=[{}])未在Excel表头中找到", originalAttrName, attrMatchKey);
}
}
for (int i = titleNum + 1; i <= rows; i++)
......@@ -514,7 +536,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param list 导出数据集合
* @param sheetName 工作表的名称
* @return 结果
......@@ -526,7 +548,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param list 导出数据集合
* @param sheetName 工作表的名称
* @param title 标题
......@@ -540,7 +562,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param response 返回数据
* @param list 导出数据集合
* @param sheetName 工作表的名称
......@@ -553,7 +575,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param response 返回数据
* @param list 导出数据集合
* @param sheetName 工作表的名称
......@@ -570,7 +592,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param sheetName 工作表的名称
* @return 结果
*/
......@@ -581,7 +603,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param sheetName 工作表的名称
* @param title 标题
* @return 结果
......@@ -594,7 +616,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param sheetName 工作表的名称
* @return 结果
*/
......@@ -605,7 +627,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param sheetName 工作表的名称
* @param title 标题
* @return 结果
......@@ -620,7 +642,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @return 结果
*/
public void exportExcel(HttpServletResponse response)
......@@ -642,7 +664,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @return 结果
*/
public AjaxResult exportExcel()
......@@ -710,7 +732,7 @@ public class ExcelUtil<T>
/**
* 填充excel数据
*
*
* @param index 序号
* @param row 单元格行
*/
......@@ -808,7 +830,7 @@ public class ExcelUtil<T>
/**
* 创建表格样式
*
*
* @param wb 工作薄对象
* @return 样式列表
*/
......@@ -864,7 +886,7 @@ public class ExcelUtil<T>
/**
* 根据Excel注解创建表格头样式
*
*
* @param wb 工作薄对象
* @return 自定义样式列表
*/
......@@ -900,7 +922,7 @@ public class ExcelUtil<T>
/**
* 根据Excel注解创建表格列样式
*
*
* @param wb 工作薄对象
* @return 自定义样式列表
*/
......@@ -932,7 +954,7 @@ public class ExcelUtil<T>
/**
* 根据Excel注解创建表格列样式
*
*
* @param styles 自定义样式列表
* @param field 属性列信息
* @param excel 注解信息
......@@ -977,8 +999,8 @@ public class ExcelUtil<T>
{
// 创建列
Cell cell = row.createCell(column);
// 写入列信息
cell.setCellValue(attr.name());
// 写入列信息(清理空白字符)
cell.setCellValue(cleanBlankChars(attr.name()));
setDataValidation(attr, row, column);
cell.setCellStyle(styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor())));
if (isSubList())
......@@ -995,7 +1017,7 @@ public class ExcelUtil<T>
/**
* 设置单元格信息
*
*
* @param value 单元格值
* @param attr 注解相关
* @param cell 单元格信息
......@@ -1181,7 +1203,7 @@ public class ExcelUtil<T>
/**
* 设置 POI XSSFSheet 单元格提示或选择框
*
*
* @param sheet 表单
* @param textlist 下拉框显示的内容
* @param promptContent 提示内容
......@@ -1191,7 +1213,7 @@ public class ExcelUtil<T>
* @param endCol 结束列
*/
public void setPromptOrValidation(Sheet sheet, String[] textlist, String promptContent, int firstRow, int endRow,
int firstCol, int endCol)
int firstCol, int endCol)
{
DataValidationHelper helper = sheet.getDataValidationHelper();
DataValidationConstraint constraint = textlist.length > 0 ? helper.createExplicitListConstraint(textlist) : helper.createCustomConstraint("DD1");
......@@ -1218,7 +1240,7 @@ public class ExcelUtil<T>
/**
* 设置某些列的值只能输入预制的数据,显示下拉框(兼容超出一定数量的下拉框).
*
*
* @param sheet 要设置的sheet.
* @param textlist 下拉框显示的内容
* @param promptContent 提示内容
......@@ -1288,7 +1310,7 @@ public class ExcelUtil<T>
/**
* 解析导出值 0=男,1=女,2=未知
*
*
* @param propertyValue 参数值
* @param converterExp 翻译注解
* @param separator 分隔符
......@@ -1325,7 +1347,7 @@ public class ExcelUtil<T>
/**
* 反向解析值 男=0,女=1,未知=2
*
*
* @param propertyValue 参数值
* @param converterExp 翻译注解
* @param separator 分隔符
......@@ -1362,7 +1384,7 @@ public class ExcelUtil<T>
/**
* 解析字典值
*
*
* @param dictValue 字典值
* @param dictType 字典类型
* @param separator 分隔符
......@@ -1375,7 +1397,7 @@ public class ExcelUtil<T>
/**
* 反向解析值字典值
*
*
* @param dictLabel 字典标签
* @param dictType 字典类型
* @param separator 分隔符
......@@ -1388,7 +1410,7 @@ public class ExcelUtil<T>
/**
* 数据处理器
*
*
* @param value 数据值
* @param excel 数据注解
* @return
......@@ -1464,7 +1486,7 @@ public class ExcelUtil<T>
/**
* 获取下载路径
*
*
* @param filename 文件名称
*/
public String getAbsoluteFile(String filename)
......@@ -1480,7 +1502,7 @@ public class ExcelUtil<T>
/**
* 获取bean中的属性值
*
*
* @param vo 实体对象
* @param field 字段
* @param excel 注解
......@@ -1512,7 +1534,7 @@ public class ExcelUtil<T>
/**
* 以类的属性的get方法方法形式获取值
*
*
* @param o
* @param name
* @return value
......@@ -1601,26 +1623,21 @@ public class ExcelUtil<T>
}
}
// 多注解
if (field.isAnnotationPresent(Excels.class))
{
// 多注解(Excels)处理
if (field.isAnnotationPresent(Excels.class)) {
Excels attrs = field.getAnnotation(Excels.class);
Excel[] excels = attrs.value();
for (Excel attr : excels)
{
if (StringUtils.isNotEmpty(includeFields))
{
for (Excel attr : excels) {
// 注解名称先清理空白字符
String cleanAttrName = cleanBlankChars(attr.name());
if (StringUtils.isNotEmpty(includeFields)) {
if (ArrayUtils.contains(this.includeFields, field.getName() + "." + attr.targetAttr())
&& (attr != null && (attr.type() == Type.ALL || attr.type() == type)))
{
&& (attr != null && (attr.type() == Type.ALL || attr.type() == type))) {
fields.add(new Object[] { field, attr });
}
}
else
{
} else {
if (!ArrayUtils.contains(this.excludeFields, field.getName() + "." + attr.targetAttr())
&& (attr != null && (attr.type() == Type.ALL || attr.type() == type)))
{
&& (attr != null && (attr.type() == Type.ALL || attr.type() == type))) {
fields.add(new Object[] { field, attr });
}
}
......@@ -1655,7 +1672,7 @@ public class ExcelUtil<T>
/**
* 创建工作表
*
*
* @param sheetNo sheet数量
* @param index 序号
*/
......@@ -1673,7 +1690,7 @@ public class ExcelUtil<T>
/**
* 获取单元格值
*
*
* @param row 获取的行
* @param column 获取单元格列号
* @return 单元格值
......@@ -1733,7 +1750,7 @@ public class ExcelUtil<T>
/**
* 判断是否是空行
*
*
* @param row 判断的行
* @return
*/
......@@ -1814,7 +1831,7 @@ public class ExcelUtil<T>
/**
* 格式化不同类型的日期对象
*
*
* @param dateFormat 日期格式
* @param val 被格式化的日期对象
* @return 格式化后的日期字符
......@@ -1880,7 +1897,7 @@ public class ExcelUtil<T>
/**
* 获取对象的子列表方法
*
*
* @param name 名称
* @param pojoClass 类对象
* @return 子列表方法
......@@ -1914,12 +1931,12 @@ public class ExcelUtil<T>
return IntStream.range(0, headerRow.getLastCellNum())
.mapToObj(headerRow::getCell)
.map(cell -> {
// 单元格类型容错(数字/字符串统一转字符串)
if (cell == null) {
return "";
}
// 统一转换为字符串并清理空白字符
cell.setCellType(CellType.STRING);
return StringUtils.trim(cell.getStringCellValue());
return cleanBlankChars(cell.getStringCellValue());
})
.filter(StringUtils::isNotBlank)
.collect(Collectors.toList());
......@@ -1928,7 +1945,4 @@ public class ExcelUtil<T>
return Collections.emptyList();
}
}
}
}
\ No newline at end of file
......@@ -59,6 +59,13 @@ public class OutboundOrders extends BaseEntity
@Excel(name = "出库单状态1-草稿 2-已完成 3-已取消 字典,检索条件")
private Long orderStatus;
/** 开始日期(检索条件) */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startDate;
/** 结束日期(检索条件) */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endDate;
/** 出库日期 日期无时间 */
......
......@@ -9,13 +9,14 @@
<result property="orderId" column="order_id" />
<result property="systemNo" column="system_no" />
<result property="orderTypeId" column="order_type_id" />
<result property="orderType" column="order_type" /> <!-- 新增order_type字段映射 -->
<result property="orderType" column="order_type" />
<result property="batchCode" column="batch_code" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehouseName" column="warehouse_name" />
<result property="ownerId" column="owner_id" />
<result property="ownerName" column="owner_name" />
<result property="orderStatus" column="order_status" />
<!-- 保留原字段映射,新增startDate/endDate用于查询 -->
<result property="inboundDate" column="inbound_date" />
<result property="destination" column="destination" />
<result property="totalPlannedQuantity" column="total_planned_quantity" />
......@@ -75,7 +76,7 @@
oo.order_id,
oo.system_no,
oo.order_type_id,
oo.order_type, -- 新增order_type字段查询
oo.order_type,
oo.batch_code,
oo.warehouse_id,
w.warehouses_name as warehouse_name,
......@@ -105,12 +106,14 @@
<if test="orderId != null and orderId != ''"> and oo.order_id = #{orderId}</if>
<if test="systemNo != null and systemNo != ''"> and oo.system_no = #{systemNo}</if>
<if test="orderTypeId != null and orderTypeId != ''"> and oo.order_type_id = #{orderTypeId}</if>
<if test="orderType != null and orderType != ''"> and oo.order_type = #{orderType}</if> <!-- 新增order_type查询条件 -->
<if test="orderType != null and orderType != ''"> and oo.order_type = #{orderType}</if>
<if test="batchCode != null and batchCode != ''"> and oo.batch_code = #{batchCode}</if>
<if test="warehouseId != null and warehouseId != ''"> and oo.warehouse_id = #{warehouseId}</if>
<if test="ownerId != null and ownerId != ''"> and oo.owner_id = #{ownerId}</if>
<if test="orderStatus != null "> and oo.order_status = #{orderStatus}</if>
<if test="inboundDate != null "> and oo.inbound_date = #{inboundDate}</if>
<!-- 替换为时间段查询:startDate和endDate -->
<if test="startDate != null"> and oo.inbound_date &gt;= #{startDate}</if>
<if test="endDate != null"> and oo.inbound_date &lt;= #{endDate}</if>
<if test="destination != null and destination != ''"> and oo.destination = #{destination}</if>
<if test="totalPlannedQuantity != null "> and oo.total_planned_quantity = #{totalPlannedQuantity}</if>
<if test="totalActualQuantity != null "> and oo.total_actual_quantity = #{totalActualQuantity}</if>
......@@ -126,7 +129,7 @@
oo.order_id,
oo.system_no,
oo.order_type_id,
oo.order_type, -- 新增order_type字段查询
oo.order_type,
oo.batch_code,
oo.warehouse_id,
w.warehouses_name as warehouse_name,
......@@ -194,11 +197,12 @@
<if test="orderId != null">order_id,</if>
<if test="systemNo != null">system_no,</if>
<if test="orderTypeId != null">order_type_id,</if>
<if test="orderType != null">order_type,</if> <!-- 新增order_type字段插入 -->
<if test="orderType != null">order_type,</if>
<if test="batchCode != null">batch_code,</if>
<if test="warehouseId != null">warehouse_id,</if>
<if test="ownerId != null">owner_id,</if>
<if test="orderStatus != null">order_status,</if>
<!-- 保留inboundDate字段的插入(业务字段仍需存储) -->
<if test="inboundDate != null">inbound_date,</if>
<if test="destination != null">destination,</if>
<if test="totalPlannedQuantity != null">total_planned_quantity,</if>
......@@ -217,7 +221,7 @@
<if test="orderId != null">#{orderId},</if>
<if test="systemNo != null">#{systemNo},</if>
<if test="orderTypeId != null">#{orderTypeId},</if>
<if test="orderType != null">#{orderType},</if> <!-- 新增order_type值插入 -->
<if test="orderType != null">#{orderType},</if>
<if test="batchCode != null">#{batchCode},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="ownerId != null">#{ownerId},</if>
......@@ -243,7 +247,7 @@
<if test="orderId != null">order_id = #{orderId},</if>
<if test="systemNo != null">system_no = #{systemNo},</if>
<if test="orderTypeId != null">order_type_id = #{orderTypeId},</if>
<if test="orderType != null">order_type = #{orderType},</if> <!-- 新增order_type字段更新 -->
<if test="orderType != null">order_type = #{orderType},</if>
<if test="batchCode != null">batch_code = #{batchCode},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="ownerId != null">owner_id = #{ownerId},</if>
......@@ -304,7 +308,6 @@
</foreach>
</insert>
<select id="SelectOutboundOrdersMaterialsTopTenByQuantity" resultType="java.util.Map">
select
m.material_name as name,
......@@ -316,7 +319,7 @@
and ooi.shipped_at >= DATE_FORMAT(CURDATE(), '%Y-%m-01 00:00:00')
and ooi.shipped_at &lt; DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 MONTH), '%Y-%m-01 00:00:00')
where
m.is_used =1
m.is_used =1
and m.is_active =1
group by m.id, m.material_name
order by value desc
......@@ -325,24 +328,26 @@
<select id="SelectOutboundOrdersMaterialsTopTenByAmount" resultType="java.util.Map">
select
m.material_name as name,
sum(IFNULL(ooi.actual_quantity, 0) * IFNULL(ooi.unit_price, 0)) as value
m.material_name as name,
sum(IFNULL(ooi.actual_quantity, 0) * IFNULL(ooi.unit_price, 0)) as value
from materials m
left join outbound_order_items ooi
left join outbound_order_items ooi
on ooi.material_id = m.id
and ooi.is_used = 1
and ooi.shipped_at >= DATE_FORMAT(CURDATE(), '%Y-%m-01 00:00:00')
and ooi.shipped_at &lt; DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 MONTH), '%Y-%m-01 00:00:00')
and ooi.is_used = 1
and ooi.shipped_at >= DATE_FORMAT(CURDATE(), '%Y-%m-01 00:00:00')
and ooi.shipped_at &lt; DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 MONTH), '%Y-%m-01 00:00:00')
where
m.is_used =1
m.is_used =1
and m.is_active =1
group by m.id, m.material_name
order by value desc
limit 10;
limit 10;
</select>
<select id="outboundOrdersCount" resultType="String">
select count(*) from outbound_orders where is_used = 1 and order_status=2 and inbound_date &gt;= DATE_FORMAT(CURDATE(), '%Y-%m-01')
and inbound_date &lt; DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 MONTH), '%Y-%m-01')
select count(*) from outbound_orders where is_used = 1 and order_status=2
and inbound_date &gt;= DATE_FORMAT(CURDATE(), '%Y-%m-01')
and inbound_date &lt; DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 MONTH), '%Y-%m-01')
</select>
<update id="batchUpdateInventory">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论