Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override
| | |
| | | orderPlanDecomposition:'تقرير تفصيلي لخطة الطلب', |
| | | damageReport:'تقرير الاستراحة', |
| | | crossProcessBreaking:'تقرير تفصيلي للعمليات المتقاطعة', |
| | | teamOutput:'تقرير إنتاج الفريق', |
| | | teamOutputReport:'تقرير إنتاج الفريق', |
| | | teamOutput:'班组产量明细报表', |
| | | teamOutputSummary:'班组产量汇总报表', |
| | | splittingDetailsOutside:'تقرير تفاصيل الرفوف', |
| | | taskCompletionStatus:'تقرير إنجاز المهام', |
| | | rawMaterialRequisition:'تقرير اختيار الزجاج الأصلي', |
| | |
| | | orderPlanDecomposition:'تقرير تفصيلي لخطة الطلب', |
| | | secondaryBrokenReport:'تقرير الاستراحة ', |
| | | crossProcessBreakdown:'تقرير تفصيلي للعمليات المتقاطعة', |
| | | teamOutput:'تقرير إنتاج الفريق', |
| | | notCrossProcessBreakdown:'非跨工序次破报表', |
| | | secondaryBrokenTotal:'次破总报表', |
| | | teamOutput:'班组产量明细报表', |
| | | teamOutputSummary:'班组产量汇总报表', |
| | | splittingDetails:'تقرير تفاصيل الرفوف', |
| | | TaskCompletionStatus:'تقرير إنجاز المهام', |
| | | rawMaterialRequisition:'تقرير اختيار الزجاج الأصلي', |
| | |
| | | orderPlanDecomposition:'Flow card progress report', |
| | | damageReport:'Breakage statement', |
| | | crossProcessBreaking:'Cross process breakage report', |
| | | teamOutput:'Team production report', |
| | | teamOutputReport:'Team production report', |
| | | teamOutput:'班组产量明细报表', |
| | | teamOutputSummary:'班组产量汇总报表', |
| | | splittingDetailsOutside:'Separate frame detail report', |
| | | taskCompletionStatus:'Task completion report', |
| | | rawMaterialRequisition:'Raw material requisition report', |
| | |
| | | orderPlanDecomposition:'Order plan breakdown report', |
| | | secondaryBrokenReport:' Breakage statement', |
| | | crossProcessBreakdown:'Cross process breakage report', |
| | | teamOutput:'Team production report', |
| | | notCrossProcessBreakdown:'非跨工序次破报表', |
| | | secondaryBrokenTotal:'次破总报表', |
| | | teamOutput:'班组产量明细报表', |
| | | teamOutputSummary:'班组产量汇总报表', |
| | | splittingDetails:'Separate frame detail report', |
| | | TaskCompletionStatus:'Task completion report', |
| | | rawMaterialRequisition:'Raw material requisition report', |
| | |
| | | orderPlanDecomposition:'주문 계획 분석 보고서', |
| | | damageReport:'불량 파손 보고서', |
| | | crossProcessBreaking:'공정 간 불량 보고서', |
| | | teamOutput:'팀 생산 보고서', |
| | | teamOutputReport:'팀 생산 보고서', |
| | | teamOutput:'班组产量明细报表', |
| | | teamOutputSummary:'班组产量汇总报表', |
| | | splittingDetailsOutside:'선반 별 상세 보고서', |
| | | taskCompletionStatus:'작업 완료 현황 보고서', |
| | | rawMaterialRequisition:'원판 출고 보고서', |
| | |
| | | orderPlanDecomposition:'주문 계획 분석 보고서', |
| | | secondaryBrokenReport:'불량 파손 보고서', |
| | | crossProcessBreakdown:'공정 간 불량 보고서', |
| | | teamOutput:'팀 생산 보고서', |
| | | notCrossProcessBreakdown:'非跨工序次破报表', |
| | | secondaryBrokenTotal:'次破总报表', |
| | | teamOutput:'班组产量明细报表', |
| | | teamOutputSummary:'班组产量汇总报表', |
| | | splittingDetails:'프레임별 상세 보고서', |
| | | TaskCompletionStatus:'작업 완료 현황 보고서', |
| | | rawMaterialRequisition:'원판 출고 보고서', |
| | |
| | | orderPlanDecomposition:'Отчет о разложении плана заказа', |
| | | damageReport:'Отчет о повреждениях', |
| | | crossProcessBreaking:'Отчет о межоперационных повреждениях', |
| | | teamOutput:'Отчет о выпуске бригад', |
| | | teamOutputReport:'Отчет о выпуске бригад', |
| | | teamOutput:'班组产量明细报表', |
| | | teamOutputSummary:'班组产量汇总报表', |
| | | splittingDetailsOutside:'Подробная ведомость распределительной рамы', |
| | | taskCompletionStatus:'Ведомость выполнения мандата', |
| | | rawMaterialRequisition:'Отчет о получении оригинального стекла', |
| | |
| | | orderPlanDecomposition:'Отчет о разложении плана заказа', |
| | | secondaryBrokenReport:'Отчет о повреждениях', |
| | | crossProcessBreakdown:'Отчет о межоперационных повреждениях', |
| | | teamOutput:'Отчет о выпуске бригад', |
| | | notCrossProcessBreakdown:'非跨工序次破报表', |
| | | secondaryBrokenTotal:'次破总报表', |
| | | teamOutput:'班组产量明细报表', |
| | | teamOutputSummary:'班组产量汇总报表', |
| | | splittingDetails:'Подробная ведомость распределительной рамы', |
| | | TaskCompletionStatus:'Ведомость выполнения мандата', |
| | | rawMaterialRequisition:'Отчет о получении оригинального стекла', |
| | |
| | | orderPlanDecomposition:'订单计划分解报表', |
| | | damageReport:'次破报表', |
| | | crossProcessBreaking:'跨工序次破报表', |
| | | teamOutput:'班组产量报表', |
| | | teamOutputReport:'班组产量报表', |
| | | teamOutput:'班组产量明细报表', |
| | | teamOutputSummary:'班组产量汇总报表', |
| | | splittingDetailsOutside:'分架明细报表', |
| | | taskCompletionStatus:'任务完成情况报表', |
| | | rawMaterialRequisition:'原片领料报表', |
| | |
| | | crossProcessBreakdown:'跨工序次破报表', |
| | | notCrossProcessBreakdown:'非跨工序次破报表', |
| | | secondaryBrokenTotal:'次破总报表', |
| | | teamOutput:'班组产量报表', |
| | | teamOutput:'班组产量明细报表', |
| | | teamOutputSummary:'班组产量汇总报表', |
| | | splittingDetails:'分架明细报表', |
| | | TaskCompletionStatus:'任务完成情况报表', |
| | | rawMaterialRequisition:'原片领料报表', |
| | |
| | | component: () => import('../views/pp/report/TeamOutput.vue'), |
| | | }, |
| | | { |
| | | //班组产量汇总 |
| | | path: 'teamOutputSummary', |
| | | name: 'teamOutputSummary', |
| | | component: () => import('../views/pp/report/TeamOutputSummary.vue'), |
| | | }, |
| | | { |
| | | //在制品报表 |
| | | path: 'workInProgress', |
| | | name: 'workInProgress', |
| | |
| | | reportingWorkDate:ref(["",""]), |
| | | qualityInspectionDate:ref(["",""]), |
| | | brokenDate:ref(["",""]), |
| | | teamOutputDate:ref(["",""]), |
| | | yieldDate:ref(["",""]), |
| | | replenishDate:ref(["",""]), |
| | | searchOrderListFilter:ref([]),//订单首页筛选] |
| | |
| | | this.reportingWorkDate=["",""] |
| | | this.qualityInspectionDate=["",""] |
| | | this.brokenDate=["",""] |
| | | this.teamOutputDate=["",""] |
| | | this.yieldDate=["",""] |
| | | this.replenishDate=["",""] |
| | | this.searchOrderFilter={ |
| | |
| | | <el-menu-item index="/main/report/OrderPlanDecomposition">{{$t('report.orderPlanDecomposition')}}</el-menu-item> |
| | | <el-menu-item index="/main/report/OrderReportingWorks">{{$t('report.page.orderWorkReportForm')}}</el-menu-item> |
| | | </el-sub-menu> |
| | | <!-- <el-sub-menu index="2" popper-class="test">--> |
| | | <!-- <template #title>产量报表</template>--> |
| | | <!-- <el-menu-item index="/main/report/TeamOutput">班组产量</el-menu-item>--> |
| | | <!-- <el-menu-item index="/main/report/EquipmentOutput">设备产量</el-menu-item>--> |
| | | <!-- </el-sub-menu>--> |
| | | <el-sub-menu index="3" popper-class="test"> |
| | | <template #title>{{$t('report.secondaryBrokenReport')}}</template> |
| | | <el-menu-item index="/main/report/DamageReport">{{$t('report.secondaryBrokenTotal')}}</el-menu-item> |
| | | <el-menu-item index="/main/report/CrossProcessBreaking">{{$t('report.crossProcessBreakdown')}}</el-menu-item> |
| | | <el-menu-item index="/main/report/NotCrossProcessBreaking">{{$t('report.notCrossProcessBreakdown')}}</el-menu-item> |
| | | </el-sub-menu> |
| | | <el-menu-item index="/main/report/TeamOutput">{{$t('report.teamOutput')}}</el-menu-item> |
| | | <el-sub-menu index="5" popper-class="test"> |
| | | <template #title>{{$t('report.page.teamOutputReport')}}</template> |
| | | <el-menu-item index="/main/report/TeamOutputSummary">{{$t('report.teamOutputSummary')}}</el-menu-item> |
| | | <el-menu-item index="/main/report/TeamOutput">{{$t('report.teamOutput')}}</el-menu-item> |
| | | </el-sub-menu> |
| | | |
| | | <el-menu-item index="/main/report/SplittingDetailsOutside">{{$t('report.splittingDetails')}}</el-menu-item> |
| | | <el-menu-item index="/main/report/TaskCompletionStatus">{{$t('report.TaskCompletionStatus')}}</el-menu-item> |
| | | <el-menu-item index="/main/report/RawMaterialRequisition">{{$t('report.rawMaterialRequisition')}}</el-menu-item> |
| | |
| | | import {addListener, toolbarButtonClickEvent} from "@/hook/mouseMove" |
| | | import {VxeUI} from "vxe-pc-ui"; |
| | | import companyInfo from "@/stores/sd/companyInfo"; |
| | | import useOrderInfoStore from "@/stores/sd/order/orderInfo"; |
| | | //语言获取 |
| | | const {t} = useI18n() |
| | | let router = useRouter() |
| | |
| | | orderId: '', |
| | | project: '' |
| | | }) |
| | | |
| | | const reportTime=company.reportTime |
| | | const orderInfo = useOrderInfoStore() |
| | | |
| | | //工序 |
| | | const procseeValue = ref() |
| | |
| | | let day = pad(date.getDate()); |
| | | let newEndTime = `${year}-${month}-${day} ${times}`; |
| | | //第一次加载数据 |
| | | request.post(`/report/teamOutput/1/${total.pageSize}/${startTime}/${newEndTime}/${selectProcesses}`, filterData.value).then((res) => { |
| | | |
| | | request.post(`/report/teamOutput/1/${total.pageSize}/${orderInfo.teamOutputDate}/${reportTime}/${selectProcesses}`, filterData.value).then((res) => { |
| | | |
| | | if (res.code == 200) { |
| | | total.value = res.data.footSum |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | pageTotal.value = res.data.total |
| | | orderInfo.teamOutputDate = res.data.selectDate |
| | | produceList = produceList.value.concat(deepClone(res.data.data)) |
| | | titleSelectJson.value.processType = res.data.process |
| | | produceList.forEach(item => { |
| | |
| | | const newEndTime = formatDateTime(endPlusOne); |
| | | const selectProcesses = procseeValue.value; |
| | | form.date1 = [startTime, newEndTime]; |
| | | request.post(`/report/teamOutput/${pageNum.value}/${total.pageSize}/${startTime}/${newEndTime}/${selectProcesses}`, filterData.value).then((res) => { |
| | | request.post(`/report/teamOutput/1/${total.pageSize}/${orderInfo.teamOutputDate}/${reportTime}/${selectProcesses}`, filterData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | |
| | | total.value = res.data.footSum |
| | | orderInfo.teamOutputDate = res.data.selectDate |
| | | produceList = deepClone(res.data.data) |
| | | produceList.forEach(item => { |
| | | item.mmTotal = sumMmValues(item.workProcessName); |
| | |
| | | |
| | | form.date1 = [startTime, newEndTime]; |
| | | |
| | | request.post(`/report/teamOutput/${pageNum.value}/${total.pageSize}/${startTime}/${newEndTime}/${selectProcesses}`, filterData.value) |
| | | request.post(`/report/teamOutput/1/${total.pageSize}/${orderInfo.teamOutputDate}/${reportTime}/${selectProcesses}`, filterData.value) |
| | | .then((res) => { |
| | | if (res.code == 200) { |
| | | total.value = res.data.footSum; |
| | | total.dataTotal = res.data.total.total * 1; |
| | | total.pageTotal = res.data.total.pageTotal; |
| | | pageTotal.value = res.data.total; |
| | | |
| | | orderInfo.teamOutputDate = res.data.selectDate |
| | | produceList = res.data.data; |
| | | produceList.forEach(item => { |
| | | item.mmTotal = sumMmValues(item.workProcessName); |
| | |
| | | endPlusOne.setDate(endPlusOne.getDate()); |
| | | const newEndTime = formatDateTime(endPlusOne); |
| | | form.date1 = [startTime, newEndTime]; |
| | | request.post(`/report/teamOutput/1/${total.pageSize}/${startTime}/${newEndTime}/${selectProcesses}`, filterData.value).then((res) => { |
| | | request.post(`/report/teamOutput/1/${total.pageSize}/${orderInfo.teamOutputDate}/${reportTime}/${selectProcesses}`, filterData.value).then((res) => { |
| | | |
| | | if (res.code == 200) { |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal=parseInt(res.data.total) |
| | | pageNum.value=1 |
| | | orderInfo.teamOutputDate = res.data.selectDate |
| | | total.value = res.data.footSum |
| | | produceList = deepClone(res.data.data) |
| | | produceList.forEach(item => { |
| | |
| | | <!-- <el-input placeholder="销售单号" v-model="form.name" style="width: 150px"/>--> |
| | | <!-- <el-input placeholder="项目名称" v-model="form.name" style="width: 150px"/>--> |
| | | |
| | | <el-date-picker |
| | | v-model="form.date1" |
| | | :start-placeholder="$t('basicData.startDate')" |
| | | :end-placeholder="$t('basicData.endDate')" |
| | | format="YYYY/MM/DD HH:mm" |
| | | style="width: 350px" |
| | | type="daterange" |
| | | value-format="YYYY/MM/DD HH:mm" |
| | | /> |
| | | <el-date-picker |
| | | v-model="orderInfo.teamOutputDate" |
| | | type="daterange" |
| | | :start-placeholder="$t('basicData.startDate')" |
| | | :end-placeholder="$t('basicData.endDate')" |
| | | format="YYYY/MM/DD HH:mm" |
| | | value-format="YYYY-MM-DD HH:mm" |
| | | /> |
| | | |
| | | <el-select v-model="procseeValue" clearable default-value="default_city" style="width: 120px"> |
| | | <el-option |
| | |
| | | <vxe-button style="margin-right: 0.5rem" |
| | | @click="exportExcel('/report/exportTeamOutput', |
| | | t('report.teamOutput'), |
| | | form.date1)"> |
| | | orderInfo.teamOutputDate)"> |
| | | {{t('basicData.export')}}</vxe-button> |
| | | </template> |
| | | |
| New file |
| | |
| | | <script setup> |
| | | |
| | | import {onMounted, reactive, ref} from "vue"; |
| | | import {useRouter} from 'vue-router' |
| | | import request from "@/utils/request"; |
| | | import deepClone from "@/utils/deepClone"; |
| | | import {ElDatePicker, ElMessage} from "element-plus"; |
| | | import {useI18n} from 'vue-i18n' |
| | | import footSum from "@/hook/footSum" |
| | | import {addListener, toolbarButtonClickEvent} from "@/hook/mouseMove" |
| | | import {VxeUI} from "vxe-pc-ui"; |
| | | import companyInfo from "@/stores/sd/companyInfo"; |
| | | import useOrderInfoStore from "@/stores/sd/order/orderInfo"; |
| | | //语言获取 |
| | | const {t} = useI18n() |
| | | let router = useRouter() |
| | | let filterData = ref({}) |
| | | const company = companyInfo() |
| | | //提交的表单 |
| | | const form = reactive({ |
| | | date1: '', |
| | | orderId: '', |
| | | project: '' |
| | | }) |
| | | |
| | | const reportTime=company.reportTime |
| | | const orderInfo = useOrderInfoStore() |
| | | |
| | | //工序 |
| | | const procseeValue = ref() |
| | | |
| | | //表尾求和 |
| | | const sumNum = (list, field) => { |
| | | let count = 0 |
| | | list.forEach(item => { |
| | | count += Number(item[field]) |
| | | }) |
| | | return count.toFixed(2) |
| | | } |
| | | |
| | | //定义滚动条高度 |
| | | let scrollTop = ref(null) |
| | | let scrollHeight = ref(null) |
| | | let clientHeight = ref(null) |
| | | const scrollEvnt = (row) => { |
| | | // 内容高度 |
| | | scrollTop.value = row.$event.target.scrollTop |
| | | scrollHeight.value = row.$event.target.scrollHeight |
| | | clientHeight.value = row.$event.target.clientHeight |
| | | } |
| | | |
| | | |
| | | //定义页面总页数 |
| | | let pageTotal = ref('') |
| | | //定义数据返回结果 |
| | | let produceList = ref([]) |
| | | //定义当前页数 |
| | | let pageNum = ref(1) |
| | | let pageState = null |
| | | |
| | | //计算时间差 |
| | | function getDaysBetween(startTime, endTime, includeEnd = false) { |
| | | const start = new Date(startTime) |
| | | const end = new Date(endTime) |
| | | |
| | | // 转为时间戳计算差值 |
| | | const diffMs = end.setHours(0, 0, 0, 0) - start.setHours(0, 0, 0, 0) |
| | | const diffDays = diffMs / (1000 * 60 * 60 * 24) |
| | | |
| | | // 返回整数天数 |
| | | return includeEnd ? diffDays + 1 : diffDays |
| | | } |
| | | |
| | | const times=company.reportTime |
| | | //获取七天前到当前时间 |
| | | function getNowTime() { |
| | | const pad = (n) => n.toString().padStart(2, '0'); |
| | | |
| | | const formatDate = (date) => { |
| | | const year = date.getFullYear(); |
| | | const month = pad(date.getMonth() + 1); |
| | | const day = pad(date.getDate()); |
| | | return `${year}-${month}-${day} ${times}`; |
| | | }; |
| | | |
| | | const now = new Date(); |
| | | const startDate = new Date(now.getTime() - 3600 * 1000 * 24 * 3); // 三天前 |
| | | const start = formatDate(startDate); |
| | | const end = formatDate(now); |
| | | |
| | | return [start, end]; |
| | | } |
| | | |
| | | onMounted(() => { |
| | | //启用表格拖动选中 |
| | | addListener(xGrid.value, gridOptions) |
| | | |
| | | }) |
| | | |
| | | //第一次加载获取近七天时间和默认状态 |
| | | form.date1 = getNowTime() |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | let selectProcesses = procseeValue.value |
| | | |
| | | let total = reactive({ |
| | | pageTotal: 0, |
| | | dataTotal: 0, |
| | | pageSize: 100 |
| | | }) |
| | | //定义接收加载表头下拉数据 |
| | | const titleSelectJson = ref({ |
| | | processType: [], |
| | | }) |
| | | let date = new Date(endTime); // 将日期字符串转为 Date 对象 |
| | | // 使用 setDate 方法加一天 |
| | | date.setDate(date.getDate() + 1); |
| | | const pad = (n) => n.toString().padStart(2, '0'); |
| | | let year = date.getFullYear(); |
| | | let month = pad(date.getMonth() + 1); |
| | | let day = pad(date.getDate()); |
| | | let newEndTime = `${year}-${month}-${day} ${times}`; |
| | | //第一次加载数据 |
| | | request.post(`/report/TeamOutputSummary/1/${total.pageSize}/${orderInfo.teamOutputDate}/${reportTime}/${selectProcesses}`, filterData.value).then((res) => { |
| | | |
| | | if (res.code == 200) { |
| | | total.value = res.data.footSum |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | pageTotal.value = res.data.total |
| | | orderInfo.teamOutputDate = res.data.selectDate |
| | | produceList = produceList.value.concat(deepClone(res.data.data)) |
| | | titleSelectJson.value.processType = res.data.process |
| | | produceList.forEach(item => { |
| | | item.mmTotal = sumMmValues(item.workProcessName); |
| | | }); |
| | | xGrid.value.reloadData(produceList) |
| | | gridOptions.loading = false |
| | | } else { |
| | | gridOptions.loading = false |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | |
| | | //页脚翻页查询 |
| | | const selectPageList = () => { |
| | | gridOptions.loading = true |
| | | // 解析 company.reportTime |
| | | const [reportHourStr, reportMinuteStr] = company.reportTime.split(":"); |
| | | const reportHour = parseInt(reportHourStr); |
| | | const reportMinute = parseInt(reportMinuteStr); |
| | | |
| | | // 原始 form.date1 是日期对象数组 |
| | | const rawStart = new Date(form.date1[0]); |
| | | const rawEnd = new Date(form.date1[1]); |
| | | |
| | | // 判断时间部分是否需要修正为 company.reportTime |
| | | const isZeroOrReport = (dateObj) => { |
| | | const h = dateObj.getHours(); |
| | | const m = dateObj.getMinutes(); |
| | | // 判断条件:是 00:00 或者是 reportTime 对应的时间 |
| | | return (h === 0 && m === 0) || (h === reportHour && m === reportMinute); |
| | | }; |
| | | |
| | | if (isZeroOrReport(rawStart)) { |
| | | rawStart.setHours(reportHour, reportMinute, 0, 0); |
| | | } |
| | | if (isZeroOrReport(rawEnd)) { |
| | | rawEnd.setHours(reportHour, reportMinute, 0, 0); |
| | | } |
| | | const startTime = formatDateTime(rawStart); |
| | | const endPlusOne = new Date(rawEnd); |
| | | endPlusOne.setDate(endPlusOne.getDate()); |
| | | const newEndTime = formatDateTime(endPlusOne); |
| | | const selectProcesses = procseeValue.value; |
| | | form.date1 = [startTime, newEndTime]; |
| | | request.post(`/report/TeamOutputSummary/1/${total.pageSize}/${orderInfo.teamOutputDate}/${reportTime}/${selectProcesses}`, filterData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | |
| | | total.value = res.data.footSum |
| | | orderInfo.teamOutputDate = res.data.selectDate |
| | | produceList = deepClone(res.data.data) |
| | | produceList.forEach(item => { |
| | | item.mmTotal = sumMmValues(item.workProcessName); |
| | | }); |
| | | xGrid.value.reloadData(produceList) |
| | | gridOptions.loading = false |
| | | } else { |
| | | gridOptions.loading = false |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | const formatDateTime = (date) => { |
| | | const year = date.getFullYear(); |
| | | const month = pad(date.getMonth() + 1); |
| | | const day = pad(date.getDate()); |
| | | const hour = pad(date.getHours()); |
| | | const minute = pad(date.getMinutes()); |
| | | return `${year}-${month}-${day} ${hour}:${minute}:00`; |
| | | }; |
| | | |
| | | |
| | | //点击查询 |
| | | const getWorkOrder = () => { |
| | | gridOptions.loading = true; |
| | | |
| | | // 解析 company.reportTime |
| | | const [reportHourStr, reportMinuteStr] = company.reportTime.split(":"); |
| | | const reportHour = parseInt(reportHourStr); |
| | | const reportMinute = parseInt(reportMinuteStr); |
| | | |
| | | // 原始 form.date1 是日期对象数组 |
| | | const rawStart = new Date(form.date1[0]); |
| | | const rawEnd = new Date(form.date1[1]); |
| | | |
| | | // 判断时间部分是否需要修正为 company.reportTime |
| | | const isZeroOrReport = (dateObj) => { |
| | | const h = dateObj.getHours(); |
| | | const m = dateObj.getMinutes(); |
| | | // 判断条件:是 00:00 或者是 reportTime 对应的时间 |
| | | return (h === 0 && m === 0) || (h === reportHour && m === reportMinute); |
| | | }; |
| | | |
| | | if (isZeroOrReport(rawStart)) { |
| | | rawStart.setHours(reportHour, reportMinute, 0, 0); |
| | | } |
| | | if (isZeroOrReport(rawEnd)) { |
| | | rawEnd.setHours(reportHour, reportMinute, 0, 0); |
| | | } |
| | | |
| | | // 格式化 |
| | | const startTime = formatDateTime(rawStart); |
| | | |
| | | const endPlusOne = new Date(rawEnd); |
| | | endPlusOne.setDate(endPlusOne.getDate()); |
| | | const newEndTime = formatDateTime(endPlusOne); |
| | | |
| | | const selectProcesses = procseeValue.value; |
| | | |
| | | const timeDifference = getDaysBetween(startTime, newEndTime); |
| | | if (timeDifference > 180) { |
| | | ElMessage.warning(t('report.theTimeLimitCannotExceed180Days')); |
| | | gridOptions.loading = false; |
| | | return; |
| | | } |
| | | |
| | | form.date1 = [startTime, newEndTime]; |
| | | |
| | | request.post(`/report/TeamOutputSummary/1/${total.pageSize}/${orderInfo.teamOutputDate}/${reportTime}/${selectProcesses}`, filterData.value) |
| | | .then((res) => { |
| | | if (res.code == 200) { |
| | | total.value = res.data.footSum; |
| | | orderInfo.teamOutputDate = res.data.selectDate |
| | | total.dataTotal = res.data.total.total * 1; |
| | | total.pageTotal = res.data.total.pageTotal; |
| | | pageTotal.value = res.data.total; |
| | | |
| | | produceList = res.data.data; |
| | | produceList.forEach(item => { |
| | | item.mmTotal = sumMmValues(item.workProcessName); |
| | | }); |
| | | |
| | | xGrid.value.loadData(produceList); |
| | | gridOptions.loading = false; |
| | | } else { |
| | | gridOptions.loading = false |
| | | ElMessage.warning(res.msg); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | const sumMmValues = (workProcessName) => { |
| | | if (!workProcessName) return 0; |
| | | |
| | | return workProcessName |
| | | .split('+') // 拆分每个部分 |
| | | .map(part => { |
| | | const match = part.match(/^(\d+)(?=mm)/); // 提取 mm 前面的数字 |
| | | return match ? parseInt(match[1], 10) : 0; |
| | | }) |
| | | .reduce((sum, num) => sum + num, 0); // 求和 |
| | | } |
| | | //页脚跳转 |
| | | const handlePageChange = ({currentPage, pageSize}) => { |
| | | pageNum.value = currentPage |
| | | total.pageTotal = pageSize |
| | | selectPageList() |
| | | } |
| | | |
| | | /*使用筛选,后端获取数据*/ |
| | | const changeFilterEvent = (event, option, $panel,) => { |
| | | // 手动触发筛选 |
| | | $panel.changeOption(event, !!option.data, option) |
| | | } |
| | | |
| | | function filterChanged(column){ |
| | | gridOptions.loading = true |
| | | let selectProcesses = procseeValue.value |
| | | //gridOptions.loading=true |
| | | //筛选条件发生变化条件发生变化 |
| | | let value = column.datas[0]!=undefined?column.datas[0]:'' |
| | | value = value.trim() |
| | | //判断是否存在外键 |
| | | if (column.property.indexOf('.')>-1){ |
| | | const columnArr = column.property.split('.') |
| | | filterData.value[columnArr[0]] = { |
| | | [columnArr[1]]:value |
| | | } |
| | | }else{ |
| | | filterData.value[column.property] = value |
| | | } |
| | | |
| | | // 解析 company.reportTime |
| | | const [reportHourStr, reportMinuteStr] = company.reportTime.split(":"); |
| | | const reportHour = parseInt(reportHourStr); |
| | | const reportMinute = parseInt(reportMinuteStr); |
| | | |
| | | // 原始 form.date1 是日期对象数组 |
| | | const rawStart = new Date(form.date1[0]); |
| | | const rawEnd = new Date(form.date1[1]); |
| | | |
| | | // 判断时间部分是否需要修正为 company.reportTime |
| | | const isZeroOrReport = (dateObj) => { |
| | | const h = dateObj.getHours(); |
| | | const m = dateObj.getMinutes(); |
| | | // 判断条件:是 00:00 或者是 reportTime 对应的时间 |
| | | return (h === 0 && m === 0) || (h === reportHour && m === reportMinute); |
| | | }; |
| | | |
| | | if (isZeroOrReport(rawStart)) { |
| | | rawStart.setHours(reportHour, reportMinute, 0, 0); |
| | | } |
| | | if (isZeroOrReport(rawEnd)) { |
| | | rawEnd.setHours(reportHour, reportMinute, 0, 0); |
| | | } |
| | | const startTime = formatDateTime(rawStart); |
| | | const endPlusOne = new Date(rawEnd); |
| | | endPlusOne.setDate(endPlusOne.getDate()); |
| | | const newEndTime = formatDateTime(endPlusOne); |
| | | form.date1 = [startTime, newEndTime]; |
| | | request.post(`/report/TeamOutputSummary/1/${total.pageSize}/${orderInfo.teamOutputDate}/${reportTime}/${selectProcesses}`, filterData.value).then((res) => { |
| | | |
| | | if (res.code == 200) { |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal=parseInt(res.data.total) |
| | | orderInfo.teamOutputDate = res.data.selectDate |
| | | pageNum.value=1 |
| | | total.value = res.data.footSum |
| | | produceList = deepClone(res.data.data) |
| | | produceList.forEach(item => { |
| | | item.mmTotal = sumMmValues(item.workProcessName); |
| | | }); |
| | | xGrid.value.loadData(produceList) |
| | | |
| | | gridOptions.loading=false |
| | | } else { |
| | | gridOptions.loading = false |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | |
| | | } |
| | | |
| | | /*后端返回结果多层嵌套展示*/ |
| | | const hasDecimal = (value) => { |
| | | const regex = /\./; // 定义正则表达式,查找小数点 |
| | | return regex.test(value); // 返回true/false |
| | | } |
| | | |
| | | //子组件接收参数 |
| | | const xGrid = ref() |
| | | const gridOptions = reactive({ |
| | | loading: true, |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe: true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true, height: 30},//鼠标移动或选择高亮 |
| | | id: 'TeamOutput', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | | exportConfig: {}, |
| | | scrollY: {enabled: true},//开启虚拟滚动 |
| | | showOverflow: true, |
| | | columnConfig: { |
| | | resizable: true, |
| | | useKey: true |
| | | }, |
| | | filterConfig: { //筛选配置项 |
| | | remote: true |
| | | }, |
| | | customConfig: { |
| | | storage: true |
| | | }, |
| | | editConfig: { |
| | | trigger: 'click', |
| | | mode: 'row', |
| | | showStatus: true |
| | | },//表头参数 |
| | | columns: [ |
| | | {type: 'expand', fixed: "left", slots: {content: 'content'}, width: 50}, |
| | | {type: 'seq', fixed: "left", title: t('basicData.Number'), width: 50}, |
| | | |
| | | { |
| | | field: 'thisProcess', |
| | | title: t('reportingWorks.reportingProcess'), |
| | | showOverflow: "ellipsis", |
| | | filters:[{ data: '' }],slots: { filter: 'num1_filter' } |
| | | }, |
| | | { |
| | | field: 'teamsGroupsName', title: t('reportingWorks.teamsType'),filters:[{ data: '' }],slots: { filter: 'num1_filter' } |
| | | }, |
| | | |
| | | {field: 'workProcessName', title: t('report.workProcessName'), |
| | | filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'completedQuantity', title: t('reportingWorks.completedQuantity')}, |
| | | {field: 'area', title: t('reportingWorks.completedArea')}, |
| | | |
| | | ],//表头按钮 |
| | | |
| | | toolbarConfig: { |
| | | // buttons: [{ |
| | | // |
| | | // }], |
| | | slots: { |
| | | tools: 'toolbar_buttons' |
| | | }, |
| | | // import: false, |
| | | // export: true, |
| | | // print: true, |
| | | zoom: true, |
| | | custom: true |
| | | }, |
| | | data: [],//table body实际数据 |
| | | //脚部求和 |
| | | footerMethod ({ columns, data }) {//页脚函数 |
| | | return[ |
| | | columns.map((column, columnIndex) => { |
| | | if (columnIndex === 0) { |
| | | return t('basicData.total') |
| | | } |
| | | const List = ["completedQuantity",'area','thicknessArea'] |
| | | if (List.includes(column.field)) { |
| | | //return footSum(data, column.field) |
| | | return total.value?.[column.field] ?? 0 |
| | | } |
| | | return '' |
| | | }) |
| | | ] |
| | | } |
| | | |
| | | }) |
| | | |
| | | function exportExcel(url, fileName,date) { |
| | | gridOptions.loading = true |
| | | let processes = procseeValue.value |
| | | if(date===null){ |
| | | ElMessage.warning(t('report.pleaseSelectADateFirst')) |
| | | return |
| | | } |
| | | |
| | | if(processes===null){ |
| | | ElMessage.warning(t('report.pleaseSelectAProcessFirst')) |
| | | return |
| | | } |
| | | |
| | | const date1 = new Date(date[0]); |
| | | const date2 = new Date(date[1]); |
| | | const timeDiff = Math.abs(date2.getTime() - date1.getTime()); |
| | | const daysDiff = timeDiff / (1000 * 3600 * 24); |
| | | if(Math.floor(daysDiff)>180){ |
| | | ElMessage.warning(t('report.theFilteringTimeForExportCannotExceed180Days')) |
| | | return |
| | | } |
| | | let dataMp = ref({ |
| | | date: date, |
| | | processes: processes |
| | | }) |
| | | request.post(url,dataMp.value,{responseType :'blob'}).then(res => { |
| | | const blob = new Blob([res]) |
| | | if ('download' in document.createElement('a')) { // 非IE下载 |
| | | const elink = document.createElement('a') |
| | | elink.download = `${fileName}.xlsx` |
| | | elink.style.display = 'none' |
| | | elink.href = URL.createObjectURL(blob) |
| | | document.body.appendChild(elink) |
| | | elink.click() |
| | | URL.revokeObjectURL(elink.href) // 释放URL 对象 |
| | | document.body.removeChild(elink) |
| | | gridOptions.loading = false |
| | | } else { // IE10+下载 |
| | | navigator.msSaveBlob(blob, fileName) |
| | | } |
| | | |
| | | }) |
| | | } |
| | | |
| | | const handleCellDblClick = ({ row, column, cell, $event }) => { |
| | | VxeUI.clipboard.copy(row[column.property]) |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div style="width: 100%;height: 100%"> |
| | | <div class="head"> |
| | | <!-- <el-input placeholder="销售单号" v-model="form.name" style="width: 150px"/>--> |
| | | <!-- <el-input placeholder="项目名称" v-model="form.name" style="width: 150px"/>--> |
| | | |
| | | <el-date-picker |
| | | v-model="orderInfo.teamOutputDate" |
| | | type="daterange" |
| | | :start-placeholder="$t('basicData.startDate')" |
| | | :end-placeholder="$t('basicData.endDate')" |
| | | format="YYYY/MM/DD HH:mm" |
| | | value-format="YYYY-MM-DD HH:mm" |
| | | /> |
| | | |
| | | <el-select v-model="procseeValue" clearable default-value="default_city" style="width: 120px"> |
| | | <el-option |
| | | :label="t('report.allProcess')" |
| | | :value="'all'" |
| | | /> |
| | | <el-option |
| | | v-for="item in titleSelectJson['processType']" |
| | | :key="item.id" |
| | | :label="item.basic_name" |
| | | :value="item.basic_name" |
| | | /> |
| | | </el-select> |
| | | <el-button type="primary" @click="getWorkOrder">{{$t('basicData.search')}}</el-button> |
| | | |
| | | |
| | | </div> |
| | | <div class="main-table"> |
| | | <vxe-grid |
| | | ref="xGrid" |
| | | class="mytable-scrollbar" |
| | | height="100%" |
| | | v-bind="gridOptions" |
| | | @filter-change="filterChanged" |
| | | @cell-dblclick="handleCellDblClick" |
| | | |
| | | > |
| | | <!-- @toolbar-button-click="toolbarButtonClickEvent"--> |
| | | <!-- 下拉显示所有信息插槽--> |
| | | <template #content="{ row }"> |
| | | <ul class="expand-wrapper"> |
| | | <li v-for="(item,index) in gridOptions.columns" v-show="item.field!=undefined "> |
| | | <span style="font-weight: bold">{{ item.title + ': ' }}</span> |
| | | <span>{{ row[item.field] }}</span> |
| | | </li> |
| | | </ul> |
| | | </template> |
| | | |
| | | <template #pager> |
| | | <!--使用 pager 插槽--> |
| | | <!-- 'PrevJump','NextJump', --> |
| | | <vxe-pager |
| | | v-model:current-page="pageNum" |
| | | v-model:page-size="total.pageSize" |
| | | v-model:pager-count="total.pageTotal" |
| | | :layouts="[ 'PrevPage', 'Jump','PageCount', 'NextPage', 'Total']" |
| | | :total="total.dataTotal" |
| | | @page-change="handlePageChange" |
| | | > |
| | | </vxe-pager> |
| | | </template> |
| | | <template #num1_filter="{ column, $panel }"> |
| | | <div> |
| | | <div v-for="(option, index) in column.filters" :key="index"> |
| | | <input v-model="option.data" type="text" |
| | | @keyup.enter.native="$panel.confirmFilter()" |
| | | @input="changeFilterEvent($event, option, $panel)"/> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <template #toolbar_buttons> |
| | | <vxe-button style="margin-right: 0.5rem" |
| | | @click="exportExcel('/report/exportTeamOutputSummary', |
| | | t('report.teamOutputSummary'), |
| | | orderInfo.teamOutputDate)"> |
| | | {{t('basicData.export')}}</vxe-button> |
| | | </template> |
| | | |
| | | </vxe-grid> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | .head{ |
| | | width: 100%; |
| | | height: 35px; |
| | | } |
| | | |
| | | .main-table{ |
| | | width: 100%; |
| | | height: calc(100% - 35px); |
| | | } |
| | | .vxe-grid { |
| | | /* 禁用浏览器默认选中 */ |
| | | -webkit-user-select: none; |
| | | -moz-user-select: none; |
| | | -ms-user-select: none; |
| | | user-select: none; |
| | | } |
| | | </style> |
| | |
| | | return Result.success(reportService.rawMaterialRequisitionSv(selectTime1, selectTime2, report)); |
| | | } |
| | | |
| | | @ApiOperation("班组产量汇总报表") |
| | | @PostMapping("/TeamOutputSummary/{pageNum}/{pageSize}/{selectDate}/{reportTime}/{selectProcesses}") |
| | | public Result TeamOutputSummary( |
| | | @PathVariable Integer pageNum, |
| | | @PathVariable Integer pageSize, |
| | | @PathVariable List<String> selectDate, |
| | | @PathVariable String reportTime, |
| | | @PathVariable String selectProcesses, |
| | | @RequestBody TeamOutputDTO teamOutputDTO) { |
| | | return Result.success(reportService.TeamOutputSummarySv(pageNum, pageSize, selectDate, reportTime,selectProcesses, teamOutputDTO)); |
| | | |
| | | } |
| | | |
| | | @ApiOperation("班组产量明细报表") |
| | | @PostMapping("/teamOutput/{pageNum}/{pageSize}/{selectTime1}/{selectTime2}/{selectProcesses}") |
| | | @PostMapping("/teamOutput/{pageNum}/{pageSize}/{selectDate}/{reportTime}/{selectProcesses}") |
| | | public Result teamOutput( |
| | | @PathVariable Integer pageNum, |
| | | @PathVariable Integer pageSize, |
| | | @PathVariable String selectTime1, |
| | | @PathVariable String selectTime2, |
| | | @PathVariable List<String> selectDate, |
| | | @PathVariable String reportTime, |
| | | @PathVariable String selectProcesses, |
| | | @RequestBody TeamOutputDTO teamOutputDTO) { |
| | | return Result.success(reportService.teamOutputSv(pageNum, pageSize, selectTime1, selectTime2,selectProcesses, teamOutputDTO)); |
| | | return Result.success(reportService.teamOutputSv(pageNum, pageSize, selectDate, reportTime,selectProcesses, teamOutputDTO)); |
| | | |
| | | } |
| | | @ApiOperation("跨工序次破报表导出") |
| | |
| | | DownExcel.download(response, ScheduleProductionScheduleDTO.class, reportService.exportScheduleReportSv(dates), "ScheduleProduction"); |
| | | } |
| | | |
| | | @ApiOperation("班组产量导出") |
| | | @ApiOperation("班组产量明细导出") |
| | | @PostMapping("/exportTeamOutput") |
| | | public void exportTeamOutput(HttpServletResponse response, |
| | | @RequestBody Map<String, Object> dates |
| | |
| | | DownExcel.download(response, TeamOutputDTO.class, reportService.exportTeamOutputSv(dates), "TeamOutput"); |
| | | } |
| | | |
| | | @ApiOperation("班组产量汇总导出") |
| | | @PostMapping("/exportTeamOutputSummary") |
| | | public void exportTeamOutputSummary(HttpServletResponse response, |
| | | @RequestBody Map<String, Object> dates |
| | | ) throws IOException, IllegalAccessException, InstantiationException { |
| | | //参数:相应的数据,实体类信息,相应的方法(数据获取),生成的excel名字 |
| | | DownExcel.download(response, TeamOutputDTO.class, reportService.exportTeamOutputSummarySv(dates), "TeamOutput"); |
| | | } |
| | | |
| | | @ApiOperation("在制品汇总报表") |
| | | @PostMapping("/workInProgressCombination/{pageNum}/{pageSize}/{orderId}/{inputProject}/{selectProcesses}/{optionVal}/{terminationVal}") |
| | | public Result workInProgressCombination( |
| | |
| | | |
| | | List<Map<String, String>> selectProcessCompletedMp(Date selectTime1, Date selectTime2, String orderId, String inputProject, String selectProcesses, String laminating, Report report); |
| | | |
| | | List<TeamOutputDTO> TeamOutputSummaryMp(Integer offset, Integer pageSize, String selectTime1, String selectTime2, String selectProcesses, String laminating, TeamOutputDTO teamOutputDTO); |
| | | |
| | | Map<String, Integer> teamOutputSummaryPageTotal(Integer offset, Integer pageSize, String selectTime1, String selectTime2, String selectProcesses, String laminating, TeamOutputDTO teamOutputDTO); |
| | | |
| | | List<TeamOutputDTO> exportTeamOutputSummaryMp(List<LocalDate> date, String selectProcesses, String laminating); |
| | | |
| | | |
| | | // Map<String, Integer> getWorkInProgressTotal( |
| | |
| | | @Param("orderDetail") OrderDetail orderDetail); |
| | | |
| | | List<Map<String,Object>> getProjectList(Long id); |
| | | |
| | | Integer countByCustomerName(@Param("customer") Customer customer); |
| | | } |
| | |
| | | // } |
| | | |
| | | public Map<String, Object> teamOutputSv(Integer pageNum, Integer pageSize, |
| | | String selectTime1, String selectTime2, |
| | | List<String> selectDate, |
| | | String reportTime, |
| | | String selectProcesses, TeamOutputDTO teamOutputDTO) { |
| | | if ("all".equals(selectProcesses)) { |
| | | selectProcesses = ""; |
| | | } |
| | | // 默认时间范围:过去 15 天(日期 + reportTime) |
| | | String startDate = toReportTime(LocalDate.now().minusDays(15).toString(), reportTime); |
| | | String endDate = toReportTime(LocalDate.now().toString(), reportTime); |
| | | |
| | | // 如果前端传了时间,就用前端日期 + reportTime |
| | | if (selectDate != null && selectDate.size() == 2) { |
| | | if (selectDate.get(0) != null && !selectDate.get(0).isEmpty()) { |
| | | startDate = toReportTime(selectDate.get(0), reportTime); |
| | | } |
| | | if (selectDate.get(1) != null && !selectDate.get(1).isEmpty()) { |
| | | endDate = toReportTime(selectDate.get(1), reportTime); |
| | | } |
| | | } |
| | | Integer offset = (pageNum - 1) * pageSize; |
| | | Map<String, Object> result = new HashMap<>(); |
| | | |
| | | String laminating = reportMapper.getLaminating(selectProcesses); |
| | | |
| | | String finalStartDate = startDate; |
| | | String finalEndDate = endDate; |
| | | String finalSelectProcesses = selectProcesses; |
| | | CompletableFuture<List<TeamOutputDTO>> dataFuture = asyncExecutor.runAsync(() -> |
| | | reportMapper.teamOutputMp(offset, pageSize, selectTime1, selectTime2, finalSelectProcesses, laminating, teamOutputDTO)); |
| | | reportMapper.teamOutputMp(offset, pageSize, finalStartDate, finalEndDate, finalSelectProcesses, laminating, teamOutputDTO)); |
| | | |
| | | CompletableFuture<List<Map<String, String>>> processFuture = asyncExecutor.runAsync(() -> |
| | | productionSchedulingMapper.selectProcess()); |
| | | |
| | | CompletableFuture<Map<String, Integer>> totalFuture = asyncExecutor.runAsync(() -> |
| | | reportMapper.teamOutputPageTotal(offset, pageSize, selectTime1, selectTime2, finalSelectProcesses, laminating, teamOutputDTO)); |
| | | reportMapper.teamOutputPageTotal(offset, pageSize, finalStartDate, finalEndDate, finalSelectProcesses, laminating, teamOutputDTO)); |
| | | |
| | | |
| | | CompletableFuture<Map<String, Float>> footSumFuture = asyncExecutor.runAsync(() -> |
| | | reportMapper.teamOutputFootSum(selectTime1, selectTime2, finalSelectProcesses, laminating, teamOutputDTO)); |
| | | reportMapper.teamOutputFootSum(finalStartDate, finalEndDate, finalSelectProcesses, laminating, teamOutputDTO)); |
| | | |
| | | // 等待所有任务完成 |
| | | CompletableFuture.allOf(dataFuture, processFuture, totalFuture, footSumFuture).join(); |
| | |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("并行查询异常:" + e.getMessage(), e); |
| | | } |
| | | |
| | | List<String> list = new ArrayList<>(); |
| | | list.add(startDate); |
| | | list.add(endDate); |
| | | result.put("selectDate", list); |
| | | return result; |
| | | } |
| | | |
| | |
| | | } |
| | | String laminating = reportMapper.getLaminating(process); |
| | | List<TeamOutputDTO> list = reportMapper.exportTeamOutputMp(date, process, laminating); |
| | | |
| | | // 清洗每个 TeamOutputDTO 实例的 String 字段(去除前后空格) |
| | | for (TeamOutputDTO dto : list) { |
| | | for (Field field : dto.getClass().getDeclaredFields()) { |
| | | field.setAccessible(true); |
| | | try { |
| | | Object value = field.get(dto); |
| | | if (value instanceof String) { |
| | | String trimmed = ((String) value).trim(); |
| | | field.set(dto, trimmed); |
| | | } |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | public List exportTeamOutputSummarySv(Map<String, Object> dates) { |
| | | List<LocalDate> date= (List<LocalDate>) dates.get("date"); |
| | | String process= (String) dates.get("processes"); |
| | | if (process.equals("all")){ |
| | | process=""; |
| | | } |
| | | String laminating = reportMapper.getLaminating(process); |
| | | List<TeamOutputDTO> list = reportMapper.exportTeamOutputSummaryMp(date, process, laminating); |
| | | |
| | | // 清洗每个 TeamOutputDTO 实例的 String 字段(去除前后空格) |
| | | for (TeamOutputDTO dto : list) { |
| | |
| | | |
| | | return map; |
| | | } |
| | | |
| | | public Map<String, Object> TeamOutputSummarySv(Integer pageNum, Integer pageSize, List<String> selectDate, |
| | | String reportTime, String selectProcesses, TeamOutputDTO teamOutputDTO) { |
| | | if ("all".equals(selectProcesses)) { |
| | | selectProcesses = ""; |
| | | } |
| | | |
| | | Integer offset = (pageNum - 1) * pageSize; |
| | | |
| | | // 默认时间范围:过去 15 天(日期 + reportTime) |
| | | String startDate = toReportTime(LocalDate.now().minusDays(15).toString(), reportTime); |
| | | String endDate = toReportTime(LocalDate.now().toString(), reportTime); |
| | | |
| | | // 如果前端传了时间,就用前端日期 + reportTime |
| | | if (selectDate != null && selectDate.size() == 2) { |
| | | if (selectDate.get(0) != null && !selectDate.get(0).isEmpty()) { |
| | | startDate = toReportTime(selectDate.get(0), reportTime); |
| | | } |
| | | if (selectDate.get(1) != null && !selectDate.get(1).isEmpty()) { |
| | | endDate = toReportTime(selectDate.get(1), reportTime); |
| | | } |
| | | } |
| | | Map<String, Object> result = new HashMap<>(); |
| | | |
| | | String laminating = reportMapper.getLaminating(selectProcesses); |
| | | |
| | | String finalSelectProcesses = selectProcesses; |
| | | String finalStartDate = startDate; |
| | | String finalEndDate = endDate; |
| | | CompletableFuture<List<TeamOutputDTO>> dataFuture = asyncExecutor.runAsync(() -> |
| | | reportMapper.TeamOutputSummaryMp(offset, pageSize, finalStartDate, finalEndDate, finalSelectProcesses, laminating, teamOutputDTO)); |
| | | |
| | | CompletableFuture<List<Map<String, String>>> processFuture = asyncExecutor.runAsync(() -> |
| | | productionSchedulingMapper.selectProcess()); |
| | | |
| | | CompletableFuture<Map<String, Integer>> totalFuture = asyncExecutor.runAsync(() -> |
| | | reportMapper.teamOutputSummaryPageTotal(offset, pageSize, finalStartDate, finalEndDate, finalSelectProcesses, laminating, teamOutputDTO)); |
| | | |
| | | |
| | | |
| | | CompletableFuture<Map<String, Float>> footSumFuture = asyncExecutor.runAsync(() -> |
| | | reportMapper.teamOutputFootSum(finalStartDate, finalEndDate, finalSelectProcesses, laminating, teamOutputDTO)); |
| | | |
| | | // 等待所有任务完成 |
| | | CompletableFuture.allOf(dataFuture, processFuture, totalFuture, footSumFuture).join(); |
| | | |
| | | try { |
| | | result.put("data", dataFuture.get()); |
| | | result.put("process", processFuture.get()); |
| | | result.put("total", totalFuture.get()); |
| | | result.put("footSum", footSumFuture.get()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("并行查询异常:" + e.getMessage(), e); |
| | | } |
| | | List<String> list = new ArrayList<>(); |
| | | list.add(startDate); |
| | | list.add(endDate); |
| | | result.put("selectDate", list); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | try { |
| | | Customer customer = JSONObject.parseObject(JSONObject.toJSONString(object.get("customer")), Customer.class); |
| | | if(customer!=null){ |
| | | if (customer.getId()!=null && customer.getId()!=0){ |
| | | customerMapper.updateCustomer(customer); |
| | | log.setFunction("insertCustomer修改"); |
| | | }else{ |
| | | customerMapper.insertCustomer(customer); |
| | | log.setFunction("insertCustomer新增"); |
| | | Integer count = customerMapper.countByCustomerName(customer); |
| | | if (count > 0) { |
| | | saveState = false; |
| | | }else { |
| | | if (customer.getId()!=null && customer.getId()!=0){ |
| | | customerMapper.updateCustomer(customer); |
| | | log.setFunction("insertCustomer修改"); |
| | | }else{ |
| | | customerMapper.insertCustomer(customer); |
| | | log.setFunction("insertCustomer新增"); |
| | | } |
| | | logService.saveLog(log); |
| | | } |
| | | logService.saveLog(log); |
| | | } |
| | | } catch (Exception e) { |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | |
| | | AND rw.reviewed_state >= 0 |
| | | AND rwd.completed_quantity > 0 |
| | | AND rw.reporting_work_time >= #{selectTime1} |
| | | AND rw.reporting_work_time < #{selectTime2} |
| | | AND rw.reporting_work_time <= #{selectTime2} |
| | | <choose> |
| | | <!-- 有传工序:精确匹配 --> |
| | | <when test="selectProcesses != null and selectProcesses != ''"> |
| | |
| | | ) t |
| | | WHERE 1 = 1 |
| | | <if test="teamOutputDTO.workProcessName != null and teamOutputDTO.workProcessName != ''"> |
| | | AND t.workProcessName REGEXP #{teamOutputDTO.workProcessName} |
| | | and t.workProcessName like concat('%', #{teamOutputDTO.workProcessName}, '%') |
| | | </if> |
| | | HAVING 1 = 1 |
| | | <if test="teamOutputDTO.thicknessSum != null and teamOutputDTO.thicknessSum != ''"> |
| | |
| | | AND rw.reviewed_state >= 0 |
| | | AND rwd.completed_quantity > 0 |
| | | AND rw.reporting_work_time >= #{date[0]} |
| | | AND rw.reporting_work_time < #{date[1]} |
| | | AND rw.reporting_work_time <= #{date[1]} |
| | | <choose> |
| | | <!-- 有传工序:精确匹配 --> |
| | | <when test="process != null and process != ''"> |
| | |
| | | GROUP BY |
| | | t.this_process |
| | | </select> |
| | | |
| | | <select id="TeamOutputSummaryMp"> |
| | | SELECT |
| | | t.this_process, |
| | | t.teams_groups_name, |
| | | t.workProcessName, |
| | | |
| | | -- 数量汇总 |
| | | SUM(t.completed_quantity) AS completed_quantity, |
| | | |
| | | -- 面积汇总 |
| | | ROUND(SUM(t.area), 2) AS area |
| | | FROM |
| | | ( |
| | | /* ================= 内层子查询(保持不变) ================= */ |
| | | SELECT |
| | | rw.reporting_work_time, |
| | | rw.this_process, |
| | | rw.teams_groups_name, |
| | | o.project, |
| | | o.order_id, |
| | | rw.process_id, |
| | | fc.order_number, |
| | | MAX(ogd.child_width) AS width, |
| | | MAX(ogd.child_height) AS height, |
| | | od.edging_type, |
| | | rwd.completed_quantity AS completed_quantity, |
| | | ROUND( |
| | | MAX(ogd.child_width) * MAX(ogd.child_height) |
| | | * rwd.completed_quantity / 1000000, |
| | | 2 |
| | | ) AS area, |
| | | od.product_name, |
| | | JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')) AS code, |
| | | rw.reviewed, |
| | | rw.examine_time, |
| | | rw.device_name, |
| | | o.order_type, |
| | | CASE |
| | | WHEN LOCATE('step', #{laminating}) > 0 |
| | | THEN GROUP_CONCAT(ogd.glass_child SEPARATOR '+') |
| | | ELSE MAX(ogd.glass_child) |
| | | END AS workProcessName, |
| | | o.batch |
| | | FROM |
| | | pp.reporting_work AS rw |
| | | LEFT JOIN pp.reporting_work_detail AS rwd |
| | | ON rwd.reporting_work_id = rw.reporting_work_id |
| | | LEFT JOIN pp.flow_card AS fc |
| | | ON fc.order_id = rw.order_id |
| | | AND fc.process_id = rw.process_id |
| | | AND fc.order_number = rwd.order_number |
| | | AND fc.technology_number = rwd.technology_number |
| | | LEFT JOIN sd.order_glass_detail AS ogd |
| | | ON ogd.order_id = fc.order_id |
| | | AND ogd.order_number = fc.order_number |
| | | AND ogd.technology_number = fc.technology_number |
| | | LEFT JOIN sd.order_detail AS od |
| | | ON od.order_id = ogd.order_id |
| | | AND od.order_number = ogd.order_number |
| | | LEFT JOIN sd.`order` AS o |
| | | ON o.order_id = od.order_id |
| | | WHERE |
| | | o.create_order > 0 |
| | | AND rw.reviewed_state >= 0 |
| | | AND rwd.completed_quantity > 0 |
| | | AND rw.reporting_work_time >= #{selectTime1} |
| | | AND rw.reporting_work_time <= #{selectTime2} |
| | | |
| | | <choose> |
| | | <!-- 有传工序:精确匹配 --> |
| | | <when test="selectProcesses != null and selectProcesses != ''"> |
| | | AND rw.this_process = #{selectProcesses} |
| | | </when> |
| | | <!-- 未传工序:不加限制,查所有) --> |
| | | <otherwise></otherwise> |
| | | </choose> |
| | | |
| | | <if test="teamOutputDTO.thisProcess != null and teamOutputDTO.thisProcess != ''"> |
| | | AND rw.this_process REGEXP #{teamOutputDTO.thisProcess} |
| | | </if> |
| | | <if test="teamOutputDTO.teamsGroupsName != null and teamOutputDTO.teamsGroupsName != ''"> |
| | | AND rw.teams_groups_name LIKE CONCAT('%', #{teamOutputDTO.teamsGroupsName}, '%') |
| | | </if> |
| | | <if test="teamOutputDTO.project != null and teamOutputDTO.project != ''"> |
| | | AND o.project REGEXP #{teamOutputDTO.project} |
| | | </if> |
| | | <if test="teamOutputDTO.processId != null and teamOutputDTO.processId != ''"> |
| | | AND rw.process_id REGEXP #{teamOutputDTO.processId} |
| | | </if> |
| | | <if test="teamOutputDTO.edgingType != null and teamOutputDTO.edgingType != ''"> |
| | | AND od.edging_type REGEXP #{teamOutputDTO.edgingType} |
| | | </if> |
| | | <if test="teamOutputDTO.deviceName != null and teamOutputDTO.deviceName != ''"> |
| | | AND rw.device_name REGEXP #{teamOutputDTO.deviceName} |
| | | </if> |
| | | <if test="teamOutputDTO.batch != null and teamOutputDTO.batch != ''"> |
| | | AND o.batch REGEXP #{teamOutputDTO.batch} |
| | | </if> |
| | | |
| | | <choose> |
| | | <when test="laminating == ''"> |
| | | GROUP BY |
| | | rw.reporting_work_id, |
| | | rw.process_id, |
| | | rw.this_process, |
| | | rw.teams_groups_name, |
| | | rwd.order_number, |
| | | rwd.technology_number |
| | | </when> |
| | | <otherwise> |
| | | GROUP BY |
| | | <if test="laminating == 'stepA' || laminating == 'stepC'"> |
| | | ogd.`group`, |
| | | </if> |
| | | rw.reporting_work_id, |
| | | rw.process_id, |
| | | rw.this_process, |
| | | rw.teams_groups_name, |
| | | rwd.order_number |
| | | </otherwise> |
| | | </choose> |
| | | ) t |
| | | WHERE 1 = 1 |
| | | <if test="teamOutputDTO.workProcessName != null and teamOutputDTO.workProcessName != ''"> |
| | | and t.workProcessName like concat('%', #{teamOutputDTO.workProcessName}, '%') |
| | | </if> |
| | | GROUP BY |
| | | t.this_process, |
| | | t.teams_groups_name, |
| | | t.workProcessName |
| | | |
| | | ORDER BY |
| | | t.this_process, |
| | | t.teams_groups_name, |
| | | t.workProcessName |
| | | LIMIT #{offset}, #{pageSize}; |
| | | </select> |
| | | |
| | | <select id="teamOutputSummaryPageTotal"> |
| | | |
| | | select CEILING(COUNT(*) / #{pageSize}) AS pageTotal, |
| | | COUNT(*) AS total FROM( |
| | | SELECT |
| | | t.this_process, |
| | | t.teams_groups_name, |
| | | t.workProcessName, |
| | | |
| | | -- 数量汇总 |
| | | SUM(t.completed_quantity) AS completed_quantity, |
| | | |
| | | -- 面积汇总 |
| | | ROUND(SUM(t.area), 2) AS area |
| | | FROM |
| | | ( |
| | | /* ================= 内层子查询(保持不变) ================= */ |
| | | SELECT |
| | | rw.reporting_work_time, |
| | | rw.this_process, |
| | | rw.teams_groups_name, |
| | | o.project, |
| | | o.order_id, |
| | | rw.process_id, |
| | | fc.order_number, |
| | | MAX(ogd.child_width) AS width, |
| | | MAX(ogd.child_height) AS height, |
| | | od.edging_type, |
| | | rwd.completed_quantity AS completed_quantity, |
| | | ROUND( |
| | | MAX(ogd.child_width) * MAX(ogd.child_height) |
| | | * rwd.completed_quantity / 1000000, |
| | | 2 |
| | | ) AS area, |
| | | od.product_name, |
| | | JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')) AS code, |
| | | rw.reviewed, |
| | | rw.examine_time, |
| | | rw.device_name, |
| | | o.order_type, |
| | | CASE |
| | | WHEN LOCATE('step', #{laminating}) > 0 |
| | | THEN GROUP_CONCAT(ogd.glass_child SEPARATOR '+') |
| | | ELSE MAX(ogd.glass_child) |
| | | END AS workProcessName, |
| | | o.batch |
| | | FROM |
| | | pp.reporting_work AS rw |
| | | LEFT JOIN pp.reporting_work_detail AS rwd |
| | | ON rwd.reporting_work_id = rw.reporting_work_id |
| | | LEFT JOIN pp.flow_card AS fc |
| | | ON fc.order_id = rw.order_id |
| | | AND fc.process_id = rw.process_id |
| | | AND fc.order_number = rwd.order_number |
| | | AND fc.technology_number = rwd.technology_number |
| | | LEFT JOIN sd.order_glass_detail AS ogd |
| | | ON ogd.order_id = fc.order_id |
| | | AND ogd.order_number = fc.order_number |
| | | AND ogd.technology_number = fc.technology_number |
| | | LEFT JOIN sd.order_detail AS od |
| | | ON od.order_id = ogd.order_id |
| | | AND od.order_number = ogd.order_number |
| | | LEFT JOIN sd.`order` AS o |
| | | ON o.order_id = od.order_id |
| | | WHERE |
| | | o.create_order > 0 |
| | | AND rw.reviewed_state >= 0 |
| | | AND rwd.completed_quantity > 0 |
| | | AND rw.reporting_work_time >= #{selectTime1} |
| | | AND rw.reporting_work_time <= #{selectTime2} |
| | | |
| | | <choose> |
| | | <!-- 有传工序:精确匹配 --> |
| | | <when test="selectProcesses != null and selectProcesses != ''"> |
| | | AND rw.this_process = #{selectProcesses} |
| | | </when> |
| | | <!-- 未传工序:不加限制,查所有) --> |
| | | <otherwise></otherwise> |
| | | </choose> |
| | | |
| | | <if test="teamOutputDTO.thisProcess != null and teamOutputDTO.thisProcess != ''"> |
| | | AND rw.this_process REGEXP #{teamOutputDTO.thisProcess} |
| | | </if> |
| | | <if test="teamOutputDTO.teamsGroupsName != null and teamOutputDTO.teamsGroupsName != ''"> |
| | | AND rw.teams_groups_name LIKE CONCAT('%', #{teamOutputDTO.teamsGroupsName}, '%') |
| | | </if> |
| | | <if test="teamOutputDTO.project != null and teamOutputDTO.project != ''"> |
| | | AND o.project REGEXP #{teamOutputDTO.project} |
| | | </if> |
| | | <if test="teamOutputDTO.processId != null and teamOutputDTO.processId != ''"> |
| | | AND rw.process_id REGEXP #{teamOutputDTO.processId} |
| | | </if> |
| | | <if test="teamOutputDTO.edgingType != null and teamOutputDTO.edgingType != ''"> |
| | | AND od.edging_type REGEXP #{teamOutputDTO.edgingType} |
| | | </if> |
| | | <if test="teamOutputDTO.deviceName != null and teamOutputDTO.deviceName != ''"> |
| | | AND rw.device_name REGEXP #{teamOutputDTO.deviceName} |
| | | </if> |
| | | <if test="teamOutputDTO.batch != null and teamOutputDTO.batch != ''"> |
| | | AND o.batch REGEXP #{teamOutputDTO.batch} |
| | | </if> |
| | | |
| | | <choose> |
| | | <when test="laminating == ''"> |
| | | GROUP BY |
| | | rw.reporting_work_id, |
| | | rw.process_id, |
| | | rw.this_process, |
| | | rw.teams_groups_name, |
| | | rwd.order_number, |
| | | rwd.technology_number |
| | | </when> |
| | | <otherwise> |
| | | GROUP BY |
| | | <if test="laminating == 'stepA' || laminating == 'stepC'"> |
| | | ogd.`group`, |
| | | </if> |
| | | rw.reporting_work_id, |
| | | rw.process_id, |
| | | rw.this_process, |
| | | rw.teams_groups_name, |
| | | rwd.order_number |
| | | </otherwise> |
| | | </choose> |
| | | ) t |
| | | WHERE 1 = 1 |
| | | <if test="teamOutputDTO.workProcessName != null and teamOutputDTO.workProcessName != ''"> |
| | | and t.workProcessName like concat('%', #{teamOutputDTO.workProcessName}, '%') |
| | | </if> |
| | | GROUP BY |
| | | t.this_process, |
| | | t.teams_groups_name, |
| | | t.workProcessName |
| | | |
| | | ORDER BY |
| | | t.this_process, |
| | | t.teams_groups_name, |
| | | t.workProcessName |
| | | |
| | | ) as b |
| | | LIMIT #{offset}, #{pageSize}; |
| | | </select> |
| | | |
| | | <select id="exportTeamOutputSummaryMp"> |
| | | SELECT |
| | | t.this_process, |
| | | t.teams_groups_name, |
| | | t.workProcessName, |
| | | -- 数量汇总 |
| | | SUM(t.completed_quantity) AS completed_quantity, |
| | | |
| | | -- 面积汇总 |
| | | ROUND(SUM(t.area), 2) AS area |
| | | FROM |
| | | ( |
| | | SELECT |
| | | rw.reporting_work_time, |
| | | rw.this_process, |
| | | rw.teams_groups_name, |
| | | o.project, |
| | | o.order_id, |
| | | rw.process_id, |
| | | fc.order_number, |
| | | MAX(ogd.child_width) AS width, |
| | | MAX(ogd.child_height) AS height, |
| | | od.edging_type, |
| | | rwd.completed_quantity AS completed_quantity, |
| | | ROUND( |
| | | MAX(ogd.child_width) * MAX(ogd.child_height) |
| | | * rwd.completed_quantity / 1000000, |
| | | 2 |
| | | ) AS area, |
| | | od.product_name, |
| | | JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')) AS code, |
| | | rw.reviewed, |
| | | rw.examine_time, |
| | | rw.device_name, |
| | | o.order_type, |
| | | CASE |
| | | WHEN LOCATE('step', #{laminating}) > 0 |
| | | THEN GROUP_CONCAT(ogd.glass_child SEPARATOR '+') |
| | | ELSE MAX(ogd.glass_child) |
| | | END AS workProcessName, |
| | | o.batch |
| | | FROM |
| | | pp.reporting_work AS rw |
| | | LEFT JOIN pp.reporting_work_detail AS rwd |
| | | ON rwd.reporting_work_id = rw.reporting_work_id |
| | | LEFT JOIN pp.flow_card AS fc |
| | | ON fc.order_id = rw.order_id |
| | | AND fc.process_id = rw.process_id |
| | | AND fc.order_number = rwd.order_number |
| | | AND fc.technology_number = rwd.technology_number |
| | | LEFT JOIN sd.order_glass_detail AS ogd |
| | | ON ogd.order_id = fc.order_id |
| | | AND ogd.order_number = fc.order_number |
| | | AND ogd.technology_number = fc.technology_number |
| | | LEFT JOIN sd.order_detail AS od |
| | | ON od.order_id = ogd.order_id |
| | | AND od.order_number = ogd.order_number |
| | | LEFT JOIN sd.`order` AS o |
| | | ON o.order_id = od.order_id |
| | | WHERE |
| | | o.create_order > 0 |
| | | AND rw.reviewed_state >= 0 |
| | | AND rwd.completed_quantity > 0 |
| | | AND rw.reporting_work_time >= #{date[0]} |
| | | AND rw.reporting_work_time <= #{date[1]} |
| | | |
| | | <choose> |
| | | <!-- 有传工序:精确匹配 --> |
| | | <when test="selectProcesses != null and selectProcesses != ''"> |
| | | AND rw.this_process = #{selectProcesses} |
| | | </when> |
| | | <!-- 未传工序:不加限制,查所有) --> |
| | | <otherwise></otherwise> |
| | | </choose> |
| | | |
| | | <choose> |
| | | <when test="laminating == ''"> |
| | | GROUP BY |
| | | rw.reporting_work_id, |
| | | rw.process_id, |
| | | rw.this_process, |
| | | rw.teams_groups_name, |
| | | rwd.order_number, |
| | | rwd.technology_number |
| | | </when> |
| | | <otherwise> |
| | | GROUP BY |
| | | <if test="laminating == 'stepA' || laminating == 'stepC'"> |
| | | ogd.`group`, |
| | | </if> |
| | | rw.reporting_work_id, |
| | | rw.process_id, |
| | | rw.this_process, |
| | | rw.teams_groups_name, |
| | | rwd.order_number |
| | | </otherwise> |
| | | </choose> |
| | | ) t |
| | | |
| | | GROUP BY |
| | | t.this_process, |
| | | t.teams_groups_name, |
| | | t.workProcessName |
| | | |
| | | ORDER BY |
| | | t.this_process, |
| | | t.teams_groups_name, |
| | | t.workProcessName |
| | | </select> |
| | | </mapper> |
| | |
| | | order by id desc |
| | | </select> |
| | | |
| | | <select id="countByCustomerName"> |
| | | SELECT COUNT(*) |
| | | FROM sd.customer |
| | | WHERE customer_name=#{customer.customerName} |
| | | </select> |
| | | |
| | | <select id="getSelectCustomer"> |
| | | select |
| | | * |