|
@@ -59,6 +59,8 @@ import {
|
|
|
getAllPlanListByMachineId,
|
|
|
getAllPlanListByProductTypeAndStatus, updatePlanOne
|
|
|
} from "@/api/plan/paln.js";
|
|
|
+
|
|
|
+import {getDicts} from "@/api/system/dict/data"
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -110,6 +112,8 @@ export default {
|
|
|
},
|
|
|
// 产品类别
|
|
|
productTypeList:[{value:"A面",lable:"A面"},{value:"B面",lable:"B面"}],
|
|
|
+ counter:0,
|
|
|
+ timerId: null
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
@@ -118,6 +122,18 @@ export default {
|
|
|
// 得到业务员信息
|
|
|
// this.getSalesman();
|
|
|
this.getProductsInfo();
|
|
|
+ //查询字典信息
|
|
|
+ getDicts("dpsx").then(res=>{
|
|
|
+ //制定周期跑一次定时任务
|
|
|
+ console.log(res.data[0].dictValue)
|
|
|
+ this.timerId = setInterval(() => {
|
|
|
+ this.counter++;
|
|
|
+ console.log(`计数器:`,this.counter);
|
|
|
+ // 注意:适时清理定时器,例如在组件销毁时
|
|
|
+ // 得到排产计划信息
|
|
|
+ this.getAmmunitionPlanInfo();
|
|
|
+ }, res.data[0].dictValue);
|
|
|
+ })
|
|
|
},
|
|
|
methods: {
|
|
|
// 查询排产信息
|
|
@@ -164,7 +180,7 @@ export default {
|
|
|
let nextRow2 = this.tableData[rowIndex + 1] //下一行数据
|
|
|
// 当上一行的数据等于当前行数据时,当前行单元格隐藏
|
|
|
|
|
|
- console.log(row.listOfPendingProduction)
|
|
|
+ // console.log(row.listOfPendingProduction)
|
|
|
if(row.listOfPendingProduction==null||row.listOfPendingProduction==undefined|| row.listOfPendingProduction==""){
|
|
|
return;
|
|
|
}
|
|
@@ -268,48 +284,6 @@ export default {
|
|
|
});
|
|
|
})
|
|
|
},
|
|
|
- // 下拉框数据改变查询色号批号信息
|
|
|
- selectedChangeDate(row,selectedProduct) {
|
|
|
- //选择的那个销售产品
|
|
|
- this.product = this.productsInfo.find(product => product.id === selectedProduct);
|
|
|
- this.form.product=selectedProduct;
|
|
|
- //通过母粒编码查询到对应的母粒信息
|
|
|
- let queryParams = {
|
|
|
- "materielCode": this.product.colourNumber
|
|
|
- }
|
|
|
- //得到对应的母粒信息
|
|
|
- getMaterielInfo(queryParams).then((response) => {
|
|
|
- if (response.data!=null) {
|
|
|
- this.materiel = response.data;
|
|
|
- //色号 母粒编码+色号
|
|
|
- row.currentColorCode = this.materiel.materieEncoding+"("+this.materiel.materieColorNumber+")";
|
|
|
- }
|
|
|
- });
|
|
|
- //isDisabled(有批号就用,没批号就自己输入)
|
|
|
- if(this.product.lotNumber!=undefined&&this.product.lotNumber!=""){
|
|
|
- row.currentLotNumber=this.product.lotNumber;
|
|
|
- this.isDisabled=true;
|
|
|
- }else {
|
|
|
- this.isDisabled=false;
|
|
|
- }
|
|
|
- //产品规格
|
|
|
- row.currentSpecification= this.product.productSpecifications;
|
|
|
- //销售单编号(以前打算存的是业务员信息后来存的是销售单编号)
|
|
|
- row.salesmanId=this.product.saleOrderNo;
|
|
|
- },
|
|
|
- // 新增计划产品信息
|
|
|
- handleAddPlan(row) {
|
|
|
- if(this.selectedWorkshop=="南车间"){
|
|
|
- this.nanInsertDialogTableVisible = true
|
|
|
- }else{
|
|
|
- this.beiInsertDialogTableVisible = true
|
|
|
- }
|
|
|
- this.tableData2=[]
|
|
|
- //先清空
|
|
|
- this.machineId=""
|
|
|
- //当前操作机台号
|
|
|
- this.machineId=row.machineId;
|
|
|
- },
|
|
|
|
|
|
// tab栏点击切换
|
|
|
tabClick(tab, event) {
|
|
@@ -375,114 +349,7 @@ export default {
|
|
|
isRowFilled(row) {
|
|
|
return row.currentSpecification && row.currentSpindleCount && row.number && row.startTime && row.plannedEndTime;
|
|
|
},
|
|
|
- // 新增一行标记为可编辑
|
|
|
- addEditableRow() {
|
|
|
- // 检查当前编辑行是否已填写完毕
|
|
|
- if(this.tableData2.length!=0){
|
|
|
- if (this.editingRowIndex !== -1 && !this.isRowFilled(this.tableData2[this.editingRowIndex])) {
|
|
|
- this.$message({
|
|
|
- message: '请先完成上一条数据的填写',
|
|
|
- type: 'warning'
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- //新增行之前先让以前的行不能编辑
|
|
|
- this.tableData2.forEach(item => {
|
|
|
- item.isEditing = false;
|
|
|
- })
|
|
|
- }
|
|
|
- this.tableData2.push({
|
|
|
- currentColorCode: '',
|
|
|
- currentSpecification: '',
|
|
|
- currentLotNumber: '',
|
|
|
- currentSpindleCount: '',
|
|
|
- number: '',
|
|
|
- startTime: '',
|
|
|
- plannedEndTime:'',
|
|
|
- planStatus:0,
|
|
|
- productId:'',
|
|
|
- salesmanId:'',
|
|
|
- isEditing: true // 标记为正在编辑状态
|
|
|
- });
|
|
|
- this.editingRowIndex = this.tableData2.length - 1; // 更新当前编辑的行索引
|
|
|
- this.lastEditLine = this.tableData2.length - 1
|
|
|
- },
|
|
|
- // 添加计划
|
|
|
- addPlanInfo(){
|
|
|
- const datatime=Date.now()+this.machineId;
|
|
|
- //处理表格数据
|
|
|
- this.tableData2.forEach(item=>{
|
|
|
- item.timestampRandomCode=datatime;
|
|
|
- item.machineId=this.machineId;
|
|
|
- })
|
|
|
- //时间戳
|
|
|
- let data={
|
|
|
- //机台号
|
|
|
- machineId: this.machineId,
|
|
|
- timestampRandomCode:datatime,
|
|
|
- //计划信息
|
|
|
- detailsOfTheRefuelingPlans: this.tableData2
|
|
|
- }
|
|
|
- //添加计划信息
|
|
|
- addMaterielInfo(data).then(response => {
|
|
|
- if (response.code == 200) {
|
|
|
- this.$message({
|
|
|
- message: '添加成功',
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
- this.getAmmunitionPlanInfo();
|
|
|
- //最后把弹窗关掉
|
|
|
- this.nanInsertDialogTableVisible=false
|
|
|
- //更改订单投产信息的批号,
|
|
|
- } else {
|
|
|
- this.$message({
|
|
|
- message: '添加失败',
|
|
|
- type: 'error'
|
|
|
- });
|
|
|
- //最后把弹窗关掉
|
|
|
- this.nanInsertDialogTableVisible=false
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- },
|
|
|
- // 修改产品计划
|
|
|
- handleEditPlan(row) {
|
|
|
- this.tableData2=[];
|
|
|
- //弹窗
|
|
|
- if(this.selectedWorkshop=="南车间"){
|
|
|
- this.nanUpdateDialogTableVisible = true
|
|
|
- }else{
|
|
|
- this.beiUpdateDialogTableVisible = true
|
|
|
- }
|
|
|
- this.tableData2=[];
|
|
|
- getAllPlanListByMachineId(row.machineId).then((response) => {
|
|
|
- //得到生产中,停产的,待产的
|
|
|
- response.data.forEach(item => {
|
|
|
- item.isEditing=false;
|
|
|
- item.planStatus=parseInt(item.planStatus);
|
|
|
- item.productId=parseInt(item.productId)
|
|
|
- })
|
|
|
- this.tableData2=response.data;
|
|
|
- console.log( this.tableData2)
|
|
|
- // 在数据加载完成后,手动触发每个行的第一个下拉框的 change 事件
|
|
|
- this.$nextTick(() => {
|
|
|
- // 获取第一个业务员选择框(假设表格只有一行)
|
|
|
- for (let i = 0; i < this.tableData2.length; i++) {
|
|
|
- const firstSalesmanSelect = this.$refs['salesmanSelect'+i];
|
|
|
- // console.log(firstSalesmanSelect,11111111)
|
|
|
- // 触发 change 事件
|
|
|
- if (firstSalesmanSelect) {
|
|
|
- firstSalesmanSelect.$emit('change', {
|
|
|
- target: {value: "ddd"},
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
- })
|
|
|
-
|
|
|
|
|
|
- },
|
|
|
//弹窗里边的点击查询
|
|
|
onSubmit(){
|
|
|
this.formData.machineId=this.machineId;
|
|
@@ -521,6 +388,9 @@ export default {
|
|
|
computed: {
|
|
|
|
|
|
},
|
|
|
+ beforeDestroy() {
|
|
|
+ clearInterval(this.timerId); // 清理定时器
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|