Commit 69db319b by yubin

修bug

parent 6dd5c256
......@@ -58,7 +58,14 @@ export function listInboundOutboundStatistics(query) {
params: query
})
}
// 查询出入库统计列表详细
export function listInboundOutboundStatisticsList(query) {
return request({
url: '/inventory/items/getStatisticsInfo',
method: 'get',
params: query
})
}
// 导出出入库统计数据
export function exportInboundOutboundStatistics(query) {
return request({
......
......@@ -18,152 +18,137 @@
<div class="page-container">
<!-- 物料查询表单 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="主订单号" prop="mainOrderId">
<el-input
v-model="queryParams.mainOrderId"
placeholder="请输入主订单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="时间段" prop="dateRange">
<el-date-picker
v-model="queryParams.dateRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
clearable
/>
</el-form-item>
<el-form-item label="货主" prop="ownerId">
<el-input
v-model="queryOwnerName"
placeholder="请选择货主"
readonly
@focus="openOwnerSelector"
:suffix-icon="''"
>
<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="materialId">
<el-input
v-model="queryParams.materialId"
placeholder="请输入物料ID或编码"
clearable
@keyup.enter.native="handleQuery"
<el-form-item label="主订单号" prop="mainOrderId">
<el-input
v-model="queryParams.mainOrderId"
placeholder="请输入主订单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="时间段" prop="dateRange">
<el-date-picker
v-model="queryParams.dateRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
clearable
/>
</el-form-item>
<el-form-item label="货主" prop="ownerId">
<el-input
v-model="queryOwnerName"
placeholder="请选择货主"
readonly
@focus="openOwnerSelector"
:suffix-icon="''"
>
<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="materialId">
<el-input
v-model="queryParams.materialId"
placeholder="请输入物料ID或编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="仓库" prop="warehouseId">
<el-input
v-model="queryWarehouseName"
placeholder="请选择仓库"
readonly
@focus="openWarehouseSelector"
:suffix-icon="''"
>
<template v-if="queryWarehouseName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearQueryWarehouse"
></i>
</template>
</el-input>
</el-form-item>
<el-form-item label="库位" prop="locationId">
<el-input
v-model="queryLocationName"
placeholder="请选择库位"
readonly
@focus="openLocationSelector"
:suffix-icon="''"
:disabled="!queryParams.warehouseId"
>
<template v-if="queryLocationName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearQueryLocation"
></i>
</template>
</el-input>
</el-form-item>
<el-form-item label="订单状态" prop="orderStatus">
<el-select v-model="queryParams.orderStatus" placeholder="请选择订单状态" clearable class="w20">
<el-option
v-for="item in orderStatusOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-form-item>
<el-form-item label="仓库" prop="warehouseId">
<el-input
v-model="queryWarehouseName"
placeholder="请选择仓库"
readonly
@focus="openWarehouseSelector"
:suffix-icon="''"
>
<template v-if="queryWarehouseName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearQueryWarehouse"
></i>
</template>
</el-input>
</el-form-item>
<el-form-item label="库位" prop="locationId">
<el-input
v-model="queryLocationName"
placeholder="请选择库位"
readonly
@focus="openLocationSelector"
:suffix-icon="''"
:disabled="!queryParams.warehouseId"
>
<template v-if="queryLocationName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearQueryLocation"
></i>
</template>
</el-input>
</el-form-item>
<el-form-item label="订单状态" prop="orderStatus">
<el-select v-model="queryParams.orderStatus" placeholder="请选择订单状态" clearable class="w20">
<el-option
v-for="item in orderStatusOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 物料查询表格(折叠面板分组) -->
<!-- 物料查询表格 -->
<div class="table-container">
<el-collapse v-loading="loading" accordion>
<!-- 遍历SAP分组 -->
<el-collapse-item
v-for="(group, groupIndex) in groupedList"
:key="groupIndex"
:title="`SAP物料号:${group.sapNo || '未分类'}(共${group.items.length}条)`"
:name="group.sapNo || `uncategorized-${groupIndex}`"
>
<el-table
:data="group.items"
border
style="width: 100%; margin-top: 8px;"
>
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column label="物料名称" align="center" prop="materialName" min-width="150" show-overflow-tooltip />
<el-table-column label="TS Code" align="center" prop="tsCode" width="120" />
<el-table-column label="危险类别" align="center" prop="hazardId" width="120" />
<el-table-column label="规格型号" align="center" prop="specification" width="120" />
<el-table-column label="计量单位" align="center" prop="materialUnit" width="120" />
<el-table-column label="单位重量" align="center" prop="unitWeight" width="120">
<template slot-scope="scope">
{{ formatAmount(scope.row.unitWeight || 0) }}
</template>
</el-table-column>
<el-table-column label="计划数量" align="center" prop="plannedQuantity" width="100" />
<el-table-column label="实际数量" align="center" prop="actualQuantity" width="100" />
<el-table-column label="总额" align="center" prop="totalAmount" width="100">
<template slot-scope="scope">
{{ formatAmount(scope.row.totalAmount || 0) }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleViewDetail(scope.row)"
>详情</el-button>
</template>
</el-table-column>
</el-table>
</el-collapse-item>
<!-- 无数据提示 -->
<div v-if="!loading && groupedList.length === 0" class="no-data">暂无数据</div>
</el-collapse>
<el-table v-loading="loading" :data="returnOrderItemList" border height="100%" style="width: 100%">
<el-table-column type="index" label="序号" width="60" align="center" fixed="left" />
<el-table-column label="物料名称" align="center" prop="materialName" min-width="150" show-overflow-tooltip />
<el-table-column label="SAP物料号" align="center" prop="sapNo" width="120" />
<el-table-column label="TS Code" align="center" prop="tsCode" width="120" />
<el-table-column label="危险类别" align="center" prop="hazardId" width="120" />
<el-table-column label="规格型号" align="center" prop="specification" width="120" />
<el-table-column label="计量单位" align="center" prop="materialUnit" width="120" />
<el-table-column label="单位重量" align="center" prop="unitWeight" width="120" >
<template slot-scope="scope">
{{ formatAmount(scope.row.unitWeight || 0) }}
</template>
</el-table-column>
<el-table-column label="计划数量" align="center" prop="plannedQuantity" width="100" />
<el-table-column label="实际数量" align="center" prop="actualQuantity" width="100" />
<el-table-column label="总额" align="center" prop="totalAmount" width="100" >
<template slot-scope="scope">
{{ formatAmount(scope.row.totalAmount || 0) }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleViewDetail(scope.row)"
>详情</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页组件(全局分页,按原始数据总数分页) -->
<!-- 分页组件 -->
<pagination
v-show="total>0"
:total="total"
......@@ -304,7 +289,7 @@
</template>
<script>
import { listInboundOutboundStatistics, exportInboundOutboundStatistics } from "@/api/inventory/items"
import { listInboundOutboundStatistics, exportInboundOutboundStatistics,listInboundOutboundStatisticsList } from "@/api/inventory/items"
import RightToolbar from "@/components/RightToolbar"
import PageTitle from "@/components/PageTitle"
import OwnerSelector from "@/views/compononents/OwnerSelector.vue"
......@@ -325,7 +310,7 @@ export default {
loading: true,
showSearch: true,
total: 0,
groupedList: [], // 按SAP分组后的列表
returnOrderItemList: [],
queryParams: {
pageNum: 1,
pageSize: 10,
......@@ -386,36 +371,11 @@ export default {
delete params.dateRange
listInboundOutboundStatistics(params).then(response => {
const rawList = response.rows || []
this.returnOrderItemList = response.rows || []
this.total = response.total || 0
// 核心:按sapNo分组
const groupedMap = {}
rawList.forEach(item => {
// sapNo为空时归为"未分类"
const sapKey = item.sapNo || '未分类'
if (!groupedMap[sapKey]) {
groupedMap[sapKey] = []
}
groupedMap[sapKey].push(item)
})
// 转换为分组列表(用于折叠面板渲染)
this.groupedList = Object.keys(groupedMap).map(sapNo => ({
sapNo,
items: groupedMap[sapNo],
expanded: false // 默认全部折叠,可改为 true 全部展开
}))
// 默认展开第一个分组(可选)
if (this.groupedList.length > 0) {
this.groupedList[0].expanded = true
}
this.loading = false
}).catch(() => {
this.loading = false
this.groupedList = []
})
},
handleQuery() {
......@@ -526,7 +486,7 @@ export default {
params.warehouseId = params.warehouseId || this.queryParams.warehouseId
params.locationId = params.locationId || this.queryParams.locationId
listInboundOutboundStatistics(params).then(response => {
listInboundOutboundStatisticsList(params).then(response => {
this.detailList = response.rows || []
this.detailTotal = response.total || 0
this.detailLoading = false
......@@ -609,21 +569,4 @@ export default {
.w20 {
width: 150px;
}
.no-data {
text-align: center;
padding: 20px;
color: #999;
font-size: 14px;
}
/* 折叠面板样式优化 */
::v-deep .el-collapse-item__header {
font-size: 14px;
font-weight: 500;
}
::v-deep .el-collapse-item__content {
padding: 0 !important;
}
</style>
\ No newline at end of file
......@@ -515,8 +515,9 @@
<div style="display: flex; align-items: center; flex-direction: column; gap: 8px;">
<el-input
v-model="form.allowedCategoryNames"
@click="initMaterialSelector"
@click="initMaterialSelector"
placeholder="请选择允许存放的物料"
readonly
style="width: 100%;"
/>
</div>
......
......@@ -80,7 +80,6 @@
>
<el-table-column prop="materialName" label="物料名称" width="180" />
<el-table-column prop="batchId" label="批次ID" width="150" />
<el-table-column prop="outboundOrderId" label="出库单号" width="150" />
<el-table-column prop="warehousesName" label="仓库名称" width="120" />
<el-table-column prop="locationName" label="库位名称" width="120" />
<el-table-column
......
......@@ -91,7 +91,7 @@
style="width: 100%"
>
<el-option
v-for="dict in dict.type.outbound_order_type"
v-for="dict in dict.type.inbound_outbound_type"
:key="dict.value"
:label="dict.label"
:value="Number(dict.value)"
......@@ -194,7 +194,7 @@
<el-table-column label="系统编号" align="center" prop="systemNo" width="150" />
<el-table-column label="出库类型" align="center" prop="orderTypeId" width="120">
<template slot-scope="scope">
<dict-tag v-if="dict.type.outbound_order_type" :options="dict.type.outbound_order_type" :value="scope.row.orderTypeId"/>
<dict-tag v-if="dict.type.inbound_outbound_type" :options="dict.type.inbound_outbound_type" :value="scope.row.orderTypeId"/>
<span v-else>-</span>
</template>
</el-table-column>
......@@ -296,10 +296,10 @@
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="库类型" prop="orderTypeId">
<el-select v-model="form.orderTypeId" placeholder="请选择库类型" :disabled="isViewDetail || formDisabled.orderTypeId" style="width: 100%">
<el-form-item label="库类型" prop="orderTypeId">
<el-select v-model="form.orderTypeId" placeholder="请选择库类型" :disabled="isViewDetail || formDisabled.orderTypeId" style="width: 100%">
<el-option
v-for="item in dict.type.outbound_order_type"
v-for="item in dict.type.inbound_outbound_type"
:key="item.value"
:label="item.label"
:value="item.value"
......@@ -405,7 +405,7 @@
</el-row>
<!-- 明细表格区域(按物料分组展示) -->
<el-divider content-position="center">库单明细信息</el-divider>
<el-divider content-position="center">库单明细信息</el-divider>
<!-- 物料分组操作区 - 仅编辑模式显示 -->
<el-row :gutter="10" class="mb8" v-if="!isViewDetail">
......@@ -519,7 +519,7 @@
title="导入"
import-url="/inventory/orders/import"
template-url="/inventory/orders/importTemplate"
template-name="库单导入模板"
template-name="库单导入模板"
@success="getList"
:show-trdc-checkbox="true"
@orderTypeChange="handleOrderTypeChange"
......@@ -541,7 +541,7 @@ import PageTitle from "@/components/PageTitle"
import ImportExcel from "@/components/ImportExcel/index"
export default {
name: "Orders",
dicts: ['outbound_order_type', 'inbound_order_type', 'outbound_order_status', 'label_color','order_type'],
dicts: ['inbound_outbound_type', 'inbound_order_type', 'outbound_order_status', 'label_color','order_type'],
components: {
OutboundOrderFormWithItems,
WarehouseSelector,
......@@ -800,6 +800,7 @@ handleOwnerSelected(owner) {
async handleShip(row) {
try {
// 调用ship接口提交数据到后端
console.log("handleShip",row)
await ship({
...row,
orderId: row.orderId, // 用户填写的出货单号
......@@ -830,9 +831,8 @@ handleOwnerSelected(owner) {
// 整组编辑方法
editGroupDetail(materialId) {
if (!this.outboundOrderItemsGroup[materialId]) return
this.isEditDetail = true
this.detailDialogTitle = `编辑物料${materialId}整组明细`
this.detailDialogTitle = `编辑物料${this.outboundOrderItemsGroup[materialId].materialName}整组明细`
this.currentMaterialId = materialId
// 传递整组数据到子组件
this.currentGroupData = { ...this.outboundOrderItemsGroup[materialId] }
......
......@@ -137,7 +137,7 @@
<dict-tag :options="dict.type.yes_no" :value="scope.row.isActive"/>
</template>
</el-table-column>
<el-table-column label="排序" align="center" prop="sortNo" />
<el-table-column label="创建日期" align="center" prop="createTime" width="160" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120" fixed="right">
<template slot-scope="scope">
......@@ -242,17 +242,13 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="排序" prop="sortNo">
<el-input-number v-model="form.sortNo" placeholder="请输入排序" :min="0" :step="1" style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="税号" prop="taxNumber">
<el-input v-model="form.taxNumber" placeholder="请输入税号" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="银行账户" prop="bankAccount">
<el-input v-model="form.bankAccount" placeholder="请输入银行账户" />
......@@ -352,10 +348,6 @@ export default {
],
isActive: [
{ required: true, message: '是否激活不能为空', trigger: 'blur' }
],
sortNo: [
{ required: true, message: '排序不能为空', trigger: 'blur' },
{ type: 'number', message: '排序必须为数字值', trigger: 'blur' }
]
}
}
......
......@@ -59,10 +59,18 @@ public class OutboundOrderItemsController extends BaseController
public TableDataInfo getStatistics(OutboundOrdersSummaryVO outboundOrderItems)
{
startPage();
List<OutboundOrderItems> list = outboundOrderItemsService.selectOutboundOrderItemsStatistics(outboundOrderItems);
List<OutboundOrdersSummaryVO> list = outboundOrderItemsService.selectOutboundOrderItemsStatistics(outboundOrderItems);
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('inventory:items:list')")
@GetMapping("/getStatisticsInfo")
public TableDataInfo getStatisticsInfo(OutboundOrderItems outboundOrderItems)
{
startPage();
List<OutboundOrderItems> list = outboundOrderItemsService.selectOutboundOrderItemsStatisticsList(outboundOrderItems);
return getDataTable(list);
}
/**
* 导出出库单明细列表
*/
......
......@@ -78,7 +78,7 @@ public class OutboundOrderItems extends BaseEntity
/** 约数 */
@Excel(name = "约数")
private double divisor;
private Double divisor;
/** 标签颜色 字典,检索条件 */
@Excel(name = "标签颜色 字典,检索条件")
......
......@@ -51,10 +51,10 @@ public class OutboundTemplateVO extends BaseEntity {
private Long plannedQuantity;
@Excel(name = "约数")
private double divisor;
private Double divisor;
/** 件重 */
@Excel(name = "件重")
private double pieceWeight;
private Double pieceWeight;
/** 件数(实际件数) */
@Excel(name = "件数")
......
......@@ -36,7 +36,9 @@ public interface OutboundOrderItemsMapper
* @param outboundOrderItems 出库单明细
* @return 出库单明细集合
*/
public List<OutboundOrderItems> selectOutboundOrderItemsStatistics(OutboundOrdersSummaryVO outboundOrderItems);
public List<OutboundOrdersSummaryVO> selectOutboundOrderItemsStatistics(OutboundOrdersSummaryVO outboundOrderItems);
public List<OutboundOrderItems> selectOutboundOrderItemsStatisticsList(OutboundOrderItems outboundOrderItems);
/**
* 新增出库单明细
*
......
......@@ -36,7 +36,7 @@ public interface IOutboundOrderItemsService
* @param outboundOrderItems 出库单明细
* @return 出库单明细集合
*/
public List<OutboundOrderItems> selectOutboundOrderItemsStatistics(OutboundOrdersSummaryVO outboundOrderItems);
public List<OutboundOrdersSummaryVO> selectOutboundOrderItemsStatistics(OutboundOrdersSummaryVO outboundOrderItems);
/**
* 新增出库单明细
*
......@@ -70,4 +70,5 @@ public interface IOutboundOrderItemsService
public int deleteOutboundOrderItemsById(String id);
public List<OutboundOrderItems> selectOutboundOrderItemsStatisticsList(OutboundOrderItems outboundOrderItems);
}
......@@ -145,11 +145,6 @@ public class InventoryServiceImpl implements IInventoryService
for (OutboundOrderItems outboundOrderItem : outboundOrderItems) {
OutboundOrderLog outboundOrderLog = outboundOrderLogMapper.selectOutboundOrderLogById(outboundOrderItem.getId());
// ========== 新增空值校验(兜底) ==========
if (outboundOrderLog == null) {
throw new ServiceException("明细ID【" + outboundOrderItem.getId() + "】对应的出库日志不存在");
}
// ==========================================
Inventory inventory =inventoryMapper.selectInventoryById(outboundOrderLog.getInventoryId());
inventory.setQuantity(inventory.getQuantity()-outboundOrderItem.getActualQuantity());
if (inventory.getQuantity()==0){
......
......@@ -64,11 +64,16 @@ public class OutboundOrderItemsServiceImpl implements IOutboundOrderItemsService
}
@Override
public List<OutboundOrderItems> selectOutboundOrderItemsStatistics(OutboundOrdersSummaryVO outboundOrderItems) {
List<OutboundOrderItems> list = outboundOrderItemsMapper.selectOutboundOrderItemsStatistics(outboundOrderItems);
public List<OutboundOrdersSummaryVO> selectOutboundOrderItemsStatistics(OutboundOrdersSummaryVO outboundOrderItems) {
List<OutboundOrdersSummaryVO> list = outboundOrderItemsMapper.selectOutboundOrderItemsStatistics(outboundOrderItems);
return list;
}
@Override
public List<OutboundOrderItems> selectOutboundOrderItemsStatisticsList(OutboundOrderItems outboundOrderItems) {
List<OutboundOrderItems> list = outboundOrderItemsMapper.selectOutboundOrderItemsStatisticsList(outboundOrderItems);
return list;
}
@Override
public int insertOutboundOrderItems(OutboundOrderItems outboundOrderItems)
......@@ -110,4 +115,5 @@ public class OutboundOrderItemsServiceImpl implements IOutboundOrderItemsService
}
}
......@@ -91,7 +91,7 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService
public int insertOutboundOrders(OutboundOrders outboundOrders)
{
outboundOrders.setCreateTime(DateUtils.getNowDate());
outboundOrders.setCreateBy(SystemUtils.getUserName());
outboundOrders.setCreateUserCode(SystemUtils.getUserName());
outboundOrders.setId(UUID.randomUUID().toString());
int rows = outboundOrdersMapper.insertOutboundOrders(outboundOrders);
......@@ -113,7 +113,7 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService
outboundOrderLogMapper.deleteOutboundOrderLogByOrdersId(outboundOrders.getId());
outboundOrders.setUpdateBy(SystemUtils.getUserName());
outboundOrders.setUpdateUserCode(SystemUtils.getUserName());
outboundOrders.setUpdateTime(DateUtils.getNowDate());
insertOutboundOrderItems(outboundOrders);
return outboundOrdersMapper.updateOutboundOrders(outboundOrders);
......@@ -152,6 +152,7 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService
public int ship(OutboundOrders outboundOrders) {
OutboundOrderItems outboundOrderItems1 = new OutboundOrderItems();
outboundOrderItems1.setOutboundOrderId(outboundOrders.getId());
outboundOrderItems1.setDivisor(null);
List<OutboundOrderItems> outboundOrderItems = outboundOrderItemsMapper.selectOutboundOrderItemsList(outboundOrderItems1);
List<OutboundOrderItems> outboundOrderItems2 = outboundOrderItems;
OutboundOrderLog outboundOrderLog = new OutboundOrderLog();
......@@ -171,7 +172,7 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService
outboundOrders.setId(outboundOrders.getId());
outboundOrders.setOrderStatus(2l);
outboundOrders.setUpdateTime(DateUtils.getNowDate());
outboundOrders.setUpdateBy(SystemUtils.getUserName());
outboundOrders.setUpdateUserCode(SystemUtils.getUserName());
outboundOrdersMapper.updateOutboundOrders(outboundOrders);
inventoryService.ship(outboundOrderItems2);
......
......@@ -250,6 +250,62 @@
m.total_weight,
m.volume,
m.shelf_life_days,
m.storage_temperature,
m.special_requirements,
m.sort_no,
sum(oi.planned_quantity) as planned_quantity,
sum(oi.actual_quantity) as actual_quantity,
sum(oi.unit_price * oi.actual_quantity) as total_amount
from outbound_order_items oi
left join outbound_orders o on oi.outbound_order_id = o.id
left join materials m on oi.material_id = m.id
left join warehouses w on oi.warehouse_id = w.id
left join storage_locations sl on oi.location_id = sl.id
<where>
oi.is_used = 1 and o.is_used = 1
<if test="orderId != null and orderId != ''"> and oi.order_id like concat('%', #{orderId}, '%')</if>
<if test="materialId != null and materialId != ''"> and oi.material_id = #{materialId}</if>
<if test="batchCode != null and batchCode != ''"> and oi.batch_code = #{batchCode}</if>
<if test="startDate != null and startDate != ''"> and date_format(COALESCE(oi.shipped_at, o.inbound_date),'%Y-%m-%d') &gt;= #{startDate}</if>
<if test="endDate != null and endDate != ''"> and date_format(COALESCE(oi.shipped_at, o.inbound_date),'%Y-%m-%d') &lt;= #{endDate}</if>
<if test="warehouseId != null and warehouseId != ''"> and oi.warehouse_id = #{warehouseId}</if>
<if test="locationId != null and locationId != ''"> and oi.location_id = #{locationId}</if>
<if test="itemStatus != null "> and oi.item_status = #{itemStatus}</if>
</where>
group by oi.material_id,
m.material_name,
m.sap_no,
m.ts_code,
m.hazard_id,
m.specification,
m.material_unit,
m.unit_weight,
m.package_weight,
m.total_weight,
m.volume,
m.shelf_life_days,
m.storage_temperature,
m.special_requirements,
m.sort_no
order by total_amount desc, m.sap_no, m.sort_no
</select>
<select id="selectOutboundOrderItemsStatisticsList"
parameterType="OutboundOrdersSummaryVO"
resultMap="OutboundOrderItemsResult">
select
oi.material_id,
m.material_name,
m.sap_no,
m.ts_code,
m.hazard_id,
m.specification,
m.material_unit,
m.unit_weight,
m.package_weight,
m.total_weight,
m.volume,
m.shelf_life_days,
oi.location_id,
sl.location_name as location_name,
m.storage_temperature,
......@@ -276,8 +332,6 @@
<if test="orderId != null and orderId != ''"> and oi.order_id like concat('%', #{orderId}, '%')</if>
<if test="materialId != null and materialId != ''"> and oi.material_id = #{materialId}</if>
<if test="batchCode != null and batchCode != ''"> and oi.batch_code = #{batchCode}</if>
<if test="startDate != null and startDate != ''"> and date_format(COALESCE(oi.shipped_at, o.inbound_date),'%Y-%m-%d') &gt;= #{startDate}</if>
<if test="endDate != null and endDate != ''"> and date_format(COALESCE(oi.shipped_at, o.inbound_date),'%Y-%m-%d') &lt;= #{endDate}</if>
<if test="warehouseId != null and warehouseId != ''"> and oi.warehouse_id = #{warehouseId}</if>
<if test="locationId != null and locationId != ''"> and oi.location_id = #{locationId}</if>
<if test="itemStatus != null "> and oi.item_status = #{itemStatus}</if>
......
......@@ -100,7 +100,7 @@
where oo.is_used = 1
</sql>
<select id="selectOutboundOrdersList" parameterType="OutboundOrders" resultMap="OutboundOrdersResult">
<select id="selectOutboundOrdersList" parameterType="OutboundOrders" resultMap="OutboundOrdersOutboundOrderItemsResult">
<include refid="selectOutboundOrdersVo"/>
<if test="orderId != null and orderId != ''"> and oo.order_id = #{orderId}</if>
<if test="systemNo != null and systemNo != ''"> and oo.system_no = #{systemNo}</if>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论