Browse Source

2025-10-10

领料申请管理的材料明细新增
master
fengyuan_yang 3 months ago
parent
commit
8522657df3
  1. 283
      src/views/modules/orderIssure/soIssueNotify/searchIssureNotify.vue

283
src/views/modules/orderIssure/soIssueNotify/searchIssureNotify.vue

@ -176,6 +176,7 @@
<el-tab-pane label="材料明细" name="sub">
<el-form label-position="top" style="margin-left: 2px;">
<el-button v-if="!editBatchVisible" type="primary" @click="editBatchModel">批量编辑</el-button>
<el-button v-if="!editBatchVisible" type="success" @click="addMaterialModal">新增</el-button>
<el-button v-if="editBatchVisible" type="primary" @click="batchModel" :loading="saveLoading">批量保存</el-button>
</el-form>
<el-table
@ -214,7 +215,7 @@
</el-input>
</span>
<span v-else>
<span>{{scope.row[scope.column.property]}}</span>
<span>{{calculateQtyToIssue(scope.row)}}</span>
</span>
</template>
</el-table-column>
@ -934,6 +935,56 @@
</el-footer>
</el-dialog>
<!-- 新增材料模态框 -->
<el-dialog title="新增材料明细" :close-on-click-modal="false" v-drag :visible.sync="addMaterialModalFlag" width="525px">
<el-form :inline="true" label-position="top" :model="newMaterialData" style="margin-left: 7px;margin-top: -5px;">
<el-form-item>
<span style="cursor: pointer" slot="label" @click="getBaseList(508)"><a href="#">材料</a></span>
<el-input v-model="newMaterialData.componentPartNo" @change="partBlur(508)" style="width: 120px"></el-input>
<el-input v-model="newMaterialData.partDesc" disabled style="width: 362px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="newMaterialData" style="margin-left: 7px">
<el-form-item label="生产订单">
<el-select v-model="newMaterialData.orderNo" @change="onOrderNoChange" placeholder="请选择生产订单" style="width: 215px">
<el-option
v-for="item in orderOptions"
:key="item.orderNo"
:label="item.orderNo"
:value="item.orderNo">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="申请单序号">
<el-input v-model="newMaterialData.itemNo" disabled style="width: 122px"></el-input>
</el-form-item>
<el-form-item label="类型">
<el-input v-model="newMaterialData.issueType" value="替代料" disabled style="width: 122px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="newMaterialData" style="margin-left: 7px">
<el-form-item label="调机量">
<el-input-number :controls="false" :step="0" v-model="newMaterialData.componentScrap" :min="0" style="width: 152px"></el-input-number>
</el-form-item>
<el-form-item label="首检量">
<el-input-number :controls="false" :step="0" v-model="newMaterialData.firstInspectionQty" :min="0" style="width: 152px"></el-input-number>
</el-form-item>
<el-form-item label="标准用量">
<el-input-number :controls="false" :step="0" v-model="newMaterialData.standardDosage" :min="0" style="width: 152px"></el-input-number>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" style="margin-left: 7px">
<el-form-item :label="'备注'">
<el-input type="textarea" v-model="newMaterialData.remark" :rows="3" resize='none' show-word-limit style="width: 485px;height: 20px"></el-input>
</el-form-item>
</el-form>
<el-footer style="height:35px;margin-top: 55px;text-align:center">
<el-button type="primary" @click="saveNewMaterial">保存</el-button>
<el-button type="primary" @click="addMaterialModalFlag=false">取消</el-button>
</el-footer>
</el-dialog>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
</div>
</template>
@ -973,9 +1024,13 @@
import {
getOutboundDetail2, //
} from "@/api/qc/outbound_notification.js"
import Chooselist from '@/views/modules/common/Chooselist_eam'
import {verifyData} from "@/api/chooselist/chooselist.js"
export default {
components: {
Chooselist,
},
data() {
return {
height:200,
@ -996,6 +1051,21 @@
username:this.$store.state.user.name,
},
closeModalFlag:false,
addMaterialModalFlag: false,
newMaterialData: {
componentPartNo: '',
partDesc: '',
issueType: '替代料',
orderNo: '',
itemNo: '',
remark: '',
componentScrap: 0,
firstInspectionQty: 0,
standardDosage: 0,
bomSeqNo: '',
warehouseId: ''
},
orderOptions: [],
searchData: {
page: 1,
limit: 100,
@ -1494,6 +1564,57 @@
status: true,
fixed: '',
columnWidth: 80
},{
userId: this.$store.state.user.name,
functionId: 701002,
serialNumber: '701002Table3ComponentScrap',
tableId: "701002Table3",
tableName: "申请单材料明细表",
columnProp: "componentScrap",
headerAlign: "center",
align: "right",
columnLabel: "调机量",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},{
userId: this.$store.state.user.name,
functionId: 701002,
serialNumber: '701002Table3FirstInspectionQty',
tableId: "701002Table3",
tableName: "申请单材料明细表",
columnProp: "firstInspectionQty",
headerAlign: "center",
align: "right",
columnLabel: "首检量",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},{
userId: this.$store.state.user.name,
functionId: 701002,
serialNumber: '701002Table3StandardDosage',
tableId: "701002Table3",
tableName: "申请单材料明细表",
columnProp: "standardDosage",
headerAlign: "center",
align: "right",
columnLabel: "标准用量",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},{
userId: this.$store.state.user.name,
functionId: 701002,
@ -1596,7 +1717,6 @@
status: true,
fixed: '',
columnWidth: 80
},
],
columnList4:[
@ -2595,7 +2715,6 @@
//
if (data && data.code == 0) {
this.dataList3 = data.rows
} else {
this.dataList3 = [];
}
@ -2814,7 +2933,7 @@
},
//
//
//
createNotifyModal(){
let inData={
@ -3425,11 +3544,13 @@
this.pp_pageIndex = 1
this.searchPartModel()
},
//
pp_currentChangeHandle(val) {
this.pp_pageIndex = val
this.searchPartModel()
},
//
choosePart(row) {
//
@ -3442,7 +3563,8 @@
this.$message.success('选择物料成功,数据已填入表单');
},
//
//
async xiadaNotifyModel(row){
//
this.currentRow = JSON.parse(JSON.stringify(row));
@ -3546,6 +3668,155 @@
}
return this.currentRow.status === '草稿' || this.currentRow.status === '编辑中';
},
//
calculateQtyToIssue(row) {
const componentScrap = parseFloat(row.componentScrap) || 0;
const firstInspectionQty = parseFloat(row.firstInspectionQty) || 0;
const standardDosage = parseFloat(row.standardDosage) || 0;
return (componentScrap + firstInspectionQty + standardDosage).toFixed(2);
},
//
addMaterialModal() {
if (!this.currentRow || !this.currentRow.notifyNo) {
this.$alert('请先选择一条主表记录!', '提示', {
confirmButtonText: '确定'
});
return false;
}
if (!this.isEditableStatus()) {
this.$alert('当前状态不允许编辑!只有草稿或编辑中状态才能新增材料。', '提示', {
confirmButtonText: '确定'
});
return false;
}
//
this.newMaterialData = {
componentPartNo: '',
partDesc: '',
issueType: '替代料',
orderNo: '',
itemNo: '', //
remark: '',
componentScrap: 0,
firstInspectionQty: 0,
standardDosage: 0,
bomSeqNo: '',
warehouseId: ''
};
//
this.loadOrderOptions();
this.addMaterialModalFlag = true;
},
//
loadOrderOptions() {
//
this.orderOptions = this.dataList2.map(item => ({
orderNo: item.sOOrderNo,
itemNo: item.itemNo //
}));
},
//
onOrderNoChange(selectedOrderNo) {
if (selectedOrderNo) {
//
const selectedOrder = this.dataList2.find(item => item.sOOrderNo === selectedOrderNo);
if (selectedOrder) {
this.newMaterialData.itemNo = selectedOrder.itemNo;
}
} else {
this.newMaterialData.itemNo = '';
}
},
//
saveNewMaterial() {
//
if (!this.newMaterialData.componentPartNo) {
this.$message.error('请选择材料编码')
return;
}
if (!this.newMaterialData.orderNo) {
this.$message.error('请选择生产订单')
return;
}
//
const qtyToIssue = this.calculateQtyToIssue(this.newMaterialData)
//
const saveData = {
...this.newMaterialData,
site: this.currentRow.site,
notifyNo: this.currentRow.notifyNo,
qtyToIssue: qtyToIssue,
}
saveSOIssueNotifyOrderMateria(saveData).then(({data}) => {
if (data && data.code === 0) {
//
this.getNotifyMaterialList();
this.addMaterialModalFlag = false
this.$message.success('操作成功')
} else {
this.$message.error(data.msg)
}
})
},
//
getNextItemNo() {
if (this.dataList3.length === 0) {
return 1;
}
const maxItemNo = Math.max(...this.dataList3.map(item => item.itemNo || 0));
return maxItemNo + 1;
},
// S
getBaseList (val, type) {
this.tagNo = val
this.tagType = type
this.$nextTick(() => {
let strVal = ''
if (val === 508) {
strVal = this.newMaterialData.componentPartNo
this.$refs.baseList.init(val, strVal)
}
})
},
//
getBaseData (val) {
if (this.tagNo === 508) {
this.newMaterialData.componentPartNo = val.PartNo
this.newMaterialData.partDesc = val.PartDescription
this.newMaterialData.warehouseId = val.outbound_warehouse_id
}
},
//
partBlur (tagNo) {
let tempData = {
tagno: tagNo,
conditionSql: " and PartNo = '" + this.newMaterialData.componentPartNo + "'" + " and site = '" + this.newMaterialData.site + "'"
}
verifyData(tempData).then(({data}) => {
if (data && data.code === 0) {
if (data.baseListData.length > 0) {
this.newMaterialData.componentPartNo = data.baseListData[0].PartNo
this.newMaterialData.partDesc = data.baseListData[0].PartDescription
} else {
this.newMaterialData.partDesc = ''
}
}
})
},
},
}
</script>

Loading…
Cancel
Save