yixindibang/ruoyi-ui/src/views/measurement/operation/moltenironpound/index.vue

1338 lines
55 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!--铁水-->
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-row style="display: inline-block;width: 260px">
<el-col :span="24">
<el-form-item label="磅点" prop="poundid" label-width="40">
<search-select v-model="queryParams.poundid"
:options = "getOptionsByKey('moltenironpound')"
></search-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="类型" prop="poundname" label-width="40">
<el-select v-model="queryParams.poundclass" placeholder="类型">
<el-option
v-for="dict in dict.type.weighttype"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item style="width: 70px;color: #606266;margin: 0 0 0 0;">
<label style="margin-left: 10px;">过磅方式</label>
<el-radio-group v-model="queryParams.weighttype">
<el-radio v-for="dict in dict.type.weighttype" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="重量" prop="1aaa">
<el-input
v-model="queryParams.weight"
style=""
clearable
readonly
/>
</el-form-item>
<el-form-item>
<el-button type="primary" size="mini" @click="handleGetweight">获取重量</el-button>
</el-form-item>
<el-row style="display: inline-block;width: 300px">
<el-col :span="24">
<el-form-item label="收货单位" prop="recunitid">
<search-select v-model="queryPageParams.mstBill.recunitid"
:options = "getOptionsByKey('recunit')"
clearable
></search-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="品名" prop="itmcode">
<search-select v-model="queryPageParams.mstBill.itmcode"
:options = "getOptionsByKey('itmcode')"
clearable
></search-select>
</el-form-item>
</el-col>
</el-row>
<el-row style="display: inline-block;width: 300px">
<el-col :span="24">
<el-form-item label="发货单位" prop="sendunitid">
<search-select v-model="queryPageParams.mstBill.sendunitid"
:options = "getOptionsByKey('sendunit')"
clearable
></search-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="生产班组" prop="trnunitid">
<search-select v-model="queryPageParams.mstBill.trnunitid"
:options = "getOptionsByKey('trnunit')"
clearable
></search-select>
</el-form-item>
</el-col>
</el-row>
<el-row style="display: inline-block;width: 100px">
<el-col>
<el-form-item prop="sendunitid">
<el-checkbox
v-model="queryPageParams.mstBill.bllstt"
:true-label="'2'"
:false-label="'1'"
>完成</el-checkbox>
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- 主磅单信息 -->
<el-card>
<el-row>
<el-col :span="24">
<el-button class="transition-all duration-200" type="primary" size="mini">主磅单信息</el-button>
<el-button class="transition-all duration-200" size="mini" @click = "getMstBillData">新增</el-button>
<el-button class="transition-all duration-200" size="mini" @click = "getMstBillDataById">修改</el-button>
<el-button class="transition-all duration-200" size="mini" @click="handleSearchMstBillFirst">查询</el-button>
<el-button class="transition-all duration-200" size="mini" @click = "finishMstBill">完成</el-button>
<el-button class="transition-all duration-200" size="mini" @click = "unFinishMstBill">取消完成</el-button>
<el-button class="transition-all duration-200" size="mini">主榜单作废</el-button>
<el-table v-loading="mstBillLoading"
:data="mstBillList"
border
stripe
@selection-change = "handleMstSelectionChange"
ref = "mstBillTable"
@row-click = "handleMstBillClick"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="单号" align="center" prop="usrcode" width="180"/>
<el-table-column label="榜单日期" align="center" prop="bsndt" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.bsndt, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="品名" align="center" prop="itmcode" width="200px">
<template slot-scope="scope">
<search-select
:disabled = "true"
v-model="scope.row.itmcode"
:options = "getOptionsByKey('itmcode')"
class="search-select-custom-disabled"
></search-select>
</template>
</el-table-column>
<el-table-column label="材质" align="center" prop="" />
<el-table-column label="直供商" align="center" prop="zgsId" />
<el-table-column label="单位" align="center" prop="msrunit" />
<el-table-column label="发货单位" align="center" prop="sendunitid" width="200px">
<template slot-scope="scope">
<search-select
:disabled = "true"
v-model="scope.row.sendunitid"
:options = "getOptionsByKey('sendunit')"
class="search-select-custom-disabled"
></search-select>
</template>
</el-table-column>
<el-table-column label="收货单位" align="center" prop="recunitid" width="200px" >
<template slot-scope="scope">
<search-select
:disabled = "true"
v-model="scope.row.recunitid"
:options = "getOptionsByKey('recunit')"
class="search-select-custom-disabled"
></search-select>
</template>
</el-table-column>
<el-table-column label="生产班组" align="center" prop="trnunitid" width="200px" >
<template slot-scope="scope">
<search-select
:disabled = "true"
v-model="scope.row.trnunitid"
:options = "getOptionsByKey('trnunit')"
class="search-select-custom-disabled"
></search-select>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
</el-table>
<pagination
v-show="queryPageParams.mstBill.total>0"
:total="queryPageParams.mstBill.total"
:page.sync="queryPageParams.mstBill.pageNum"
:limit.sync="queryPageParams.mstBill.pageSize"
@pagination="handleSearchMstBill"
/>
</el-col>
</el-row>
</el-card>
<!-- 底部列表区域 -->
<el-card>
<el-row>
<el-col :span="20"
v-show="activeTab === 'weighingRequest'">
<el-button v-for="tab in tabs" :key="tab.name" :type="activeTab === tab.name ? 'primary' : 'default'"
@click="activeTab = tab.name" size="mini" > {{ tab.label }}</el-button>
<el-table
v-loading="poundBillDetailLoading"
:data="poundBillDetailList"
border
stripe
ref="poundBillTable"
@selection-change="handlePoundBillDetailSelectionChange"
height="500"
@row-click="handlePoundBillClick"
>
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="按钮1" align="center" prop="id" />-->
<el-table-column label="主榜单号" align="center" prop="appliid" width="200px">
<template slot-scope="scope">
<search-select
:disabled = "true"
v-model="scope.row.appliid"
:options = "getOptionsByKey('appli')"
class="search-select-custom-disabled"
></search-select>
</template>
</el-table-column>
<el-table-column label="榜单号" align="center" prop="usrcode" width="200px"/>
<el-table-column label="车号" align="center" prop="carno"/>
<el-table-column label="炉次" align="center" prop="boilerno"/>
<el-table-column label="发货单位" align="center" prop="sendunitid" width="200px">
<template slot-scope="scope">
<search-select
:disabled = "true"
v-model="scope.row.sendunitid"
:options = "getOptionsByKey('sendunit')"
class="search-select-custom-disabled"
></search-select>
</template>
</el-table-column>
<el-table-column label="收货单位" align="center" prop="recunitid" width="200px">
<template slot-scope="scope">
<search-select
:disabled = "true"
v-model="scope.row.recunitid"
:options = "getOptionsByKey('recunit')"
class="search-select-custom-disabled"
></search-select>
</template>
</el-table-column>
<el-table-column label="品名" align="center" prop="itmcode" width="200px">
<template slot-scope="scope">
<search-select
:disabled = "true"
v-model="scope.row.itmcode"
:options = "getOptionsByKey('itmcode')"
class="search-select-custom-disabled"
></search-select>
</template>
</el-table-column>
<el-table-column label="毛重" align="center" prop="wghmqty"/>
<el-table-column label="皮重" align="center" prop="empmqty"/>
<el-table-column label="净重" align="center" prop="netmqty"/>
<el-table-column label="过毛时间" align="center" prop="wghdt">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.wghdt, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="过毛司磅员" align="center" prop="wghdtoprname"/>
<el-table-column label="过皮时间" align="center" prop="empdt">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.empdt, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="过皮司磅员" align="center" prop="empdtoprname"/>
</el-table>
<pagination
v-show="queryPageParams.poundBillDetail.total>0"
:total="queryPageParams.poundBillDetail.total"
:page.sync="queryPageParams.poundBillDetail.pageNum"
:limit.sync="queryPageParams.poundBillDetail.pageSize"
@pagination="queryPoundBillDetail"
/>
</el-col>
<el-col :span="activeTab === 'tareRequest'? 24 : 20"
v-show="activeTab === 'tareRequest'">
<el-button v-for="tab in tabs" :key="tab.name" :type="activeTab === tab.name ? 'primary' : 'default'"
@click="activeTab = tab.name" size="mini" > {{ tab.label }}</el-button>
<el-form :model="queryParams" v-show="activeTab === 'tareRequest'" ref="queryForm" size="small" :inline="true" label-width="68px">
<el-form-item label="起始日期" prop="lstedtdt">
<el-date-picker clearable
v-model="queryPageParams.poundBillFull.queryStart"
type="date"
value-format="yyyy-MM-dd"
placeholder=""
@keyup.enter.native="handleQueryPoundBillFullListFirst">
</el-date-picker>
</el-form-item>
<el-form-item label="截止日期" prop="lstedtdt">
<el-date-picker clearable
v-model="queryPageParams.poundBillFull.queryEnd"
type="date"
value-format="yyyy-MM-dd"
placeholder=""
@keyup.enter.native="handleQueryPoundBillFullListFirst">
</el-date-picker>
</el-form-item>
<el-form-item label="车号" prop="carno" label-width="40">
<el-input
v-model="queryPageParams.poundBillFull.carno"
placeholder="请输入车号"
clearable
@keyup.enter.native="handleQueryPoundBillFullListFirst"
/>
</el-form-item>
<el-form-item label="磅单号" prop="usrcode" label-width="40">
<el-input
v-model="queryPageParams.poundBillFull.usrcode"
placeholder="请输入磅单号"
clearable
@keyup.enter.native="handleQueryPoundBillFullListFirst"
/>
</el-form-item>
<el-button class="transition-all duration-200" type="primary" size="mini" @click="handleQueryPoundBillFullListFirst">查询磅单</el-button>
</el-form>
<el-table
v-loading="poundBillFullLoading"
:data="poundBillFullList"
border
stripe>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主榜单号" align="center" prop="appliid" width="200px">
<template slot-scope="scope">
<search-select
:disabled = "true"
v-model="scope.row.appliid"
:options = "getOptionsByKey('appli')"
class="search-select-custom-disabled"
></search-select>
</template>
</el-table-column>
<el-table-column label="榜单号" align="center" prop="usrcode" width="200px"/>
<el-table-column label="发货单位" align="center" prop="sendunitid" width="200px">
<template slot-scope="scope">
<search-select
:disabled = "true"
v-model="scope.row.sendunitid"
:options = "getOptionsByKey('sendunit')"
class="search-select-custom-disabled"
></search-select>
</template>
</el-table-column>
<el-table-column label="收货单位" align="center" prop="recunitid" width="200px">
<template slot-scope="scope">
<search-select
:disabled = "true"
v-model="scope.row.recunitid"
:options = "getOptionsByKey('recunit')"
class="search-select-custom-disabled"
></search-select>
</template>
</el-table-column>
<el-table-column label="承运单位" align="center" prop="trnunitid" width="200px">
<template slot-scope="scope">
<search-select
:disabled = "true"
v-model="scope.row.trnunitid"
:options = "getOptionsByKey('trnunit')"
class="search-select-custom-disabled"
></search-select>
</template>
</el-table-column>
<el-table-column label="品名" align="center" prop="itmcode" width="200px">
<template slot-scope="scope">
<search-select
:disabled = "true"
v-model="scope.row.itmcode"
:options = "getOptionsByKey('itmcode')"
class="search-select-custom-disabled"
></search-select>
</template>
</el-table-column>
<el-table-column label="炉次" align="center" prop="boilerno"/>
<el-table-column label="罐号" align="center" prop="carno"/>
<el-table-column label="司机" align="center" prop="cardriver"/>
<el-table-column label="毛重" align="center" prop="wghmqty"/>
<el-table-column label="皮重" align="center" prop="empmqty"/>
<el-table-column label="净重" align="center" prop="netmqty"/>
<el-table-column label="过毛时间" align="center" prop="wghdt">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.wghdt, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="过毛司磅员" align="center" prop="wghdtoprname"/>
<el-table-column label="过皮时间" align="center" prop="empdt">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.empdt, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="过皮司磅员" align="center" prop="empdtoprname"/>
<el-table-column label="备注" align="center" prop="remark" width="200px"/>
</el-table>
<pagination
v-show="queryPageParams.poundBillFull.total>0 && activeTab === 'tareRequest'"
:total="queryPageParams.poundBillFull.total"
:page.sync="queryPageParams.poundBillFull.pageNum"
:limit.sync="queryPageParams.poundBillFull.pageSize"
@pagination="handleQueryPoundBillFullList"
/>
</el-col>
<el-col :span="4" v-show="activeTab === 'weighingRequest'">
<el-button type="primary" size="mini" @click="">操作</el-button>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-row>
<el-col :span="6">
<el-form-item prop="" label-width="40">
<p></p>
</el-form-item>
</el-col>
<el-col :span="18">
<el-form-item prop="" label-width="40">
<el-button type="info" style="width: 200px;font-size: 20px" @click = "addPoundBillDetail" :disabled = "this.mstBillFormData.isCompleted">增明细</el-button>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item prop="" label-width="40">
<span style="font-size: 20px">炉次</span>
</el-form-item>
</el-col>
<el-col :span="18">
<el-form-item prop="boilerno" label-width="40">
<el-input v-model="queryParams.boilerno" placeholder="请输入炉次" clearable></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item prop="" label-width="40">
<span style="font-size: 20px">罐号</span>
</el-form-item>
</el-col>
<el-col :span="18">
<el-form-item prop="carno" label-width="40">
<search-select v-model="queryParams.carno"
:options = "getOptionsByKey('carno')"
></search-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item prop="poundid" label-width="40">
<p></p>
</el-form-item>
</el-col>
<el-col :span="18">
<el-form-item prop="poundname" label-width="40">
<el-button type="info" style="width: 200px;font-size: 20px" @click = "updateWgtPoundBillDetail" :disabled = "this.mstBillFormData.isCompleted">称毛重</el-button>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item prop="" label-width="40">
<p></p>
</el-form-item>
</el-col>
<el-col :span="18">
<el-form-item prop="" label-width="40">
<el-button type="info" style="width: 200px;font-size: 20px" @click = "updatePoundBillDetail" :disabled = "this.mstBillFormData.isCompleted">称皮重</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-col>
</el-row>
</el-card>
<!-- 添加或修改主榜单信息对话框 -->
<el-dialog :title="mstBillFormData.mstBillTitle" :visible.sync="mstBillFormData.mstBillOpen" width="1500px" append-to-body>
<el-form ref="mstBillFormData.mstBillForm" :model="mstBillFormData.mstBillForm" :rules="mstBillFormData.mstBillRules" label-width="80px">
<el-row>
<el-col :span="8">
<el-form-item label="主榜单编号" prop="usrcode" readonly>
<el-input v-model="mstBillFormData.mstBillForm.usrcode" placeholder="请输入主榜单编号" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="业务日期" prop="bsndt">
<el-date-picker clearable
v-model="mstBillFormData.mstBillForm.bsndt"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择业务日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="业务磅点" prop="poundid">
<search-select
v-model="mstBillFormData.mstBillForm.poundid"
:options = "getOptionsByKey('buspound')"
:disabled = "true"
></search-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="16">
<el-form-item label="发货单位" prop="sendunitid">
<search-select v-model="mstBillFormData.mstBillForm.sendunitid"
:options = "getOptionsByKey('sendunit')"
clearable
></search-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="品名" prop="itmcode">
<search-select v-model="mstBillFormData.mstBillForm.itmcode"
:options = "getOptionsByKey('itmcode')"
clearable
></search-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="16">
<el-form-item label="收货单位" prop="recunitid">
<search-select v-model="mstBillFormData.mstBillForm.recunitid"
:options = "getOptionsByKey('recunit')"
clearable
></search-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="计量单位" prop="msrunit">
<el-input v-model="mstBillFormData.mstBillForm.msrunit" placeholder="请输入计量单位" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="16">
<el-form-item label="班组/承运" prop="trnunitid">
<search-select v-model="mstBillFormData.mstBillForm.trnunitid"
:options = "getOptionsByKey('trnunit')"
clearable
></search-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="usrcode">
<el-input v-model="mstBillFormData.mstBillForm.remark" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="mstBillFormSubmit">确 定</el-button>
<el-button @click="mstBillFormCancel">取 消</el-button>
</div>
</el-dialog>
<!-- 添加或修改榜单信息对话框 -->
<el-dialog :title="poundBillDetailFormData.poundBillDetailTitle" :visible.sync="poundBillDetailFormData.poundBillDetailOpen" width="1500px" append-to-body>
<el-form ref="poundBillDetailFormData.poundBillDetailForm" :model="poundBillDetailFormData.poundBillDetailForm" :rules="poundBillDetailFormData.poundBillDetailRules" label-width="80px">
<el-row>
<el-col :span="8">
<el-form-item label="主榜单编号" prop="usrcode" readonly>
<!-- <el-input v-model="mstBillFormData.mstBillForm.usrcode" placeholder="请输入主榜单编号" />-->
<search-select v-model="poundBillDetailFormData.poundBillDetailForm.appliid"
:options = "getOptionsByKey('appli')"
disabled
class="search-select-custom-disabled"
></search-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="明细号" prop="usrcode">
<el-input v-model="poundBillDetailFormData.poundBillDetailForm.usrcode" placeholder="" readonly/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="发货单位" prop="sendunitid">
<search-select v-model="poundBillDetailFormData.poundBillDetailForm.sendunitid"
:options = "getOptionsByKey('sendunit')"
></search-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="16">
<el-form-item label="收货单位" prop="recunitid">
<search-select v-model="poundBillDetailFormData.poundBillDetailForm.recunitid"
:options = "getOptionsByKey('recunit')"
></search-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="品名" prop="itmcode">
<search-select v-model="poundBillDetailFormData.poundBillDetailForm.itmcode"
:options = "getOptionsByKey('itmcode')"
></search-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="16">
<el-form-item label="炉次" prop="boilerno">
<el-input v-model="poundBillDetailFormData.poundBillDetailForm.boilerno" placeholder="" readonly/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="罐号" prop="carno">
<el-input v-model="poundBillDetailFormData.poundBillDetailForm.carno" placeholder="" readonly/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="毛重" prop="wghmqty">
<el-input v-model="poundBillDetailFormData.poundBillDetailForm.wghmqty" placeholder="" readonly/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="皮重" prop="empmqty">
<el-input v-model="poundBillDetailFormData.poundBillDetailForm.empmqty" placeholder="" readonly/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="净重" prop="netmqty">
<el-input v-model="poundBillDetailFormData.poundBillDetailForm.netmqty" placeholder="" readonly/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="poundBillDetailFormWght" v-show = "poundBillDetailFormData.isWght">称毛重</el-button>
<el-button type="primary" @click="poundBillDetailFormEmp" v-show = "!poundBillDetailFormData.isWght">称皮重</el-button>
<el-button @click="poundBillDetailFormCancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listMoltenironpound, getMoltenironpound, delMoltenironpound, addMoltenironpound, updateMoltenironpound } from "@/api/measurement/operation/moltenironpound"
import SearchSelect from "@/components/SearchSelect/index.vue";
import {
addPoundmst,
complete,
getNumber,
getPoundmst,
listPoundmst, unComplete,
updatePoundmst
} from "@/api/measurement/bill/poundmst";
import Decimal from "decimal.js";
import {getTruepound} from "@/api/measurement/basedata/truepound";
import {
addTransPoundbill,
getNumber as getPoundBillNumber,
getPoundbill, listPoundbill,
addMoltenironPoundbill,
updateMoltenironPoundbill, updateMolReWeightPoundbill,
} from "@/api/measurement/bill/poundbill";
import {getCarnoEmpwgtData} from "@/api/measurement/basedata/empwgtdata";
//引入searchSelect方法
import { getSearchSelectData } from "@/api/tool/gen.js";
//引入searchData组件
import {selectConfigs} from "@/components/SearchSelect/searchdata.js";
export default {
name: "Moltenironpound",
components: {SearchSelect},
dicts: ['pound_status', 'pound', 'sys_yes_no','weighttype'],
data() {
return {
// 遮罩层
loading: false,
//主榜单遮罩层
mstBillLoading:false,
//过磅明细遮罩层
poundBillDetailLoading:false,
//完成磅单遮罩层
poundBillFullLoading:false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 铁水磅表格数据
operationpoundList: [],
//主榜单数据列表
mstBillList:[],
//过磅明细数据列表
poundBillDetailList:[],
//完成磅单数据列表
poundBillFullList:[],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
//存储物理磅点的相关参数
truepoundData:{},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
billstate: null,
usrcode: null,
weight:0,
carno: null,
boilerno: null,
poundid: null,
},
//存储各个列表的查询条件参数。
queryPageParams:{
mstBill: {
total: 0,
pageNum: 1,
pageSize: 10,
isinuse:"Y",
recunitid:"",//收货单位
itmcode:"",//物料编码
trnunitid:"",//运输单位
sendunitid:"",//发货单位
poundid:"",//业务磅点,java对象中存储为该字段。
bllstt:"1",//完成状态
},
poundBillDetail: {
total: 0,
pageNum: 1,
pageSize: 10
},
poundBillFull: {
total: 0,
pageNum: 1,
pageSize: 10,
poundid: "",
queryStart: "",
queryEnd: "",
carno: "",
usrcode: "",
},
historyPound:{
total:0,
pageNum:1,
pageSize:10,
},
},
// 表单参数
form: {},
tabs: [
{ name: 'weighingRequest', label: '过磅明细' },
{ name: 'tareRequest', label: '完成磅单' },
],
activeTab: 'weighingRequest',
// 表单校验
rules: {
},
//主榜单相关界面参数
mstBillFormData:{
selectedIds:[],
selectedUsrcodes:[],
mstBillForm:{},
mstBillRules:{},
mstBillTitle:"主榜单信息",
mstBillOpen:false,
thisSelectedRow:{},
isCompleted:false,
},
//榜单明细相关界面参数
poundBillDetailFormData:{
selectedIds:[],
reWeighingStatus:[],
poundBillDetailForm:{
boilerno: null,
carno: null,
},
poundBillDetailRules:{
//炉号是必填项
boilerno: [
{ required: true, message: "炉次不能为空", trigger: "submit" }
],
//车号是必填项
carno: [
{ required: true, message: "车号不能为空", trigger: "submit" }
],
},
poundBillDetailTitle:"榜单明细信息",
poundBillDetailOpen:false,
thisSelectedRow:{},
isWght:true,
isReweighing:false,
},
//关于searchSelect的参数数据
searchData: {
optionsMap: {},
selectConfigs:selectConfigs
},
}
},
created() {
// this.getList()
this.loadAllSelectOptions();
},
watch: {
//监听磅点变化
'queryParams.poundid': function(newVal, oldVal) {
if(newVal!= null && newVal!== ""){
//如果磅点不为空则根据id查询数据库获取值将磅单种类赋值到poundtype
getTruepound(newVal).then(response => {
console.log(response.data);
this.queryParams.poundtype = response.data.poundtype;
this.queryParams.poundclass = response.data.poundclass;
//将获取到的物理磅点所有数据存储下来
this.truepoundData = response.data;
//触发查询主榜单的逻辑。
this.handleSearchMstBillFirst();
});
}else {
this.queryParams.poundtype = "";
this.queryParams.poundclass = "";
this.truepoundData = {};
}
},
},
methods: {
/** 查询铁水磅列表 */
getList() {
this.loading = true
listMoltenironpound(this.queryParams).then(response => {
this.operationpoundList = response.rows
this.total = response.total
this.loading = false
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 主榜单重置
resetMstBillForm() {
this.mstBillFormData.mstBillForm = {
id: null,
bsndt: null,
poundid: null,
sendunitid: null,
itmcode: null,
recunitid: null,
boilerno: null,
trnunitid: null,
msrunit: null,
usrcode: null,
}
this.resetForm("mstBillFormData.mstBillForm");
},
// 榜单明细表单重置
resetPoundBillDetailForm() {
this.poundBillDetailFormData.poundBillDetailForm = {
id: null,
appliid: null,
usrcode: null,
sendunitid: null,
recunitid: null,
itmcode: null,
carno: null,
boilerno: null,
wghmqty: null,
empmqty: null,
netmqty: null,
}
this.resetForm("poundBillDetailFormData.poundBillDetailForm")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
// 主榜单多选框选中数据
handleMstSelectionChange(selection) {
if (selection.length > 0){
this.mstBillFormData.selectedIds = selection.map(item => item.id)
this.mstBillFormData.selectedUsrcodes = selection.map(item => item.usrcode)
//获取最后选中的数据的完成状态。
const mstCompletedStatus = selection[selection.length - 1].bllstt;
if ("1" === mstCompletedStatus) {
this.mstBillFormData.isCompleted = false;
} else {
this.mstBillFormData.isCompleted = true;
}
this.queryPoundBillDetailFirst();
} else {
this.mstBillFormData.selectedIds = [];
this.mstBillFormData.selectedUsrcodes = [];
}
},
// 过磅明细多选框选中数据
handlePoundBillDetailSelectionChange(selection) {
if (selection.length > 0){
this.poundBillDetailFormData.selectedIds = selection.map(item => item.id)
this.poundBillDetailFormData.reWeighingStatus = selection.map(item => item.agnstatus)
}else {
this.poundBillDetailFormData.selectedIds = [];
this.poundBillDetailFormData.reWeighingStatus = [];
}
},
// 获取重量,生成随机重量(两位小数,避免精度问题)
handleGetweight() {
//检查是否选中磅点。
if (!this.checkPoundSelected())return;
// 生成 100 到 10000 的整数(代表 1.00 到 100.00
const randomInt = Math.floor(Math.random() * 9900 + 100);
// 转换为两位小数,内存中是有限小数
this.queryParams.weight = new Decimal(randomInt / 100);
debugger
},
//单击主榜单进行单选。
//主榜单单击选中,并将车号进行赋值。(单选)
handleMstBillClick(row) {
// 清空之前的选择
this.$refs.mstBillTable.clearSelection();
// 设置当前行为选中状态
this.$refs.mstBillTable.toggleRowSelection(row, true);
this.mstBillFormData.thisSelectedRow = row;
},
//过磅明细单击选中,并将车号进行赋值。(单选)
handlePoundBillClick(row) {
// 清空之前的选择
this.$refs.poundBillTable.clearSelection();
// 设置当前行为选中状态
this.$refs.poundBillTable.toggleRowSelection(row, true);
this.poundBillDetailFormData.thisSelectedRow = row;
//将车号和炉次赋值到输入框中
this.queryParams.carno = row.carno;
this.queryParams.boilerno = row.boilerno;
},
//查询主榜单数据,分页设置为1
handleSearchMstBillFirst(){
//如果没有选中磅点
if (!this.checkPoundSelected())return;
this.queryPageParams.mstBill.pageNum = 1;
this.handleSearchMstBill();
},
//查询主榜单数据
handleSearchMstBill(){
this.mstBillLoading = true
this.queryPageParams.mstBill.poundid = this.truepoundData.buspoundid;
listPoundmst(this.queryPageParams.mstBill).then(response => {
this.queryPageParams.mstBill.total = response.total;
this.mstBillList = response.rows;
this.mstBillLoading = false;
})
},
//检查是否选中磅点。
checkPoundSelected() {
if (this.queryParams.poundid == null || this.queryParams.poundid === "") {
this.$message.error("请选择磅点!");
return false;
}
return true;
},
//新增主榜单,将当前重量上的数据赋值到重量中,并且打开弹窗
getMstBillData(){
//如果没有选中磅点
if (!this.checkPoundSelected())return;
this.resetMstBillForm();
getNumber().then(response => {
this.mstBillFormData.mstBillForm.usrcode = response.data.number;
this.mstBillFormData.mstBillForm.bsndt = response.data.date;
//将业务磅点进行赋值
this.mstBillFormData.mstBillForm.poundid = this.truepoundData.buspoundid;
this.mstBillFormData.mstBillForm.mstBillTitle = '新增主榜单';
//赋值oa单据类型。
this.mstBillFormData.mstBillForm.oabilltype = 'SP_InStock';
//打开弹窗界面
this.mstBillFormData.mstBillOpen = true;
});
},
//修改主榜单
getMstBillDataById(){
debugger;
const id = this.mstBillFormData.selectedIds[0];
//如果id为空或null
if (id == null || id === "") {
this.$message.error("请选择主榜单!");
return;
}
this.resetMstBillForm();
getPoundmst(id).then(response => {
this.mstBillFormData.mstBillForm = response.data;
this.mstBillFormData.mstBillTitle = '新增主榜单';
this.mstBillFormData.mstBillOpen = true;
})
},
//主榜单界面,点击确定。
mstBillFormSubmit(){
this.$refs["mstBillFormData.mstBillForm"].validate(valid => {
if (valid) {
//设置业务磅点ID
this.mstBillFormData.mstBillForm.poundid = this.truepoundData.buspoundid;
if (this.mstBillFormData.mstBillForm.id == null){
addPoundmst(this.mstBillFormData.mstBillForm).then(response => {
this.$message.success("新增主榜单成功!");
this.mstBillFormData.mstBillOpen = false;
//查询主榜单数据
this.handleSearchMstBillFirst();
})
}else{
updatePoundmst(this.mstBillFormData.mstBillForm).then(response => {
this.$message.success("修改主榜单成功!");
this.mstBillFormData.mstBillOpen = false;
//查询主榜单数据
this.handleSearchMstBillFirst();
})
}
}
})
},
//关闭称主榜单弹窗
mstBillFormCancel(){
this.mstBillFormData.mstBillOpen = false;
},
//点击增明细,打开榜单明细弹窗。
async addPoundBillDetail() {
this.poundBillDetailFormData.isWght = true;
this.poundBillDetailFormData.isReweighing = false;
// 校验是否选中主榜单
if (this.mstBillFormData.selectedIds.length === 0) {
this.$message.error("请先选择主榜单!");
return;
}
//清空表单中数据
this.resetPoundBillDetailForm();
try {
// 获取榜单编码
const response = await getPoundBillNumber();
this.poundBillDetailFormData.poundBillDetailForm.usrcode = response.data.number;
// 主榜单赋值
const mainRow = this.mstBillFormData.thisSelectedRow;
const form = this.poundBillDetailFormData.poundBillDetailForm;
form.appliid = this.mstBillFormData.selectedIds[0];
form.wetusrcode = this.mstBillFormData.selectedUsrcodes[0];
form.sendunitid = mainRow.sendunitid;
form.recunitid = mainRow.recunitid;
form.trnunitid = mainRow.trnunitid;
// 设置车号、司机、毛重
form.carno = this.queryParams.carno;
form.boilerno = this.queryParams.boilerno;
form.wghmqty = this.queryParams.weight;
//设置磅点信息
// 磅点信息
form.poundid = this.truepoundData.id;
form.poundname = this.truepoundData.name;
//配置物料信息
form.itmname = mainRow.itmname;
form.itmcode = mainRow.itmcode;
//配置计量单位
form.msrname = mainRow.msrunit;
// 展示弹窗
this.poundBillDetailFormData.poundBillDetailOpen = true;
} catch (error) {
console.error("新增明细失败:", error);
this.$message.error("新增明细失败,请稍后重试!");
}
},
//点击确定(称毛重),新增榜单明细。
poundBillDetailFormWght() {
this.$refs["poundBillDetailFormData.poundBillDetailForm"].validate(valid => {
if (valid) {
this.$confirm(`称毛重,毛重为:${this.poundBillDetailFormData.poundBillDetailForm.wghmqty}`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
//如果当前单据为复磅数据
if (this.poundBillDetailFormData.isReweighing) {
updateMolReWeightPoundbill(this.poundBillDetailFormData.poundBillDetailForm).then(response => {
this.$message.success("称重成功!");
this.poundBillDetailFormData.poundBillDetailOpen = false;
//查询榜单明细数据
this.queryPoundBillDetailFirst();
})
} else {
addMoltenironPoundbill(this.poundBillDetailFormData.poundBillDetailForm).then(response => {
this.$message.success("新增榜单明细成功!");
this.poundBillDetailFormData.poundBillDetailOpen = false;
//查询榜单明细数据
this.queryPoundBillDetailFirst();
})
}
}).catch(() => {});
}
})
},
//点击取消,关闭榜单明细弹窗。
poundBillDetailFormCancel() {
this.poundBillDetailFormData.poundBillDetailOpen = false;
},
//点击称毛重,打开榜单明细弹窗。
async updateWgtPoundBillDetail() {
// 校验是否选中过磅明细
if (this.poundBillDetailFormData.selectedIds.length === 0) {
this.$message.error("请先选择过磅明细!");
return;
}
console.log(this.poundBillDetailFormData.reWeighingStatus[0]);
//再判断当前获取的榜单是否为复磅中数据。
if ("ing" !== this.poundBillDetailFormData.reWeighingStatus[0]){
//只有复磅单据才允许单独称毛重
this.$message.error("只有复磅单据才允许单独称毛重!");
return;
}
//如果重量为空
if (this.queryParams.weight == null || this.queryParams.weight === "") {
this.$message.error("请先获取重量!");
return;
}
this.poundBillDetailFormData.isWght = true;
this.poundBillDetailFormData.isReweighing = true;
//清空表单中数据
this.resetPoundBillDetailForm();
try {
//通过选中的过磅明细id获取过磅明细数据
const response = await getPoundbill(this.poundBillDetailFormData.selectedIds[0]);
this.poundBillDetailFormData.poundBillDetailForm = response.data;
const form = this.poundBillDetailFormData.poundBillDetailForm;
//获取重量数据中的数据作为毛重数据。
form.wghmqty = this.queryParams.weight;
// 展示弹窗
this.poundBillDetailFormData.poundBillDetailOpen = true;
} catch (error) {
console.error("称毛重:", error);
this.$message.error("新增明细失败,请稍后重试!");
}
},
//点击称皮重,打开榜单明细弹窗。
async updatePoundBillDetail() {
this.poundBillDetailFormData.isWght = false;
// 校验是否选中过磅明细
if (this.poundBillDetailFormData.selectedIds.length === 0) {
this.$message.error("请先选择过磅明细!");
return;
}
//如果重量为空
if (this.queryParams.weight == null || this.queryParams.weight === "") {
this.$message.error("请先获取重量!");
return;
}
//清空表单中数据
this.resetPoundBillDetailForm();
try {
//通过选中的过磅明细id获取过磅明细数据
getPoundbill(this.poundBillDetailFormData.selectedIds[0]).then(response => {
this.poundBillDetailFormData.poundBillDetailForm = response.data;
const form = this.poundBillDetailFormData.poundBillDetailForm;
//获取重量数据中的数据作为皮重数据。
form.empmqty = this.queryParams.weight;
// 计算净重
const gross = new Decimal(form.wghmqty);
const tare = new Decimal(form.empmqty);
form.netmqty = gross.minus(tare);
// 展示弹窗
this.poundBillDetailFormData.poundBillDetailOpen = true;
})
} catch (error) {
console.error("称皮重:", error);
this.$message.error("新增明细失败,请稍后重试!");
}
},
//点击确定(称皮重),新增榜单明细。
poundBillDetailFormEmp() {
this.$refs["poundBillDetailFormData.poundBillDetailForm"].validate(valid => {
if (valid) {
this.poundBillDetailFormData.poundBillDetailForm.params = {};
this.poundBillDetailFormData.poundBillDetailForm.params.ttsid = this.queryParams.poundid;
this.poundBillDetailFormData.poundBillDetailForm.params.buspoundid = this.truepoundData.buspoundid;
//如果不存在皮重数据,则提示,不存在可用皮重数据是否继续保存,点击确定则执行保存逻辑。
this.$confirm(`称皮重,皮重为:${this.poundBillDetailFormData.poundBillDetailForm.empmqty}`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
updateMoltenironPoundbill(this.poundBillDetailFormData.poundBillDetailForm).then(response => {
this.$message.success("榜单明细称皮重成功!");
this.poundBillDetailFormData.poundBillDetailOpen = false;
//查询榜单明细数据
this.queryPoundBillDetailFirst();
})
}).catch(() => {});
}
})
},
//根据主榜单ID查询过磅明细,并将分页。
queryPoundBillDetailFirst(){
this.queryPageParams.poundBillDetail.pageNum = 1;
this.queryPoundBillDetail();
},
//根据主榜单ID查询过磅明细。
queryPoundBillDetail(){
// 校验是否选中主榜单
if (this.mstBillFormData.selectedIds.length === 0) {
this.$message.error("请先选择主榜单!");
return;
}
this.poundBillDetailLoading = true;
var thisQueryParams = {
billstate:"1",
isinuse:"Y"
}
thisQueryParams.appliid = this.mstBillFormData.selectedIds[0];
listPoundbill(thisQueryParams).then(response => {
this.queryPageParams.poundBillDetail.total = response.total;
this.poundBillDetailList = response.rows;
this.poundBillDetailLoading = false;
})
},
//点击查询磅单按钮设置页数为1
handleQueryPoundBillFullListFirst(){
this.queryPageParams.poundBillFull.pageNum = 1;
this.handleQueryPoundBillFullList();
},
//查询完成的榜单数据
handleQueryPoundBillFullList(){
//是否选中磅点
if (!this.checkPoundSelected())return;
//是否选中主榜单
if (this.mstBillFormData.selectedIds.length === 0) {
this.$message.error("请先选择主榜单!");
return;
}
this.poundBillFullLoading = true;
var thisqueryParams = {
billstate:"2",
isinuse:"Y"
}
//设置物理磅点作为查询条件
thisqueryParams.poundid = this.truepoundData.id;
//设置主榜单ID作为查询条件
thisqueryParams.appliid = this.mstBillFormData.selectedIds[0];
thisqueryParams.carno = this.queryPageParams.poundBillFull.carno;
thisqueryParams.usrcode = this.queryPageParams.poundBillFull.usrcode;
thisqueryParams.params = {};
thisqueryParams.params.queryStart = this.queryPageParams.poundBillFull.queryStart;
thisqueryParams.params.queryEnd = this.queryPageParams.poundBillFull.queryEnd;
thisqueryParams.pageNum = this.queryPageParams.poundBillFull.pageNum;
thisqueryParams.pageSize = this.queryPageParams.poundBillFull.pageSize;
listPoundbill(thisqueryParams).then(response => {
this.queryPageParams.poundBillFull.total = response.total;
this.poundBillFullList = response.rows;
this.poundBillFullLoading = false;
})
},
//选中主榜单,点击完成
async finishMstBill() {
// 校验是否选中主榜单
if (this.mstBillFormData.selectedIds.length === 0) {
this.$message.error("请先选择主榜单!");
return;
}
//触发完成方法
//拼接参数
const data = {
id:this.mstBillFormData.selectedIds[0],
usrcode:this.mstBillFormData.selectedUsrcodes[0],
}
const res = await complete(data);
if (res.code === 200) {
this.$message.success("完成主榜单成功!");
//查询主榜单数据
this.handleSearchMstBillFirst();
} else {
this.$message.error("完成主榜单失败!");
}
},
//选中主榜单,点击取消完成
async unFinishMstBill() {
// 校验是否选中主榜单
if (this.mstBillFormData.selectedIds.length === 0) {
this.$message.error("请先选择主榜单!");
return;
}
//触发完成方法
//拼接参数
const data = {
id:this.mstBillFormData.selectedIds[0],
usrcode:this.mstBillFormData.selectedUsrcodes[0],
}
const res = await unComplete(data);
if (res.code === 200) {
this.$message.success("完成主榜单成功!");
//查询主榜单数据
this.handleSearchMstBillFirst();
} else {
this.$message.error("完成主榜单失败!");
}
},
//searchSelect相关方法
buildCacheKey({ params, where, groupby = '', orderby = '' }) {
return `${params}|${where}|${groupby}|${orderby}`;
},
async loadAllSelectOptions() {
for (const cfg of this.searchData.selectConfigs) {
const key = this.buildCacheKey(cfg);
if (!this.searchData.optionsMap[key]) {
const [tableName, value, label] = cfg.params.split(';');
const res = await getSearchSelectData({
tableName: tableName,
value: value,
label: label,
where: cfg.where,
groupby: cfg.groupby,
orderby: cfg.orderby
});
this.$set(this.searchData.optionsMap, key, res.code === 200 ? res.data : []);
}
}
},
getOptionsByKey(key) {
const cfg = this.searchData.selectConfigs.find(c => c.key === key);
return this.searchData.optionsMap[this.buildCacheKey(cfg)] || [];
},
}
}
</script>