|
|
<script>import { searchDelHeaderList, searchDelNotifyDetail, updateDelNotifyDetail,} from '@/api/pad.js'import scanForm from "./scanForm.vue";import dayjs from "dayjs";import {Decimal} from "decimal.js";import {finallyPrintBoxLabel, getPrintBoxLabel, getPrintBoxLabelHandle} from "../../../api/pad";import {printOutBoxLabel} from "../print/print_outBox_label";import {queryStandardWeight} from "../../../api/production/generateReport";export default { name: "shippingScan", components:{ scanForm, }, data() { return { allNum:0, notifyQty:0, height:200, delNotifyHeaderTableLoading:false, // 搜索表单对象
searchData:{ site:"", startDate:dayjs().format("YYYY-MM-DD"), endDate:dayjs().format("YYYY-MM-DD"), customerId:undefined, delNotifyNo:undefined, shipFlag:true, no:1, size:50, total:0, }, scanFlag:false, checkoutDelNotifyDetailDialogVisible:false, // 主表对象
delNotifyHeader:{
}, // 子表对象
delNotifyDetail:{
}, // 主表
delNotifyHeaderList:[], // 子表
delNotifyDetailList:[], no:1, size:50, total:0, boxLabelVisible:false, selectDelNotifyDetail:{}, boxNum:0, endBoxQty:0, scatteredBoxNo:0, boxLabelTotalQty:0, } }, mounted () { this.$nextTick(() => { this.height = window.innerHeight - 475 }) }, methods: { searchDelHeaderList(){ let params = JSON.parse(JSON.stringify(this.searchData)) params.no = this.no; params.size = this.size; if (this.searchData.shipFlag){ params.shipFlag = "Y"; }else { params.shipFlag = null; } this.delNotifyHeaderList = []; this.delNotifyDetailList = []; this.delNotifyHeaderTableLoading = true; searchDelHeaderList(params).then(({data})=>{ this.delNotifyHeaderTableLoading = false; if (data && data.code === 0){ this.delNotifyHeaderList = data.data.records; this.total = data.data.total; this.delNotifyDetailList = data.data.records[0].delNotifyDetailVoList }else { this.$message.warning(data.msg) } }).catch((error)=>{ this.delNotifyHeaderTableLoading = false; }) }, // 分页
sizeChangeHandle(val){ this.size = val; this.no = 1; this.searchDelHeaderList(); }, currentChangeHandle(val){ this.no = val; this.searchDelHeaderList(); }, getSignNumber(number){ return new Decimal(number).toSignificantDigits().toNumber() }, rowClickDelNotifyHeaderTable(row){ // 缓存对象
this.delNotifyHeader = row // this.delNotifyDetailList = this.delNotifyHeader.delNotifyDetailVoList;
this.searchDelNotifyDetail(); }, updateDelNotifyDetailBtn(status){ this.delNotifyDetail.approveResultFlag = status; console.log(this.$store.state.user) this.delNotifyDetail.approvedBy = this.$store.state.user.name; this.updateDelNotifyDetail(); }, updateDelNotifyDetail(){ updateDelNotifyDetail(this.delNotifyDetail).then(({data})=>{ if (data && data.code === 0){ this.searchDelHeaderList(); this.checkoutDelNotifyDetailDialogVisible = false; this.$message.success(data.msg) }else { this.$message.warning(data.msg) } }).catch((error)=>{ this.$message.error("网络异常") }) }, checkoutDelNotifyDetailBtn(row){ this.delNotifyDetail = JSON.parse(JSON.stringify(row)); this.checkoutDelNotifyDetailDialogVisible = true; }, clickScan(row){ this.delNotifyDetail = JSON.parse(JSON.stringify(row)) this.allNum = this.delNotifyDetail.allNum this.notifyQty = this.delNotifyDetail.notifyQty let params = { site: row.site, partNo: row.partNo } //根据物料获取对应的标准袋重量
queryStandardWeight(params).then(({data})=>{ if (data && data.code === 0 && data.row){ this.delNotifyDetail.standardWeight = data.row.standardWeight } else { this.delNotifyDetail.standardWeight = 0 } }).catch() this.scanFlag = true }, changeAllNum(val){ this.allNum = val; // this.delNotifyDetail.allNum = val;
this.searchDelNotifyDetail(); }, searchDelNotifyDetail(){ let params = { site:this.delNotifyHeader.site, delNotifyNo:this.delNotifyHeader.delNotifyNo, } searchDelNotifyDetail(params).then(({data})=>{ if (data && data.code === 0){ this.delNotifyDetailList = data.data; }else { this.$message.warning(data.msg) } }).catch((error)=>{ this.$message.error(error) }) }, boxLabelVisibleHandler(row){ this.selectDelNotifyDetail = { site:row.site, delNotifyNo:row.delNotifyNo, delNotifyItemNo:row.delNotifyItemNo, partNo:row.partNo, partDesc:row.partDescription, shipQty:row.allNum, qtyPerBox:0, qtyPerBag:0, printTotalBoxCount:0, printBoxSeqNo:0, }; getPrintBoxLabel(this.selectDelNotifyDetail).then(({data})=>{ if (data && data.code === 0){ if (data.row){ this.boxLabelTotalQty = data.row.QtyPerBox; this.selectDelNotifyDetail.qtyPerBag = data.row.QtyPerBag; this.selectDelNotifyDetail.qtyPerBox = data.row.BagPerBox; this.selectDelNotifyDetail.printTotalBoxCount = data.row.PrintTotalBoxCount; this.selectDelNotifyDetail.printBoxSeqNo = data.row.PrintBoxSeqNo; } this.boxLabelVisible = true; }else { this.$message.warning(data.msg) } }).catch((error)=>{ this.$message.error(error) }) }, printBoxLabel(){ if (this.selectDelNotifyDetail.shipQty === undefined || this.selectDelNotifyDetail.shipQty === null || this.selectDelNotifyDetail.shipQty === ""){ this.$message.warning("发货数量不能为空") return } if (this.selectDelNotifyDetail.qtyPerBag === undefined || this.selectDelNotifyDetail.qtyPerBag === null || this.selectDelNotifyDetail.qtyPerBag === ""){ this.$message.warning("每盒(袋)数量不能为空") return } if (this.selectDelNotifyDetail.qtyPerBox === undefined || this.selectDelNotifyDetail.qtyPerBox === null || this.selectDelNotifyDetail.qtyPerBox === ""){ this.$message.warning("每箱中的盒数不能为空") return } if (this.boxNum === undefined || this.boxNum === null || this.boxNum === ""){ this.$message.warning("箱数不能为空") return } if (this.endBoxQty === undefined || this.endBoxQty === null || this.endBoxQty === ""){ this.$message.warning("末箱余数不能为空") return } if (this.selectDelNotifyDetail.printTotalBoxCount === undefined || this.selectDelNotifyDetail.printTotalBoxCount === null || this.selectDelNotifyDetail.printTotalBoxCount === ""){ this.$message.warning("总箱数不能为空") return } if (this.selectDelNotifyDetail.printBoxSeqNo === undefined || this.selectDelNotifyDetail.printBoxSeqNo === null || this.selectDelNotifyDetail.printBoxSeqNo === ""){ this.$message.warning("起始箱号不能为空") return } if (this.scatteredBoxNo === undefined || this.scatteredBoxNo === null || this.scatteredBoxNo === ""){ this.$message.warning("散箱箱号不能为空") return } //起始箱号 + 箱数 > 总箱数,提示 起始箱号 + 箱数 -1 超出了总箱数。
if (this.selectDelNotifyDetail.printBoxSeqNo + this.boxNum -1> this.selectDelNotifyDetail.printTotalBoxCount){ this.$message.warning("超出总箱数。") return } // 散箱箱号 > 总箱数,提示 散箱箱号 超出了总箱数
if (this.scatteredBoxNo > this.selectDelNotifyDetail.printTotalBoxCount){ this.$message.warning("散箱箱号超出了总箱数。") return } this.printBoxLabelHandler(); }, printBoxLabelHandler(){ let params = { ...this.selectDelNotifyDetail, boxNum:this.boxNum, endBoxQty:this.endBoxQty, partSpec:this.selectDelNotifyDetail.partDesc, scatteredBoxNo:this.scatteredBoxNo, boxLabelTotalQty:this.boxLabelTotalQty, } getPrintBoxLabelHandle(params).then(({data})=>{ if (data && data.code === 0){ // 调用打印插件
this.$message.success("打印成功") printOutBoxLabel(data.rows) // 打印执行方法
this.finallyPrintBoxLabel(params); }else { this.$message.warning(data.msg) } }).catch((error)=>{ this.$message.error(error) }) }, finallyPrintBoxLabel(params){ finallyPrintBoxLabel(params).then(({data})=>{ if (data && data.code === 0){ this.boxLabelVisible = false; this.$message.success(data.msg) }else { this.$message.warning(data.msg) } }).catch((error)=>{ this.$message.error(error) }) } }, created() { this.searchDelHeaderList(); }, watch:{ "selectDelNotifyDetail.shipQty"(newVal,oldVal){ if (this.selectDelNotifyDetail.qtyPerBox === 0 || !this.selectDelNotifyDetail.qtyPerBox){ this.boxNum = 0; this.endBoxQty = 0; return } this.endBoxQty = this.selectDelNotifyDetail.shipQty % this.boxLabelTotalQty this.boxNum = Math.floor(this.selectDelNotifyDetail.shipQty / this.boxLabelTotalQty) }, "boxLabelTotalQty"(newVal,oldVal){ if (this.selectDelNotifyDetail.qtyPerBox === 0 || !this.selectDelNotifyDetail.qtyPerBox){ this.boxNum = 0; this.endBoxQty = 0; return } this.endBoxQty = this.selectDelNotifyDetail.shipQty % this.boxLabelTotalQty this.boxNum = Math.floor(this.selectDelNotifyDetail.shipQty / this.boxLabelTotalQty) }, "boxNum"(newVal,oldVal){ if (this.endBoxQty > 0){ this.scatteredBoxNo = this.boxNum + this.selectDelNotifyDetail.printBoxSeqNo }else { this.scatteredBoxNo = 0 } }, "selectDelNotifyDetail.printBoxSeqNo"(newVal,oldVal){ if (this.endBoxQty > 0){ this.scatteredBoxNo = this.boxNum + this.selectDelNotifyDetail.printBoxSeqNo }else { this.scatteredBoxNo = 0 } }, "selectDelNotifyDetail.qtyPerBag"(newVal,oldVal){ if (newVal > 0){ this.boxLabelTotalQty = this.selectDelNotifyDetail.qtyPerBag * this.selectDelNotifyDetail.qtyPerBox } }, "selectDelNotifyDetail.qtyPerBox"(newVal,oldVal){ if (newVal > 0){ this.boxLabelTotalQty = this.selectDelNotifyDetail.qtyPerBag * this.selectDelNotifyDetail.qtyPerBox } } }, computed:{
}}</script>
<template> <div style="padding: 10px"> <el-form ref="searchDataForm" label-position="top" :model="searchData" label-width="80px"> <el-row :gutter="20"> <el-col :span="7"> <el-row> <el-col :span="11"> <el-form-item label="通知单日期"> <el-date-picker style="width: 100%" :editable="false" v-model="searchData.startDate" value-format="yyyy-MM-dd" type="date"> </el-date-picker> </el-form-item> </el-col> <el-col :span="2"> <el-form-item label=" " style="text-align: center"> --> </el-form-item> </el-col> <el-col :span="11"> <el-form-item label=" "> <el-date-picker style="width: 100%" :editable="false" v-model="searchData.endDate" value-format="yyyy-MM-dd" type="date"> </el-date-picker> </el-form-item> </el-col> </el-row> </el-col> <el-col :span="3"> <el-form-item label="客户编号"> <el-input v-model="searchData.customerId" clearable/> </el-form-item> </el-col> <el-col :span="3"> <el-form-item label="通知单单号"> <el-input v-model="searchData.delNotifyNo" clearable/> </el-form-item> </el-col> <el-col :span="3"> <el-form-item label="工厂编号" prop="site"> <el-select filterable v-model="searchData.site" default-first-option style="width: 100%"> <el-option label="全部" value=""></el-option> <el-option label="1-沪声" value="1"></el-option> <el-option label="2-赫艾" value="2"></el-option> </el-select> </el-form-item> </el-col> <el-col :span="3"> <el-form-item :label="' '"> <el-checkbox v-model="searchData.shipFlag">仅显示未完全发货清单</el-checkbox> </el-form-item> </el-col> <el-col :span="2"> <el-form-item :label="' '"> <el-button type="primary" style="height: 20px;font-size: 14px;line-height: 10px" @click="searchDelHeaderList">查 询</el-button> </el-form-item> </el-col> </el-row> </el-form> <div v-loading="delNotifyHeaderTableLoading"> <el-table :height="height" :data="delNotifyHeaderList" border highlight-current-row @row-click="rowClickDelNotifyHeaderTable" style="margin-top: 10px;"> <el-table-column prop="delNotifyNo" header-align="center" align="left" width="150" label="通知单号"/> <el-table-column prop="notifyDate" header-align="center" align="left" width="150" label="要求发货日期"/> <el-table-column prop="customerId" header-align="center" align="left" width="120" label="客户编码"/> <el-table-column prop="customerName" header-align="center" align="left" width="120" label="客户名称"/> <el-table-column prop="billAirwayNo" header-align="center" align="left" width="120" label="运单号"/> <el-table-column prop="forwarderId" header-align="center" align="left" width="80" label="货代"/> <el-table-column prop="remark" header-align="center" align="left" show-overflow-tooltip min-width="120" label="备注"/> <el-table-column prop="notifyDate" header-align="center" align="left" width="120" label="通知单日期"/> <el-table-column prop="receiver" header-align="center" align="left" width="100" label="经手人"/> <el-table-column prop="delAddId" header-align="center" align="left" show-overflow-tooltip width="120" label="送货地址"/> <el-table-column prop="creditFlag" header-align="center" align="left" width="120" label="退货标记"/> <el-table-column prop="site" header-align="center" align="left" width="120" label="工厂编码"/> <el-table-column prop="shipFlag" header-align="center" align="left" width="120" label="是否发货"/> <el-table-column prop="shipResult" header-align="center" align="left" width="150" label="发货状态信息"/> <el-table-column prop="realShipDate" header-align="center" align="left" width="150" label="实际发货日期"/> </el-table> <div style=" font-size: 18px;"> <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="no" :page-sizes="[50, 100, 500, 1000]" :page-size="size" :total="total" layout="total, sizes, prev, pager, next, jumper"> </el-pagination> </div>
<el-table :data="delNotifyDetailList" height="250" border stripe style="margin-top: 10px;"> <el-table-column label="操作" width="150px" header-align="center" fixed align="center"> <template slot-scope="{row,$index}"> <el-link style="cursor: pointer" v-if="row.approveFlag === 'N'" @click="checkoutDelNotifyDetailBtn(row)">检验</el-link> <el-link style="cursor: pointer" v-if="row.shipQty < row.notifyQty && row.allNum < row.notifyQty && delNotifyHeader.shipResult !== '全部发货'" @click="clickScan(row)">标签扫描</el-link> <el-link style="cursor: pointer" @click="boxLabelVisibleHandler(row)" v-if="false">外箱标签</el-link> </template> </el-table-column> <el-table-column prop="delNotifyItemNo" header-align="center" align="left" width="150px" label="通知单号序号"> <template slot-scope="{row,$index}"> {{getSignNumber(row.delNotifyItemNo)}} </template> </el-table-column> <el-table-column prop="partNo" header-align="center" align="left" width="120" label="产品编码"/> <el-table-column prop="partDescription" header-align="center" align="left" width="150" show-overflow-tooltip label="产品名称规格"/> <el-table-column prop="approveResultFlag" header-align="center" align="left" width="150" show-overflow-tooltip label="出货检验结果"> <template slot-scope="{row,$index}"> <span v-if="row.approveResultFlag === 'Y'">合格</span> <span v-else-if="row.approveResultFlag === 'N'">不合格</span> <span v-else>待检验</span> </template> </el-table-column> <el-table-column prop="notifyQty" header-align="center" align="right" width="120" label="通知单数量"/> <el-table-column prop="shipQty" header-align="center" align="right" width="120" label="发货数量"/> <el-table-column prop="allNum" header-align="center" align="right" width="120" label="扫描数量"> <template slot-scope="{row}"> {{row.allNum?row.allNum:0}} </template> </el-table-column> <el-table-column prop="umid" header-align="center" align="left" width="120" label="销售计量单位"/> <el-table-column prop="orderNo" header-align="center" align="left" width="120" label="销售订单号"/> <el-table-column prop="itemNo" header-align="center" align="left" width="120" label="订单序号"/> <el-table-column prop="customerPONo" header-align="center" align="left" width="150" label="客户采购订单号"/> <el-table-column prop="orderType" header-align="center" align="left" width="120" label="订单类型"/> <el-table-column prop="custPartNo" header-align="center" align="left" width="150" label="客户产品编号"/> <el-table-column prop="intSales" header-align="center" align="left" width="120" label="内部销售"/> <el-table-column prop="extSales" header-align="center" align="left" width="120" label="外部销售"/> <el-table-column prop="subOrderType" header-align="center" align="left" width="180" label="零部件订单类型"/> <el-table-column prop="techInfo" header-align="center" align="left" width="150" label="技术注意事项"/> <el-table-column prop="remark" header-align="center" align="left" show-overflow-tooltip width="180" label="备注"/> </el-table> </div>
<!--检验弹框--> <el-dialog title="出货检验" :visible.sync="checkoutDelNotifyDetailDialogVisible" width="40%"> <el-form :model="delNotifyDetail" label-position="top" label-width="120"> <el-row :gutter="30"> <el-col :span="10"> <el-form-item label="通知单号"> <el-input disabled v-model="delNotifyDetail.delNotifyNo" readonly></el-input> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="工厂编号" prop="site"> <el-select filterable disabled v-model="delNotifyDetail.site" readonly style="width: 100%"> <el-option label="全部" value=""></el-option> <el-option label="1-沪声" value="1"></el-option> <el-option label="2-赫艾" value="2"></el-option> </el-select> </el-form-item> </el-col> <el-col :span="10"> <el-form-item label="产品编码"> <el-input disabled v-model="delNotifyDetail.partNo" readonly></el-input> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="产品描述"> <el-input disabled v-model="delNotifyDetail.partDescription" readonly></el-input> </el-form-item> </el-col> <el-col :span="10"> <el-form-item label="通知单数量"> <div class="right"> <el-input disabled v-model="delNotifyDetail.notifyQty" type="number" readonly></el-input> </div> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="扫码数量"> <div class="right"> <el-input disabled v-model="delNotifyDetail.allNum" type="number" readonly></el-input> </div> </el-form-item> </el-col> <el-col :span="10"> <el-form-item label="销售订单"> <el-input disabled v-model="delNotifyDetail.delNotifyNo" readonly></el-input> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="客户采购订单"> <el-input disabled v-model="delNotifyDetail.customerPONo" readonly></el-input> </el-form-item> </el-col> <el-col :span="10"> <el-form-item label="内部销售"> <el-input disabled v-model="delNotifyDetail.intSales" readonly></el-input> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="外部销售"> <el-input disabled v-model="delNotifyDetail.extSales" readonly></el-input> </el-form-item> </el-col> </el-row> </el-form> <span slot="footer" class="dialog-footer" style="text-align: center"> <el-button type="primary" :disabled="!delNotifyDetail.allNum || delNotifyDetail.allNum === 0" @click="updateDelNotifyDetailBtn('Y')">合 格</el-button> <el-button @click="updateDelNotifyDetailBtn('N')">不 合 格</el-button> </span> </el-dialog> <el-dialog :visible.sync="boxLabelVisible" v-drag :close-on-click-modal="false" title="打印外箱标签" width="800px"><!-- {{selectDelNotifyDetail}}--> <el-form :model="selectDelNotifyDetail" label-position="top" label-width="120"> <el-row :gutter="20"> <el-col :span="4"> <el-form-item label="工厂编码"> <el-input v-model="selectDelNotifyDetail.site" disabled></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="通知单号"> <el-input v-model="selectDelNotifyDetail.delNotifyNo" disabled></el-input> </el-form-item> </el-col> <el-col :span="4"> <el-form-item label="通知单序号"> <el-input v-model="selectDelNotifyDetail.delNotifyItemNo" disabled></el-input> </el-form-item> </el-col> </el-row> <el-row :gutter="20"> <el-col :span="6"> <el-form-item label="产品编码"> <el-input v-model="selectDelNotifyDetail.partNo" disabled></el-input> </el-form-item> </el-col> <el-col :span="8"> <el-form-item label="产品名称"> <el-input v-model="selectDelNotifyDetail.partDesc" disabled></el-input> </el-form-item> </el-col> </el-row> <el-row :gutter="20"> <el-col :span="4"> <el-form-item label="发货数量" required> <el-input-number v-model="selectDelNotifyDetail.shipQty" :controls="false" :step="0" :precision="0"></el-input-number> </el-form-item> </el-col> <el-col :span="4"> <el-form-item label="每盒(袋)数量" required> <el-input-number v-model="selectDelNotifyDetail.qtyPerBag" :controls="false" :step="0" :precision="0"></el-input-number> </el-form-item> </el-col> <el-col :span="4"> <el-form-item label="每箱中的盒(袋)数" required> <el-input-number v-model="selectDelNotifyDetail.qtyPerBox" :controls="false" :step="0" :precision="0"></el-input-number> </el-form-item> </el-col> <el-col :span="4"> <el-form-item label="每箱总数量"> <el-input-number v-model="boxLabelTotalQty" disabled :controls="false" :step="0" :precision="0"></el-input-number> </el-form-item> </el-col> <el-col :span="4"> <el-form-item label="箱数" required> <el-input-number v-model="boxNum" :controls="false" :step="0" :precision="0"></el-input-number> </el-form-item> </el-col> <el-col :span="4"> <el-form-item label="末箱子余数" required> <el-input-number v-model="endBoxQty" :controls="false" :step="0" :precision="0"></el-input-number> </el-form-item> </el-col> </el-row> <fieldset> <legend>箱号信息:</legend> <el-row :gutter="30"> <el-col :span="4"> <el-form-item label="总箱数" required> <el-input-number v-model="selectDelNotifyDetail.printTotalBoxCount" :controls="false" :step="0" :precision="0"></el-input-number> </el-form-item> </el-col> <el-col :span="4"> <el-form-item label="起始箱号" required> <el-input-number v-model="selectDelNotifyDetail.printBoxSeqNo" :controls="false" :step="0" :precision="0"></el-input-number> </el-form-item> </el-col> <el-col :span="4"> <el-form-item label="箱数" required> <el-input-number v-model="boxNum" :controls="false" :step="0" :precision="0"></el-input-number> </el-form-item> </el-col> <el-col :span="4"> <el-form-item label="散箱箱号" required> <el-input-number v-model="scatteredBoxNo" :controls="false" :step="0" :precision="0"></el-input-number> </el-form-item> </el-col> </el-row> </fieldset> </el-form> <span slot="footer" class="dialog-footer" style="text-align: center"> <el-button type="primary" @click="printBoxLabel">打印</el-button> <el-button @click="boxLabelVisible = false">取消</el-button> </span> </el-dialog> <scan-form :scan-flag.sync="scanFlag" @changeAllNum="changeAllNum" :all-num="allNum" :notify-qty="notifyQty" :detail="delNotifyDetail"></scan-form> </div></template>
<style scoped>.el-select-dropdown__item{ font-size: 18px;}.right /deep/ .el-input--medium .el-input__inner{ text-align: right;}</style>
|