Browse Source

2025-10-10

领料申请管理的材料明细新增
master
fengyuan_yang 12 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-tab-pane label="材料明细" name="sub">
<el-form label-position="top" style="margin-left: 2px;"> <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="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-button v-if="editBatchVisible" type="primary" @click="batchModel" :loading="saveLoading">批量保存</el-button>
</el-form> </el-form>
<el-table <el-table
@ -214,7 +215,7 @@
</el-input> </el-input>
</span> </span>
<span v-else> <span v-else>
<span>{{scope.row[scope.column.property]}}</span>
<span>{{calculateQtyToIssue(scope.row)}}</span>
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
@ -934,6 +935,56 @@
</el-footer> </el-footer>
</el-dialog> </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> </div>
</template> </template>
@ -973,9 +1024,13 @@
import { import {
getOutboundDetail2, // 获取出库明细 getOutboundDetail2, // 获取出库明细
} from "@/api/qc/outbound_notification.js" } from "@/api/qc/outbound_notification.js"
import Chooselist from '@/views/modules/common/Chooselist_eam'
import {verifyData} from "@/api/chooselist/chooselist.js"
export default { export default {
components: {
Chooselist,
},
data() { data() {
return { return {
height:200, height:200,
@ -996,6 +1051,21 @@
username:this.$store.state.user.name, username:this.$store.state.user.name,
}, },
closeModalFlag:false, closeModalFlag:false,
addMaterialModalFlag: false,
newMaterialData: {
componentPartNo: '',
partDesc: '',
issueType: '替代料',
orderNo: '',
itemNo: '',
remark: '',
componentScrap: 0,
firstInspectionQty: 0,
standardDosage: 0,
bomSeqNo: '',
warehouseId: ''
},
orderOptions: [],
searchData: { searchData: {
page: 1, page: 1,
limit: 100, limit: 100,
@ -1494,6 +1564,57 @@
status: true, status: true,
fixed: '', fixed: '',
columnWidth: 80 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, userId: this.$store.state.user.name,
functionId: 701002, functionId: 701002,
@ -1596,7 +1717,6 @@
status: true, status: true,
fixed: '', fixed: '',
columnWidth: 80 columnWidth: 80
}, },
], ],
columnList4:[ columnList4:[
@ -2595,7 +2715,6 @@
//区分请求成功和失败的状况 //区分请求成功和失败的状况
if (data && data.code == 0) { if (data && data.code == 0) {
this.dataList3 = data.rows this.dataList3 = data.rows
} else { } else {
this.dataList3 = []; this.dataList3 = [];
} }
@ -2814,7 +2933,7 @@
}, },
//申请单主表新增方法
//申请单主表新增方法
//新增领料申请单模态框 //新增领料申请单模态框
createNotifyModal(){ createNotifyModal(){
let inData={ let inData={
@ -3425,11 +3544,13 @@
this.pp_pageIndex = 1 this.pp_pageIndex = 1
this.searchPartModel() this.searchPartModel()
}, },
// 当前页 工单分页信息 // 当前页 工单分页信息
pp_currentChangeHandle(val) { pp_currentChangeHandle(val) {
this.pp_pageIndex = val this.pp_pageIndex = val
this.searchPartModel() this.searchPartModel()
}, },
// 选择物料 // 选择物料
choosePart(row) { choosePart(row) {
// 关闭选择模态框 // 关闭选择模态框
@ -3442,7 +3563,8 @@
this.$message.success('选择物料成功,数据已填入表单'); this.$message.success('选择物料成功,数据已填入表单');
}, },
//下达申请单方法
//下达申请单方法
async xiadaNotifyModel(row){ async xiadaNotifyModel(row){
// 设置当前行为要下达的行 // 设置当前行为要下达的行
this.currentRow = JSON.parse(JSON.stringify(row)); this.currentRow = JSON.parse(JSON.stringify(row));
@ -3546,6 +3668,155 @@
} }
return this.currentRow.status === '草稿' || this.currentRow.status === '编辑中'; 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> </script>

Loading…
Cancel
Save