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
......@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论