|
|
|
@ -190,7 +190,7 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {getProductOrder} from "@//api/mes/productOrder";
|
|
|
|
|
import {getProductOrder, updateProductOrder} from "@//api/mes/productOrder";
|
|
|
|
|
import {
|
|
|
|
|
delProductplan,
|
|
|
|
|
getDispatchCode, getDispatchDrawingList,
|
|
|
|
@ -354,6 +354,7 @@ export default {
|
|
|
|
|
this.close();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
handleDeleteMesProductPlan() {
|
|
|
|
|
let productPlan = this.checkedMesProductPlanList[0];
|
|
|
|
@ -368,13 +369,40 @@ export default {
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
//历史删除
|
|
|
|
|
const mesProductPlanDetailList = this.mesProductPlanList;
|
|
|
|
|
this.mesProductPlanList = mesProductPlanDetailList.filter(function (item) {
|
|
|
|
|
return productPlan.dispatchCode !== item.dispatchCode
|
|
|
|
|
});
|
|
|
|
|
const delList = this.mesProductPlanList;
|
|
|
|
|
let dispatchSum = 0;
|
|
|
|
|
try {
|
|
|
|
|
const planIds = delList.filter(function (item) {
|
|
|
|
|
return productPlan.dispatchCode === item.dispatchCode
|
|
|
|
|
}).map(item => {
|
|
|
|
|
if (item.planStatus !== '1') {
|
|
|
|
|
throw Error("只能删除未派工状态的生产派工单!");
|
|
|
|
|
}
|
|
|
|
|
if (item.processId === productPlan.processId) {
|
|
|
|
|
dispatchSum = dispatchSum + item.planAmount;
|
|
|
|
|
}
|
|
|
|
|
return item.planId;
|
|
|
|
|
});
|
|
|
|
|
dispatchSum = this.form.dispatchAmount - dispatchSum;
|
|
|
|
|
delProductplan(planIds).then(res =>{
|
|
|
|
|
// 更新生产工单
|
|
|
|
|
updateProductOrder({
|
|
|
|
|
productOrderId: this.form.productOrderId,
|
|
|
|
|
dispatchAmount: dispatchSum
|
|
|
|
|
})
|
|
|
|
|
getProductOrder(this.form.productOrderId).then(res => {
|
|
|
|
|
this.form = res.data;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
const mesProductPlanDetailList = this.mesProductPlanList;
|
|
|
|
|
this.mesProductPlanList = mesProductPlanDetailList.filter(function (item) {
|
|
|
|
|
return productPlan.dispatchCode !== item.dispatchCode
|
|
|
|
|
});
|
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
|
} catch (e) {
|
|
|
|
|
this.$modal.msgError(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// delProductplan(planIds);
|
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|