<template>
|
<div class="mod-config">
|
<basic-container>
|
<div class="wrap">
|
<div class="lf" ref="letfDom" style="width: 700px;">
|
<ttable
|
:table="table"
|
@handleSelectionChange="handleSelectionChange"
|
@currentChange="handleCurrentChange"
|
:uploadInfo="uploadInfo"
|
:prelang="prelang"
|
:options="options"
|
:ajaxFun="ajaxFun"
|
ref="packagingTable"
|
>
|
<template #toolbar>
|
<el-dropdown
|
@command="auditHandleCommand"
|
v-if="permissions.packaging_audit_btn"
|
>
|
<el-button>
|
审核<i class="el-icon-arrow-down el-icon--right"></i>
|
</el-button>
|
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-item
|
:command="item.command"
|
v-for="item in auditArr"
|
:disabled="item.disabled"
|
>{{ item.label }}</el-dropdown-item
|
>
|
</el-dropdown-menu>
|
</el-dropdown>
|
<el-dropdown
|
@command="printTypeHandleCommand"
|
style="margin-left:10px;"
|
>
|
<el-button>
|
打印<i class="el-icon-arrow-down el-icon--right"></i>
|
</el-button>
|
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-item
|
:command="item.command"
|
v-for="item in printTypeArr"
|
:disabled="item.disabled"
|
>{{ item.label }}</el-dropdown-item
|
>
|
</el-dropdown-menu>
|
</el-dropdown>
|
</template>
|
<template #tableInfo>
|
<div style="margin-bottom:10px;">
|
<div>
|
<div
|
style="display:flex;justify-content:space-around;height: 100px;"
|
>
|
<div class="packaging-info-item" style="width:45%;">
|
<div style="font-size:30px;font-weight:bold;">编号</div>
|
<div>
|
<el-input
|
style="height:50px;"
|
v-model="packagingForm.no"
|
disabled
|
></el-input>
|
</div>
|
</div>
|
<div class="packaging-info-item" style="width:45%;">
|
<div style="font-size:30px;font-weight:bold;">
|
物料编码
|
</div>
|
<div>
|
<el-input
|
style="height:50px;"
|
v-model="packagingForm.cusMaterialCode"
|
disabled
|
></el-input>
|
</div>
|
</div>
|
</div>
|
<div
|
style="display:flex;justify-content:space-around;height: 100px;"
|
>
|
<div class="packaging-info-item" style="width:45%;">
|
<div style="font-size:30px;font-weight:bold;">
|
已扫码数量(根)
|
</div>
|
<div>
|
<el-input
|
style="height:50px;"
|
v-model="packagingForm.number"
|
disabled
|
></el-input>
|
</div>
|
</div>
|
<div class="packaging-info-item" style="width:45%;">
|
<div style="font-size:30px;font-weight:bold;">
|
理论装箱数量(根)
|
</div>
|
<div>
|
<el-input
|
style="height:50px;"
|
v-model="packagingForm.theoreticalNumber"
|
disabled
|
></el-input>
|
</div>
|
</div>
|
</div>
|
<div style="display:flex;justify-content:space-around;">
|
<div class="packaging-info-item" style="width:45%;">
|
<div style="font-size:30px;font-weight:bold;">
|
实际重量(kg)
|
</div>
|
<div>
|
<el-input
|
style="height:50px;"
|
v-model="packagingForm.realWeight"
|
disabled
|
></el-input>
|
</div>
|
</div>
|
<div class="packaging-info-item" style="width:45%;">
|
<div style="font-size:30px;font-weight:bold;">
|
差异重量(kg)
|
</div>
|
<div>
|
<el-input
|
style="height:50px;"
|
v-model="packagingForm.differenceWeight"
|
disabled
|
></el-input>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</template>
|
</ttable>
|
<div class="touch-div" ref="moveDom">
|
<span></span>
|
<span></span>
|
</div>
|
</div>
|
<div class="rt">
|
<ttable
|
:table="joinTable"
|
@handleSelectionChange="joinHandleSelectionChange"
|
:uploadInfo="joinUploadInfo"
|
:prelang="joinPrelang"
|
:options="joinOptions"
|
:ajaxFun="joinAjaxFun"
|
:paramObj="paramObj"
|
ref="joinPackagingTable"
|
>
|
<template #toolbar>
|
<div style="display:flex;">
|
<div>
|
<span>SN码:</span>
|
</div>
|
<div class="l-mes">
|
<el-input
|
v-model="number"
|
ref="seach_input"
|
placeholder="SN码"
|
@keyup.enter.native="getProductOut()"
|
></el-input>
|
</div>
|
<div>
|
<span>至库位:</span>
|
</div>
|
<div class="l-mes">
|
<el-select
|
v-model="locationNo"
|
filterable
|
placeholder="请选择库位"
|
>
|
<el-option
|
v-for="item in moveLocations"
|
:key="item"
|
:label="item"
|
:value="item"
|
>
|
</el-option>
|
</el-select>
|
</div>
|
<div>
|
<el-button
|
type="success"
|
style="padding:9px 5px;border-radius:30%;"
|
@click="updateLocationForPart"
|
>更新库位</el-button
|
>
|
</div>
|
</div>
|
</template>
|
</ttable>
|
</div>
|
</div>
|
<table-form
|
v-if="addOrUpdateVisible"
|
ref="addOrUpdate"
|
@refreshDataList="getData"
|
></table-form>
|
</basic-container>
|
</div>
|
</template>
|
<style>
|
.dividerClass {
|
height: 25em;
|
margin: 0 50%;
|
}
|
.wrap {
|
width: 100%;
|
height: 100%;
|
display: flex;
|
}
|
|
.wrap .lf {
|
height: 100%;
|
border-right: 1px solid rgba(0, 0, 0, 0.08);
|
width: 700px;
|
padding: 0 20px;
|
position: relative;
|
}
|
|
.wrap .lf .touch-div {
|
position: absolute;
|
top: 0;
|
height: 100%;
|
left: 100%;
|
width: 20px;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
cursor: col-resize;
|
}
|
|
.wrap .lf .touch-div span {
|
width: 2px;
|
background: #bbb;
|
margin: 0 2px;
|
height: 15px;
|
}
|
|
.wrap .rt {
|
height: 100%;
|
overflow-y: auto;
|
flex: 1;
|
padding: 20px;
|
}
|
|
.packaging-form-class .el-form-item {
|
margin-bottom: 0px;
|
}
|
|
.packaging-form-class .el-form-item .el-form-item__label {
|
padding: 0px 0px;
|
font-weight: bold;
|
}
|
|
.packaging-form-class .el-form-item .el-input.is-disabled .el-input__inner {
|
color: #606266;
|
}
|
.packaging-info-item .el-input.is-disabled .el-input__inner {
|
color: #606266;
|
height: 50px;
|
font-size: 30px;
|
}
|
.packaging-tip-class {
|
background-color: red;
|
}
|
</style>
|
<script>
|
import {
|
delObj,
|
fetchList,
|
getEnableFinishProdList,
|
getPackJmreportUrl,
|
updateInLocationNoBatch,
|
packCancelConfirm,
|
packConfirm,
|
validateStepFinish,
|
validatePackageCodeSnCustomerOrder
|
} from '@/api/warehouse/packaging'
|
import ttable from '@/views/common/ztt-table.vue'
|
import TableForm from './packaging-form'
|
import { mapGetters } from 'vuex'
|
import { fetchList as getSock, getStockBySn } from '@/api/warehouse/stock'
|
import {
|
addPackagingStock,
|
getPackagingItemPage,
|
getWeight,
|
removePackagingItemById,
|
weighVerifyCheck
|
} from '../../../api/warehouse/packaging'
|
import { remote } from '../../../api/admin/dict'
|
|
export default {
|
data() {
|
return {
|
packagingForm: {
|
no: null,
|
cusMaterialCode: null,
|
packSize: null,
|
packMaterial: null,
|
number: null,
|
netWeight: null,
|
grossWeight: null,
|
realWeight: null,
|
differenceWeight: null,
|
createTime: null,
|
updateTime: null,
|
createUser: null,
|
updateUser: null,
|
theoreticalNumber: null
|
},
|
packParm: {},
|
tabelData: [],
|
auditArr: [
|
{
|
label: '确认',
|
command: 'CONFIRM',
|
disabled: false,
|
permitArr: []
|
},
|
{
|
label: '取消',
|
command: 'CANCEL',
|
disabled: false,
|
permitArr: []
|
}
|
],
|
printTypeArr: [
|
{
|
label: '称重标签',
|
command: 'WEIGHT',
|
disabled: false,
|
permitArr: []
|
},
|
{
|
label: '合格证',
|
command: 'QUALIFIED',
|
disabled: false,
|
permitArr: []
|
}
|
],
|
packagingId: 0,
|
number: null,
|
ajaxFun: fetchList,
|
multipleSelection: [],
|
isShowQuery: false,
|
uploadInfo: {
|
// 是否展示上传EXCEL以及对应的url
|
isShow: false,
|
url: ''
|
},
|
prelang: 'routing',
|
options: {
|
height: 300, // 默认高度-为了表头固定
|
stripe: false, // 是否为斑马纹 table
|
highlightCurrentRow: false, // 是否要高亮当前行
|
border: true, // 是否有纵向边框
|
lazy: false, // 是否需要懒加载
|
fit: true, // 列的宽度是否自撑开
|
multiSelect: false, //
|
seqNo: true,
|
isRefresh: true, // 是否显示刷新按钮
|
isShowHide: true, // 是否显示显影按钮H
|
isSearch: true, // 高级查询按钮
|
defaultOrderBy: { column: 'createTime', direction: 'desc' }
|
},
|
table: {
|
total: 0,
|
currentPage: 1,
|
pageSize: 20,
|
data: [],
|
// 标题
|
column: [
|
{
|
minWidth: '140',
|
prop: 'no',
|
label: '编号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text',
|
render: { fun: this.addOrUpdateHandle }
|
},
|
{
|
minWidth: '120',
|
prop: 'cusMaterialCode',
|
label: '物料编码',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '120',
|
prop: 'packSize',
|
label: '包装尺寸',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
formatter: this.formatPackSizeType,
|
optList: () => {
|
return this.packSizeOptions
|
}
|
},
|
{
|
minWidth: '120',
|
prop: 'packMaterial',
|
label: '包材',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
formatter: this.formatPackMaterialType,
|
optList: () => {
|
return this.packMaterialOptions
|
}
|
},
|
{
|
minWidth: '140',
|
prop: 'number',
|
label: '数量(根)',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
// 工序名称
|
{
|
minWidth: '120',
|
prop: 'netWeight',
|
label: '净重(kg)',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text',
|
noShowTip: false
|
},
|
{
|
minWidth: '120',
|
prop: 'grossWeight',
|
label: '毛重(kg)',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text',
|
noShowTip: false
|
},
|
{
|
width: '100',
|
prop: 'realWeight',
|
label: '实际重量(kg)',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '100',
|
prop: 'differenceWeight',
|
label: '差异重量(kg)',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
// 是否确认
|
{
|
minWidth: '120',
|
prop: 'isConfirm',
|
label: '确认',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
optList: () => {
|
return this.getConfirmOptionList()
|
},
|
formatter: (row, column, cellValue) => {
|
return cellValue == true ? '是' : '否'
|
}
|
},
|
{
|
minWidth: '120',
|
prop: 'createTime',
|
width: '240',
|
label: '创建日期',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'datetimerange'
|
},
|
// 状态
|
{
|
minWidth: '120',
|
width: '240',
|
prop: 'updateTime',
|
label: '更新日期',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'datetimerange'
|
},
|
// 描述
|
{
|
minWidth: '120',
|
prop: 'createUser',
|
label: '创建人',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
// 更新时间
|
{
|
minWidth: '200',
|
prop: 'updateUser',
|
label: '更新人',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
}, // 描述
|
{
|
minWidth: '120',
|
prop: 'theoreticalNumber',
|
label: '理论装箱数量',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
}
|
],
|
toolbar: [
|
{
|
text: '新增',
|
type: 'primary',
|
fun: this.addOrUpdateHandle,
|
disabled: false,
|
permitArr: []
|
},
|
{
|
text: '称重',
|
type: 'primary',
|
fun: this.beginWeight,
|
disabled: false,
|
permitArr: []
|
}
|
// },
|
// {
|
// text: '打印合格证',
|
// fun: this.printQualified,
|
// disabled: false,
|
// permitArr: []
|
// }
|
],
|
operator: [
|
{
|
text: '删除',
|
type: 'text',
|
size: 'small',
|
fun: this.deleteHandle
|
}
|
],
|
operatorConfig: {
|
fixed: 'right',
|
label: '操作',
|
width: 100,
|
minWidth: 100
|
}
|
},
|
addOrUpdateVisible: false,
|
|
paramObj: { packagingId: 0 },
|
joinAjaxFun: getPackagingItemPage,
|
relateVisible: false,
|
joinMultipleSelection: [],
|
joinUploadInfo: {
|
// 是否展示上传EXCEL以及对应的url
|
isShow: false,
|
url: ''
|
},
|
joinPrelang: 'operation',
|
joinOptions: {
|
height: 300, // 默认高度-为了表头固定
|
stripe: true, // 是否为斑马纹 table
|
highlightCurrentRow: false, // 是否要高亮当前行
|
border: true, // 是否有纵向边框
|
lazy: false, // 是否需要懒加载
|
fit: true, // 列的宽度是否自撑开
|
multiSelect: true, //
|
seqNo: true,
|
isRefresh: true, // 是否显示刷新按钮
|
isShowHide: true, // 是否显示显影按钮
|
isSearch: false, // 高级查询按钮
|
defaultOrderBy: { column: 'createTime', direction: 'desc' }
|
},
|
joinTable: {
|
total: 0,
|
currentPage: 1,
|
pageSize: 20,
|
data: [],
|
// 标题
|
column: [
|
{
|
width: '140',
|
prop: 'partNo',
|
label: '零件号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '140',
|
prop: 'outBatchNo',
|
label: 'SN码',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '100',
|
prop: 'partName',
|
label: '零件名称',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '100',
|
prop: 'ifsBatchNo',
|
label: 'ifs批次号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '100',
|
prop: 'packageQty',
|
label: '数量',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '100',
|
prop: 'reelNumber',
|
label: '载具编号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '100',
|
prop: 'locationName',
|
label: '库位',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '100',
|
prop: 'inLocationNo',
|
label: '至库位号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '100',
|
prop: 'inLocationName',
|
label: '至库位',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '120',
|
prop: 'specs',
|
label: '执行标准',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '100',
|
prop: 'createTime',
|
label: '包装时间',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'datetimerange'
|
}
|
],
|
toolbar: [],
|
operator: [
|
{
|
text: '删除',
|
type: 'text',
|
size: 'small',
|
fun: this.joinDeleteHandle
|
}
|
],
|
operatorConfig: {
|
fixed: 'right',
|
label: '操作',
|
width: 60,
|
minWidth: 60
|
}
|
},
|
confirmOptionList: [
|
{
|
value: true,
|
label: '是'
|
},
|
{
|
value: false,
|
label: '否'
|
}
|
],
|
packSizeOptions: [],
|
packMaterialOptions: [],
|
moveLocations: [],
|
locationNo: null
|
}
|
},
|
components: {
|
ttable,
|
TableForm
|
},
|
computed: {
|
...mapGetters(['permissions'])
|
},
|
activated() {
|
this.getData()
|
},
|
created() {
|
this.getPackSizeOptions()
|
this.getPackMaterialOptions()
|
this.getMoveLocations()
|
},
|
mounted() {
|
this.letfDom = this.$refs.letfDom
|
const moveDom = this.$refs.moveDom
|
|
moveDom.onmousedown = (e) => {
|
this.clientStartX = e.clientX
|
e.preventDefault()
|
|
document.onmousemove = (e) => {
|
this.moveHandle(e.clientX, this.letfDom)
|
}
|
|
document.onmouseup = () => {
|
document.onmouseup = null
|
document.onmousemove = null
|
}
|
}
|
},
|
methods: {
|
getMoveLocations() {
|
this.moveLocations = []
|
getEnableFinishProdList().then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.moveLocations = resData.data
|
}
|
})
|
},
|
getPackMaterialOptions() {
|
remote('pack_material').then((response) => {
|
if (response.data.code === 0) {
|
this.packMaterialOptions = response.data.data
|
} else {
|
this.packMaterialOptions = []
|
}
|
})
|
},
|
formatPackMaterialType(row, column, cellValue) {
|
this.packMaterialOptions.forEach((obj) => {
|
if (obj.value === cellValue) {
|
cellValue = obj.label
|
}
|
})
|
return cellValue
|
},
|
getPackSizeOptions() {
|
remote('pack_size').then((response) => {
|
if (response.data.code === 0) {
|
this.packSizeOptions = response.data.data
|
} else {
|
this.packSizeOptions = []
|
}
|
})
|
},
|
formatPackSizeType(row, column, cellValue) {
|
this.packSizeOptions.forEach((obj) => {
|
if (obj.value === cellValue) {
|
cellValue = obj.label
|
}
|
})
|
return cellValue
|
},
|
getConfirmOptionList() {
|
return this.confirmOptionList
|
},
|
moveHandle(nowClientX, letfDom) {
|
const computedX = nowClientX - this.clientStartX
|
const leftBoxWidth = parseInt(letfDom.style.width)
|
let changeWidth = leftBoxWidth + computedX
|
|
if (changeWidth < 600) {
|
changeWidth = 600
|
}
|
|
if (changeWidth > 900) {
|
changeWidth = 900
|
}
|
|
letfDom.style.width = changeWidth + 'px'
|
|
this.clientStartX = nowClientX
|
},
|
getData(selectedId) {
|
if (this.$refs.packagingTable !== undefined) {
|
this.$refs.packagingTable.getDataList(selectedId)
|
this.$nextTick(() => {
|
this.$refs.seach_input.focus()
|
})
|
}
|
},
|
// 新增 / 修改
|
addOrUpdateHandle(row) {
|
this.addOrUpdateVisible = true
|
this.$nextTick(() => {
|
this.$refs.addOrUpdate.init(row == null ? null : row.id)
|
})
|
},
|
// 确认
|
confirmPackaging() {
|
if (JSON.stringify(this.packParm) != '{}') {
|
// TODO
|
} else {
|
this.$message.error('请选择包装')
|
}
|
},
|
// 称重
|
beginWeight() {
|
if (JSON.stringify(this.packParm) != '{}') {
|
weighVerifyCheck(this.packParm).then((response) => {
|
var data = response.data
|
if (data.code == 0) {
|
var isPass = data.data.success
|
var message = data.data.message
|
const messageFormat =
|
'<span style="color:#fff;">' + message + '</span>'
|
if (!isPass) {
|
this.$confirm(messageFormat, '提示', {
|
confirmButtonText: '继续',
|
cancelButtonText: '取消',
|
customClass: 'packaging-tip-class',
|
dangerouslyUseHTMLString: true,
|
type: 'warning'
|
})
|
.then(() => {
|
this.packParm.isRecException = true
|
this.getWeight()
|
})
|
.catch(() => {
|
this.$message({
|
type: 'info',
|
message: '已取消'
|
})
|
})
|
} else {
|
this.packParm.isRecException = false
|
this.getWeight()
|
}
|
}
|
})
|
} else {
|
this.$message.error('请选择包装')
|
}
|
},
|
getWeight() {
|
if (JSON.stringify(this.packParm) != '{}') {
|
getWeight(this.packParm).then((response) => {
|
var data = response.data
|
if (data.code == 0) {
|
var packData = data.data
|
this.$set(this.packParm, 'number', packData.number)
|
this.$set(this.packParm, 'netWeight', packData.netWeight)
|
this.$set(this.packParm, 'grossWeight', packData.grossWeight)
|
this.$set(this.packParm, 'realWeight', packData.realWeight)
|
this.$set(
|
this.packParm,
|
'differenceWeight',
|
packData.differenceWeight
|
)
|
|
this.packagingForm.number = packData.number
|
this.packagingForm.netWeight = packData.netWeight
|
this.packagingForm.grossWeight = packData.grossWeight
|
this.packagingForm.realWeight = packData.realWeight
|
this.packagingForm.differenceWeight = packData.differenceWeight
|
|
this.$message.success('称重更新成功')
|
} else {
|
this.$message.error('称重更新失败')
|
}
|
})
|
} else {
|
this.$message.error('请选择包装')
|
}
|
this.$nextTick(() => {
|
this.$refs.seach_input.focus()
|
})
|
},
|
// 删除
|
deleteHandle(row) {
|
this.$confirm('是否确认删除包装编号:' + row.no + '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
closeOnClickModal: false,
|
type: 'warning'
|
})
|
.then(function() {
|
return delObj(row.id)
|
})
|
.then((response) => {
|
var data = response.data
|
if (data.code == 0) {
|
this.$message.success('删除成功')
|
} else {
|
this.$message.error('删除失败')
|
}
|
this.getData()
|
this.getJoinData()
|
this.packagingForm.number = null
|
this.packagingForm.netWeight = null
|
this.packagingForm.grossWeight = null
|
this.packagingForm.realWeight = null
|
this.packagingForm.differenceWeight = null
|
this.packagingForm.no = null
|
this.packagingForm.cusMaterialCode = null
|
this.packagingForm.theoreticalNumber = null
|
})
|
},
|
handleSelectionChange(val) {
|
// 将选中记录赋值给multipleSelection
|
this.multipleSelection = val
|
},
|
handleCurrentChange(row) {
|
if (row) {
|
this.packParm = row
|
this.packagingId = row.id
|
this.paramObj = { packagingId: row.id }
|
this.$nextTick(() => {
|
this.getJoinData()
|
})
|
this.assignmentData(row)
|
}
|
},
|
// 回显记录行内容
|
assignmentData(row) {
|
this.packagingForm.no = row.no
|
this.packagingForm.cusMaterialCode = row.cusMaterialCode
|
this.packagingForm.packSize = row.packSize
|
this.packagingForm.packMaterial = row.packMaterial
|
this.packagingForm.number = row.number
|
this.packagingForm.netWeight = row.netWeight
|
this.packagingForm.grossWeight = row.grossWeight
|
this.packagingForm.realWeight = row.realWeight
|
this.packagingForm.differenceWeight = row.differenceWeight
|
this.packagingForm.createTime = row.createTime
|
this.packagingForm.updateTime = row.updateTime
|
this.packagingForm.createUser = row.createUser
|
this.packagingForm.updateUser = row.updateUser
|
this.packagingForm.theoreticalNumber = row.theoreticalNumber
|
},
|
// 背景色
|
tableRowClassName(row, callback) {
|
let result = ''
|
if (!row.status) {
|
result = 'danger-row'
|
}
|
callback(result)
|
},
|
joinHandleSelectionChange(val) {
|
this.joinMultipleSelection = val
|
},
|
getJoinData() {
|
if (this.$refs.joinPackagingTable !== undefined) {
|
this.$refs.joinPackagingTable.getDataList()
|
}
|
},
|
joinDeleteHandle(row) {
|
this.$confirm('是否确认删除系统号:' + row.systemNo + '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
closeOnClickModal: false,
|
type: 'warning'
|
})
|
.then(function() {
|
return removePackagingItemById(row.id)
|
})
|
.then((response) => {
|
var data = response.data
|
if (data.code == 0) {
|
var packData = data.data
|
this.$set(this.packParm, 'number', packData.number)
|
this.$set(this.packParm, 'netWeight', packData.netWeight)
|
this.$set(this.packParm, 'grossWeight', packData.grossWeight)
|
this.$set(this.packParm, 'realWeight', packData.realWeight)
|
this.$set(
|
this.packParm,
|
'differenceWeight',
|
packData.differenceWeight
|
)
|
this.packagingForm.number = packData.number
|
this.packagingForm.netWeight = packData.netWeight
|
this.packagingForm.grossWeight = packData.grossWeight
|
this.packagingForm.realWeight = packData.realWeight
|
this.packagingForm.differenceWeight = packData.differenceWeight
|
|
this.$message.success('删除成功')
|
} else {
|
this.$message.error('删除失败')
|
}
|
this.getJoinData()
|
})
|
},
|
getProductOut() {
|
if (this.packagingId > 0) {
|
if (this.number != null) {
|
// 先校验
|
validateStepFinish(this.number.trim()).then((res) => {
|
if (res.data.code === 0) {
|
getStockBySn({
|
partBatchNo: this.number.trim()
|
}).then((res) => {
|
var paramObj = {
|
stockList: res.data.data,
|
id: this.packagingId
|
}
|
// 校验2
|
validatePackageCodeSnCustomerOrder(paramObj).then((res) => {
|
if (res.data.code === 0) {
|
addPackagingStock(paramObj).then((res) => {
|
if (res.data.code === 0) {
|
const data = res.data.data
|
this.$set(this.packParm, 'number', data.number)
|
this.$set(this.packParm, 'netWeight', data.netWeight)
|
this.$set(
|
this.packParm,
|
'grossWeight',
|
data.grossWeight
|
)
|
this.$set(this.packParm, 'realWeight', data.realWeight)
|
this.$set(
|
this.packParm,
|
'differenceWeight',
|
data.differenceWeight
|
)
|
this.packagingForm.number = data.number
|
this.packagingForm.netWeight = data.netWeight
|
this.packagingForm.grossWeight = data.grossWeight
|
this.packagingForm.realWeight = data.realWeight
|
this.packagingForm.differenceWeight =
|
data.differenceWeight
|
this.getJoinData()
|
}
|
})
|
}
|
})
|
})
|
this.number = null
|
}
|
})
|
} else {
|
this.$message.error('SN码不能为空')
|
}
|
} else {
|
this.$message.error('请选择一个箱子')
|
}
|
},
|
initPackagingForm() {
|
this.packagingForm.number = null
|
this.packagingForm.netWeight = null
|
this.packagingForm.grossWeight = null
|
this.packagingForm.realWeight = null
|
this.packagingForm.differenceWeight = null
|
this.packagingForm.no = null
|
this.packagingForm.cusMaterialCode = null
|
this.packagingForm.theoreticalNumber = null
|
},
|
// 审核确认
|
auditHandleCommand(event) {
|
if (JSON.stringify(this.packParm) != '{}') {
|
if (event === 'CONFIRM') {
|
// 确认
|
if (!this.packParm.isConfirm) {
|
packConfirm(this.packParm.id).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.getData()
|
this.initPackagingForm()
|
this.$message.success('确认成功')
|
} else {
|
this.$message.error('确认失败')
|
}
|
})
|
} else {
|
this.$message.error('该包装记录已确认')
|
}
|
} else {
|
// 取消
|
if (this.packParm.isConfirm) {
|
packCancelConfirm(this.packParm.id).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.getData()
|
this.initPackagingForm()
|
this.$message.success('取消成功')
|
} else {
|
this.$message.error('取消失败')
|
}
|
})
|
} else {
|
this.$message.error('该包装记录未确认,不可进行取消操作')
|
}
|
}
|
} else {
|
this.$message.error('请选择包装')
|
}
|
},
|
printTypeHandleCommand(event) {
|
if (JSON.stringify(this.packParm) != '{}') {
|
let reportCode = 0
|
if (event === 'WEIGHT') {
|
reportCode = 2
|
/* const url =
|
'http://10.88.15.197:8005/jmreport/view/691205428065345536?token=null&id=' +
|
this.packParm.id
|
window.open(url) */
|
} else {
|
reportCode = 1
|
/* const url =
|
'http://10.88.15.197:8005/jmreport/view/690054202883842048?token=null&id=' +
|
this.packParm.id
|
window.open(url) */
|
}
|
// 获取积木报表url
|
getPackJmreportUrl(reportCode).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
const url = resData.data + '&id=' + this.packParm.id
|
window.open(url)
|
} else {
|
this.$message.error('获取积木报表url失败')
|
}
|
})
|
} else {
|
this.$message.error('请选择包装')
|
}
|
},
|
updateLocationForPart() {
|
if (this.joinMultipleSelection.length > 0) {
|
if (this.locationNo != null) {
|
const reqParam = []
|
this.joinMultipleSelection.forEach((item) => {
|
reqParam.push({
|
id: item.id,
|
packagingId: this.packParm.id,
|
inLocationNo: this.locationNo
|
})
|
})
|
updateInLocationNoBatch(reqParam).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.$nextTick(() => {
|
this.getJoinData()
|
})
|
this.$message.success('更新库位成功')
|
} else {
|
this.$message.error('更新库位失败')
|
}
|
})
|
} else {
|
this.$message.error('请选择至库位')
|
}
|
} else {
|
this.$message.error('请选择包装明细')
|
}
|
},
|
printQualified() {
|
if (JSON.stringify(this.packParm) != '{}') {
|
const args = encodeURIComponent(
|
JSON.stringify(Object.assign({ packagingId: this.packParm.id }))
|
)
|
const url = '/mes/jasper/print/pdf/2?args=' + args
|
window.open(url)
|
} else {
|
this.$message.error('请选择包装')
|
}
|
}
|
}
|
}
|
</script>
|