Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop

This commit is contained in:
shilixia 2021-12-20 14:12:31 +08:00
commit eef9972931
9 changed files with 2091 additions and 301 deletions

View File

@ -0,0 +1,200 @@
<template>
<div class="tableMneu">
<div
class="mask"
v-if="isShowHeaderBox || menuOpen"
@click="maskClick"
></div>
<el-table
ref="tableMenu"
:data="tableData"
border
fit
style="width: 100%"
row-key="id"
height="100%"
default-expand-all
highlight-current-row
@row-click="handlerRowClick"
@expand-change="handlerExpand"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
>
<el-table-column label="名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column label="进度">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
export default {
props: {
list: Array,
BGScrollTop: Number
},
computed: {
tableData() {
return this.list;
}
},
watch: {
BGScrollTop: {
handler: function(newValue) {
let table = this.$refs.tableMenu.bodyWrapper;
// console.log(newValue, table);
table.scrollTo(0, newValue);
// table.scrollTo({
// top: newValue,
// left: 0,
// behavior: "smooth"
// });
}
}
},
data() {
return {
// tableData: [],
checkList: [],
isShowHeaderBox: false,
menuOpen: false,
//当前点击的row
currentRow: {}
};
},
methods: {
handlerWatchScroll() {
let table = this.$refs.tableMenu.bodyWrapper;
table.addEventListener("scroll", e => {
// console.log(e.srcElement.scrollTop);
this.$emit("TableScrollTop", e.srcElement.scrollTop);
});
},
handlerSelect(row) {
this.$refs.tableMenu.setCurrentRow(row);
},
handlerExpand(row, expand) {
// console.log(row, expanded);
this.$emit("handlerExpand", row, expand);
},
maskClick() {
this.isShowHeaderBox = false;
this.menuOpen = false;
this.currentRow = {};
},
handlerRowClick(row) {
this.$emit("handlerRowClick", row);
},
},
mounted() {
this.handlerWatchScroll();
}
};
</script>
<style lang="scss" scoped>
.tableMneu {
width: 100%;
position: relative;
height: 100%;
.mask {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
background-color: transparent;
z-index: 9999;
}
.icons {
cursor: pointer;
&:hover {
color: #409eff;
}
}
.menulist {
width: 100px;
position: absolute;
background-color: rgb(255, 255, 255);
border-radius: 5px;
border: 1px solid #ebeef5;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
transition: 0.3s;
width: 70px;
z-index: 9999;
.item {
background-color: rgb(255, 255, 255);
line-height: 30px;
text-align: center;
font-size: 12px;
color: rgb(102, 102, 102);
cursor: pointer;
height: 30px;
}
.item:hover {
color: #409eff;
}
}
.headerBox {
z-index: 9999;
position: absolute;
right: -128px;
top: 50px;
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
width: 170px;
background-color: #fff;
&::after {
content: " ";
position: absolute;
top: -5px;
left: 16px;
width: 0;
height: 0;
border-right: 7px solid transparent;
border-left: 7px solid transparent;
border-bottom: 7px solid #fff;
}
.title {
margin: 0;
padding: 8px 16px;
min-height: 32px;
border-bottom: 1px solid #e9e9e9;
color: #303030;
font-weight: 500;
}
.main {
.line {
padding: 8px 10px;
display: flex;
flex-direction: row;
align-items: center;
width: 150px;
.pre {
flex: 1 1 auto;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
}
}
</style>
<style lang="scss" >
.tableMneu {
.el-table th.gutter {
display: table-cell !important;
}
.el-table td,
.el-table th {
padding: 8px 0;
}
.el-table--border td {
border-right: none;
}
}
</style>

View File

@ -0,0 +1,156 @@
<template>
<div
class="slider"
ref="slider"
>
<div
class="process"
:style="{ width }"
style="font-size: 12px;color: #ffffff;text-align: right"
>
<span v-if="per">{{ per }}</span>
<span v-else>{{ per }}</span>
</div>
<div class="process1"
:style="{width:process1Width}"
style="font-size: 12px;color: #ffffff;text-align: right"
>
<span v-if="per1"> {{ per1 }}</span>
</div>
</div>
</template>
<script>
export default {
props: ["min", "max", "value", "widths", "per1", "id", "parentId"],
data() {
return {
//滚动条DOM元素
slider: null,
//拖拽DOM元素
thunk: null,
//当前值
per: this.value,
perOk: this.per1,
//当前是否拖拽tip
isMove: false,
// process1Width:'10px',
};
},
watch: {
value(newValue, oldValue) {
this.per = newValue;
}
},
methods: {
thunkMousedown(e) {
let width = parseInt(this.width);
let disX = e.clientX;
this.$emit("thunkMousedown");
this.isMove = true;
console.log(this.isMove);
document.onmousemove = e => {
let newWidth = e.clientX - disX + width;
let scale = newWidth / this.slider.offsetWidth;
this.per = Math.ceil((this.max - this.min) * scale + this.min);
this.per = Math.max(this.per, this.min);
this.per = Math.min(this.per, this.max);
this.$emit("thunkMousemove", e, this.index);
};
document.onmouseup = event => {
this.isMove = false;
this.$emit(
"thunkMouseup",
parseInt(this.scale * 100),
event,
this.id,
this.parentId
);
document.onmousemove = document.onmouseup = null;
};
return false;
}
},
//渲染到页面的时候
mounted() {
this.slider = this.$refs.slider;
this.thunk = this.$refs.trunk;
},
computed: {
scale() {
return (this.per - this.min) / (this.max - this.min);
},
width() {
if (this.slider) {
return this.widths * this.scale + "px";
} else {
return 0 + "px";
}
},
process1Width() {
if (this.slider) {
let scale1 = (this.perOk - this.min) / (this.max - this.min);
return this.widths * scale1 + "px";
} else {
return 0 + "px";
}
},
left() {
if (this.slider) {
return this.widths * this.scale - this.thunk.offsetWidth / 2 + "px";
} else {
return 0 + "px";
}
}
}
};
</script>
<style>
.slider {
position: relative;
height: 20px;
background: #e4e7ed;
border-radius: 3px;
cursor: text;
user-select: none;
width: 100%;
display: inline-block
}
.slider .process {
position: absolute;
left: 0;
top: 0;
width: 112px;
height: 20px;
border-radius: 3px;
background: #409eff;
}
.slider .process1 {
position: absolute;
left: 0;
top: 0;
width: 10px;
height: 20px;
border-radius: 3px;
background: #11c750;
}
.slider .block i {
font-size: 25px;
position: relative;
left: -3px;
top: 15px;
cursor: pointer;
}
.slider .tips i {
position: absolute;
margin-left: -5px;
left: 50%;
bottom: -9px;
font-size: 16px;
color: #000;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -4,11 +4,12 @@
<el-date-picker
v-model="timeRange"
type="daterange"
start-placeholder="计划开始日期"
end-placeholder="计划结束日期"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
>
<!-- @change="timeRangeChange"-->
</el-date-picker>
</el-row>
<div class="chart" ref="chart">
@ -944,7 +945,7 @@
};
this.handlerSelect();
},
//获取近三年的所有天数
//获取要显示的所有天数
getDay() {
this.getAllDate();
},
@ -959,8 +960,13 @@
return false;
},
getAllDate() {
let obj = {};
let arr = [this.currentYear - 1, this.currentYear, this.currentYear + 1];
let obj = {},arr=[];
let start = new Date(this.timeRange[0]).getFullYear();
let end = new Date(this.timeRange[1]).getFullYear();
for(let i=start;i<end+1;i++){
arr.push(i)
}
arr = [ this.currentYear -1,this.currentYear, this.currentYear + 1];
arr.forEach(item => {
obj.year = item;
obj.days = this.isLeapYear(item) ? 365 : 366;
@ -974,7 +980,6 @@
this.allDays.forEach(item => {
item.month = this.handleMonthDay(item.days, item.year);
});
// console.log(this.allDays);
this.allDays.forEach(element => {
if (element.year == this.currentYear) {
element.month[0][this.currentMonth].forEach(k => {
@ -1063,15 +1068,6 @@
break;
}
},
setList() {
/*getPlanGantt().then(res=>{
if(res.code===200){
this.list = res.data.results;
}else{
this.$message.error(res.msg);
}
})*/
},
//设置里程碑线的高度
setStoneLine(isFirst) {
this.$nextTick(() => {
@ -1112,7 +1108,6 @@
mounted() {
document.addEventListener("scroll", this.handleScroll);
this.getDay();
this.setList();
this.setStoneLine();
},
beforeDestroy() {

View File

@ -1,63 +1,62 @@
<template>
<div class="app-container">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>生产任务列表</span>
</div>
<el-table
<div slot="header" class="clearfix">
<span>生产任务列表</span>
</div>
<el-table
:data="productionplanList.results"
border
border
fit
stripe
style="width: 100%"
height="300"
height="300"
>
<el-table-column type="index" width="50" />
<el-table-column label="任务编号" width="110">
<el-table-column type="index" width="50"/>
<el-table-column label="任务编号" width="110">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="订单编号" width="110">
<el-table-column label="订单编号" width="110">
<template slot-scope="scope">{{ scope.row.order_.number }}</template>
</el-table-column>
<el-table-column label="合同编号" width="110">
<el-table-column label="合同编号" width="110">
<template slot-scope="scope">{{ scope.row.order_.contract_.number }}</template>
</el-table-column>
<el-table-column label="产品名称" width="150" show-overflow-tooltip>
<el-table-column label="产品名称" width="150" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.product_.name }}</template>
</el-table-column>
<el-table-column label="产品型号" width="110">
<el-table-column label="产品型号" width="110">
<template slot-scope="scope">{{ scope.row.product_.specification }}</template>
</el-table-column>
<el-table-column label="产品单位" width="110">
<el-table-column label="产品单位" width="110">
<template slot-scope="scope">{{ scope.row.product_.unit }}</template>
</el-table-column>
<el-table-column label="生产数量" width="110">
<el-table-column label="生产数量" width="110">
<template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
<el-table-column label="计划开工时间" width="110">
<el-table-column label="计划开工时间" width="110">
<template slot-scope="scope">{{ scope.row.start_date }}</template>
</el-table-column>
<el-table-column label="计划完工时间" width="110">
<el-table-column label="计划完工时间" width="110">
<template slot-scope="scope">{{ scope.row.end_date }}</template>
</el-table-column>
<el-table-column label="交付截止时间" width="110">
<el-table-column label="交付截止时间" width="110">
<template slot-scope="scope">{{ scope.row.order_.delivery_date }}</template>
</el-table-column>
<el-table-column label="是否生成子计划" width="120">
<template slot-scope="scope" >
<el-table-column label="是否生成子计划" width="120">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_planed==false"></el-tag>
<el-tag v-if="scope.row.is_planed==true"></el-tag>
</template>
<el-tag v-if="scope.row.is_planed==true"></el-tag>
</template>
</el-table-column>
<el-table-column label="创建时间" width="160">
<el-table-column label="创建时间" width="160">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
<el-table-column
@ -68,17 +67,19 @@
>
<template slot-scope="scope">
<el-link type="primary"
v-if="scope.row.is_planed"
@click="handleselectplan(scope)"
>查看子计划</el-link>
<el-link type="primary"
v-else
@click="handleWork(scope)"
>生成子计划</el-link>
v-if="scope.row.is_planed"
@click="handleselectplan(scope)"
>查看子计划
</el-link>
<el-link type="primary"
v-else
@click="handleWork(scope)"
>生成子计划
</el-link>
</template>
</el-table-column>
</el-table>
<pagination
<pagination
v-show="productionplanList.count > 0"
:total="productionplanList.count"
:page.sync="listQuery1.page"
@ -86,270 +87,311 @@
@pagination="getplanList"
/>
</el-card>
<el-tabs type="border-card">
<el-tab-pane label="订单排产">
<el-table
:data="orderList.results"
border
fit
stripe
style="width: 100%"
height="250"
>
<el-table-column type="index" width="50" />
<el-table-column label="订单编号" width="110">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="客户名称" width="110">
<template slot-scope="scope" show-overflow-tooltip>{{ scope.row.customer_.name }}</template>
</el-table-column>
<el-table-column label="合同编号" width="110">
<template slot-scope="scope">{{ scope.row.contract_.number }}</template>
</el-table-column>
<el-table-column label="合同名称" show-overflow-tooltip width="110">
<template slot-scope="scope">{{ scope.row.contract_.name }}</template>
</el-table-column>
<el-table-column label="所需产品" show-overflow-tooltip width="150">
<template slot-scope="scope">{{ scope.row.product_.name }}</template>
</el-table-column>
<el-table-column label="产品型号" width="110">
<template slot-scope="scope">{{ scope.row.product_.specification }}</template>
</el-table-column>
<el-table-column label="产品数量" width="110">
<template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
<el-table-column label="已派数量" width="110">
<template slot-scope="scope">{{ scope.row.planed_count }}</template>
</el-table-column>
<el-table-column label="交货日期" width="110">
<template slot-scope="scope">{{ scope.row.delivery_date }}</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="220px"
<el-tabs type="border-card" v-model="activeName" @tab-click="activeNameClick">
<el-tab-pane label="订单排产" name="订单排产">
<el-table
:data="orderList.results"
border
fit
stripe
style="width: 100%"
height="250"
>
<template slot-scope="scope">
<el-link type="primary"
v-if="checkPermission(['warehouse_update'])"
@click="handleclick(scope)"
>排产</el-link
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="orderList.count > 0"
:total="orderList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getorderList"
/>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:title="'排产计划'"
>
<el-form
ref="Form"
:model="orderplan"
label-width="120px"
label-position="right"
:rules="rule1"
>
<el-form-item label="排产数量" prop="count">
<el-input-number v-model="orderplan.count" :min="0"></el-input-number>
</el-form-item>
<el-form-item label="计划排产时间" prop="value1">
<el-table-column type="index" width="50"/>
<el-table-column label="订单编号" width="110">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="客户名称" width="110">
<template slot-scope="scope" show-overflow-tooltip>{{ scope.row.customer_.name }}</template>
</el-table-column>
<el-table-column label="合同编号" width="110">
<template slot-scope="scope">{{ scope.row.contract_.number }}</template>
</el-table-column>
<el-table-column label="合同名称" show-overflow-tooltip width="110">
<template slot-scope="scope">{{ scope.row.contract_.name }}</template>
</el-table-column>
<el-table-column label="所需产品" show-overflow-tooltip width="150">
<template slot-scope="scope">{{ scope.row.product_.name }}</template>
</el-table-column>
<el-table-column label="产品型号" width="110">
<template slot-scope="scope">{{ scope.row.product_.specification }}</template>
</el-table-column>
<el-table-column label="产品数量" width="110">
<template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
<el-table-column label="已派数量" width="110">
<template slot-scope="scope">{{ scope.row.planed_count }}</template>
</el-table-column>
<el-table-column label="交货日期" width="110">
<template slot-scope="scope">{{ scope.row.delivery_date }}</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="220px"
>
<template slot-scope="scope">
<el-link type="primary"
v-if="checkPermission(['warehouse_update'])"
@click="handleclick(scope)"
>排产
</el-link
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="orderList.count > 0"
:total="orderList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getorderList"
/>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:title="'排产计划'"
>
<el-form
ref="Form"
:model="orderplan"
label-width="120px"
label-position="right"
:rules="rule1"
>
<el-form-item label="排产数量" prop="count">
<el-input-number v-model="orderplan.count" :min="0"></el-input-number>
</el-form-item>
<el-form-item label="计划排产时间" prop="value1">
<el-date-picker
v-model="value1"
type="daterange"
start-placeholder="计划开始日期"
end-placeholder="计划结束日期"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirm('Form')">确认</el-button>
</div>
</el-dialog>
</el-tab-pane>
<el-tab-pane label="甘特图" name="甘特图">
<gantt
v-if="ganttShow"
:proList="proList"
></gantt>
</el-tab-pane>
<!--<el-row style="position: absolute;z-index: 20000;top: 0;right: 0;">
<el-date-picker
v-model="value1"
type="daterange"
start-placeholder="计划开始日期"
end-placeholder="计划结束日期"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirm('Form')">确认</el-button>
</div>
</el-dialog>
</el-tab-pane>
<el-tab-pane label="甘特图">甘特图</el-tab-pane>
</el-tabs>
v-model="timeRange"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
>
&lt;!&ndash; @change="timeRangeChange"&ndash;&gt;
</el-date-picker>
</el-row>-->
</el-tabs>
</div>
</template>
<script>
import { getordertoplan } from "@/api/sam";
import { createProductionplan,getProductionplanList,createsubplan} from "@/api/pm";
import { getMaterialList } from "@/api/mtm";
import checkPermission from "@/utils/permission";
<script>
import gantt from "@/components/Gantt/index";
import {getordertoplan} from "@/api/sam";
import {createProductionplan, getProductionplanList, createsubplan} from "@/api/pm";
import {getMaterialList} from "@/api/mtm";
import checkPermission from "@/utils/permission";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaulteorderplan = {
};
export default {
components: { Pagination },
data() {
return {
orderplan: defaulteorderplan,
orderList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaulteorderplan = {};
export default {
components: {Pagination,gantt},
data() {
return {
orderplan: defaulteorderplan,
orderList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
productionplanList: {
count: 0,
},
listQuery1: {
page: 1,
page_size: 20,
},
value1: '',
listLoading: true,
dialogVisible: false,
dialogType: "new",
rule1: {
number: [{ required: true, message: "请输入", trigger: "blur" }],
},
};
},
computed: {},
watch: {},
created() {
this.getorderList();
this.getplanList();
},
methods: {
checkPermission,
//订单列表
getorderList() {
this.listLoading = true;
getordertoplan(this.listQuery).then((response) => {
if (response.data) {
this.orderList = response.data;
}
this.listLoading = false;
});
},
//生产计划列表
//列表
getplanList() {
this.listLoading = true;
getProductionplanList(this.listQuery).then((response) => {
if (response.data) {
this.productionplanList = response.data;
}
this.listLoading = false;
});
},
handleclick(scope){
this.orderID = scope.row.id;
this.countsx = scope.row.count;
this.planed_count = scope.row.planed_count;
this.delivery_date = scope.row.delivery_date;
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
count: 0,
},
listQuery1: {
page: 1,
page_size: 20,
},
value1: '',
listLoading: true,
ganttShow: false,
dialogVisible: false,
dialogType: "new",
activeName: "订单排产",
rule1: {
number: [{required: true, message: "请输入", trigger: "blur"}],
},
timeRange:[],
proList:[],
};
},
async confirm(form) {
this.orderplan.start_date = this.value1[0];
if( this.delivery_date>=this.value1[1])
{
this.orderplan.end_date = this.value1[1];
}
else{
this.$message.error("计划完成时间超过订单交付日期,请从新选择日期!");
}
this.orderplan.order = this.orderID
if( this.orderplan.count<=(this.countsx-this.planed_count)){
createProductionplan(this.orderplan).then((res) => {
if (res.code >= 200) {
this.getorderList();
this.getplanList();
this.dialogVisible = false;
this.$message.success("成功");
computed: {},
watch: {},
created() {
this.getorderList();
this.getplanList();
},
methods: {
checkPermission,
//订单列表
getorderList() {
this.listLoading = true;
getordertoplan(this.listQuery).then((response) => {
if (response.data) {
this.orderList = response.data;
}
this.listLoading = false;
});
},
//生产计划列表
//列表
getplanList() {
let that = this;
this.listLoading = true;
getProductionplanList(this.listQuery).then((response) => {
if (response.data) {
this.productionplanList = response.data;
let list = response.data.results;
let arr= [];
list.forEach(item => {
if (!item.children || item.children.length < 1) {
let startTime = new Date(item.start_date).getTime();
let endTime = new Date(item.end_date).getTime();
let obj = new Object();
obj.name = item.number;
obj.id = item.id;
obj.top = 20;
obj.startTime = startTime;
obj.endTime = endTime;
obj.planTime = [startTime, endTime];
obj.per = item.count;
obj.type = 1;
obj.isShow = true;
arr.push(obj);
}
that.proList = arr;
});
}
else
{
this.$message.error("排产数超过所需数,请合理排产!");
}
this.listLoading = false;
});
},
handleclick(scope) {
this.orderID = scope.row.id;
this.countsx = scope.row.count;
this.planed_count = scope.row.planed_count;
this.delivery_date = scope.row.delivery_date;
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
async confirm(form) {
this.orderplan.start_date = this.value1[0];
if (this.delivery_date >= this.value1[1]) {
this.orderplan.end_date = this.value1[1];
} else {
this.$message.error("计划完成时间超过订单交付日期,请从新选择日期!");
}
this.orderplan.order = this.orderID
if (this.orderplan.count <= (this.countsx - this.planed_count)) {
createProductionplan(this.orderplan).then((res) => {
if (res.code >= 200) {
this.getorderList();
this.getplanList();
this.dialogVisible = false;
this.$message.success("成功");
}
},
handleWork(scope)
{
this.$confirm("确认生成子计划?", "提醒", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await createsubplan(scope.row.id).then((res) => {
});
} else {
this.$message.error("排产数超过所需数,请合理排产!");
}
},
handleWork(scope) {
this.$confirm("确认生成子计划?", "提醒", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await createsubplan(scope.row.id).then((res) => {
if (res.code >= 200) {
this.$message.success("生成子计划成功!");
this.$router.push({name: "work", params: { id: scope.row.id }, })
this.getplanList()
this.$router.push({name: "work", params: {id: scope.row.id},})
this.getplanList()
}
});
})
.catch((err) => {
console.error(err);
});
})
.catch((err) => {
console.error(err);
});
},
activeNameClick(tab, event){
debugger;
console.log(tab, event);
if(tab.label==='甘特图'){
this.ganttShow = true;
}else{
this.ganttShow = false;
}
},
//查看子计划
handleselectplan(scope) {
this.$router.push({name: "work", params: {id: scope.row.id},})
}
},
//查看子计划
handleselectplan(scope)
{
this.$router.push({name: "work", params: { id: scope.row.id }, })
}
};
},
};
</script>
</script>
<style>
<style>
.el-table .warning-row {
background: oldlace;
}
@ -357,4 +399,4 @@ export default {
.el-table .success-row {
background: #f0f9eb;
}
</style>
</style>

View File

@ -212,6 +212,14 @@ class Ticket(CommonBModel):
act_state = models.IntegerField('进行状态', default=1, help_text='当前工单的进行状态', choices=act_state_choices)
multi_all_person = models.JSONField('全部处理的结果', default=dict, blank=True, help_text='需要当前状态处理人全部处理时实际的处理结果json格式')
# class TicketCustomField(BaseModel):
# """
# 工单自定义表单数据
# """
# form_field = models.ForeignKey(CustomField, verbose_name='关联自定义表单字段', on_delete=models.CASCADE)
# field_value = models.JSONField('录入值', null=True, blank=True)
# field_display_value = models.CharField('展示值', max_length=1000, null=True, blank=True, help_text='可用于只读时展示')
# ticket = models.ForeignKey(Ticket, verbose_name='关联的工单', on_delete=models.CASCADE, related_name='ticket_data')
class TicketFlow(BaseModel):
"""

View File

@ -12,4 +12,18 @@ class GetParticipants:
def get_create_by(cls, state:dict={}, ticket:dict={}, ticket_data:dict={}, request={}):
"""工单创建人"""
participant = ticket.create_by.id
return participant
return participant
class HandleScripts:
all_funcs = [
{'func': 'handle_wproduct', 'name':'处理不合格品'}
]
@classmethod
def handle_wproduct(cls, ticket:dict={}):
"""处理不合格品"""
ticket_data = ticket.ticket_data
wp = ticket.wt_ticket
wp = ticket_data
if 'shenli2' in ticket_data and ticket_data['shenli2']:
if ticket_data['shenli2'] in ['返工', '返修']:
pass

View File

@ -84,6 +84,7 @@ class WprouctTicket(CommonAModel):
step = models.ForeignKey(Step, verbose_name='所在步骤', on_delete=models.CASCADE)
subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='所在子生产计划', on_delete=models.CASCADE)
ticket = models.ForeignKey('wf.ticket', verbose_name='关联工单', on_delete=models.CASCADE, related_name='wt_ticket')
decision = models.CharField('最终决定', null=True, blank=True, max_length=100)
class Pick(CommonADModel):
"""

View File

@ -338,7 +338,7 @@ class WProductViewSet(ListModelMixin, GenericViewSet):
报废操作
"""
obj = self.get_object()
if obj.ow_wproduct.ow_operation.count() >4 or obj.act_state != WProduct.WPR_ACT_STATE_NOTOK:
if Operation.objects.filter(ow_operation__wproduct=obj, is_submited=True).count() >4 or obj.act_state != WProduct.WPR_ACT_STATE_NOTOK:
raise exceptions.APIException('该产品不支持直接报废')
obj.act_state = WProduct.WPR_ACT_STATE_SCRAP
obj.update_by = request.user