|
|
|
@ -6,6 +6,9 @@ import { |
|
|
|
removeShipmentRollData, |
|
|
|
saveShipmentRollData |
|
|
|
} from '../../../../api/shipment/roll' |
|
|
|
import {getWareHouseList} from '../../../../api/material/poReceive' |
|
|
|
import {getLocationListForSearch} from '../../../../api/base/normalSearch' |
|
|
|
import {endShipment} from '../../../../api/shipment' |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'shipmentBox', |
|
|
|
@ -18,15 +21,30 @@ export default { |
|
|
|
type:Array, |
|
|
|
default:()=>[] |
|
|
|
}, |
|
|
|
shipment:{ |
|
|
|
type:Object, |
|
|
|
default:()=>{} |
|
|
|
} |
|
|
|
}, |
|
|
|
data(){ |
|
|
|
return { |
|
|
|
open:false, |
|
|
|
endOpen:false, |
|
|
|
form:{}, |
|
|
|
endForm:{}, |
|
|
|
endForm:{ |
|
|
|
warehouseId:'', |
|
|
|
locationId:'', |
|
|
|
shipmentDate:'', |
|
|
|
}, |
|
|
|
rollDataList:[], |
|
|
|
endDataList:[], |
|
|
|
warehouseList:[], |
|
|
|
locationList:[], |
|
|
|
rules:{ |
|
|
|
warehouseId:[{required:true,message:'请选择仓库',trigger:'change'}], |
|
|
|
locationId:[{required:true,message:'请选择库位',trigger:'change'}], |
|
|
|
shipmentDate:[{required:true,message:'请选择出库日期',trigger:'change'}], |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
methods:{ |
|
|
|
@ -147,10 +165,19 @@ export default { |
|
|
|
handleEndBox(){ |
|
|
|
this.endForm = { |
|
|
|
warehouseId:'', |
|
|
|
locationId:'', |
|
|
|
shipmentDate:'', |
|
|
|
} |
|
|
|
this.getRecordData(); |
|
|
|
this.getWareHouseList(); |
|
|
|
}, |
|
|
|
getRecordData(){ |
|
|
|
if (this.dataList.length === 0){ |
|
|
|
this.$message.warning('未新增箱子') |
|
|
|
return |
|
|
|
} |
|
|
|
let params = { |
|
|
|
...this.form, |
|
|
|
...this.shipment, |
|
|
|
} |
|
|
|
getShipmentRollAllData(params).then(({data})=>{ |
|
|
|
if (data && data.code === 0){ |
|
|
|
@ -162,6 +189,78 @@ export default { |
|
|
|
}).catch((error)=>{ |
|
|
|
this.$message.error(error) |
|
|
|
}) |
|
|
|
}, |
|
|
|
endShipment(){ |
|
|
|
this.$refs.endForm.validate((valid,obj) => { |
|
|
|
if (valid) { |
|
|
|
let params = { |
|
|
|
...this.endForm, |
|
|
|
site:this.shipment.site, |
|
|
|
shipmentId:this.shipment.shipmentId, |
|
|
|
} |
|
|
|
endShipment(params).then(({data})=>{ |
|
|
|
if (data && data.code === 0){ |
|
|
|
this.endOpen = false; |
|
|
|
this.$emit('end') |
|
|
|
this.$message.success(data.msg) |
|
|
|
}else { |
|
|
|
this.$message.warning(data.msg) |
|
|
|
} |
|
|
|
}).catch((error)=>{ |
|
|
|
this.$message.error(error) |
|
|
|
}) |
|
|
|
}else { |
|
|
|
let i = 0; |
|
|
|
Object.keys(obj).forEach(key => { |
|
|
|
if (i === 0){ |
|
|
|
this.$message.warning(obj[key][0].message) |
|
|
|
return |
|
|
|
} |
|
|
|
i++; |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
getWareHouseList(){ |
|
|
|
let params = { |
|
|
|
site:this.$store.state.user.site |
|
|
|
} |
|
|
|
getWareHouseList(params).then(({data})=>{ |
|
|
|
if (data && data.code === 0){ |
|
|
|
this.warehouseList = data.rows |
|
|
|
if (this.warehouseList.length > 0){ |
|
|
|
this.endForm.warehouseId = this.warehouseList[0].wareHouseId |
|
|
|
} |
|
|
|
}else { |
|
|
|
this.$message.warning(data.msg) |
|
|
|
} |
|
|
|
}).catch((error)=>{ |
|
|
|
this.$message.error(error) |
|
|
|
}) |
|
|
|
}, |
|
|
|
getLocationListForSearch(){ |
|
|
|
let params={ |
|
|
|
site:this.$store.state.user.site, |
|
|
|
warehouseId:this.endForm.warehouseId, |
|
|
|
active:'Y' |
|
|
|
} |
|
|
|
this.locationList = [] |
|
|
|
getLocationListForSearch(params).then(({data})=>{ |
|
|
|
if (data && data.code === 0){ |
|
|
|
this.locationList = data.rows |
|
|
|
}else { |
|
|
|
this.$message.warning(data.msg) |
|
|
|
} |
|
|
|
}).catch((error)=>{ |
|
|
|
this.$message.error(error) |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
watch:{ |
|
|
|
"endForm.warehouseId"(newVal,oldVal){ |
|
|
|
if (newVal && newVal !== oldVal){ |
|
|
|
this.getLocationListForSearch() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -170,6 +269,7 @@ export default { |
|
|
|
|
|
|
|
<template> |
|
|
|
<div> |
|
|
|
{{shipment}} |
|
|
|
<div style="display: flex;justify-content: space-between;"> |
|
|
|
<div><el-button type="primary" @click="handleAddBox">新增箱子</el-button></div> |
|
|
|
<div><el-button type="primary" @click="handleEndBox">最终出库</el-button></div> |
|
|
|
@ -237,19 +337,24 @@ export default { |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<el-dialog title="最终出库" :visible.sync="endOpen" v-drag :close-on-click-modal="false" append-to-body width="800px"> |
|
|
|
<el-form :model="endForm" label-width="100px" label-position="top" > |
|
|
|
<el-form :model="endForm" :rules="rules" ref="endForm" label-width="100px" label-position="top" > |
|
|
|
<el-row :gutter="10"> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-form-item label="仓库"> |
|
|
|
<el-select v-model="endForm.warehouseId" placeholder="请选择仓库"> |
|
|
|
<el-option value="材料" label="材料"></el-option> |
|
|
|
<el-option value="成品" label="成品"></el-option> |
|
|
|
<el-option value="车间" label="车间"></el-option> |
|
|
|
<el-form-item label="仓库" prop="warehouseId" :show-message="false"> |
|
|
|
<el-select v-model="endForm.warehouseId" style="width: 100%;"> |
|
|
|
<el-option :value="i.wareHouseId" :label="i.wareHouseName" v-for="i in warehouseList" :key="i.menuId"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-form-item label="库位" prop="locationId" :show-message="false"> |
|
|
|
<el-select v-model="endForm.locationId" style="width: 100%;"> |
|
|
|
<el-option :value="i.locationId" :label="i.locationName" v-for="i in locationList" :key="i.locationId"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-form-item label="出库日期"> |
|
|
|
<el-form-item label="出库日期" prop="shipmentDate" :show-message="false"> |
|
|
|
<el-date-picker |
|
|
|
style="width: 100%" |
|
|
|
v-model="endForm.shipmentDate" |
|
|
|
@ -259,9 +364,9 @@ export default { |
|
|
|
</el-date-picker> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="4" :offset="12"> |
|
|
|
<el-col :span="4" :offset="8"> |
|
|
|
<el-form-item label=" "> |
|
|
|
<div style="float: right;"><el-button type="primary" >最终出库</el-button></div> |
|
|
|
<div style="float: right;"><el-button type="primary" @click="endShipment">最终出库</el-button></div> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
|