Commit ebf1004d by yubin

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

parent 06bd89ab
...@@ -3,14 +3,15 @@ ...@@ -3,14 +3,15 @@
<!-- 页面标题和操作按钮 --> <!-- 页面标题和操作按钮 -->
<PageTitle> <PageTitle>
<template #buttons> <template #buttons>
<el-button <el-button
type="primary" type="primary"
plain plain
icon="el-icon-plus" icon="el-icon-plus"
size="medium" size="medium"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['inventory:orders:add']" v-hasPermi="['inventory:inbound:add']"
>新增</el-button> >新增</el-button>
<el-button <el-button
type="success" type="success"
plain plain
...@@ -18,16 +19,9 @@ ...@@ -18,16 +19,9 @@
size="medium" size="medium"
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['inventory:orders:edit']" v-hasPermi="['inventory:inbound:edit']"
>修改</el-button> >修改</el-button>
<el-button
type="success"
plain
icon="el-icon-edit"
size="medium"
@click="handleImport"
v-hasPermi="['inventory:orders:add']"
>导入</el-button>
<el-button <el-button
type="danger" type="danger"
plain plain
...@@ -35,15 +29,25 @@ ...@@ -35,15 +29,25 @@
size="medium" size="medium"
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['inventory:orders:remove']" v-hasPermi="['inventory:inbound:remove']"
>删除</el-button> >删除</el-button>
<el-button
type="warning"
plain
icon="el-icon-upload"
size="medium"
@click="handleImport"
v-hasPermi="['inventory:inbound:import']"
>导入</el-button>
<el-button <el-button
type="warning" type="warning"
plain plain
icon="el-icon-download" icon="el-icon-download"
size="medium" size="medium"
@click="handleExport" @click="handleExport"
v-hasPermi="['inventory:orders:export']" v-hasPermi="['inventory:inbound:export']"
>导出</el-button> >导出</el-button>
</template> </template>
</PageTitle> </PageTitle>
...@@ -106,32 +110,16 @@ ...@@ -106,32 +110,16 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="货主" prop="ownerId"> <!-- 【核心修改1】出库日期改为时间段选择器 -->
<el-input <el-form-item label="时间段" prop="dateRange">
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">
<el-date-picker <el-date-picker
clearable clearable
v-model="queryParams.inboundDate" v-model="queryParams.dateRange"
type="date" type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="请选择出库日期"
style="width: 100%" style="width: 100%"
/> />
</el-form-item> </el-form-item>
...@@ -150,14 +138,7 @@ ...@@ -150,14 +138,7 @@
/> />
</el-select> </el-select>
</el-form-item> </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-form-item label="仓库" prop="warehouseId">
<el-input <el-input
v-model="queryWarehouseName" v-model="queryWarehouseName"
...@@ -391,8 +372,6 @@ ...@@ -391,8 +372,6 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
...@@ -626,7 +605,7 @@ export default { ...@@ -626,7 +605,7 @@ export default {
ownerId: false, ownerId: false,
outboundOrderId: false outboundOrderId: false
}, },
// 查询参数 // 【核心修改2】查询参数:替换inboundDate为dateRange,新增startDate/endDate
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
...@@ -638,7 +617,9 @@ export default { ...@@ -638,7 +617,9 @@ export default {
warehouseId: null, warehouseId: null,
ownerId: null, ownerId: null,
orderStatus: null, orderStatus: null,
inboundDate: null, dateRange: null, // 日期范围选择器绑定
startDate: null, // 开始日期
endDate: null, // 结束日期
destination: null, destination: null,
totalPlannedQuantity: null, totalPlannedQuantity: null,
totalActualQuantity: null, totalActualQuantity: null,
...@@ -844,7 +825,8 @@ export default { ...@@ -844,7 +825,8 @@ export default {
}).catch(() => { }).catch(() => {
// 取消确认时不执行任何操作 // 取消确认时不执行任何操作
}) })
}, // 修复:获取要传递给子组件的初始化明细数据(按物料分组) },
// 修复:获取要传递给子组件的初始化明细数据(按物料分组)
getInitDetails() { getInitDetails() {
// 编辑场景:传递当前物料分组的所有明细(确保子组件反显) // 编辑场景:传递当前物料分组的所有明细(确保子组件反显)
if (this.isEditDetail && this.currentMaterialId) { if (this.isEditDetail && this.currentMaterialId) {
...@@ -876,7 +858,6 @@ export default { ...@@ -876,7 +858,6 @@ export default {
labelColor: Number(this.currentGroupData.items[0].labelColor) || 0, labelColor: Number(this.currentGroupData.items[0].labelColor) || 0,
unitPrice: Number(this.currentGroupData.items[0].unitPrice) || 0.00, unitPrice: Number(this.currentGroupData.items[0].unitPrice) || 0.00,
amount: Number(this.currentGroupData.items[0].amount) || 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 || '', warehouseName: this.currentGroupData.items[0].warehouseName || '',
locationName: this.currentGroupData.items[0].locationName || '' locationName: this.currentGroupData.items[0].locationName || ''
} }
...@@ -1147,14 +1128,21 @@ export default { ...@@ -1147,14 +1128,21 @@ export default {
this.tableKey += 1 this.tableKey += 1
}) })
}, },
/** 查询出库单主列表 */ /** 【核心修改3】查询出库单主列表 - 处理时间段参数 */
getList() { getList() {
this.loading = true this.loading = true
// 修改点1:查询时,将前端的orderId映射到后端的outboundOrderId参数 // 处理日期范围:将dateRange拆分为startDate/endDate
const { dateRange, ...restParams } = this.queryParams
const queryParams = { const queryParams = {
...this.queryParams, ...restParams,
outboundOrderId: this.queryParams.orderId // 映射查询参数 outboundOrderId: this.queryParams.orderId, // 映射查询参数
// 拆分日期范围
startDate: dateRange ? dateRange[0] : null,
endDate: dateRange ? dateRange[1] : null
} }
// 删除原inboundDate参数(如果存在)
delete queryParams.inboundDate
listOrders(queryParams).then(response => { listOrders(queryParams).then(response => {
// 修改点2:将后端返回的outboundOrderId映射为前端的orderId显示 // 修改点2:将后端返回的outboundOrderId映射为前端的orderId显示
this.ordersList = (response.rows || []).map(item => ({ this.ordersList = (response.rows || []).map(item => ({
...@@ -1238,7 +1226,7 @@ export default { ...@@ -1238,7 +1226,7 @@ export default {
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
this.getList() this.getList()
}, },
/** 重置按钮操作 */ /** 【核心修改4】重置按钮操作 - 重置日期范围 */
resetQuery() { resetQuery() {
// 检查ref存在性 // 检查ref存在性
if (this.$refs.queryForm) { if (this.$refs.queryForm) {
...@@ -1253,7 +1241,9 @@ export default { ...@@ -1253,7 +1241,9 @@ export default {
warehouseId: null, warehouseId: null,
ownerId: null, ownerId: null,
orderStatus: null, orderStatus: null,
inboundDate: null, dateRange: null, // 重置日期范围
startDate: null,
endDate: null,
destination: null, destination: null,
totalPlannedQuantity: null, totalPlannedQuantity: null,
totalActualQuantity: null, totalActualQuantity: null,
...@@ -1560,16 +1550,24 @@ export default { ...@@ -1560,16 +1550,24 @@ export default {
this.$modal.msgSuccess("删除成功") this.$modal.msgSuccess("删除成功")
}).catch(() => {}) }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 【核心修改5】导出按钮操作 - 传递时间段参数 */
handleExport() { handleExport() {
// 处理日期范围参数
const { dateRange, ...restParams } = this.queryParams
// 适配导出参数,将orderId映射到outboundOrderId // 适配导出参数,将orderId映射到outboundOrderId
const exportParams = { const exportParams = {
...this.queryParams, ...restParams,
outboundOrderId: this.queryParams.orderId, // 映射导出参数 outboundOrderId: this.queryParams.orderId, // 映射导出参数
orderType: this.queryParams.orderType, // 新增:导出订单类型参数 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`) 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 ...@@ -59,6 +59,13 @@ public class OutboundOrders extends BaseEntity
@Excel(name = "出库单状态1-草稿 2-已完成 3-已取消 字典,检索条件") @Excel(name = "出库单状态1-草稿 2-已完成 3-已取消 字典,检索条件")
private Long orderStatus; private Long orderStatus;
/** 开始日期(检索条件) */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startDate;
/** 结束日期(检索条件) */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endDate;
/** 出库日期 日期无时间 */ /** 出库日期 日期无时间 */
......
...@@ -9,13 +9,14 @@ ...@@ -9,13 +9,14 @@
<result property="orderId" column="order_id" /> <result property="orderId" column="order_id" />
<result property="systemNo" column="system_no" /> <result property="systemNo" column="system_no" />
<result property="orderTypeId" column="order_type_id" /> <result property="orderTypeId" column="order_type_id" />
<result property="orderType" column="order_type" /> <!-- 新增order_type字段映射 --> <result property="orderType" column="order_type" />
<result property="batchCode" column="batch_code" /> <result property="batchCode" column="batch_code" />
<result property="warehouseId" column="warehouse_id" /> <result property="warehouseId" column="warehouse_id" />
<result property="warehouseName" column="warehouse_name" /> <result property="warehouseName" column="warehouse_name" />
<result property="ownerId" column="owner_id" /> <result property="ownerId" column="owner_id" />
<result property="ownerName" column="owner_name" /> <result property="ownerName" column="owner_name" />
<result property="orderStatus" column="order_status" /> <result property="orderStatus" column="order_status" />
<!-- 保留原字段映射,新增startDate/endDate用于查询 -->
<result property="inboundDate" column="inbound_date" /> <result property="inboundDate" column="inbound_date" />
<result property="destination" column="destination" /> <result property="destination" column="destination" />
<result property="totalPlannedQuantity" column="total_planned_quantity" /> <result property="totalPlannedQuantity" column="total_planned_quantity" />
...@@ -75,7 +76,7 @@ ...@@ -75,7 +76,7 @@
oo.order_id, oo.order_id,
oo.system_no, oo.system_no,
oo.order_type_id, oo.order_type_id,
oo.order_type, -- 新增order_type字段查询 oo.order_type,
oo.batch_code, oo.batch_code,
oo.warehouse_id, oo.warehouse_id,
w.warehouses_name as warehouse_name, w.warehouses_name as warehouse_name,
...@@ -105,12 +106,14 @@ ...@@ -105,12 +106,14 @@
<if test="orderId != null and orderId != ''"> and oo.order_id = #{orderId}</if> <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="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="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="batchCode != null and batchCode != ''"> and oo.batch_code = #{batchCode}</if>
<if test="warehouseId != null and warehouseId != ''"> and oo.warehouse_id = #{warehouseId}</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="ownerId != null and ownerId != ''"> and oo.owner_id = #{ownerId}</if>
<if test="orderStatus != null "> and oo.order_status = #{orderStatus}</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="destination != null and destination != ''"> and oo.destination = #{destination}</if>
<if test="totalPlannedQuantity != null "> and oo.total_planned_quantity = #{totalPlannedQuantity}</if> <if test="totalPlannedQuantity != null "> and oo.total_planned_quantity = #{totalPlannedQuantity}</if>
<if test="totalActualQuantity != null "> and oo.total_actual_quantity = #{totalActualQuantity}</if> <if test="totalActualQuantity != null "> and oo.total_actual_quantity = #{totalActualQuantity}</if>
...@@ -126,7 +129,7 @@ ...@@ -126,7 +129,7 @@
oo.order_id, oo.order_id,
oo.system_no, oo.system_no,
oo.order_type_id, oo.order_type_id,
oo.order_type, -- 新增order_type字段查询 oo.order_type,
oo.batch_code, oo.batch_code,
oo.warehouse_id, oo.warehouse_id,
w.warehouses_name as warehouse_name, w.warehouses_name as warehouse_name,
...@@ -194,11 +197,12 @@ ...@@ -194,11 +197,12 @@
<if test="orderId != null">order_id,</if> <if test="orderId != null">order_id,</if>
<if test="systemNo != null">system_no,</if> <if test="systemNo != null">system_no,</if>
<if test="orderTypeId != null">order_type_id,</if> <if test="orderTypeId != null">order_type_id,</if>
<if test="orderType != null">order_type,</if> <!-- 新增order_type字段插入 --> <if test="orderType != null">order_type,</if>
<if test="batchCode != null">batch_code,</if> <if test="batchCode != null">batch_code,</if>
<if test="warehouseId != null">warehouse_id,</if> <if test="warehouseId != null">warehouse_id,</if>
<if test="ownerId != null">owner_id,</if> <if test="ownerId != null">owner_id,</if>
<if test="orderStatus != null">order_status,</if> <if test="orderStatus != null">order_status,</if>
<!-- 保留inboundDate字段的插入(业务字段仍需存储) -->
<if test="inboundDate != null">inbound_date,</if> <if test="inboundDate != null">inbound_date,</if>
<if test="destination != null">destination,</if> <if test="destination != null">destination,</if>
<if test="totalPlannedQuantity != null">total_planned_quantity,</if> <if test="totalPlannedQuantity != null">total_planned_quantity,</if>
...@@ -217,7 +221,7 @@ ...@@ -217,7 +221,7 @@
<if test="orderId != null">#{orderId},</if> <if test="orderId != null">#{orderId},</if>
<if test="systemNo != null">#{systemNo},</if> <if test="systemNo != null">#{systemNo},</if>
<if test="orderTypeId != null">#{orderTypeId},</if> <if test="orderTypeId != null">#{orderTypeId},</if>
<if test="orderType != null">#{orderType},</if> <!-- 新增order_type值插入 --> <if test="orderType != null">#{orderType},</if>
<if test="batchCode != null">#{batchCode},</if> <if test="batchCode != null">#{batchCode},</if>
<if test="warehouseId != null">#{warehouseId},</if> <if test="warehouseId != null">#{warehouseId},</if>
<if test="ownerId != null">#{ownerId},</if> <if test="ownerId != null">#{ownerId},</if>
...@@ -243,7 +247,7 @@ ...@@ -243,7 +247,7 @@
<if test="orderId != null">order_id = #{orderId},</if> <if test="orderId != null">order_id = #{orderId},</if>
<if test="systemNo != null">system_no = #{systemNo},</if> <if test="systemNo != null">system_no = #{systemNo},</if>
<if test="orderTypeId != null">order_type_id = #{orderTypeId},</if> <if test="orderTypeId != null">order_type_id = #{orderTypeId},</if>
<if test="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="batchCode != null">batch_code = #{batchCode},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if> <if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="ownerId != null">owner_id = #{ownerId},</if> <if test="ownerId != null">owner_id = #{ownerId},</if>
...@@ -304,7 +308,6 @@ ...@@ -304,7 +308,6 @@
</foreach> </foreach>
</insert> </insert>
<select id="SelectOutboundOrdersMaterialsTopTenByQuantity" resultType="java.util.Map"> <select id="SelectOutboundOrdersMaterialsTopTenByQuantity" resultType="java.util.Map">
select select
m.material_name as name, m.material_name as name,
...@@ -316,7 +319,7 @@ ...@@ -316,7 +319,7 @@
and ooi.shipped_at >= DATE_FORMAT(CURDATE(), '%Y-%m-01 00:00:00') 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.shipped_at &lt; DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 MONTH), '%Y-%m-01 00:00:00')
where where
m.is_used =1 m.is_used =1
and m.is_active =1 and m.is_active =1
group by m.id, m.material_name group by m.id, m.material_name
order by value desc order by value desc
...@@ -325,24 +328,26 @@ ...@@ -325,24 +328,26 @@
<select id="SelectOutboundOrdersMaterialsTopTenByAmount" resultType="java.util.Map"> <select id="SelectOutboundOrdersMaterialsTopTenByAmount" resultType="java.util.Map">
select select
m.material_name as name, m.material_name as name,
sum(IFNULL(ooi.actual_quantity, 0) * IFNULL(ooi.unit_price, 0)) as value sum(IFNULL(ooi.actual_quantity, 0) * IFNULL(ooi.unit_price, 0)) as value
from materials m from materials m
left join outbound_order_items ooi left join outbound_order_items ooi
on ooi.material_id = m.id on ooi.material_id = m.id
and ooi.is_used = 1 and ooi.is_used = 1
and ooi.shipped_at >= DATE_FORMAT(CURDATE(), '%Y-%m-01 00:00:00') 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.shipped_at &lt; DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 MONTH), '%Y-%m-01 00:00:00')
where where
m.is_used =1 m.is_used =1
and m.is_active =1 and m.is_active =1
group by m.id, m.material_name group by m.id, m.material_name
order by value desc order by value desc
limit 10; limit 10;
</select> </select>
<select id="outboundOrdersCount" resultType="String"> <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') select count(*) from outbound_orders where is_used = 1 and order_status=2
and inbound_date &lt; DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 MONTH), '%Y-%m-01') 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> </select>
<update id="batchUpdateInventory"> <update id="batchUpdateInventory">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论