You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

545 lines
17 KiB

<template>
<el-dialog
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
:show-close="false"
fullscreen
@close="close"
@open="open"
>
<span slot="title" class="dialog-footer">
<div class="crud-opts2">
<span class="el-dialog__title2">出库分配</span>
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<el-button slot="left" type="info" @click="dialogVisible = false">关闭</el-button>
</span>
</div>
</span>
<div class="crud-opts2">
<span class="role-span">出库明细</span>
<div class="crud-opts-form">
<el-form ref="form" :inline="true" :model="form" size="mini">
<el-form-item label="库区" prop="gender2">
<el-cascader
placeholder="请选择"
:options="sects"
:props="{ checkStrictly: true }"
clearable
@change="sectQueryChange"
/>
</el-form-item>
</el-form>
</div>
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<el-button
slot="left"
class="filter-item"
:loading="loadingAlldiv"
type="primary"
icon="el-icon-plus"
size="mini"
@click="allDiv()"
>
全部分配
</el-button>
<el-button
slot="left"
class="filter-item"
:loading="loadingAlldiv"
type="primary"
icon="el-icon-plus"
size="mini"
@click="allCancel()"
>
全部取消
</el-button>
<el-button
v-if="this.mstrow.bill_type !== '1011'"
slot="left"
class="filter-item"
:loading="loadingAlldiv"
type="primary"
icon="el-icon-check"
size="mini"
:disabled="button1"
@click="oneDiv()"
>
自动分配
</el-button>
<el-button
v-if="this.mstrow.bill_type !== '1011'"
slot="left"
class="filter-item"
type="primary"
icon="el-icon-check"
:loading="loadingAlldiv"
size="mini"
:disabled="button2"
@click="oneCancel()"
>
自动取消
</el-button>
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
:loading="loadingAlldiv"
:disabled="button3"
@click="openStructIvt"
>
手工分配
</el-button>
<el-button
v-if="this.mstrow.bill_type !== '1011'"
slot="left"
class="filter-item"
type="warning"
:loading="loadingSetAllPoint"
icon="el-icon-check"
size="mini"
@click="allSetPointAllDtl"
>
一键设置
</el-button>
</span>
</div>
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}">
<!--表格渲染-->
<el-table
ref="table"
:data="tableDtl"
style="width: 100%;"
max-height="300"
border
:cell-style="cellStyle"
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@current-change="handleDtlCurrentChange"
>
<el-table-column prop="bill_status" label="状态" align="center" width="110px" :formatter="bill_statusFormat" />
<el-table-column show-overflow-tooltip prop="material_code" label="物料编码" align="center" />
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称" align="center" />
<el-table-column show-overflow-tooltip prop="pcsn" label="批次号" align="center" width="140px" />
<el-table-column show-overflow-tooltip prop="plan_qty" label="重量" :formatter="crud.formatNum3" align="center" />
<el-table-column show-overflow-tooltip prop="assign_qty" label="已分配重量" :formatter="crud.formatNum3" align="center" />
<el-table-column show-overflow-tooltip prop="unassign_qty" label="未分配重量" :formatter="crud.formatNum3" align="center" />
</el-table>
</el-card>
<div class="crud-opts2">
<span class="role-span">分配明细</span>
<div class="crud-opts-form">
<el-form ref="form2" :inline="true" :model="form2" size="mini">
<el-form-item label="待分配" prop="unassign_qty">
<el-input-number
v-model="form2.unassign_qty"
style="width: 100px;"
:controls="false"
:precision="3"
:min="0"
disabled
/>
</el-form-item>
<el-form-item label="已分配" prop="assign_qty">
<el-input-number
v-model="form2.assign_qty"
style="width: 100px;"
:controls="false"
:precision="3"
:min="0"
disabled
/>
</el-form-item>
<el-form-item label="出库点" prop="point_code">
<el-select
v-model="form2.point_code"
clearable
placeholder="请选择"
class="filter-item"
style="width: 150px;"
>
<el-option
v-for="item in pointList"
:key="item.point_code"
:label="item.point_name"
:value="item.point_code"
/>
</el-select>
</el-form-item>
</el-form>
</div>
</div>
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}">
<!--表格渲染-->
<el-table
ref="table2"
:data="tabledis"
style="width: 100%;"
max-height="400"
size="mini"
:row-style="rowStyle"
border
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@current-change="handleDisCurrentChange"
>
<el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column prop="bill_status" label="状态" align="center" width="110px">
<template slot-scope="scope">
<el-select
v-model="scope.row.work_status"
class="filter-item"
:disabled="true"
>
<el-option
v-for="item in dict.work_status"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="material_code" label="物料编码" width="150px" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
<el-table-column prop="material_name" label="物料名称" width="170px" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
<el-table-column prop="storagevehicle_code" label="载具号" width="150px" :min-width="flexWidth('storagevehicle_code',crud.data,'载具号')" />
<el-table-column prop="pcsn" label="批次号" width="150px" :min-width="flexWidth('pcsn',crud.data,'批次号')" />
<el-table-column show-overflow-tooltip prop="plan_qty" label="出库重量" :formatter="crud.formatNum3" align="center" width="120px" :min-width="flexWidth('plan_qty',crud.data,'出库重量')">
<template scope="scope">
<el-input-number v-show="mstrow.bill_type === '1011'" v-model="scope.row.plan_qty" :precision="3" :controls="false" :min="1" style="width: 90px" />
<span v-show="mstrow.bill_type !== '1011'">{{ parseFloat(scope.row.plan_qty).toFixed(3) }}</span>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="struct_code" width="150px" label="仓位编码" align="center" />
<el-table-column show-overflow-tooltip prop="struct_name" width="150px" label="仓位名称" align="center" />
<el-table-column show-overflow-tooltip prop="insert_time" width="150px" label="入库时间" align="center" />
<el-table-column show-overflow-tooltip prop="task_code" width="150px" label="任务号" align="center" />
<el-table-column show-overflow-tooltip prop="point_code" width="150px" label="出库点" align="center" />
<el-table-column align="center" label="操作" width="120" fixed="right">
<template scope="scope">
<el-button :disabled="tabledisabled(scope.row)" type="danger" class="filter-item" size="mini" icon="el-icon-delete" @click.native.prevent="deleteRow(scope.row)" />
</template>
</el-table-column>
</el-table>
</el-card>
<pointDialog ref="child" :dialog-show.sync="pointshow" :dialog-typedisable="typedisable" :dialog-areatype="areatype" @PointChanged="PointChanged" />
<StructIvt :dialog-show.sync="structshow" :stor-id="storId" :open-array="openParam" :rowmst="openRow" @StructIvtClosed="queryTableDtl2" />
</el-dialog>
</template>
<script>
import CRUD, { crud } from '@crud/crud'
import checkoutbill from '@/views/wms/st/outbill/checkoutbill'
import StructIvt from '@/views/wms/st/outbill/StructIvt'
import PointDialog from '@/views/wms/sch/point/PointDialog'
import crudPoint from '@/views/wms/sch/point/schBasePoint'
import crudSectattr from '@/views/wms/basedata/sectattr/sectattr'
import { autoCancel, getOutBillDis } from './checkoutbill'
export default {
name: 'DivDialog',
components: { PointDialog, StructIvt },
mixins: [crud()],
dicts: ['io_bill_status', 'ST_QUALITY_SCODE', 'ST_IVT_LEVEL', 'is_used', 'work_status', 'is_usable', 'IS_OR_NOT'],
props: {
dialogShow: {
type: Boolean,
default: false
},
rowmst: {
type: Object
},
openArray: {
type: Array,
default: () => { return [] }
},
storId: {
type: String,
default: null
}
},
data() {
return {
dialogVisible: false,
loadingAlldiv: false,
loadingAutodiv: false,
loadingSetAllPoint: false,
areatype: '',
typedisable: false,
pointshow: false,
structshow: false,
button1: true,
button2: true,
button3: true,
tableDtl: [],
openParam: [],
mstrow: {},
openRow: {},
tabledis: [],
currentRow: {},
currentDis: {},
checked: false,
form: {
gender2: ''
},
form2: {
unassign_qty: '0',
assign_qty: '0',
point_code: ''
},
sects: [],
pointList: [],
rules: {
},
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
},
openArray: {
handler(newValue, oldValue) {
this.tableDtl = newValue
}
},
rowmst: {
handler(newValue, oldValue) {
this.mstrow = newValue
// this.mstrow.stor_id = ''
}
}
},
methods: {
open() {
crudSectattr.getSect({ 'stor_id': this.storId }).then(res => {
this.sects = res.content
})
const area_type = 'NBJ01'
crudPoint.getPointList({ 'region_code': area_type }).then(res => {
this.pointList = res
})
},
close() {
this.$refs['form2'].resetFields()
this.tabledis = []
this.$emit('DivChanged')
this.$emit('update:dialogShow', false)
},
bill_statusFormat(row, column) {
return this.dict.label.io_bill_status[row.bill_status]
},
PointChanged(row) {
this.form2.point_code = row.point_code
},
openStructIvt() {
this.currentRow.remark = ''
this.currentRow.stor_id = this.storId
this.loadingAlldiv = true
checkoutbill.getStructIvt(this.currentRow).then(res => {
this.openParam = res
this.structshow = true
this.openRow = this.currentRow
this.loadingAlldiv = false
}).catch(() => {
this.loadingAlldiv = false
})
},
sectQueryChange(val) {
if (val.length === 1) {
this.mstrow.stor_id = val[0]
this.mstrow.sect_id = ''
}
if (val.length === 0) {
this.mstrow.sect_id = ''
this.mstrow.stor_id = ''
}
if (val.length === 2) {
this.mstrow.stor_id = val[0]
this.mstrow.sect_id = val[1]
}
},
tabledisabled(row) {
if ((row.work_status === '00' || row.work_status === '01') && row.is_issued === '0') {
return false
} else {
return true
}
},
deleteRow(row) {
checkoutbill.oneCancel(row).then(res => {
this.queryTableDtl()
})
},
handleDtlCurrentChange(current) {
if (current !== null) {
this.currentRow = current
this.form2.unassign_qty = current.unassign_qty
this.form2.assign_qty = current.assign_qty
this.tabledis = []
if (current.bill_status === '10') {
this.button1 = false
this.button2 = true
this.button3 = false
} else if (current.bill_status === '30') {
this.button1 = false
this.button2 = false
this.button3 = false
} else if (current.bill_status === '40') {
this.button1 = true
this.button2 = false
this.button3 = true
}
this.queryTableDdis(current.iostorinvdtl_id)
} else {
this.button1 = true
this.button2 = true
this.button3 = true
this.mstrow.iostorinvdtl_id = ''
this.currentRow = {}
this.tabledis = []
}
},
handleDisCurrentChange(current) {
if (current !== null) {
this.currentDis = current
} else {
this.mstrow.iostorinvdis_id = ''
this.currentDis = {}
}
},
allDiv() {
this.loadingAlldiv = true
checkoutbill.allDiv(this.mstrow).then(res => {
this.crud.notify('分配成功!', CRUD.NOTIFICATION_TYPE.INFO)
this.queryTableDtl()
this.loadingAlldiv = false
}).catch(() => {
this.loadingAlldiv = false
})
},
oneDiv() {
this.loadingAutodiv = true
if (this.currentRow.iostorinvdtl_id !== null) {
this.mstrow.iostorinvdtl_id = this.currentRow.iostorinvdtl_id
checkoutbill.allDivOne(this.mstrow).then(res => {
this.queryTableDtl()
this.loadingAutodiv = false
}).catch(() => {
this.loadingAutodiv = false
})
}
},
allCancel() {
this.loadingAlldiv = true
checkoutbill.allCancel(this.mstrow).then(res => {
this.queryTableDtl()
this.loadingAlldiv = false
}).catch(() => {
this.loadingAlldiv = false
})
},
oneCancel() {
this.loadingAlldiv = true
if (this.currentRow.iostorinvdtl_id !== null) {
checkoutbill.autoCancel(this.currentRow).then(res => {
this.queryTableDtl()
this.loadingAlldiv = false
}).catch(() => {
this.loadingAlldiv = false
})
}
},
allSetPointAllDtl() {
if (this.form2.point_code === '') {
this.crud.notify('请先选择站点!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.loadingSetAllPoint = true
const data = {
'point_code': this.form2.point_code,
'iostorinv_id': this.mstrow.iostorinv_id,
'bill_code': this.mstrow.bill_code,
'checked': this.checked
}
checkoutbill.allSetPoint(data).then(res => {
this.queryTableDdis(this.currentRow.iostorinvdtl_id)
this.crud.notify('设置成功!', CRUD.NOTIFICATION_TYPE.INFO)
this.loadingSetAllPoint = false
}).catch(() => {
this.loadingSetAllPoint = false
})
},
queryTableDtl() {
checkoutbill.getOutBillDtl({ 'iostorinv_id': this.mstrow.iostorinv_id }).then(res => {
this.tableDtl = res
})
},
queryTableDtl2() {
this.queryTableDtl()
},
queryTableDdis(iostorinvdtl_id) {
checkoutbill.getOutBillDis({ 'iostorinvdtl_id': iostorinvdtl_id, 'bill_status': '01' }).then(res => {
this.tabledis = res
}).catch(() => {
this.tabledis = []
})
},
cellStyle({ row, column, rowIndex, columnIndex }) {
const assign_qty = parseFloat(row.assign_qty)
const plan_qty = parseFloat(row.plan_qty)
if (column.property === 'assign_qty') {
if (assign_qty > plan_qty) {
return 'background: yellow'
}
}
},
rowStyle({ row, rowIndex }) {
const stylejson = {}
if (this.rowmst.is_overdue === '1') {
if (row.is_overdue === '1') {
stylejson.background = '#f3f071'
return stylejson
}
}
}
}
}
</script>
<style>
.crud-opts2 {
padding: 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .el-dialog__title2 {
line-height: 24px;
font-size:20px;
color:#303133;
}
.crud-opts2 .role-span {
padding: 10px 0px 10px 0px;
}
.crud-opts2 .crud-opts-form {
padding: 10px 0px 0px 20px;
}
.input-with-select {
background-color: #fff;
}
</style>