Compare commits
2 Commits
95987d352c
...
cff26eaac7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cff26eaac7 | ||
|
|
bb78fba24e |
14
klp-ui/src/views/wms/report/merge/acid.vue
Normal file
14
klp-ui/src/views/wms/report/merge/acid.vue
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<merge-template :actionType="201"></merge-template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import mergeTemplate from "@/views/wms/report/template/merge.vue";
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
mergeTemplate,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
14
klp-ui/src/views/wms/report/merge/duge.vue
Normal file
14
klp-ui/src/views/wms/report/merge/duge.vue
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<merge-template :actionType="206"></merge-template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import mergeTemplate from "@/views/wms/report/template/merge.vue";
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
mergeTemplate,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
14
klp-ui/src/views/wms/report/merge/lajiao.vue
Normal file
14
klp-ui/src/views/wms/report/merge/lajiao.vue
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<merge-template :actionType="204"></merge-template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import mergeTemplate from "@/views/wms/report/template/merge.vue";
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
mergeTemplate,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
14
klp-ui/src/views/wms/report/merge/shuang.vue
Normal file
14
klp-ui/src/views/wms/report/merge/shuang.vue
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<merge-template :actionType="205"></merge-template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import mergeTemplate from "@/views/wms/report/template/merge.vue";
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
mergeTemplate,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
14
klp-ui/src/views/wms/report/merge/tuozhi.vue
Normal file
14
klp-ui/src/views/wms/report/merge/tuozhi.vue
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<merge-template :actionType="203"></merge-template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import mergeTemplate from "@/views/wms/report/template/merge.vue";
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
mergeTemplate,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
14
klp-ui/src/views/wms/report/merge/zinc.vue
Normal file
14
klp-ui/src/views/wms/report/merge/zinc.vue
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<merge-template :actionType="202"></merge-template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import mergeTemplate from "@/views/wms/report/template/merge.vue";
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
mergeTemplate,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
289
klp-ui/src/views/wms/report/template/merge.vue
Normal file
289
klp-ui/src/views/wms/report/template/merge.vue
Normal file
@@ -0,0 +1,289 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container" v-loading="loading">
|
||||||
|
<el-row>
|
||||||
|
<el-form label-width="80px" inline>
|
||||||
|
<el-form-item label="开始时间" prop="startTime">
|
||||||
|
<el-date-picker style="width: 200px;" v-model="queryParams.startTime" type="datetime"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择开始时间"></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="结束时间" prop="endTime">
|
||||||
|
<el-date-picker style="width: 200px;" v-model="queryParams.endTime" type="datetime"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择结束时间"></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="入场钢卷号" prop="enterCoilNo">
|
||||||
|
<el-input style="width: 200px; display: inline-block;" v-model="queryParams.enterCoilNo"
|
||||||
|
placeholder="请输入入场钢卷号" clearable @keyup.enter.native="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="当前钢卷号" prop="currentCoilNo">
|
||||||
|
<el-input style="width: 200px;" v-model="queryParams.currentCoilNo" placeholder="请输入当前钢卷号" clearable
|
||||||
|
@keyup.enter.native="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="产品名称" prop="itemName">
|
||||||
|
<el-input style="width: 200px;" v-model="queryParams.itemName" placeholder="请输入产品名称" clearable
|
||||||
|
@keyup.enter.native="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="规格" prop="itemSpecification">
|
||||||
|
<memo-input style="width: 200px;" v-model="queryParams.itemSpecification" storageKey="coilSpec"
|
||||||
|
placeholder="请选择规格" clearable @keyup.enter.native="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="材质" prop="itemMaterial">
|
||||||
|
<muti-select style="width: 200px;" v-model="queryParams.itemMaterial" :options="dict.type.coil_material"
|
||||||
|
placeholder="请选择材质" clearable @keyup.enter.native="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="厂家" prop="itemManufacturer">
|
||||||
|
<muti-select style="width: 200px;" v-model="queryParams.itemManufacturer"
|
||||||
|
:options="dict.type.coil_manufacturer" placeholder="请选择厂家" clearable @keyup.enter.native="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="getList">查询</el-button>
|
||||||
|
<el-button type="primary" @click="exportData">导出产出钢卷</el-button>
|
||||||
|
<el-button type="primary" @click="exportLossData">导出消耗钢卷</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-descriptions title="统计信息" :column="3" border>
|
||||||
|
<el-descriptions-item label="产出数量">{{ summary.outCount }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="产出总重">{{ summary.outTotalWeight }}t</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="产出均重">{{ summary.outAvgWeight }}t</el-descriptions-item>
|
||||||
|
|
||||||
|
<el-descriptions-item label="消耗数量">{{ summary.lossCount }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="消耗总重">{{ summary.lossTotalWeight }}t</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="消耗均重">{{ summary.lossAvgWeight }}t</el-descriptions-item>
|
||||||
|
|
||||||
|
<el-descriptions-item label="合计数量">{{ summary.totalCount }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="合计总重">{{ summary.totalWeight }}t</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="合计均重">{{ summary.totalAvgWeight }}t</el-descriptions-item>
|
||||||
|
|
||||||
|
<!-- 成品率 -->
|
||||||
|
<el-descriptions-item label="成品率">{{ summary.passRate }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="损耗率">{{ summary.lossRate }}</el-descriptions-item>
|
||||||
|
<!-- 异常率 -->
|
||||||
|
<el-descriptions-item label="异常率">{{ summary.abRate }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
|
||||||
|
<el-descriptions title="明细信息" :column="3" border>
|
||||||
|
</el-descriptions>
|
||||||
|
<el-tabs v-model="activeTab">
|
||||||
|
<el-tab-pane label="投入钢卷" name="loss">
|
||||||
|
<el-table :data="lossList" border height="calc(100vh - 320px)">
|
||||||
|
<el-table-column label="入场钢卷号" align="center" prop="enterCoilNo">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<coil-no :coil-no="scope.row.enterCoilNo"></coil-no>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="当前钢卷号" align="center" prop="currentCoilNo">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<coil-no :coil-no="scope.row.currentCoilNo"></coil-no>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" />
|
||||||
|
<el-table-column label="逻辑库位" align="center" prop="warehouseName" />
|
||||||
|
<!-- <el-table-column label="实际库区" align="center" prop="actualWarehouseName" /> -->
|
||||||
|
<el-table-column label="产品类型" align="center" width="250">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<ProductInfo v-if="scope.row.itemType == 'product'" :product="scope.row.product" />
|
||||||
|
<RawMaterialInfo v-else-if="scope.row.itemType === 'raw_material'" :material="scope.row.rawMaterial" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="重量 (吨)" align="center" prop="netWeight" />
|
||||||
|
<el-table-column label="长度 (米)" align="center" prop="length" />
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip />
|
||||||
|
<el-table-column label="更新人" align="center" prop="updateByName" />
|
||||||
|
<el-table-column label="更新时间" align="center" prop="updateTime" />
|
||||||
|
</el-table>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="产出钢卷" name="output">
|
||||||
|
<el-table :data="outList" border height="calc(100vh - 320px)">
|
||||||
|
<el-table-column label="入场钢卷号" align="center" prop="enterCoilNo">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<coil-no :coil-no="scope.row.enterCoilNo"></coil-no>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="当前钢卷号" align="center" prop="currentCoilNo">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<coil-no :coil-no="scope.row.currentCoilNo"></coil-no>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" />
|
||||||
|
<el-table-column label="逻辑库位" align="center" prop="warehouseName" />
|
||||||
|
<el-table-column label="实际库区" align="center" prop="actualWarehouseName" />
|
||||||
|
<el-table-column label="产品类型" align="center" width="250">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<ProductInfo v-if="scope.row.itemType == 'product'" :product="scope.row.product" />
|
||||||
|
<RawMaterialInfo v-else-if="scope.row.itemType === 'raw_material'" :material="scope.row.rawMaterial" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="重量 (吨)" align="center" prop="netWeight" />
|
||||||
|
<el-table-column label="长度 (米)" align="center" prop="length" />
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip />
|
||||||
|
<el-table-column label="出库状态" align="center" prop="status">
|
||||||
|
<!-- 0在库,1已出库 -->
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.status === 0 ? '在库' : '已出库' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="更新人" align="center" prop="updateByName" />
|
||||||
|
<el-table-column label="更新时间" align="center" prop="updateTime" />
|
||||||
|
</el-table>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listCoilWithIds } from "@/api/wms/coil";
|
||||||
|
import {
|
||||||
|
listPendingAction,
|
||||||
|
} from '@/api/wms/pendingAction';
|
||||||
|
import MemoInput from "@/components/MemoInput";
|
||||||
|
import MutiSelect from "@/components/MutiSelect";
|
||||||
|
import ProductInfo from "@/components/KLPService/Renderer/ProductInfo";
|
||||||
|
import RawMaterialInfo from "@/components/KLPService/Renderer/RawMaterialInfo";
|
||||||
|
import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
|
||||||
|
import { calcSummary } from "@/views/wms/report/js/calc";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'MergeTemplate',
|
||||||
|
props: {
|
||||||
|
actionType: {
|
||||||
|
type: Number,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
MemoInput,
|
||||||
|
MutiSelect,
|
||||||
|
ProductInfo,
|
||||||
|
RawMaterialInfo,
|
||||||
|
CoilNo,
|
||||||
|
},
|
||||||
|
dicts: ['product_coil_status', 'coil_material', 'coil_itemname', 'coil_manufacturer'],
|
||||||
|
data() {
|
||||||
|
// 工具函数:个位数补零
|
||||||
|
const addZero = (num) => num.toString().padStart(2, '0')
|
||||||
|
|
||||||
|
// 获取当前日期(默认选中当天)
|
||||||
|
const now = new Date()
|
||||||
|
const currentDate = `${now.getFullYear()}-${addZero(now.getMonth() + 1)}`
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成指定日期/月份的时间范围字符串
|
||||||
|
* @param {string} dateStr - 支持格式:yyyy-MM(月份) 或 yyyy-MM-dd(具体日期)
|
||||||
|
* @returns {object} 包含start(开始时间)和end(结束时间)的对象
|
||||||
|
*/
|
||||||
|
const getDayTimeRange = (dateStr) => {
|
||||||
|
// 先校验输入格式是否合法
|
||||||
|
const monthPattern = /^\d{4}-\d{2}$/; // yyyy-MM 正则
|
||||||
|
const dayPattern = /^\d{4}-\d{2}-\d{2}$/; // yyyy-MM-dd 正则
|
||||||
|
|
||||||
|
if (!monthPattern.test(dateStr) && !dayPattern.test(dateStr)) {
|
||||||
|
throw new Error('输入格式错误,请传入 yyyy-MM 或 yyyy-MM-dd 格式的字符串');
|
||||||
|
}
|
||||||
|
|
||||||
|
let startDate, endDate;
|
||||||
|
|
||||||
|
if (monthPattern.test(dateStr)) {
|
||||||
|
// 处理 yyyy-MM 格式:获取本月第一天和最后一天
|
||||||
|
const [year, month] = dateStr.split('-').map(Number);
|
||||||
|
// 月份是0基的(0=1月,1=2月...),所以要减1
|
||||||
|
// 第一天:yyyy-MM-01
|
||||||
|
startDate = `${dateStr}-01`;
|
||||||
|
// 最后一天:通过 new Date(year, month, 0) 计算(month是原始月份,比如2代表2月,传2则取3月0日=2月最后一天)
|
||||||
|
const lastDayOfMonth = new Date(year, month, 0).getDate();
|
||||||
|
endDate = `${dateStr}-${lastDayOfMonth.toString().padStart(2, '0')}`;
|
||||||
|
} else {
|
||||||
|
// 处理 yyyy-MM-dd 格式:直接使用传入的日期
|
||||||
|
startDate = dateStr;
|
||||||
|
endDate = dateStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 拼接时间部分
|
||||||
|
return {
|
||||||
|
start: `${startDate} 00:00:00`,
|
||||||
|
end: `${endDate} 23:59:59`
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const { start, end } = getDayTimeRange(currentDate)
|
||||||
|
return {
|
||||||
|
lossList: [],
|
||||||
|
outList: [],
|
||||||
|
activeTab: 'loss',
|
||||||
|
loading: false,
|
||||||
|
queryParams: {
|
||||||
|
startTime: start,
|
||||||
|
endTime: end,
|
||||||
|
enterCoilNo: '',
|
||||||
|
currentCoilNo: '',
|
||||||
|
warehouseId: '',
|
||||||
|
itemName: '',
|
||||||
|
itemSpecification: '',
|
||||||
|
itemMaterial: '',
|
||||||
|
itemManufacturer: '',
|
||||||
|
pageSize: 9999,
|
||||||
|
pageNum: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
summary() {
|
||||||
|
return calcSummary(this.outList, this.lossList)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.handleQuery()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleQuery() {
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
async getList() {
|
||||||
|
this.loading = true;
|
||||||
|
const res = await listPendingAction({ ...this.queryParams, actionType: this.actionType, actionStatus: 2 });
|
||||||
|
// 获取两层数据
|
||||||
|
const lossIds = res.rows.map(item => item.coilId);
|
||||||
|
// 使用new Set去重
|
||||||
|
const outIds = [...new Set(res.rows.map(item => item.processedCoilIds))];
|
||||||
|
|
||||||
|
if (lossIds.length === 0 || outIds.length === 0) {
|
||||||
|
this.$message({
|
||||||
|
message: '查询结果为空',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
this.loading = false;
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const [lossRes, outRes] = await Promise.all([
|
||||||
|
listCoilWithIds({ ...this.queryParams, coilIds: lossIds.join(',') || '' }),
|
||||||
|
listCoilWithIds({ ...this.queryParams, coilIds: outIds.join(',') || '' }),
|
||||||
|
]);
|
||||||
|
this.lossList = lossRes.rows;
|
||||||
|
this.outList = outRes.rows;
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
// 导出
|
||||||
|
exportData() {
|
||||||
|
if (this.outList.length === 0) {
|
||||||
|
this.$message.warning('暂无数据可导出')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.download('wms/materialCoil/export', {
|
||||||
|
coilIds: this.outList.map(item => item.coilId).join(',')
|
||||||
|
}, `materialCoil_${this.queryParams.date}_${new Date().getTime()}.xlsx`)
|
||||||
|
},
|
||||||
|
exportLossData() {
|
||||||
|
if (this.lossList.length === 0) {
|
||||||
|
this.$message.warning('暂无数据可导出')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.download('wms/materialCoil/export', {
|
||||||
|
coilIds: this.lossList.map(item => item.coilId).join(',')
|
||||||
|
}, `materialCoil_${this.queryParams.date}_${new Date().getTime()}.xlsx`)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
||||||
Reference in New Issue
Block a user