Files
longdianningxing/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue

806 lines
26 KiB
Vue

<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
slot="left"
v-if="this.mstrow.bill_type !== '1011'"
class="filter-item"
:loading="loadingAlldiv"
type="primary"
icon="el-icon-check"
size="mini"
:disabled="button1"
@click="oneDiv()"
>
自动分配
</el-button>
<el-button
slot="left"
v-if="this.mstrow.bill_type !== '1011'"
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
slot="left"
v-if="this.mstrow.bill_type !== '1011'"
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="sap_pcsn" label="sap批次" align="center" />
<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-column prop="quality_scode" label="品质类型" align="center" width="110px" :formatter="quality_scodeFormat" />
<!-- <el-table-column prop="source_bill_type" label="源单类型" align="center" width="130px" :formatter="invtypeFormat" />-->
<el-table-column show-overflow-tooltip prop="vbeln" label="交货单" align="center" />
<el-table-column show-overflow-tooltip prop="source_bill_code" label="源单编号" align="center" />
<el-table-column show-overflow-tooltip prop="width" label="幅宽" align="center" width="100" />
</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" v-if="mstrow.stor_id !== '1582991156504039455'">
<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-item prop="checked">
<el-checkbox v-if="mstrow.stor_id !== '1582991156504039455'" v-model="checked">是否异常出库</el-checkbox>
</el-form-item>
<el-form-item label="超期发货:" prop="is_overdue">
<el-radio v-model="rowmst.is_overdue" label="1" :disabled="rowmst.bill_status === '40'" @change="updataIsOverdue">不发超期</el-radio>
<el-radio v-model="rowmst.is_overdue" label="0" :disabled="rowmst.bill_status === '40'" @change="updataIsOverdue">发超期</el-radio>
</el-form-item>
<!--<el-form-item label="超期数量:" prop="assign_qty" v-if="rowmst.is_overdue === '1'">
<el-input-number
v-model="overdue_qyt"
style="width: 100px;"
:controls="false"
:precision="3"
:min="0"
disabled
/>
</el-form-item>-->
</el-form>
</div>
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<!-- <el-button
slot="left"
class="filter-item"
type="warning"
icon="el-icon-check"
size="mini"
:disabled="button4"
@click="setPoint()"
>
设置站点
</el-button>-->
<el-button
slot="left"
v-if="this.mstrow.bill_type !== '1011'"
class="filter-item"
:loading="loadingSetPoint"
type="warning"
icon="el-icon-check"
size="mini"
v-if="mstrow.stor_id !== '1582991156504039455'"
:disabled="button4"
@click="oneSetPoint2"
>
设置站点
</el-button>
<el-button
slot="left"
v-if="this.mstrow.bill_type !== '1011'"
class="filter-item"
:loading="loadingSetAllPoint"
type="warning"
icon="el-icon-check"
:disabled="button5"
v-if="mstrow.stor_id !== '1582991156504039455'"
size="mini"
@click="allSetPoint"
>
一键设置
</el-button>
<el-button
slot="left"
v-if="this.mstrow.bill_type === '1011'"
class="filter-item"
:loading="loadingSetAllPoint"
type="warning"
icon="el-icon-check"
:disabled="button5"
size="mini"
@click="saveUpdate"
>
保存修改
</el-button>
</span>
</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="box_no" label="木箱号" width="250px" :min-width="flexWidth('box_no',crud.data,'木箱号')" />
<el-table-column prop="pcsn" label="子卷批次号" width="150px" :min-width="flexWidth('pcsn',crud.data,'子卷批次号')" />
<el-table-column prop="sap_pcsn" label="sap批次号" width="150px" :min-width="flexWidth('sap_pcsn',crud.data,'sap批次号')" />
<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="is_overdue" width="150px" label="是否超期" align="center" :formatter="formatOverdue" />
<el-table-column show-overflow-tooltip prop="instorage_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/pub/PointDialog'
import crudPoint from '@/views/wms/sch/point/point'
import crudUserStor from '@/views/wms/basedata/st/userStor/userStor'
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,
loadingSetPoint: false,
loadingSetAllPoint: false,
areatype: '',
typedisable: false,
pointshow: false,
structshow: false,
button1: true,
button2: true,
button3: true,
button4: true,
button5: true,
tableDtl: [],
openParam: [],
mstrow: {},
openRow: {},
tabledis: [],
currentRow: {},
currentDis: {},
checked: false,
form: {
gender2: ''
},
form2: {
unassign_qty: '0',
assign_qty: '0',
point_code: ''
},
sects: [],
invtypelist: [],
pointList: [],
rules: {
},
overdue_qyt: 0
}
},
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() {
crudUserStor.getSect({ 'stor_id': this.storId }).then(res => {
this.sects = res.content
})
var area_type = '1585167595403874304'
if (this.storId.toString() === '1582991156504039455') {
area_type = '1791031105286180864'
}
crudPoint.getPoint({ 'area_type': area_type }).then(res => {
this.pointList = res
})
checkoutbill.getInvTypes().then(res => {
this.invtypelist = 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]
},
quality_scodeFormat(row, column) {
return this.dict.label.ST_QUALITY_SCODE[row.quality_scode]
},
ivt_levelFormat(row, column) {
return this.dict.label.ST_IVT_LEVEL[row.ivt_level]
},
formatOverdue(row, column) {
return this.dict.label.IS_OR_NOT[row.is_overdue]
},
is_activeFormat(row, column) {
return this.dict.label.is_usable[row.is_active]
},
invtypeFormat(row, column) {
for (const item of this.invtypelist) {
if (item.code === row.source_bill_type) {
return item.name
}
}
},
openPoint() {
if (this.mstrow.bill_type === '010101') {
this.areatype = "'31'"
} else if (this.mstrow.bill_type === '010201' || this.mstrow.bill_type === '010202' || this.mstrow.bill_type === '010401') {
this.areatype = "'21'"
} else if (this.mstrow.bill_type === '010503' || this.mstrow.bill_type === '010501') {
this.areatype = "'22','23','24'"
} else if (this.mstrow.bill_type === '010502') {
this.areatype = "'21','22','23','24'"
} else if (this.mstrow.bill_type === '010801') {
this.areatype = "'22','23','24','31','35'"
} else if (this.mstrow.bill_type === '010601') {
this.areatype = ''
}
this.pointshow = true
this.$refs.child.getMsg(this.areatype)
},
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.openRow.stor_id = this.rowmst.stor_id
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) {
row.stor_id = this.mstrow.stor_id
row.cancel_type = '3'
checkoutbill.oneCancel(row).then(res => {
this.queryTableDtl()
this.updataIsOverdue()
})
},
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.button5 = false
this.button3 = false
} else if (current.bill_status === '30') {
this.button1 = false
this.button2 = false
this.button3 = false
this.button5 = false
} else if (current.bill_status === '40') {
this.button1 = true
this.button2 = false
this.button3 = true
this.button5 = false
}
this.queryTableDdis(current.iostorinvdtl_id)
} else {
this.button1 = true
this.button2 = true
this.button3 = true
this.button5 = true
this.mstrow.iostorinvdtl_id = ''
this.currentRow = {}
this.tabledis = []
}
},
handleDisCurrentChange(current) {
if (current !== null) {
this.currentDis = current
if (current.work_status === '01' || current.work_status === '00') {
this.button4 = false
} else {
this.button4 = true
}
} else {
this.button4 = true
this.mstrow.iostorinvdis_id = ''
this.currentDis = {}
}
},
allDiv() {
// if (!this.mstrow.sect_id) {
// this.crud.notify('请先选择库区!', CRUD.NOTIFICATION_TYPE.INFO)
// return
// }
this.loadingAlldiv = true
this.mstrow.div_type = '1'
checkoutbill.allDiv(this.mstrow).then(res => {
this.crud.notify('分配成功!', CRUD.NOTIFICATION_TYPE.INFO)
this.queryTableDtl()
this.updataIsOverdue()
this.loadingAlldiv = false
}).catch(() => {
this.loadingAlldiv = false
})
},
oneDiv() {
// if (!this.mstrow.sect_id) {
// this.crud.notify('请先选择库区!', CRUD.NOTIFICATION_TYPE.INFO)
// return
// }
this.loadingAutodiv = true
if (this.currentRow.iostorinvdtl_id !== null) {
this.currentRow.div_type = '2'
this.currentRow.stor_id = this.rowmst.stor_id
checkoutbill.allDivOne(this.currentRow).then(res => {
this.queryTableDtl()
this.updataIsOverdue()
this.loadingAutodiv = false
}).catch(() => {
this.loadingAutodiv = false
})
}
},
allCancel() {
this.loadingAlldiv = true
this.mstrow.cancel_type = '1'
checkoutbill.allCancel(this.mstrow).then(res => {
this.queryTableDtl()
this.updataIsOverdue()
this.loadingAlldiv = false
}).catch(() => {
this.loadingAlldiv = false
})
},
oneCancel() {
this.loadingAlldiv = true
this.currentRow.stor_id = this.mstrow.stor_id
this.currentRow.cancel_type = '2'
if (this.currentRow.iostorinvdtl_id !== null) {
checkoutbill.allCancel(this.currentRow).then(res => {
this.queryTableDtl()
this.loadingAlldiv = false
this.updataIsOverdue()
}).catch(() => {
this.loadingAlldiv = false
})
}
},
setPoint() {
if (this.form2.point_code === '') {
this.crud.notify('请先选择站点!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
if (this.currentDis.point_code) {
this.crud.notify('站点已设置!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
if (this.currentDis.work_status !== '00') {
this.crud.notify('任务已生成!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
if (this.currentDis.iostorinvdis_id !== null) {
this.currentDis.point_code = this.form2.point_code
checkoutbill.setPoint(this.currentDis).then(res => {
this.queryTableDdis(this.currentDis.iostorinvdtl_id)
})
}
},
oneSetPoint2() {
if (this.form2.point_code === '') {
this.crud.notify('请先选择站点!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
if (this.currentDis.point_code) {
this.crud.notify('站点已设置!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
if (this.currentDis.work_status !== '00') {
this.crud.notify('任务已生成!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.loadingSetPoint = true
if (this.currentDis.iostorinvdis_id !== null) {
this.currentDis.point_code = this.form2.point_code
this.currentDis.checked = this.checked
checkoutbill.oneSetPoint2(this.currentDis).then(res => {
this.queryTableDdis(this.currentDis.iostorinvdtl_id)
this.crud.notify('设置成功!', CRUD.NOTIFICATION_TYPE.INFO)
this.loadingSetPoint = false
}).catch(() => {
this.currentDis.point_code = ''
this.loadingSetPoint = false
})
}
},
allSetPoint() {
if (this.mstrow.stor_id !== '1582991156504039455') {
if (this.form2.point_code === '') {
this.crud.notify('请先选择站点!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
}
if (this.currentRow === '') {
this.crud.notify('请选择明细!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.loadingSetAllPoint = true
this.currentRow.point_code = this.form2.point_code
this.currentRow.checked = this.checked
this.currentRow.stor_id = this.mstrow.stor_id
checkoutbill.allSetPoint(this.currentRow).then(res => {
this.queryTableDdis(this.currentRow.iostorinvdtl_id)
this.crud.notify('设置成功!', CRUD.NOTIFICATION_TYPE.INFO)
this.loadingSetAllPoint = false
}).catch(() => {
this.loadingSetAllPoint = false
})
},
saveUpdate() {
if (this.tabledis.length === 0) {
this.crud.notify('分配明细为空!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.loadingSetAllPoint = true
const data = {
'dtl': this.currentRow,
'tabledis': this.tabledis
}
checkoutbill.saveUpdate(data).then(res => {
this.queryTableDtl()
this.queryTableDdis(this.currentRow.iostorinvdtl_id)
this.crud.notify('保存成功!', CRUD.NOTIFICATION_TYPE.INFO)
this.loadingSetAllPoint = false
}).catch(() => {
this.loadingSetAllPoint = false
})
},
allSetPointAllDtl() {
if (this.mstrow.stor_id !== '1582991156504039455') {
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,
'stor_id': this.mstrow.stor_id
}
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()
this.updataIsOverdue()
},
queryTableDdis(iostorinvdtl_id) {
checkoutbill.getOutBillDis2({ '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
}
}
},
updataIsOverdue() {
this.rowmst.iostorinvdtl_id = this.currentRow.iostorinvdtl_id
checkoutbill.updataIsOverdue(this.rowmst).then(res => {
this.overdue_qyt = res.overdue_qyt
this.rowmst = res.mst
})
}
}
}
</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>