diff --git a/src/api/shipment/index.js b/src/api/shipment/index.js index e31417f..a6a54ba 100644 --- a/src/api/shipment/index.js +++ b/src/api/shipment/index.js @@ -3,3 +3,6 @@ import {createAPI} from '../../utils/httpRequest' export const getShipmentList = (data) => createAPI( '/shipment/list','post', data) export const getShipmentPage = (data) => createAPI( `/shipment/list/${data.no}/${data.size}`,'post',data) + + +export const endShipment = (data) => createAPI( `/shipment/end`,'post',data) diff --git a/src/views/modules/finshProduct/outWarehouse.vue b/src/views/modules/finshProduct/outWarehouse.vue index 634ad12..f41add6 100644 --- a/src/views/modules/finshProduct/outWarehouse.vue +++ b/src/views/modules/finshProduct/outWarehouse.vue @@ -316,6 +316,10 @@ export default { }).catch((error)=>{ this.$message.error(error) }) + }, + handleEndShip(){ + this.open = false; + this.getDataList(); } }, watch:{ @@ -444,7 +448,8 @@ export default { diff --git a/src/views/modules/finshProduct/outWarehouse/shipmentBox.vue b/src/views/modules/finshProduct/outWarehouse/shipmentBox.vue index e395adf..c5039d9 100644 --- a/src/views/modules/finshProduct/outWarehouse/shipmentBox.vue +++ b/src/views/modules/finshProduct/outWarehouse/shipmentBox.vue @@ -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 { + {{shipment}} 新增箱子 最终出库 @@ -237,19 +337,24 @@ export default { - + - - - - - + + + + + + + + + + - + - + - 最终出库 + 最终出库