Files
JY1.0/src/views/SalesManagement/ProductDelivery/index.vue

1375 lines
54 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-card style="height: 850px">
<div style="margin-top: 7px; margin-bottom: 7px">
<el-select
v-model="customerNameValue"
style="width:200px"
placeholder="买方名称"
size="small"
filterable
clearable
@change="searchTable()">
<el-option
v-for="item in customerName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-select
v-model="orderValue"
:remote-method="getOrder"
style="width:200px"
placeholder="订单编号"
size="small"
filterable
clearable
remote
@change="searchTable()">
<el-option
v-for="item in orderArray"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</div>
<div style="margin-top: 10px">
<el-table
v-loading="loading"
:data="tableData"
highlight-current-row
border
stripe
size="mini"
style="width: 1671px;margin-top: 10px"
height="250"
@sort-change="sortChange"
@row-click="searchCustomer">
<el-table-column :width="setColumnWidth('序号')" label="选择" align="center">
<template slot-scope="scope">
<el-button :disabled="scope.row.是否选入===1" type="text" size="mini" @click="selectIn(scope.row)">
<svg-icon icon-class="bottom" style="width: 20px;height: 20px"/>
</el-button>
</template>
</el-table-column>
<el-table-column
:width="setColumnWidth('通知日期')"
label="通知日期"
align="center"
prop="通知日期"
sortable="通知日期">
<template slot-scope="scope">
{{ scope.row.通知日期 }}
</template>
</el-table-column>
<el-table-column
:width="setColumnWidth('订单编号')"
label="订单编号"
align="center"
prop="订单编号"
sortable="订单编号"
show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.订单编号 }}
</template>
</el-table-column>
<el-table-column
:width="setColumnWidth('买方名称')"
label="买方名称"
align="center"
prop="买方名称"
sortable="买方名称"
show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.买方名称 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('地址')" label="地址" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.地址 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('备注')" label="合同备注" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.合同备注 }}
</template>
</el-table-column>
<el-table-column width="130px" label="产品名称" align="center">
<template slot-scope="scope">
{{ scope.row.产品名称 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('状态')" label="状态" align="center">
<template slot-scope="scope">
{{ scope.row.状态 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('数量')" label="通知发货" align="center">
<template slot-scope="scope">
{{ scope.row.本次发货 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('数量')" label="本次已发" align="center">
<template slot-scope="scope">
{{ scope.row.本次已发数量 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('数量')" label="累计发货" align="center">
<template slot-scope="scope">
{{ scope.row.已发数 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('数量')" label="订单数量" align="center">
<template slot-scope="scope">
{{ scope.row.订单数量 }}
</template>
</el-table-column>
<el-table-column label="产品详情" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.产品详情 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('日期')" label="交货日期" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.交货日期 }}
</template>
</el-table-column>
</el-table>
</div>
<el-col style="margin-top: 10px;width: 791px">
<span style="font-size: 13px;color: black">发货日期</span>
<el-date-picker
v-model="dateRange"
size="small"
type="daterange"
align="center"
style="width: 240px;"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="searchTable1()"/>
<el-input
v-model="consignee"
size="small"
placeholder="收货人"
style="width: 100px"
@keyup.enter.native="searchTable1()"/>
<el-button type="distribution" icon="el-icon-circle-plus-outline" size="small" @click="ADD()">发货单</el-button>
<el-tooltip :open-delay="500" effect="dark" content="修改发货单" placement="top">
<el-button type="text" icon="el-icon-edit" style="margin-left: 200px;height: 32px;" @click="EDIT()"/>
</el-tooltip>
<el-tooltip :open-delay="500" effect="dark" content="删除发货单" placement="top">
<el-button type="text" icon="el-icon-delete" style="height: 32px" @click="DELETE()"/>
</el-tooltip>
<!--<el-tooltip :open-delay="500" effect="dark" content="修改发货单" placement="top">-->
<!--<el-button type="text" icon="el-icon-document" size="mini" @click="createContract()"/>-->
<!--</el-tooltip>-->
<el-tooltip :open-delay="500" effect="dark" content="打印发货单" placement="top">
<el-button type="text" icon="el-icon-printer" style="height: 32px" @click="shipmentDocPrintQuery()"/>
<!-- @click="exportTable()" -->
</el-tooltip>
<el-table
v-loading="loading"
:data="tableData1"
:header-cell-style="{background: '#2283D4',color: 'white'}"
:row-key="getRowKeys"
highlight-current-row
border
stripe
size="mini"
style="width: 791px;margin-top: 10px;"
height="440px"
@row-click="searchTable2"
@sort-change="sortChange1">
<el-table-column width="120px" label="发货单号" align="center" prop="发货单号" sortable="发货单号">
<template slot-scope="scope">
{{ scope.row.发货单号 }}
</template>
</el-table-column>
<el-table-column width="100px" label="发货日期" align="center" prop="发货日期" sortable="发货日期">
<template slot-scope="scope">
{{ scope.row.发货日期 }}
</template>
</el-table-column>
<el-table-column width="70px" label="收货人" align="center">
<template slot-scope="scope">
{{ scope.row.收货人 }}
</template>
</el-table-column>
<el-table-column label="收货地址" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.收货地址 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('物流单号')" label="物流单号" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物流单号 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('发货金额')" label="发货金额" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ Number(scope.row.发货金额).toFixed(2) }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('发货备注')" label="发货备注" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.发货备注 }}
</template>
</el-table-column>
<el-table-column width="80px" label="操作" align="center">
<template slot-scope="scope">
<el-button type="text" icon="el-icon-top" size="mini" @click="uploadPicture(scope.row)">照片</el-button>
</template>
</el-table-column>
</el-table>
</el-col>
<el-col style="margin-top: 10px;width: 871px;margin-left: 12px">
<el-button
:disabled="isDisabled"
type="primary"
icon="el-icon-s-check"
plain
size="small"
@click="confirmDelivery()">确认发货
</el-button>
<el-table
v-loading="loading"
ref="table"
:data="tableData2"
:row-class-name="tableRowClassName"
:header-cell-style="{background: '#19466E',color: 'white'}"
highlight-current-row
border
size="mini"
style="width: 871px;margin-top: 12px"
height="440px">
<el-table-column :width="setColumnWidth('序号')" label="选择" align="center">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="selectOut(scope.row)">
<svg-icon icon-class="top" style="width: 20px;height: 20px"/>
</el-button>
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('订单编号')" label="订单编号" align="center">
<template slot-scope="scope">
{{ scope.row.订单号 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('备注')" label="合同备注" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.合同备注 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('产品名称')" label="产品名称" align="center">
<template slot-scope="scope">
{{ scope.row.产品名称 }}
</template>
</el-table-column>
<el-table-column width="60px" label="应发数" align="center" prop="应发数量">
<template slot-scope="scope">
{{ scope.row.应发数量 }}
</template>
</el-table-column>
<el-table-column label="实际发量" align="center" prop="实际发量">
<template slot-scope="scope">
<el-input-number
v-model="scope.row.查询实际发量"
:max="scope.row.应发数量"
:min="1"
size="small"
style="width: 100%"
@change="updateNum(scope.row)"/>
</template>
</el-table-column>
<el-table-column width="80px" label="单价" align="center" prop="单价">
<template slot-scope="scope">
{{ Number(scope.row.单价).toFixed(2) }}
</template>
</el-table-column>
<el-table-column width="80px" label="金额" align="center" prop="金额">
<template slot-scope="scope">
{{ Number(scope.row.单价 * scope.row.查询实际发量).toFixed(2) }}
</template>
</el-table-column>
<el-table-column width="80px" label="操作" align="center">
<template slot-scope="scope">
<el-tooltip :open-delay="700" effect="dark" content="领料" placement="top">
<el-button
:disabled="(Number(scope.row.组件仓库) !== 1 && Number(scope.row.组件精工车间) !== 1 && Number(scope.row.组件采购) !==1) || Number(scope.row.是否全部领料) === 1"
type="text"
icon="el-icon-shopping-cart-2"
size="mini"
@click.native.stop="searchTableMaterial(scope.row)">领料
</el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
</el-col>
</el-card>
<el-card v-show="false" style="height: 850px">
<div style="width:900px;margin-left: 350px">
<el-card>
<div id="WGBLD" style="width: 880px;margin: 0 auto">
<!--<div style="margin-left: 150px;width: 180px;height: 90px;vertical-align:middle">-->
<!--<img :src="require('@/assets/img/JYuser.png')" width="80px" height="80px">-->
<!--&lt;!&ndash;<span style="font-size: 33px;font-weight: bold">景耀<br>JNYO</span>&ndash;&gt;-->
<!--</div>-->
<div style="height: 65px;width: 660px;margin: 0 auto 10px">
<img src="@/assets/img/CompanyIcon.png" style="float: left; width: 160px;height: 60px;">
<img
src="@/assets/img/CompanyQRCode.jpg"
style="float: right; margin-right: 20px;width: 70px;height: 70px;">
<span style="font-size: 19px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;耀&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><span
style="font-size: 14px;">ZHEJIANG JING YAO NUMERICAL CONTROL TECHNOLOGY CO. LTD</span></span>
</div>
<div style="text-align: center;margin-bottom: 10px">
<span style="font-size: 14px">销售出库单</span>
</div>
<div style="margin-bottom: 10px">
<el-col :span="9">
<span style="float: left; margin-left: 20px;margin-top: 5px;font-size: 11px">收货单位{{
customer
}}</span>
</el-col>
<el-col :span="7">
<span style="font-size: 11px;margin-left: 70px;">销售方式现销</span>
</el-col>
<el-col :span="8">
<span style="float: right; font-size: 11px;margin-top: 5px;">编号{{ number }}</span>
</el-col>
</div>
<div style="margin-bottom: 10px">
<span style="float: left;margin-left: 20px;font-size: 11px;">摘要{{ remarks }}</span>
<span style="float: right;margin-right: 37px;font-size: 11px">日期{{ date }}</span>
</div>
<table cellspacing="0px" align="center" border="1 solid black" width="100%" style="font-size: 11px">
<tr id="tablehead12" style="height: 35px">
<td colspan="1" style="text-align: center;width: 5%">序号</td>
<td colspan="4" style="text-align: center;width: 20%">产品名称</td>
<td colspan="5" style="text-align: center;width: 25%">辅助规格</td>
<!-- <td colspan="2" style="text-align: center;width: 12%">产品条码</td>-->
<td colspan="1" style="text-align: center;width: 5%">单位</td>
<td colspan="1" style="text-align: center;width: 5%">数量</td>
<td colspan="2" style="text-align: center;width: 10%">销售单价</td>
<td colspan="2" style="text-align: center;width: 10%">销售金额</td>
<td colspan="4" style="text-align: center;width: 20%">备注</td>
</tr>
<tr v-for="(list, index) in returns" :key="index" style="height: 35px">
<td colspan="1" style="text-align: center;width: 5%">{{ list.序号 }}</td>
<td colspan="4" style="text-align: center;width: 20%">{{ list.产品名称 }}</td>
<td colspan="5" style="text-align: center;width: 25%">{{ list.辅助规格 }}</td>
<!-- <td colspan="2" style="text-align: center;width: 12%">{{ list.产品条码 }}</td>-->
<td colspan="1" style="text-align: center;width: 5%">{{ list.单位 }}</td>
<td colspan="1" style="text-align: center;width: 5%">{{ list.数量 }}</td>
<td colspan="2" style="text-align: center;width: 10%">{{ Number(list.销售单价).toFixed(2) }}</td>
<td colspan="2" style="text-align: center;width: 10%">{{
Number(list.数量 * list.销售单价).toFixed(2)
}}
</td>
<td colspan="4" style="text-align: center;width: 20%">{{ list.备注 }}</td>
</tr>
<tr style="height: 35px">
<td colspan="1" style="text-align: center;width: 5%;font-size: 11px">合计</td>
<td colspan="19" style="text-align: center;width: 95%">
<div>
<span style="float: left;margin-left: 30px;font-size: 11px">{{ totalAmountText }}</span>
</div>
<div>
<span style="float: right;margin-right: 22%;font-size: 11px">{{
Number(totalAmount).toFixed(2)
}}</span>
</div>
</td>
</tr>
</table>
<div style="margin-top: 10px;font-size: 11px">
以上货品请核对数量如有质量问题请在收货后3天内通知本公司逾期恕不负责
</div>
<div style="margin-top: 15px;font-size: 11px"><span style="font-size: 11px">审核</span><span
style="margin-left: 80px;font-size: 11px">业务员</span><span style="margin-left: 80px;font-size: 11px">发货</span><span
style="margin-left: 80px;font-size: 11px">保管</span><span
style="margin-left: 80px;font-size: 11px">制单</span><span
style="margin-left: 80px;font-size: 11px">收货</span></div>
</div>
</el-card>
</div>
</el-card>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible" title="发货单" center width="440px">
<el-form
ref="form"
:model="form"
:rules="rules"
label-position="center"
label-width="110px"
class="demo-ruleForm">
<el-row>
<el-col :span="12">
<el-form-item label="发货单号" prop="发货单号">
<el-input
v-model="form.发货单号"
size="small"
readonly
style="width:200px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="发货日期" prop="发货日期">
<el-date-picker
v-model="form.发货日期"
type="date"
size="small"
style="width: 200px"
placeholder="选择日期"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="客户名称" prop="客户名称">
<el-select
v-model="form.客户名称"
:remote-method="getCustomer"
style="width:200px"
placeholder="客户名称"
size="small"
filterable
clearable
remote
@change="getData()">
<el-option
v-for="item in customerName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="收货人" prop="收货人">
<el-input
v-model="form.收货人"
size="small"
clearable
style="width:200px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="收货地址" prop="收货地址">
<el-input
v-model="form.收货地址"
clearable
size="small"
style="width:200px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="物流单号" prop="物流单号">
<el-input
v-model="form.物流单号"
clearable
size="small"
style="width:200px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="发货备注" prop="发货备注">
<el-input
v-model="form.发货备注"
clearable
size="small"
style="width:200px"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="callOff('form')">取消</el-button>
<el-button :disabled="ADD_disable" type="distribution" size="small" @click="submit('form')">确定</el-button>
</div>
</el-dialog>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible1" title="上传图片" center width="320px">
<el-upload
id="invoiceScan"
ref="upload"
:multiple="true"
:auto-upload="false"
:on-success="uploadSuccess"
:on-exceed="warningExceed"
:limit="limit"
:data="Data"
:action="upload"
style="margin-left: 60px"
list-type="picture-card">
<i class="el-icon-plus"/>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogFormVisible1=false">取消</el-button>
<el-button type="distribution" size="small" @click="submit2('form')">确定</el-button>
</div>
</el-dialog>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisibleCreatePickingList" center width="740px">
<el-button
style="float: right;margin-right: 10px;margin-bottom: 10px"
icon="el-icon-check"
type="primary"
plain
size="small"
@click="createPickingList">
领料单
</el-button>
<span style="font-size: 18px">领料单号{{ DocumentNumber }}</span>
<el-table
v-loading="loading"
:data="tableDataCreatePickingList"
:row-class-name="tableRowClassNamee"
highlight-current-row
border
size="small"
style="width: 681px"
@selection-change="handleSelectionChange">
<el-table-column :selectable="selectable" type="selection" align="center" width="50px"/>
<el-table-column width="140px" label="订单编号" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.订单编号 }}
</template>
</el-table-column>
<el-table-column label="零件名称" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column width="70px" label="库存数" align="center">
<template slot-scope="scope">
{{ scope.row.累计库存 }}
</template>
</el-table-column>
<el-table-column width="150px" label="应领数" align="center">
<template slot-scope="scope">
<el-input-number
v-model="scope.row.实际发量"
:max="scope.row.最大值"
:min="0"
size="small"
style="width: 100%"/>
</template>
</el-table-column>
<el-table-column width="70px" label="数量" align="center">
<template slot-scope="scope">
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column width="74px" label="已申请数" align="center">
<template slot-scope="scope">
{{ scope.row.已领数量 }}
</template>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { url } from '@/utils/request'
import $ from 'jquery'
export default {
data() {
return {
isDisabled: true,
totalAmount: '',
totalAmountText: '',
tableDataCreatePickingList: [], // 创建领料单弹出框的表
dialogFormVisibleCreatePickingList: false,
DocumentNumber: '',
inventoryNumber: '',
// 以上是新增
customer: '',
state: '',
number: '',
remarks: '',
date: '',
returns: [],
ADD_disable: false,
customerNameValue: '', // 买方名称
customerName: [], // 买方名称数组
customerValue: '',
customerValue1: '',
orderNumberValue: '',
orderValue: '', // 订单编号
orderArray: [], // 订单编号数组
dateRange: '',
show: false,
show1: false,
loading: false, // 数据加载
dialogFormVisible: false,
dialogFormVisible1: false,
temp: '',
listValue: '',
upload: url,
limit: 20,
Data: {},
form: {
发货单号: '',
发货日期: '',
客户名称: '',
收货人: '',
收货地址: '',
物流单号: '',
发货备注: ''
},
rules: {
客户名称: [{ required: true, message: '请选择客户名称', trigger: 'blur' }],
收货人: [{ required: true, message: '请输入收货人', trigger: 'blur' }],
发货日期: [{ required: true, message: '请选择发货日期', trigger: 'blur' }],
收货地址: [{ required: true, message: '请输入收货地址', trigger: 'blur' }]
},
deliveryValue: '',
consignee: '',
consignee1: '',
address: '',
deliveryMxValue: [],
deliveryNum: [],
total: 0, // 分页总数
tableData: [], // 订单信息表
tableData1: [], // 产品信息表
tableData2: [], // 产品信息表
pageCurrent: 1, // 分页当前页
pageSize: 100, // 分页每页显示条数
orderName: '', // 排序列名
order: '' // 排序方式
}
},
computed: {
...mapGetters([
'id',
'token'
])
},
created() {
this.fetchData()
this.searchTable()
this.searchTable1()
},
methods: {
updateNum(row) {
var param1 = []
param1[0] = ['发货单明细流水号', row.发货单明细流水号]
param1[1] = ['发货数量', row.查询实际发量]
var Data1 = this.CreateData('12', '产品发货_发货单明细_发货数修改', param1)
this.ExecDatabase(Data1).then(response => {
if (response.data[0].result === '1') {
for (let i = 0; i < this.tableData1.length; i++) {
if (this.deliveryValue === this.tableData1[i].发货单流水号) {
this.tableData1[i].发货金额 = Number(row.单价 * row.查询实际发量).toFixed(2)
}
}
console.log('修改成功')
} else {
console.log('修改失败')
}
})
},
// 领料数据库
searchTableMaterial(row) {
var param1 = []
var Data1 = this.CreateData('11', '车间装配管理_领料单_获取单号', param1)
this.ExecDatabase(Data1).then(response => {
this.DocumentNumber = response.data[0].领料单编号
})
this.groupNum = row.组件流水号
var param = []
param[0] = ['组件流水号', row.组件流水号]
var Data = this.CreateData('11', '产品发货_发货单明细流水号_查询数据', param)
this.ExecDatabase(Data).then(response => {
this.tableDataCreatePickingList = []
for (let i = 0; i < response.data.length; i++) {
this.tableDataCreatePickingList.push({
订单编号: response.data[i].订单编号,
组件流水号: response.data[i].组件流水号,
流水号: response.data[i].流水号,
零件类型: response.data[i].零件类型,
零件名称: response.data[i].零件名称,
数量: response.data[i].数量,
累计库存: response.data[i].累计库存,
已领数量: response.data[i].已领数量,
// 最大值: Math.min(Number(response.data[i].累计库存), Number(response.data[i].数量) - Number(response.data[i].已领数量)),
// 实际发量: Math.min(Number(response.data[i].累计库存), Number(response.data[i].数量) - Number(response.data[i].已领数量))
最大值: Number(response.data[i].数量) - Number(response.data[i].已领数量),
实际发量: Number(response.data[i].数量) - Number(response.data[i].已领数量)
})
this.dialogFormVisibleCreatePickingList = true
}
})
},
selectable(row) {
// return Number(row.数量) > Number(row.已领数量) && Number(row.实际发量) > 0 && Number(row.累计库存) > 0
return Number(row.数量) > Number(row.已领数量) && Number(row.实际发量) > 0
},
// 加底色
tableRowClassNamee({ row, rowIndex }) {
if (row.累计库存 === 0) {
return 'red'
}
},
handleSelectionChange(val) {
this.multipleSelection = val
},
createPickingList() {
if (this.multipleSelection.length !== 0) {
this.NumberValuePicking = []
this.NumberPicking = []
this.typePicking = []
this.multipleSelection_variable = this.multipleSelection
this.multipleSelection = []
for (let i = 0; i < this.multipleSelection_variable.length; i++) {
this.NumberValuePicking[i] = parseInt(this.multipleSelection_variable[i].流水号)
this.NumberPicking[i] = parseInt(this.multipleSelection_variable[i].实际发量)
this.typePicking[i] = parseInt(this.multipleSelection_variable[i].零件类型)
}
var param = []
// param[0] = ['组件流水号', this.tableDataCreatePickingList[0].组件流水号]
// param[1] = ['流水号', this.tableDataCreatePickingList[0].流水号]
// param[2] = ['实领数', this.tableDataCreatePickingList[0].实际发量]
// param[3] = ['零件类型', this.tableDataCreatePickingList[0].零件类型]
// param[4] = ['人员编号', this.id]
param[0] = ['组件流水号', this.groupNum]
param[1] = ['流水号数组', this.NumberValuePicking]
param[2] = ['实领数数组', this.NumberPicking]
param[3] = ['零件类型数组', this.typePicking]
param[4] = ['人员编号', this.id]
var Data = this.CreateData('12', '产品发货_创建领料单', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('领料单创建成功')
this.searchTable3()
this.dialogFormVisibleCreatePickingList = false
} else {
this.$message.error('领料单创建失败')
}
})
} else {
this.$message.warning('请选择物料')
}
},
searchTable3() {
var param = []
param[0] = ['发货单流水号', this.deliveryValue]
param[1] = ['已发', 1]
var Data = this.CreateData('11', '产品发货_发货单明细_查询数据新', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length > 0) {
this.number = response.data[0].订单号
} else {
this.number = ''
}
this.tableData2 = response.data
console.log('ajfdlafld', this.tableData2)
})
},
// 加底色
tableRowClassName({ row, rowIndex }) {
if (row.实发量 <= row.已经领数 - row.已发数) {
return 'green'
}
},
// 以上是新曾 或者修改
fetchData() {
this.getCustomer('')
this.getOrder('')
},
exportTable() {
const htmlNode = $('#WGBLD').html()
const body = $('body')
body.children().hide()
const printNode = $(htmlNode)
body.append(printNode)
window.print()
body.children().not('script').show()
body.children().not('#app').hide()
printNode.remove()
},
getCustomer(query) {
this.customerName = []
var param = []
param[0] = ['客户名称', query]
var Data = this.CreateData('11', '合同管理_客户信息_查询数据_bak', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.customerName.push({
label: response.data[i].客户名称,
value: response.data[i].客户流水号
})
}
})
},
getOrder(query) {
this.orderArray = []
var param = []
param[0] = ['订单编号', query]
var Data = this.CreateData('11', '订单信息_列表_查询数据_bak', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.orderArray.push({
label: response.data[i].订单编号,
value: response.data[i].订单流水号
})
}
})
},
getRowKeys(row) {
return row.发货单流水号
},
searchCustomer(row) {
this.orderNumberValue = row.订单流水号
this.customerValue1 = row.客户流水号
var param = []
param[0] = ['订单流水号', row.订单流水号]
var Data = this.CreateData('11', '合同管理_客户信息_查询数据_收获人和地址', param)
this.ExecDatabase(Data).then(response => {
this.consignee1 = response.data[0].收货人
this.address = response.data[0].地址
// this.$forceUpdate()
})
},
getData() {
if (this.form.客户名称) {
var param = []
param[0] = ['客户流水号', this.form.客户名称]
var Data = this.CreateData('11', '合同管理_客户信息_查询数据_收获人和地址', param)
this.ExecDatabase(Data).then(response => {
this.form.收货人 = response.data[0].收货人
this.form.收货地址 = response.data[0].地址
// this.$forceUpdate()
})
} else {
this.form.收货人 = ''
this.form.收货地址 = ''
}
},
ADD() {
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.ADD_disable = false
this.form.客户名称 = this.customerValue1
this.form.收货人 = this.consignee1
this.form.收货地址 = this.address
var param = []
var Data = this.CreateData('11', '产品发货_单号查询', param)
this.ExecDatabase(Data).then(response => {
this.form.发货单号 = response.data[0].单号
this.form.发货日期 = response.data[0].日期
this.dialogFormVisible = true
this.temp = 1
})
},
EDIT() {
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
if (this.deliveryValue) {
this.ADD_disable = false
this.dialogFormVisible = true
this.temp = 2
} else {
this.$message.warning('请选择要更改的发货单')
}
},
submit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.ADD_disable = true
if (this.temp === 1) {
var param = []
param[0] = ['发货单号', this.form.发货单号]
param[1] = ['发货日期', this.form.发货日期]
param[2] = ['收货人', this.form.收货人]
param[3] = ['收货地址', this.form.收货地址]
param[4] = ['发货备注', this.form.发货备注]
param[5] = ['客户流水号', this.form.客户名称]
param[6] = ['物流单号', this.form.物流单号]
var Data = this.CreateData('12', '产品发货_发货单_增加', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('添加成功')
this.ADD_disable = false
this.searchTable1()
this.dialogFormVisible = false
} else {
this.$message.success('添加失败')
this.ADD_disable = false
}
})
this.temp = ''
} else if (this.temp === 2) {
var param1 = []
param1[0] = ['发货单流水号', this.deliveryValue]
param1[1] = ['发货日期', this.form.发货日期]
param1[2] = ['收货人', this.form.收货人]
param1[3] = ['收货地址', this.form.收货地址]
param1[4] = ['发货备注', this.form.发货备注]
param1[5] = ['客户流水号', this.form.客户名称]
param1[6] = ['物流单号', this.form.物流单号]
var Data1 = this.CreateData('12', '产品发货_发货单_编辑', param1)
this.ExecDatabase(Data1).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.ADD_disable = false
this.searchTable1()
this.dialogFormVisible = false
} else {
this.$message.success('编辑失败')
this.ADD_disable = false
}
})
this.temp = ''
}
}
})
},
callOff(formName) {
this.form.客户名称 = ''
this.form.收货人 = ''
this.form.收货地址 = ''
this.form.发货单号 = ''
this.form.发货日期 = ''
this.form.物流单号 = ''
this.form.发货备注 = ''
this.dialogFormVisible = false
this.$refs[formName].resetFields()
},
DELETE() {
if (this.deliveryValue) {
this.$confirm('是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
var param = []
param[0] = ['发货单流水号', this.deliveryValue]
var Data = this.CreateData('12', '产品发货_发货单_删除', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.searchTable1()
} else {
this.$message.error('删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
} else {
this.$message.warning('请选择要删除的发货单')
}
},
selectIn(row) {
if (this.deliveryValue) {
if (this.customerValue === row.客户流水号) {
var param1 = []
param1[0] = ['发货单流水号', this.deliveryValue]
param1[1] = ['发货通知流水号', row.发货通知流水号]
param1[2] = ['发货数量', row.本次发货 - row.本次已发数量]
var Data1 = this.CreateData('12', '产品发货_发货单明细_增加', param1)
this.ExecDatabase(Data1).then(response => {
if (response.data[0].result === '1') {
this.$message.success('选入成功')
this.searchTable()
this.searchTable3()
let dateRange_check, consignee_check
this.dateRange ? dateRange_check = 1 : (dateRange_check = 0, this.dateRange = '')
this.consignee ? consignee_check = 1 : consignee_check = 0
var param = []
param[0] = ['收货人_check', consignee_check]
param[1] = ['收货人', this.consignee]
param[2] = ['时间_check', dateRange_check]
param[3] = ['开始时间', this.dateRange[0]]
param[4] = ['结束时间', this.dateRange[1]]
param[5] = ['发货状态_check', 1]
param[6] = ['发货状态', 0]
param[7] = ['排序名称', this.orderName]
param[8] = ['排序方式', this.order]
var Data = this.CreateData('11', '产品发货_发货单_查询数据', param)
this.ExecDatabase(Data).then(response => {
this.tableData1 = response.data
})
} else {
this.$message.success('选入失败')
}
})
} else {
this.$message.warning('选择发货单与产品的客户不一致')
}
} else {
this.$message.warning('请先选择发货单')
}
},
selectOut(row) {
var param1 = []
param1[0] = ['发货单明细流水号', row.发货单明细流水号]
var Data1 = this.CreateData('12', '产品发货_发货单明细_删除', param1)
this.ExecDatabase(Data1).then(response => {
if (response.data[0].result === '1') {
this.$message.success('移出成功')
this.searchTable()
this.searchTable3()
let dateRange_check, consignee_check
this.dateRange ? dateRange_check = 1 : (dateRange_check = 0, this.dateRange = '')
this.consignee ? consignee_check = 1 : consignee_check = 0
var param = []
param[0] = ['收货人_check', consignee_check]
param[1] = ['收货人', this.consignee]
param[2] = ['时间_check', dateRange_check]
param[3] = ['开始时间', this.dateRange[0]]
param[4] = ['结束时间', this.dateRange[1]]
param[5] = ['发货状态_check', 1]
param[6] = ['发货状态', 0]
param[7] = ['排序名称', this.orderName]
param[8] = ['排序方式', this.order]
var Data = this.CreateData('11', '产品发货_发货单_查询数据', param)
this.ExecDatabase(Data).then(response => {
this.tableData1 = response.data
})
} else {
this.$message.success('移出失败')
}
})
},
confirmDelivery() {
this.deliveryMxValue = []
this.deliveryNum = []
if (this.deliveryValue) {
if (this.tableData2.length === 0) {
this.$message.error('未选择要发货得产品!!!')
} else {
for (let i = 0; i < this.tableData2.length; i++) {
if (((Number(this.tableData2[i].已发数量) + Number(this.tableData2[i].实际发量)) < Number(this.tableData2[i].订单数)) || (Number(this.tableData2[i].组件仓库) !== 1 && Number(this.tableData2[i].组件精工车间) !== 1 && Number(this.tableData2[i].组件采购) !== 1)) {
this.deliveryMxValue.push(this.tableData2[i].发货单明细流水号)
if (isNaN(this.tableData2[i].实际发量) === false) {
if (this.tableData2[i].实际发量 !== '' && this.tableData2[i].实际发量 !== '0' && this.tableData2[i].实际发量 !== null) {
this.deliveryNum.push(this.tableData2[i].实际发量)
} else {
this.$message.error('实际发量不能为0或空')
return
}
} else {
this.$message.error('实际发量必须为数值')
return
}
} else if ((Number(this.tableData2[i].已发数量) + Number(this.tableData2[i].实际发量)) === Number(this.tableData2[i].订单数)) {
if (this.tableData2[i].是否全部领料 === 1) {
this.deliveryMxValue.push(this.tableData2[i].发货单明细流水号)
if (isNaN(this.tableData2[i].实际发量) === false) {
if (this.tableData2[i].实际发量 !== '' && this.tableData2[i].实际发量 !== '0' && this.tableData2[i].实际发量 !== null) {
this.deliveryNum.push(this.tableData2[i].实际发量)
} else {
this.$message.error('实际发量不能为0或空')
return
}
} else {
this.$message.error('实际发量必须为数值')
return
}
} else {
this.$message.error(this.tableData2[i].产品名称 + '未全部领料 ')
return
}
}
}
var param = []
param[0] = ['发货单流水号', this.deliveryValue]
param[1] = ['发货单明细流水号组', this.deliveryMxValue]
param[2] = ['实际发量组', this.deliveryNum]
var Data = this.CreateData('12', '产品发货_发货单_确认发货', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('发货成功')
this.searchTable()
this.searchTable1()
this.tableData2 = []
this.searchTable3()
} else {
this.$message.success('发货失败')
}
})
}
} else {
this.$message.warning('请先选择发货单')
}
},
searchTable() {
let customerNameValue_check, orderValue_check
this.customerNameValue ? customerNameValue_check = 1 : customerNameValue_check = 0
this.orderValue ? orderValue_check = 1 : orderValue_check = 0
var param = []
param[0] = ['买方名称_check', customerNameValue_check]
param[1] = ['客户流水号', this.customerNameValue]
param[2] = ['订单流水号_check', orderValue_check]
param[3] = ['订单流水号', this.orderValue]
param[4] = ['排序名称', this.orderName]
param[5] = ['排序方式', this.order]
var Data = this.CreateData('11', '产品发货_订单信息_查询数据', param)
this.ExecDatabase(Data).then(response => {
this.tableData = response.data
})
},
searchTable1() {
this.tableData2 = []
this.deliveryValue = ''
let dateRange_check, consignee_check
this.dateRange ? dateRange_check = 1 : (dateRange_check = 0, this.dateRange = '')
this.consignee ? consignee_check = 1 : consignee_check = 0
var param = []
param[0] = ['收货人_check', consignee_check]
param[1] = ['收货人', this.consignee]
param[2] = ['时间_check', dateRange_check]
param[3] = ['开始时间', this.dateRange[0]]
param[4] = ['结束时间', this.dateRange[1]]
param[5] = ['发货状态_check', 1]
param[6] = ['发货状态', 0]
param[7] = ['排序名称', this.orderName]
param[8] = ['排序方式', this.order]
var Data = this.CreateData('11', '产品发货_发货单_查询数据', param)
this.ExecDatabase(Data).then(response => {
this.tableData1 = response.data
})
},
searchTable2(row) {
if (row.审核状态 === 2) {
this.isDisabled = false
}
this.deliveryValue = row.发货单流水号
this.form.发货单号 = row.发货单号
this.form.发货日期 = row.发货日期
this.form.收货人 = row.收货人
this.form.收货地址 = row.收货地址
this.form.发货备注 = row.发货备注
this.form.客户名称 = row.客户流水号
this.customer = row.客户名称
// this.number = row.发货单号
this.date = row.发货日期
this.form.物流单号 = row.物流单号
this.customerValue = row.客户流水号
this.searchTable3()
},
// searchTable3() {
// var param = []
// param[0] = ['发货单流水号', this.deliveryValue]
// param[1] = ['已发', 1]
// var Data = this.CreateData('11', '产品发货_发货单明细_查询数据新', param)
// this.ExecDatabase(Data).then(response => {
// console.log('发货单明细查询', response.data)
// this.tableData2 = response.data
// })
// },
shipmentDocPrintQuery() {
this.returns = []
// 发货单打印查询
var param = []
param[0] = ['发货单流水号', this.deliveryValue]
var Data = this.CreateData('11', '产品发货_发货单明细_打印发货单_查询数据', param)
this.ExecDatabase(Data).then(response => {
this.totalAmountText = response.data[0].总金额文本
this.totalAmount = response.data[0].总金额
for (let i = 0; i < response.data.length; i++) {
this.returns.push({
序号: i + 1,
产品名称: response.data[i].产品名称,
单位: response.data[i].单位,
销售单价: response.data[i].单价,
辅助规格: response.data[i].产品详情,
数量: response.data[i].实际发量
})
}
}).then(() => {
this.exportTable()
})
},
updateRemarks() {
var param = []
param[0] = ['订单流水号', this.orderValue]
param[1] = ['订单备注', this.remarks]
var Data = this.CreateData('12', '订单信息_编辑数据', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '0') {
this.$message.error('编辑失败')
}
})
},
ReleaseOrder() {
var param = []
param[0] = ['订单流水号', this.orderValue]
var Data = this.CreateData('12', '订单信息_下达订单', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('下达成功')
this.searchTable()
this.tableData1 = []
this.remarks = ''
} else {
this.$message.error('下达失败')
}
})
},
createProduct() {
var param = []
param[0] = ['订单流水号', this.orderValue]
var Data = this.CreateData('12', '订单信息_产品信息_增加数据', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('添加成功')
this.searchTable2()
} else {
this.$message.error('添加失败')
}
})
},
groupNameChange(row, index) {
for (let i = 0; i < this.product.length; i++) {
if (row.产品名称 === this.product[i].value) {
this.productValue = this.product[i].name
this.tableData1[index].产品详情 = ''
this.tableData1[index].单位 = ''
var param = []
param[0] = ['产品流水号', this.productValue]
var Data = this.CreateData('11', '产品信息_查询数据', param)
this.ExecDatabase(Data).then(response => {
this.tableData1[index].产品详情 = response.data[0].产品详情
this.tableData1[index].单位 = response.data[0].单位
})
} else {
this.productValue = 0
}
}
},
editProduct(row) {
var param = []
param[0] = ['组件流水号', row.组件流水号]
param[1] = ['产品名称', row.产品名称]
param[2] = ['产品详情', row.产品详情]
param[3] = ['单位', row.单位]
param[4] = ['数量', row.数量]
param[5] = ['产品流水号', this.productValue]
var Data = this.CreateData('12', 'PDM_组件名称_编辑数据', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.searchTable2()
} else {
this.$message.error('编辑失败')
}
})
},
deleteProduct(row) {
var param = []
param[0] = ['组件流水号', row.组件流水号]
var Data = this.CreateData('12', 'PDM_组件名称_删除数据', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.searchTable2()
} else {
this.$message.error('删除失败')
}
})
},
uploadPicture(row) {
this.dialogFormVisible1 = true
this.listValue = row.发货单流水号
},
submit2() {
var param = []
param[0] = ['发货单流水号', this.listValue]
param[1] = ['文件名称', '']
param[2] = ['文件后缀', '']
param[3] = ['文件内容', null]
var Data1 = this.CreateData('15', '发货管理_发货单_上传图片', param)
this.Data.param = Data1
this.$refs.upload.submit()
this.dialogFormVisible1 = false
this.$nextTick(() => {
this.searchTable()
})
},
uploadSuccess(res) { // 上传成功回调
this.dialogFormVisible1 = false
this.$refs.upload.clearFiles()
},
beforeUpload(file) { // 上传前检测
const isJPG = /^image\/.*/.test(file.type)
if (!isJPG) {
this.$message.error('只能上传图片。。')
}
return isJPG
},
warningExceed() {
this.$message.error('仅可上传五张照片')
},
sortChange(column) {
if (column.prop === '通知日期') {
this.orderName = 1
} else if (column.prop === '订单编号') {
this.orderName = 2
} else if (column.prop === '买方名称') {
this.orderName = 3
} else {
this.orderName = 0
}
if (column.order === 'ascending') {
this.order = 1
} else if (column.order === 'descending') {
this.order = 2
} else {
this.order = ''
}
this.searchTable()
},
sortChange1(column) {
if (column.prop === '发货单号') {
this.orderName = 1
} else if (column.prop === '发货日期') {
this.orderName = 2
} else {
this.orderName = 0
}
if (column.order === 'ascending') {
this.order = 1
} else if (column.order === 'descending') {
this.order = 2
} else {
this.order = ''
}
this.searchTable()
}
}
}
</script>
<style scoped lang="scss">
/deep/ .el-table .green {
background: #67C23A !important;
}
/deep/ .el-table .red {
background: #F56C6C !important;
}
</style>