parent
6bd98380b0
commit
1c7a946b4f
5 changed files with 1365 additions and 1 deletions
@ -0,0 +1,77 @@ |
||||
// 玻璃饼出库
|
||||
import request from '@/axios'; |
||||
|
||||
// 列表
|
||||
export const getList = params => |
||||
request({ |
||||
url: '/api/blade-wms/stGraphiteMoldOut/page', |
||||
method: 'get', |
||||
params |
||||
}) |
||||
|
||||
// 根据物料编码选择仓库
|
||||
export const getWarehouseList = params => |
||||
request({ |
||||
url: '/api/blade-wms/stRealtimeStock/findStorehouseByGoodsCode', |
||||
method: 'get', |
||||
params |
||||
})
|
||||
|
||||
// 查询物料信息
|
||||
export const getGoodsList = params => |
||||
request({ |
||||
url: '/api/blade-wms/combox/config/goodsAll', |
||||
method: 'get', |
||||
params |
||||
}) |
||||
|
||||
// // 根据库房ID和物料编号查找库位号
|
||||
export const getLocationData = params => {
|
||||
return request({ |
||||
url: '/api/blade-wms/stOtherOutRecord/queryByGoodsIdShId', |
||||
method: 'get', |
||||
params |
||||
}); |
||||
}; |
||||
|
||||
// 扫码出库
|
||||
export const scanIssue = params => |
||||
request({ |
||||
url: '/api/blade-wms/stGraphiteMoldOut/scanCard', |
||||
method: 'get', |
||||
params |
||||
}) |
||||
|
||||
// 报废出库
|
||||
export const scrapOut = params => {
|
||||
return request({ |
||||
url: '/api/blade-wms/stExpireRecord/invalidatedOut', |
||||
method: 'post', |
||||
params |
||||
}); |
||||
}; |
||||
|
||||
|
||||
// 批量出库
|
||||
export const batchIssue = data => |
||||
request({ |
||||
url: '/api/blade-wms/stGraphiteMoldOut/batchSubmitOutStock ', |
||||
method: 'post', |
||||
data |
||||
}); |
||||
|
||||
// 修改
|
||||
export const editIssue = data => |
||||
request({ |
||||
url: '/api/blade-wms/stGraphiteMoldOut/update', |
||||
method: 'post', |
||||
data |
||||
}); |
||||
|
||||
// 删除
|
||||
export const delIssue = params => |
||||
request({ |
||||
url: '/api/blade-wms/stGraphiteMoldOut/remove ', |
||||
method: 'post', |
||||
params |
||||
}); |
||||
@ -0,0 +1,304 @@ |
||||
<template> |
||||
<el-dialog title="修改" append-to-body :modelValue="openShow" width="90%" @close="closeDialog" fullscreen> |
||||
<!-- <el-form :inline="true" :model="formInline" class="demo-form-inline"> |
||||
<el-form-item label="车间订单号"> |
||||
<el-input v-model="formInline.orderId" placeholder="请输入"></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="新增出库数量"> |
||||
<el-input v-model="formInline.number2" placeholder="请输入"></el-input> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" @click="addOutFn()">新增出库</el-button> |
||||
<el-button type="danger" @click="delFn">删除</el-button> |
||||
</el-form-item> |
||||
</el-form> --> |
||||
<avue-crud :option="option" :table-loading="loading" :data="data" v-model="form" v-model:page="page" ref="crud" |
||||
@search-change="searchChange" @search-reset="searchReset" :before-open="beforeOpen" |
||||
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" |
||||
@refresh-change="refreshChange" @row-save="rowSave"> |
||||
<template #goodsCode="scope"> |
||||
<el-select v-model="scope.row.goodsCode" @change="val => changeGoodsCode(val,scope.index)" filterable |
||||
clearable> |
||||
<el-option v-for="item in goodsList" :key="item.id" :label="item.goodsCode" :value="item.goodsCode"></el-option> |
||||
</el-select> |
||||
</template> |
||||
<template #shId="scope"> |
||||
<el-select v-model="scope.row.shId" @change="(val) => changeWare(val,scope.index)" filterable |
||||
clearable> |
||||
<el-option v-for="item in wareList" :key="item.id" :label="item.shName" :value="item.id"></el-option> |
||||
</el-select> |
||||
</template> |
||||
<template #slId="scope"> |
||||
<el-select v-model="scope.row.slId" filterable |
||||
clearable> |
||||
<el-option v-for="item in scope.row.locationList" :key="item.slId" :label="item.location" :value="item.slId"></el-option> |
||||
</el-select> |
||||
</template> |
||||
<template #outQty="scope"> |
||||
<el-input-number v-model="scope.row.outQty" :min="1" style="width:90%;" controls-position="right"></el-input-number> |
||||
</template> |
||||
</avue-crud> |
||||
|
||||
<template #footer> |
||||
<span class="dialog-footer"> |
||||
<el-button @click="closeDialog">取 消</el-button> |
||||
<el-button type="primary" @click="submit">确 定</el-button> |
||||
</span> |
||||
</template> |
||||
</el-dialog> |
||||
</template> |
||||
<script> |
||||
import {getWarehouseList,getGoodsList,getLocationData,editIssue} from "@/api/storeManagement/glassCakeOutbound" |
||||
export default { |
||||
props: { |
||||
showDialog: { |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
editRow:{ |
||||
type: Object, |
||||
default: {} |
||||
} |
||||
}, |
||||
data() { |
||||
return { |
||||
openShow: false, |
||||
formInline: { |
||||
orderId: '', |
||||
number2: '' |
||||
}, |
||||
goodsList:[], |
||||
option: { |
||||
columnSort: true, |
||||
tip: false, |
||||
align: 'center', |
||||
calcHeight: 32, |
||||
simplePage: false, |
||||
page: false, |
||||
searchShow: true, |
||||
searchMenuSpan: 6, |
||||
searchIcon: true, |
||||
searchIndex: 3, |
||||
tree: false, |
||||
border: true, |
||||
index: false, |
||||
selection: false, |
||||
viewBtn: false, |
||||
delBtn: false, |
||||
editBtn: false, |
||||
editBtnText: '修改', |
||||
editBtnIcon: ' ', |
||||
delBtnIcon: ' ', |
||||
addBtn: false, |
||||
labelWidth: 140, |
||||
searchLabelWidth: 120, |
||||
menu: false, |
||||
menuWidth: 200, |
||||
dialogWidth: 1200, |
||||
dialogClickModal: false, |
||||
searchEnter: true, |
||||
excelBtn: true, |
||||
gridBtn: false, |
||||
searchShowBtn: false, |
||||
showOverflowTooltip: true, |
||||
header: false, |
||||
searchLabelPosition: 'left', |
||||
searchLabelPosition: 'left', |
||||
searchGutter: 24, |
||||
searchSpan: 6, |
||||
menuAlign: 'left', |
||||
gridBtn: false, |
||||
searchMenuPosition: 'right', |
||||
addBtnIcon: ' ', |
||||
viewBtnIcon: ' ', |
||||
delBtnIcon: ' ', |
||||
editBtnIcon: ' ', |
||||
|
||||
column: [ |
||||
{ |
||||
label: '生产单号', |
||||
prop: 'yoCode', |
||||
width: 150, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: '零件号', |
||||
prop: 'partCode', |
||||
width: 150, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: '零件名称', |
||||
prop: 'partName', |
||||
width: 150, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: "流程卡号", |
||||
prop: "cardNo", |
||||
width: 120, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: "生产数量", |
||||
prop: "quantity", |
||||
search: false, |
||||
width: 120, |
||||
}, |
||||
{ |
||||
label: '物料编码', |
||||
prop: 'goodsCode', |
||||
search: false, |
||||
width:180, |
||||
}, |
||||
{ |
||||
label: '物料名称', |
||||
width:150, |
||||
prop: 'goodsName', |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: '库房', |
||||
prop: 'shId', |
||||
width:150, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: '库位', |
||||
prop: 'slId', |
||||
width:150, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: '是否印字', |
||||
prop: 'printMark', |
||||
type: 'select', |
||||
width: 120, |
||||
search: false, |
||||
dicData:[ |
||||
{label:"是",value:true}, |
||||
{label:"否",value:false}, |
||||
] |
||||
}, |
||||
{ |
||||
label: '粉重', |
||||
prop: 'powderWeight', |
||||
width: 120, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: "材料号", |
||||
prop: "materialNo", |
||||
search: false, |
||||
width: 120, |
||||
}, |
||||
{ |
||||
label: '成型厚度', |
||||
prop: 'thickness', |
||||
width: 120, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: "炉批号", |
||||
prop: "stovePiNo", |
||||
search: false, |
||||
width: 120, |
||||
}, |
||||
{ |
||||
label:"出库数量", |
||||
prop: "outQty", |
||||
width:150, |
||||
} |
||||
] |
||||
}, |
||||
data: [], |
||||
wareList:[] |
||||
} |
||||
}, |
||||
mounted() { |
||||
this.openShow = this.showDialog |
||||
console.log('editRow===========',this.editRow) |
||||
this.data = [{...this.editRow}] |
||||
this.getGoods() |
||||
this.getWare() |
||||
}, |
||||
methods: { |
||||
getGoods(){ |
||||
getGoodsList().then(res =>{ |
||||
this.goodsList = res.data.data.records |
||||
}) |
||||
}, |
||||
getWare(val){ |
||||
getWarehouseList({ |
||||
goodsCode:val ? val : this.editRow.goodsCode |
||||
}).then(res =>{ |
||||
this.wareList = res.data.data |
||||
|
||||
getLocationData({ |
||||
goodsId:this.data[0].goodsId, |
||||
shId:this.data[0].shId |
||||
}).then(res =>{ |
||||
this.data[0].locationList = res.data.data.records |
||||
}) |
||||
}) |
||||
}, |
||||
|
||||
// 修改物料 |
||||
changeGoodsCode(val,index) { |
||||
let tmp = this.goodsList.find(item => item.goodsCode == val) |
||||
this.data[index].goodsName = tmp.goodsName |
||||
this.data[index].goodsId = tmp.id |
||||
this.data[index].shId = '' |
||||
this.data[index].slId = "" |
||||
this.getWare(val) |
||||
}, |
||||
// 修改仓库 |
||||
changeWare(val,index){ |
||||
this.getLocation(index) |
||||
}, |
||||
getLocation(index){ |
||||
getLocationData({ |
||||
goodsId:this.data[index].goodsId, |
||||
shId:this.data[index].shId |
||||
}).then(res => { |
||||
console.log('res--------',res) |
||||
this.data[index].locationList = res.data.data.records |
||||
// this.locationList = res.data.data |
||||
}) |
||||
}, |
||||
addOutFn() { |
||||
this.data.push({ |
||||
brCode: 'aaaa', |
||||
woCode: 'WO-090899899', |
||||
partCode: 'E6-78787-E1', |
||||
partName: '零件一', |
||||
batchNo: '9098900', |
||||
okNum: '88', |
||||
c_materiel_id: '89', |
||||
partNames: '8989', |
||||
xuqiushuliang: 99, |
||||
chukushuliang: 67, |
||||
goodbatchNo: '898989', |
||||
bsStoreRoomSet: '仓库一', |
||||
goodsKuwei: '库位一', |
||||
status: 1, |
||||
times: '2025-09-08' |
||||
}) |
||||
}, |
||||
closeDialog(val) { |
||||
this.openShow = false |
||||
this.$emit('closeDialog',val); |
||||
}, |
||||
submit(){ |
||||
editIssue(this.data[0]).then(res =>{ |
||||
// console.log() |
||||
if(res.data.code === 200){ |
||||
this.$message.success('修改成功') |
||||
this.closeDialog(true) |
||||
} |
||||
}) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
<style lang="scss" scoped></style> |
||||
@ -0,0 +1,524 @@ |
||||
<template> |
||||
<el-dialog |
||||
:title="rowItem.isBatch ? '批量出库' : '出库'" |
||||
append-to-body |
||||
:modelValue="openShow" |
||||
width="90%" |
||||
@close="closeDialog" |
||||
fullscreen |
||||
> |
||||
<div style="height: 50px"> |
||||
<el-input |
||||
v-model="formInline.orderId" |
||||
placeholder="请扫描流程卡号" |
||||
@keyup.enter.native="changeCode" |
||||
style="width: 200px; float: left" |
||||
></el-input> |
||||
<el-button type="danger" @click="delFn" style="float: right">删除</el-button> |
||||
</div> |
||||
|
||||
<avue-crud |
||||
:option="option" |
||||
:table-loading="loading" |
||||
:data="data" |
||||
v-model="form" |
||||
v-model:page="page" |
||||
ref="crud" |
||||
@search-change="searchChange" |
||||
@search-reset="searchReset" |
||||
:before-open="beforeOpen" |
||||
@selection-change="selectionChange" |
||||
@current-change="currentChange" |
||||
@size-change="sizeChange" |
||||
@refresh-change="refreshChange" |
||||
@on-load="onLoad" |
||||
@row-save="rowSave" |
||||
@cell-click="cellClick" |
||||
> |
||||
<template #goodsCode="scope"> |
||||
<el-select v-model="scope.row.goodsCode" filterable |
||||
clearable @change="val => changeGoods(val, scope.index)"> |
||||
<el-option |
||||
v-for="item in goodsList" |
||||
:key="item.id" |
||||
:label="item.goodsCode" |
||||
:value="item.goodsCode" |
||||
></el-option> |
||||
</el-select> |
||||
</template> |
||||
<template #shId="scope"> |
||||
<el-select v-model="scope.row.shId" @change="val => changeWare(val, scope.index)" filterable |
||||
clearable> |
||||
<el-option |
||||
v-for="item in scope.row.shList" |
||||
:key="item.id" |
||||
:label="item.shName" |
||||
:value="item.id" |
||||
></el-option> |
||||
</el-select> |
||||
</template> |
||||
<template #slId="scope"> |
||||
<el-select v-model="scope.row.slId" @change="val => changeLocation(val, scope.index)" filterable |
||||
clearable> |
||||
<el-option |
||||
v-for="item in scope.row.slList" |
||||
:key="item.id" |
||||
:label="item.location" |
||||
:value="item.slId" |
||||
></el-option> |
||||
</el-select> |
||||
</template> |
||||
<template #piNo="scope"> |
||||
<el-select v-model="scope.row.piNo" @change="val => changePiNo(val, scope.index)" filterable |
||||
clearable> |
||||
<el-option |
||||
v-for="item in scope.row.piNoList" |
||||
:key="item.id" |
||||
:label="item.piNo" |
||||
:value="item.piNo" |
||||
></el-option> |
||||
</el-select> |
||||
</template> |
||||
<template #outQty="scope"> |
||||
<el-input-number |
||||
v-model="scope.row.outQty" |
||||
:min="1" |
||||
:max="scope.row.stockQty" |
||||
style="width: 90%" |
||||
controls-position="right" |
||||
></el-input-number> |
||||
</template> |
||||
</avue-crud> |
||||
|
||||
<template #footer> |
||||
<span class="dialog-footer"> |
||||
<el-button @click="closeDialog">取 消</el-button> |
||||
<el-button type="primary" @click="submit">确 定</el-button> |
||||
</span> |
||||
</template> |
||||
</el-dialog> |
||||
</template> |
||||
<script> |
||||
import { |
||||
getGoodsList, |
||||
getWarehouseList, |
||||
getLocationData, |
||||
scanIssue, |
||||
batchIssue, |
||||
} from '@/api/storeManagement/graphiteMoldOutbound.js'; |
||||
export default { |
||||
props: { |
||||
showDialog: { |
||||
type: Boolean, |
||||
default: false, |
||||
}, |
||||
rowItem: { |
||||
type: Object, |
||||
default: () => ({}), |
||||
}, |
||||
}, |
||||
data() { |
||||
return { |
||||
openShow: false, |
||||
formInline: { |
||||
orderId: '', |
||||
number2: '', |
||||
}, |
||||
goodsList: [], |
||||
option: { |
||||
columnSort: true, |
||||
tip: false, |
||||
height:window.innerHeight - 200, |
||||
align: 'center', |
||||
calcHeight: 32, |
||||
simplePage: false, |
||||
page: false, |
||||
searchShow: true, |
||||
searchMenuSpan: 6, |
||||
searchIcon: true, |
||||
searchIndex: 3, |
||||
tree: false, |
||||
border: true, |
||||
index: false, |
||||
selection: true, |
||||
viewBtn: false, |
||||
delBtn: false, |
||||
editBtn: true, |
||||
cellEdit: true, |
||||
menu: true, |
||||
editBtnText: '修改', |
||||
editBtnIcon: ' ', |
||||
delBtnIcon: ' ', |
||||
addBtn: false, |
||||
labelWidth: 140, |
||||
searchLabelWidth: 120, |
||||
menu: false, |
||||
menuWidth: 200, |
||||
dialogWidth: 1200, |
||||
dialogClickModal: false, |
||||
searchEnter: true, |
||||
excelBtn: true, |
||||
gridBtn: false, |
||||
searchShowBtn: false, |
||||
showOverflowTooltip: true, |
||||
header: false, |
||||
searchLabelPosition: 'left', |
||||
searchGutter: 24, |
||||
searchSpan: 6, |
||||
menuAlign: 'left', |
||||
gridBtn: false, |
||||
searchMenuPosition: 'right', |
||||
addBtnIcon: ' ', |
||||
viewBtnIcon: ' ', |
||||
delBtnIcon: ' ', |
||||
editBtnIcon: ' ', |
||||
|
||||
column: [ |
||||
{ |
||||
label: '生产单号', |
||||
prop: 'yoCode', |
||||
width: 150, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: '零件号', |
||||
prop: 'partCode', |
||||
width: 150, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: '零件名称', |
||||
prop: 'partName', |
||||
width: 150, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: '流程卡号', |
||||
prop: 'cardNo', |
||||
width: 150, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: '生产数量', |
||||
prop: 'quantity', |
||||
search: false, |
||||
width: 120, |
||||
}, |
||||
{ |
||||
label: '物料号', |
||||
prop: 'goodsCode', |
||||
search: false, |
||||
width: 200, |
||||
}, |
||||
{ |
||||
label: '物料名称', |
||||
width: 150, |
||||
prop: 'goodsName', |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: '库房', |
||||
prop: 'shId', |
||||
width: 150, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: '库位', |
||||
prop: 'slId', |
||||
width: 150, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: '批次号', |
||||
prop: 'piNo', |
||||
width: 150, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: '是否印字', |
||||
prop: 'printMark', |
||||
width: 120, |
||||
search: false, |
||||
type: 'select', |
||||
dicData: [ |
||||
{ label: '是', value: true }, |
||||
{ label: '否', value: false }, |
||||
], |
||||
}, |
||||
{ |
||||
label: '粉重', |
||||
prop: 'powderWeight', |
||||
width: 120, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: '材料号', |
||||
prop: 'materialNo', |
||||
search: false, |
||||
width: 120, |
||||
}, |
||||
{ |
||||
label: '成型厚度', |
||||
prop: 'thickness', |
||||
width: 120, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: '炉批号', |
||||
prop: 'stovePiNo', |
||||
search: false, |
||||
width: 120, |
||||
}, |
||||
// { |
||||
// label:"已出库数量", |
||||
// prop: "outQuantity", |
||||
// width:150, |
||||
// }, |
||||
{ |
||||
label: '库存数量', |
||||
prop: 'stockQty', |
||||
width: 120, |
||||
}, |
||||
{ |
||||
label: '出库数量', |
||||
prop: 'outQty', |
||||
width: 150, |
||||
}, |
||||
], |
||||
}, |
||||
data: [], |
||||
selectionList: [], |
||||
}; |
||||
}, |
||||
mounted() { |
||||
this.openShow = this.showDialog; |
||||
this.getGoods(); |
||||
this.onLoad(); |
||||
}, |
||||
watch: { |
||||
showDialog(newVal) { |
||||
this.openShow = newVal; |
||||
if (newVal) { |
||||
this.onLoad(); |
||||
} |
||||
}, |
||||
rowItem: { |
||||
handler() { |
||||
if (this.openShow) { |
||||
this.onLoad(); |
||||
} |
||||
}, |
||||
deep: true, |
||||
}, |
||||
}, |
||||
methods: { |
||||
getGoods() { |
||||
getGoodsList().then(res => { |
||||
this.goodsList = res.data.data.records; |
||||
}); |
||||
}, |
||||
selectionChange(list) { |
||||
this.selectionList = list; |
||||
}, |
||||
uniqueByKeys(arr, keys) { |
||||
const seen = new Set(); |
||||
return arr.filter(item => { |
||||
// 生成唯一键,例如 "1-A123" 或 "1||A123"(避免字段值包含分隔符冲突) |
||||
const keyValue = keys.map(k => item[k]).join('||'); |
||||
if (seen.has(keyValue)) { |
||||
return false; |
||||
} |
||||
seen.add(keyValue); |
||||
return true; |
||||
}); |
||||
}, |
||||
changeCode() { |
||||
scanIssue({ |
||||
cardNo: this.formInline.orderId, |
||||
}).then(res => { |
||||
console.log('res------------', res); |
||||
let data_ = res.data.data; |
||||
// data_[0].outQty =data_.requireQty |
||||
data_.forEach(item => { |
||||
item.outQty = item.requireQty; |
||||
}); |
||||
|
||||
let data = [...res.data.data, ...this.data]; |
||||
this.data = this.uniqueByKeys(data, ['id', 'cardNo']); |
||||
if (this.data.length > 0) { |
||||
this.data.map(item => { |
||||
getWarehouseList({ |
||||
goodsCode: item.goodsCode, |
||||
}).then(res => { |
||||
item.shList = res.data.data; |
||||
}); |
||||
getLocationData({ |
||||
goodsId: item.goodsId, |
||||
shId: item.shId, |
||||
}).then(res => { |
||||
let data = this.uniqueById(res.data.data.records); |
||||
item.slList = data; |
||||
}); |
||||
getLocationData({ |
||||
goodsId: item.goodsId, |
||||
shId: item.shId, |
||||
slId: item.slId, |
||||
}).then(res => { |
||||
item.piNoList = res.data.data.records; |
||||
}); |
||||
}); |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
changeGoods(val, index) { |
||||
let tmp = this.goodsList.find(item => item.goodsCode == val); |
||||
console.log('tmp------------', tmp); |
||||
console.log('index------------', index); |
||||
this.data[index].goodsName = tmp.goodsName; |
||||
this.data[index].goodsId = tmp.id; |
||||
this.data[index].shId = ''; |
||||
this.data[index].slId = ''; |
||||
this.data[index].stockQty = ''; |
||||
this.data[index].outQty = ''; |
||||
|
||||
getWarehouseList({ |
||||
goodsCode: val, |
||||
}).then(res => { |
||||
this.data[index].shList = res.data.data; |
||||
}); |
||||
}, |
||||
uniqueById(arr) { |
||||
const seen = new Map(); |
||||
for (const item of arr) { |
||||
if (!seen.has(item.slId)) { |
||||
seen.set(item.slId, item); |
||||
} |
||||
} |
||||
return Array.from(seen.values()); |
||||
}, |
||||
changeWare(val, index) { |
||||
this.data[index].stockQty = ''; |
||||
this.data[index].slId = ''; |
||||
getLocationData({ |
||||
goodsId: this.data[index].goodsId, |
||||
shId: val, |
||||
}).then(res => { |
||||
let data = this.uniqueById(res.data.data.records); |
||||
this.data[index].slList = data; |
||||
}); |
||||
}, |
||||
changeLocation(val, index) { |
||||
console.log('val', val); |
||||
this.data[index].piNo = ''; |
||||
this.data[index].stockQty = ''; |
||||
getLocationData({ |
||||
goodsId: this.data[index].goodsId, |
||||
shId: this.data[index].shId, |
||||
slId: val, |
||||
}).then(res => { |
||||
this.data[index].piNoList = res.data.data.records; |
||||
}); |
||||
}, |
||||
changePiNo(val, index) { |
||||
console.log('val', val); |
||||
console.log('index', index); |
||||
let tmp = this.data[index].piNoList.find(item => item.piNo == val); |
||||
console.log('tmp=======', tmp); |
||||
this.data[index].stockQty = tmp.usableQuantity; |
||||
this.data[index].rlsId = tmp.id; |
||||
}, |
||||
closeDialog(val) { |
||||
this.openShow = false; |
||||
this.$emit('closeDialog', val); |
||||
}, |
||||
submit() { |
||||
// 1. 校验逻辑:遍历数据,检查出库数量是否超标 |
||||
const invalidRow = this.data.filter(row => { |
||||
// 获取需求数量,默认为0防止undefined |
||||
const requireQty = row.requireQty || 0; |
||||
// 获取当前出库数量,默认为0 |
||||
const outQty = row.outQty || 0; |
||||
|
||||
// 计算允许的最大出库数量 (需求 + 需求的20%) |
||||
const maxAllowedQty = requireQty + requireQty * 0.2; |
||||
|
||||
// 如果出库数量大于允许的最大值,则视为无效行 |
||||
return outQty > maxAllowedQty; |
||||
}); |
||||
console.log(898989898,invalidRow) |
||||
|
||||
// 2. 如果存在超标数据,提示用户并终止提交 |
||||
if (invalidRow.length>0) { |
||||
// 重新计算该行的最大允许数量用于提示 |
||||
const requireQty = invalidRow[0].requireQty; |
||||
const maxAllowedQty = requireQty + (requireQty * 0.2); |
||||
|
||||
// 提取标识符用于提示 |
||||
const identifier = invalidRow[0].cardNo; |
||||
|
||||
this.$message.error( |
||||
`流程卡/零件 [${identifier}] 的出库数量超过允许最大值 (${maxAllowedQty.toFixed(0)}),请调整后重试!` |
||||
); |
||||
return; |
||||
} |
||||
// 校验通过:准备提交数据(过滤无用字段) |
||||
const submitData = this.data.map(row => { |
||||
const { _select, shList, slList, piNoList, ...validData } = row; // 剔除选择状态字段 |
||||
return validData; |
||||
}); |
||||
console.log('submitData', submitData); |
||||
|
||||
batchIssue(submitData).then(res => { |
||||
if (res.data.code === 200) { |
||||
this.$message.success('出库成功'); |
||||
this.closeDialog(true); |
||||
} |
||||
}); |
||||
}, |
||||
delFn() { |
||||
if (this.selectionList.length == 0) { |
||||
this.$message.error('请至少选择一条数据'); |
||||
return; |
||||
} |
||||
|
||||
this.$confirm('确定将选择数据删除?', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}).then(() => { |
||||
// 1. 提取 arr2 中所有 id,放入 Set(提高查找效率) |
||||
const arr2Ids = new Set(this.selectionList.map(item => item.id)); |
||||
|
||||
// 2. 过滤 arr1:只保留 id 不在 arr2Ids 中的项 |
||||
const result = this.data.filter(item => !arr2Ids.has(item.id)); |
||||
this.data = result; |
||||
// return removeApiScope(this.scopeIds); |
||||
}); |
||||
}, |
||||
cellClick(row, column, cell, event) { |
||||
if (column.property === 'actualPartCode' || column.property === 'goodsKuwei') { |
||||
this.$refs.crud.rowCellEdit(row, column); |
||||
} |
||||
}, |
||||
onLoad() { |
||||
if (JSON.stringify(this.rowItem) !== '{}') { |
||||
this.data = [{ ...this.rowItem }]; |
||||
getWarehouseList({ |
||||
goodsCode: this.rowItem.goodsCode, |
||||
}).then(res => { |
||||
this.data[0].shList = res.data.data; |
||||
}); |
||||
getLocationData({ |
||||
goodsId: this.data[0].goodsId, |
||||
shId: this.data[0].shId, |
||||
}).then(res => { |
||||
let data = this.uniqueById(res.data.data.records); |
||||
this.data[0].slList = data; |
||||
}); |
||||
} |
||||
}, |
||||
}, |
||||
}; |
||||
</script> |
||||
<style lang="scss" scoped></style> |
||||
@ -0,0 +1,459 @@ |
||||
<template> |
||||
<basic-container> |
||||
<!-- 领料出库 --> |
||||
<avue-crud |
||||
:option="option" |
||||
:table-loading="loading" |
||||
:data="data" |
||||
v-model="form" |
||||
v-model:page="page" |
||||
ref="crud" |
||||
@search-change="searchChange" |
||||
@search-reset="searchReset" |
||||
:before-open="beforeOpen" |
||||
@selection-change="selectionChange" |
||||
@current-change="currentChange" |
||||
@size-change="sizeChange" |
||||
@on-load="onLoad" |
||||
@row-save="rowSave" |
||||
> |
||||
<template #menu-left> |
||||
<el-button type="primary" @click="handleOut">打印</el-button> |
||||
<el-button type="primary" @click="outboundFn">出库</el-button> |
||||
<el-button type="danger" @click="handleDelete">删除</el-button> |
||||
</template> |
||||
<template #menu="scope"> |
||||
<el-button type="text" @click="handleEdit(scope.row)" v-if="scope.row.curStatus == 0" |
||||
>修改</el-button |
||||
> |
||||
<el-button type="text" @click="handleScrap(scope.row)" v-if="scope.row.curStatus == 1" |
||||
>报废 |
||||
</el-button> |
||||
</template> |
||||
</avue-crud> |
||||
<addOut v-if="isAddOpen" :editRow="editRow" :showDialog="isAddOpen" @closeDialog="closeDialog"> |
||||
</addOut> |
||||
|
||||
<outboundDialog |
||||
v-if="isOutboundOpen" |
||||
:showDialog="isOutboundOpen" |
||||
:rowItem="rowItem" |
||||
@closeDialog="closeDialog" |
||||
@confirmOutbound="confirmOutbound" |
||||
></outboundDialog> |
||||
|
||||
<el-dialog title="报废" :modelValue="isScrapOpen" v-if="isScrapOpen" width="40%" @close="closeDialog"> |
||||
<el-alert |
||||
style="margin-bottom: 20px" |
||||
:title="scarpTitle" |
||||
type="warning" |
||||
:closable="false" |
||||
show-icon |
||||
> |
||||
</el-alert> |
||||
<el-form :model="scrapForm" :rules="scrapRules" ref="scrapFormRef" label-width="80px"> |
||||
<el-form-item label="出库数量" prop="outboundNum"> |
||||
<el-input v-model="scrapForm.outboundNum" disabled></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="报废数量" prop="scarpNum"> |
||||
<el-input-number |
||||
style="width: 100%" |
||||
v-model="scrapForm.scarpNum" |
||||
:min="1" |
||||
controls-position="right" |
||||
></el-input-number> |
||||
</el-form-item> |
||||
<el-form-item label="审批人" prop="approver"> |
||||
<el-select v-model="scrapForm.approver" clearable filterable placeholder="请选择审批人"> |
||||
<el-option |
||||
v-for="item in approverList" |
||||
:key="item.id" |
||||
:label="item.realName" |
||||
:value="item.id" |
||||
> |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-form> |
||||
<template #footer> |
||||
<span class="dialog-footer"> |
||||
<el-button @click="isScrapOpen=false">取 消</el-button> |
||||
<el-button type="primary" @click="submit" :loading="submitLoading">确 定</el-button> |
||||
</span> |
||||
</template> |
||||
</el-dialog> |
||||
</basic-container> |
||||
</template> |
||||
<script> |
||||
import { getList, scrapOut, delIssue } from '@/api/storeManagement/graphiteMoldOutbound.js'; |
||||
import addOut from './components/addDialog.vue'; |
||||
import outboundDialog from './components/outboundDialog.vue'; |
||||
import { getUserByRoleAlias } from '@/api/storeManagement/warehouseMaintenance'; |
||||
export default { |
||||
components: { |
||||
addOut, |
||||
outboundDialog, |
||||
}, |
||||
data() { |
||||
return { |
||||
loading: false, |
||||
isScrapOpen: false, |
||||
submitLoading:false, |
||||
scrapForm: { |
||||
approver: null, |
||||
scarpNum: null, |
||||
}, |
||||
editRow: {}, |
||||
scrapRules: { |
||||
scarpNum: [{ required: true, message: '请输入报废数量', trigger: 'blur' }], |
||||
approver: [{ required: true, message: '请选择审批人', trigger: 'blur' }], |
||||
}, |
||||
scarpTitle: '', |
||||
query: {}, |
||||
data: [], |
||||
form: {}, |
||||
page: { |
||||
pageSize: 10, |
||||
currentPage: 1, |
||||
total: 0, |
||||
}, |
||||
selectionList: [], |
||||
option: { |
||||
columnSort: true, |
||||
tip: false, |
||||
height: 'auto', |
||||
align: 'center', |
||||
calcHeight: 32, |
||||
simplePage: false, |
||||
searchShow: true, |
||||
searchMenuSpan: 6, |
||||
searchIcon: true, |
||||
searchIndex: 3, |
||||
tree: false, |
||||
border: true, |
||||
index: false, |
||||
selection: true, |
||||
viewBtn: false, |
||||
delBtn: false, |
||||
editBtn: false, |
||||
editBtnText: '修改', |
||||
editBtnIcon: ' ', |
||||
delBtnIcon: ' ', |
||||
addBtn: false, |
||||
labelWidth: 140, |
||||
searchLabelWidth: 120, |
||||
menu: true, |
||||
menuWidth: 80, |
||||
menuBtn: true, |
||||
menuBtnIcon: 'el-icon-menu', |
||||
menuBtnTitle: '操作', |
||||
menuList: [ |
||||
{ label: '详情', value: 'details' }, |
||||
{ label: '打印', value: 'print', display: row => row.status == '1' }, |
||||
{ label: '出库', value: 'outbound', display: row => row.status == '1' }, |
||||
{ label: '修改', value: 'edit', display: row => row.status == '1' }, |
||||
{ label: '删除', value: 'delete', display: row => row.status == '1' }, |
||||
{ label: '报废', value: 'scrap', display: row => row.status == '2' }, |
||||
], |
||||
dialogWidth: 1200, |
||||
dialogClickModal: false, |
||||
searchEnter: true, |
||||
excelBtn: true, |
||||
gridBtn: false, |
||||
searchShowBtn: false, |
||||
showOverflowTooltip: true, |
||||
searchLabelPosition: 'left', |
||||
searchLabelWidth: 'auto', |
||||
searchGutter: 24, |
||||
searchSpan: 6, |
||||
menuAlign: 'center', |
||||
gridBtn: false, |
||||
searchMenuPosition: 'right', |
||||
addBtnIcon: ' ', |
||||
viewBtnIcon: ' ', |
||||
delBtnIcon: ' ', |
||||
editBtnIcon: ' ', |
||||
searchLabelWidth:'auto', |
||||
column: [ |
||||
{ |
||||
label: '出库单号', |
||||
prop: 'outCode', |
||||
search: false, |
||||
width: 150, |
||||
}, |
||||
{ |
||||
label: '生产单号', |
||||
prop: 'yoCode', |
||||
search: true, |
||||
order: 2, |
||||
width: 150, |
||||
}, |
||||
{ |
||||
label: '批次号', |
||||
prop: 'batchCode', |
||||
search: false, |
||||
width: 150, |
||||
}, |
||||
{ |
||||
label: '流程卡号', |
||||
prop: 'cardNo', |
||||
search: true, |
||||
width: 150, |
||||
order: 5, |
||||
}, |
||||
|
||||
|
||||
{ |
||||
label: '物料编号', |
||||
prop: 'goodsCode', |
||||
search: true, |
||||
width: 150, |
||||
order: 4, |
||||
}, |
||||
{ |
||||
label: '物料名称', |
||||
prop: 'goodsName', |
||||
search: false, |
||||
width: 150, |
||||
}, |
||||
{ |
||||
label: '物料需求数量', |
||||
prop: 'requireQty', |
||||
search: false, |
||||
width: 120, |
||||
}, |
||||
{ |
||||
label: '库房', |
||||
prop: 'shName', |
||||
search: false, |
||||
width: 120, |
||||
}, |
||||
{ |
||||
label: '库位', |
||||
prop: 'location', |
||||
search: false, |
||||
width: 120, |
||||
}, |
||||
{ |
||||
label: '已出库数量', |
||||
prop: 'outQty', |
||||
search: false, |
||||
width: 120, |
||||
}, |
||||
{ |
||||
label: '状态', |
||||
prop: 'curStatus', |
||||
search: true, |
||||
width: 120, |
||||
order: 3, |
||||
searchLabelWidth: 60, |
||||
type: 'select', |
||||
dicData: [ |
||||
{ |
||||
label: '待出库', |
||||
value: 0, |
||||
}, |
||||
{ |
||||
label: '已出库', |
||||
value: 1, |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
label: '创建时间', |
||||
prop: 'createTime', |
||||
search: false, |
||||
width: 180, |
||||
type: 'datetime', |
||||
}, |
||||
{ |
||||
label: '创建人', |
||||
prop: 'createUserName', |
||||
search: false, |
||||
width: 120, |
||||
}, |
||||
{ |
||||
label: '出库时间', |
||||
prop: 'outTime', |
||||
search: false, |
||||
width: 180, |
||||
type: 'datetime', |
||||
}, |
||||
{ |
||||
label: '出库人', |
||||
prop: 'outUserName', |
||||
search: false, |
||||
width: 120, |
||||
}, |
||||
], |
||||
}, |
||||
isAddOpen: false, |
||||
isDetailsOpen: false, |
||||
isOutboundOpen: false, |
||||
rowItem: {}, |
||||
checkRow: {}, |
||||
approverList: [], //审批人列表 |
||||
}; |
||||
}, |
||||
mounted() { |
||||
this.getApproverList(); |
||||
if (JSON.stringify(this.$store.state.client.pieOutParams) !== '{}') { |
||||
this.query = this.$store.state.client.pieOutParams; |
||||
this.searchForm = this.$store.state.client.pieOutParams; |
||||
} |
||||
}, |
||||
methods: { |
||||
getApproverList() { |
||||
getUserByRoleAlias({ roleAlias: 'sj_craft' }).then(res => { |
||||
this.approverList = res.data.data; |
||||
}); |
||||
}, |
||||
searchChange(params, done) { |
||||
this.query = params; |
||||
this.page.currentPage = 1; |
||||
this.onLoad(); |
||||
this.$store.dispatch('changeSetting', { |
||||
title: 'pieOutParams', |
||||
form: this.query, |
||||
}); |
||||
done(); |
||||
}, |
||||
searchReset() { |
||||
this.query = {}; |
||||
this.$store.dispatch('changeSetting', { |
||||
title: 'pieOutParams', |
||||
form: this.query, |
||||
}); |
||||
this.onLoad(); |
||||
}, |
||||
currentChange(currentPage) { |
||||
this.page.currentPage = currentPage; |
||||
}, |
||||
sizeChange(pageSize) { |
||||
this.page.pageSize = pageSize; |
||||
}, |
||||
outboundFn() { |
||||
this.rowItem = {}; |
||||
this.isOutboundOpen = true; |
||||
}, |
||||
closeDialog(val) { |
||||
this.isAddOpen = false; |
||||
this.isDetailsOpen = false; |
||||
this.isOutboundOpen = false; |
||||
this.isScrapOpen = false |
||||
this.onLoad(); |
||||
}, |
||||
// 多选 |
||||
selectionChange(list) { |
||||
this.selectionList = list; |
||||
}, |
||||
submit() { |
||||
this.$refs.scrapFormRef.validate(valid => { |
||||
if (valid) { |
||||
this.submitLoading = true |
||||
let param = { |
||||
rlsId: this.scrapForm.rlsId, |
||||
bfType: 3, |
||||
outQty: this.scrapForm.scarpNum, |
||||
woCode: this.scrapForm.woCode, |
||||
approver: this.scrapForm.approver, |
||||
}; |
||||
scrapOut(param).then(res => { |
||||
if (res.data.code == 200) { |
||||
this.$message.success('报废成功'); |
||||
this.isScrapOpen = false; |
||||
this.$confirm('是否需要新增出库??', '', { |
||||
confirmButtonText: '需要', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}).then(() => { |
||||
this.isOutboundOpen = true; |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
}, |
||||
// 打印 |
||||
handleOut() { |
||||
|
||||
}, |
||||
|
||||
// 出库 |
||||
ouboundFn(row) { |
||||
this.isOutboundOpen = true; |
||||
this.rowItem = { |
||||
...row, |
||||
}; |
||||
}, |
||||
// 修改 |
||||
handleEdit(row) { |
||||
this.editRow = row; |
||||
this.isAddOpen = true; |
||||
}, |
||||
|
||||
// 删除 |
||||
handleDelete(row) { |
||||
if (this.selectionList.length == 0) { |
||||
this.$message.error('请至少选择一条数据'); |
||||
return; |
||||
} |
||||
// 【新增逻辑】检查是否包含已出库的数据 (curStatus === 1) |
||||
const hasOutbound = this.selectionList.some(item => item.curStatus === 1); |
||||
if (hasOutbound) { |
||||
this.$message.warning('已出库的数据不允许删除,请取消选择后重试'); |
||||
return; |
||||
} |
||||
this.$confirm('确定将选择数据删除?', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}).then(res => { |
||||
delIssue({ |
||||
ids: this.selectionList.map(item => item.id).join(','), |
||||
}).then(res => { |
||||
if (res.data.code == 200) { |
||||
this.$message.success('删除成功'); |
||||
this.onLoad(); |
||||
} |
||||
}); |
||||
}); |
||||
}, |
||||
// 报废 |
||||
handleScrap(row) { |
||||
this.rowItem = row; |
||||
this.scrapForm.outboundNum = row.outQty; |
||||
this.scrapForm.rlsId = row.rlsId; |
||||
this.scrapForm.woCode = row.woCode; |
||||
this.scarpTitle = `【${row.goodsName}】物料报废需工艺员审批,审批通过后可出库`; |
||||
this.isScrapOpen = true; |
||||
|
||||
}, |
||||
onLoad() { |
||||
let params = { |
||||
...this.query, |
||||
startEstUseTime: |
||||
this.query && |
||||
this.query.estUseTime && |
||||
this.query.estUseTime.length != 0 && |
||||
this.query.estUseTime[0], |
||||
endEstUseTime: |
||||
this.query && |
||||
this.query.estUseTime && |
||||
this.query.estUseTime.length != 0 && |
||||
this.query.estUseTime[1], |
||||
}; |
||||
if (params.estUseTime) delete params.estUseTime; |
||||
getList({ |
||||
current: this.page.currentPage, |
||||
size: this.page.pageSize, |
||||
...params, |
||||
}).then(res => { |
||||
this.data = res.data.data.records; |
||||
this.page.total = res.data.data.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
}, |
||||
}; |
||||
</script> |
||||
Loading…
Reference in new issue